Created
September 15, 2017 19:32
-
-
Save harshavardhana/cb6c0d4d220a9334a66d6259c7d54c95 to your computer and use it in GitHub Desktop.
Continuous mirroring
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
version: '2' | |
services: | |
minio: | |
image: minio/minio | |
container_name: miniobkp | |
ports: | |
- 9000:9000 | |
env_file: | |
- ./minio.env | |
command: server /export | |
volumes: | |
- minio:/root/.minio/ | |
mc: | |
image: minio/mc | |
depends_on: | |
- minio | |
container_name: mcbkp | |
env_file: | |
- ./minio.env | |
entrypoint: > | |
/bin/sh -c " | |
echo /usr/bin/mc config host a src https://play.minio.io:9000 $${PLAY_ACCESS_KEY} $${PLAY_SECRET_KEY}; | |
/usr/bin/mc config host a src https://play.minio.io:9000 $${PLAY_ACCESS_KEY} $${PLAY_SECRET_KEY}; | |
/usr/bin/mc config host a bkp http://minio:9000 $${MINIO_ACCESS_KEY} $${MINIO_SECRET_KEY}; | |
/usr/bin/mc mirror -w src bkp; | |
" | |
volumes: | |
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
MINIO_ACCESS_KEY=minio | |
MINIO_SECRET_KEY=minio123 | |
PLAY_ACCESS_KEY=Q3AM3UQ867SPQQA43P2F | |
PLAY_SECRET_KEY=zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG |
# credentials
MINIO_ROOT_USER=access_key
MINIO_ROOT_PASSWORD=secret_key
# first bucket
MINIO_FIRST_BUCKET=first
MINIO_FIRST_BUCKET_VERSION=v1
# second bucket
MINIO_SECOND_BUCKET=second
MINIO_SECOND_BUCKET_VERSION=v1
myminio
- alias for minio connection
mc:
image: minio/mc
depends_on:
- minio
entrypoint: >
/bin/sh -c "
/usr/bin/mc config host add myminio http://minio:9000 ${MINIO_ROOT_USER} ${MINIO_ROOT_PASSWORD};
/usr/bin/mc rm -r --force myminio/${MINIO_FIRST_BUCKET}/${MINIO_FIRST_BUCKET_VERSION};
/usr/bin/mc mb myminio/${MINIO_FIRST_BUCKET}/${MINIO_FIRST_BUCKET_VERSION};
/usr/bin/mc policy set download myminio/${MINIO_FIRST_BUCKET};
/usr/bin/mc rm -r --force myminio/${MINIO_SECOND_BUCKET}/${MINIO_SECOND_BUCKET_VERSION};
/usr/bin/mc mb myminio/${MINIO_SECOND_BUCKET}/${MINIO_SECOND_BUCKET_VERSION};
/usr/bin/mc policy set download myminio/${MINIO_SECOND_BUCKET};
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks very clear instructions!