https://github.com/chneau/alpine-mongo-tools
Alpine docker image with mongo tools
https://github.com/chneau/alpine-mongo-tools
Last synced: 5 months ago
JSON representation
Alpine docker image with mongo tools
- Host: GitHub
- URL: https://github.com/chneau/alpine-mongo-tools
- Owner: chneau
- License: mit
- Created: 2022-01-12T10:18:43.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-09-05T11:33:55.000Z (almost 3 years ago)
- Last Synced: 2025-12-01T20:14:15.368Z (6 months ago)
- Language: Dockerfile
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# alpine-mongo-tools
## Use case
```bash
# dump from a database
mongodump "mongodb+srv://..." --db db --gzip --archive=`date -u +"%FT%H%MZ"`-db.archive;
# store dump to an s3 compatible storage
export file="$(ls *.archive)";
export bucket="XXX";
export contentType="application/x-compressed-tar";
export dateValue="$(date -R -u)";
export folder="database_backups/";
export stringToSign="PUT\n\n${contentType}\n${dateValue}\n/${bucket}/${folder}$file";
export s3Key="XXX";
export s3Secret="XXX";
export signature="$(echo -en ${stringToSign} | openssl sha1 -hmac ${s3Secret} -binary | base64)";
curl -X PUT -T "${file}" -H "Host: ${bucket}.XXX.XXX.com" -H "Date: ${dateValue}" -H "Content-Type: ${contentType}" -H "Authorization: AWS ${s3Key}:${signature}" "https://${bucket}.XXX.XXX.com/${folder}${file}"
```