docker-sync-with-s3
docker-sync-with-s3 copied to clipboard
Docker image that runs a single cron job to sync files with S3 as defined via environment variables
docker-sync-with-s3
Docker image that runs a single cron job to sync files with S3 as defined via environment variables.
This image can be used to either sync files from a container to S3 or from S3 to a container.
It is intended that a single instance of this image will run a single cron job and sync process. If you have multiple directories to sync, then you should run multiple containers each with the appropriate configuration for that directory.
Docker Hub
This image is built automatically on the Docker Hub as silintl/sync-with-s3
Running locally
- Clone this repo
- Copy
local.env.disttolocal.envand update values as appropriate - Run
docker-compose up -d
Expected Environment Variables
ACCESS_KEY- AWS Access KeySECRET_KEY- AWS Secret Access KeyCRON_SCHEDULE- Schedule for cron job, for every 15 minutes it would be:*/15 * * * *SOURCE_PATH- Source files to be synced, example:/var/www/uploadsDESTINATION_PATH- Destination of where to sync files to, example:s3://my-bucket/site-uploadsBUCKET_LOCATION- AWS Region for bucket, ex:us-east-1LOGENTRIES_KEY- (optional) If provided, the image will send command output to syslog with priorityuser.info.S3SYNC_ARGS- (optional) If provided, the arguments will be included in theaws s3 synccommand. For example, settingS3SYNC_ARGS=--deletewill cause files in the destination to be deleted if they no longer exist in the source.
Volumes
You will need to define volumes in your Docker configuration for sharing filesystem between your application containers and this sync container.