This repository has been archived by the owner on Nov 3, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 160
Add MinIO Docker Compose Service #173
Open
NBZ4live
wants to merge
1
commit into
ddev:master
Choose a base branch
from
NBZ4live:add_minio_service
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# MinIO | ||
|
||
This recipe adds a [MinIO](https://min.io/) container to a project. | ||
|
||
[MinIO](https://min.io/) is a S3 compatible object-storage. | ||
It can be used, to run an S3 instance locally, in case the hosted S3 is not reachable (like developing while offline) | ||
|
||
## Installation | ||
|
||
* Copy the `docker-compose.minio.yaml` file to your project's DDEV root folder (`.ddev/docker-compose.minio.yaml`) | ||
* Copy the `minio-build` folder to your project's DDEV root folder (`.ddev/minio-build`) | ||
* Copy the `commands/minio` directory to the commands folder of your project's DDEV commands folder (`.ddev/commands/minio/mc`) and make sure it's executable, `chmod +x .ddev/commands/minio/mc`. | ||
* Start (or restart) DDEV to have the service initialized: `ddev start` | ||
|
||
## Connection | ||
* MinIO is available at `ddev-<projectname>-minio:9000` **inside the containers** and at `https://<projectname>.ddev.site:9000` **outside the containers** | ||
* If `https://<projectname>.ddev.site:9000` is opened in the browser, it will redirect to the object browser | ||
|
||
## Configuration | ||
The server is configured through the environment variables in `docker-compose.minio.yaml` | ||
Default credentials (for API and object browser): | ||
* MINIO_ACCESS_KEY=minio | ||
* MINIO_SECRET_KEY=minio123 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if these would be better to put in config.yaml these days, rather than having people edit the docker-compose.minio.yaml. |
||
|
||
> By default, all the files managed by MinIO will be stored in a persistent Volume with the name `<projectname>-minio`. | ||
> This volume will not be deleted automatically by DDEV when deleting your project. You will need to delete it manually! | ||
|
||
## Additional configuration | ||
The MinIO container does have `mc` ([MinIO Client](https://docs.min.io/docs/minio-client-quickstart-guide)) already present. But it is not configured out of the box. | ||
You will need to configure it manually and create your bucket! | ||
This can be done by performing the following commands: | ||
|
||
```bash | ||
ddev mc alias set local http://localhost:9000 minio minio123 # Configure the local alias in mc | ||
ddev mc mb minio/default -p # Create a bucket named "default" | ||
mc policy set download minio/default # Set the bucket policy to download | ||
``` | ||
> If you have changed the default access key and/or secret, you will need to use these values in the commands | ||
|
||
Alternatively, you could do this automatically with a post-start [hook](https://ddev.readthedocs.io/en/stable/users/extending-commands/) | ||
Example: | ||
```yaml | ||
hooks: | ||
post-start: | ||
- exec: "mc alias set local http://localhost:9000 minio minio123" | ||
service: minio | ||
- exec: "mc mb minio/default -p" | ||
service: minio | ||
- exec: "mc policy set download minio/default" | ||
service: minio | ||
``` | ||
> You can find these hooks in example.hooks.yaml | ||
|
||
## Alternative clients | ||
MinIO's API is fully compatible to Amazon S3 and besides mc ([MinIO Client](https://docs.min.io/docs/minio-client-quickstart-guide)) it can be used with other supported clients like [aws-cli](https://docs.min.io/docs/aws-cli-with-minio), [s3cmd](https://docs.min.io/docs/s3cmd-with-minio) | ||
|
||
## Additional links | ||
[MinIO Documentation](https://docs.min.io/) | ||
[MinIO Docker image](https://hub.docker.com/r/minio/minio) | ||
[MinIO Client Docker image](https://hub.docker.com/r/minio/mc) | ||
[ddev Hooks](https://ddev.readthedocs.io/en/stable/users/extending-commands/) | ||
|
||
**Contributed by [@NBZ4live](https://github.com/NBZ4live)** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
## #ddev-generated | ||
## Description: run minio client in minio container | ||
## Usage: mc [FLAGS] COMMAND [COMMAND FLAGS | -h] [ARGUMENTS...] | ||
## Example: "ddev mc" or "ddev mc ls local" | ||
|
||
mc $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,36 @@ | ||||||
version: '3.6' | ||||||
|
||||||
services: | ||||||
minio: | ||||||
container_name: ddev-${DDEV_SITENAME}-minio | ||||||
build: | ||||||
context: './minio-build' | ||||||
restart: always | ||||||
ports: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use
Suggested change
|
||||||
- 9000 | ||||||
labels: | ||||||
com.ddev.site-name: ${DDEV_SITENAME} | ||||||
com.ddev.approot: $DDEV_APPROOT | ||||||
environment: | ||||||
- VIRTUAL_HOST=$DDEV_HOSTNAME | ||||||
- HTTP_EXPOSE=9001:9000 | ||||||
- HTTPS_EXPOSE=9000:9000 | ||||||
- MINIO_ACCESS_KEY=minio | ||||||
- MINIO_SECRET_KEY=minio123 | ||||||
command: server /data | ||||||
volumes: | ||||||
- type: "volume" | ||||||
source: minio | ||||||
target: "/data" | ||||||
volume: | ||||||
nocopy: true | ||||||
- type: "bind" | ||||||
source: "." | ||||||
target: "/mnt/ddev_config" | ||||||
web: | ||||||
links: | ||||||
- minio:$DDEV_HOSTNAME | ||||||
|
||||||
volumes: | ||||||
minio: | ||||||
name: "${DDEV_SITENAME}-minio" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Many ddev commands can be extended to run tasks before or after the | ||
# ddev command is executed, for example "post-start", "post-import-db", | ||
# "pre-composer", "post-composer" | ||
# See https://ddev.readthedocs.io/en/stable/users/extending-commands/ for more | ||
# information on the commands that can be extended and the tasks you can define | ||
# for them. Example: | ||
hooks: | ||
post-start: | ||
- exec: "mc alias set local http://localhost:9000 minio minio123" | ||
service: minio | ||
- exec: "mc mb minio/default -p" | ||
service: minio | ||
- exec: "mc policy set download minio/default" | ||
service: minio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM minio/minio:latest | ||
|
||
COPY --from=minio/mc:latest /usr/bin/mc /usr/bin/mc | ||
|
||
ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"] | ||
|
||
VOLUME ["/data"] | ||
|
||
CMD ["minio"] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please figure out how to move this to a port other than 9000. 9000 is always such a terrible thing, spurring fights between xdebug and php-fpm... and even minio!!!!