Skip to content

kamranahmedse/mongodumper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mongodumper

Docker image to back up MongoDB database and upload to S3

Usage

To run the image locally, first build it

docker build -t mongodumper .

Then run it with the following environment variables:

docker run -e MONGO_URI="mongo://localhost:27017/some-db" \
    -e S3BUCKET_PATH="bucket_name/path" \
    -e AWS_ACCESS_KEY_ID="XXX" \
    -e AWS_SECRET_ACCESS_KEY="XXX" \
    -e AWS_DEFAULT_REGION="ap-south-1"  \
    mongodumper

Publishing

To build and publish the image to ECR, use the following commands

ECR_REPO="repo-name" ECR_REGION="region" ./ecr-publish.sh

You can optionally pass the tag as the first argument to the script, otherwise it will use the latest tag

ECR_REPO="repo-name" ECR_REGION="region" ./ecr-publish.sh 1.0.0

.ecr-publish.sh builds the image and uses the aws cli to publish the image to ECR. Make sure you have the aws cli installed and configured with the correct credentials. You can also use the AWS_PROFILE environment variable to specify the profile to use.

License

MIT © Kamran Ahmed

About

Docker image to back up MongoDB database and upload to S3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published