Skip to content

Instantly share code, notes, and snippets.

@harshavardhana
Created September 15, 2017 19:32
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save harshavardhana/cb6c0d4d220a9334a66d6259c7d54c95 to your computer and use it in GitHub Desktop.
Save harshavardhana/cb6c0d4d220a9334a66d6259c7d54c95 to your computer and use it in GitHub Desktop.
Continuous mirroring
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:
MINIO_ACCESS_KEY=minio
MINIO_SECRET_KEY=minio123
PLAY_ACCESS_KEY=Q3AM3UQ867SPQQA43P2F
PLAY_SECRET_KEY=zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG
@curantes
Copy link

Thanks very clear instructions!

@sshaplygin
Copy link

# 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