-
Notifications
You must be signed in to change notification settings - Fork 8
Upload DB dump to AWS S3
Upload database dump and metadata file to AWS S3.
This command requires a Docker container name to create a MySQL metadata file. A metadata file is later used to run similar DB container, import dump, commit and push the image to the registry.
Simple usage:
php bin/dockerizer docker:mysql:upload-to-aws -c <container>
Extended example:
php bin/dockerizer d:m:upload -c awesome-project-com-prod_mysql_1 \
-t registry.gitlab.com/acme/awesome-project/database-dev \
-b custom-amce-owned-bucket
Dump DB from container awesome-project-com-prod_mysql_1
and push it to the bucket custom-amce-owned-bucket
:
- Dump S3 URI
s3://custom-amce-owned-bucket/acme/awesome-project/database-dev.sql.gz
- Metadata S3 URI
s3://custom-amce-owned-bucket/acme/awesome-project/database-dev.json
-
-c
(--container
, required): Container name or ID. -
-d
(--dump
, optional): Path to the existing dump. It must be a.gz
archive. Leave empty to create a dump from a running Docker container. -
-t
(--target-image
, optional): Docker image name including registry domain (if needed) and excluding tags. If not specified, the command will ask for it interactively. -
-b
(--bucket
, optional): AWS S3 Bucket to upload data. Ignores environment variableDOCKERIZER_AWS_S3_BUCKET_PREFIX
.
@TODO: add the ability to pass the AWS S3 region. Currently, it is ony taken from the DOCKERIZER_AWS_S3_REGION
env variable.
-
AWS_ACCESS_KEY_ID
/AWS_SECRET_ACCESS_KEY
(required): upload files to the S3 bucket -
DOCKERIZER_AWS_S3_REGION
(required): AWS S3 region to upload files to. -
DOCKERIZER_AWS_S3_BUCKET_PREFIX
(optional): AWS S3 bucket prefix.
There are two ways to supply AWS S3 bucket name:
- Explicitly pass it via the
--bucket
option - Implicitly:
DOCKERIZER_AWS_S3_BUCKET_PREFIX
+ Docker image namespace.
For example, if your target image name is my-docker-registry.com:5000/namespace/repository/database-dev
then the
bucket name will be: DOCKERIZER_AWS_S3_BUCKET_PREFIX
+ namespace
. This is convenient in case all your team
buckets are prefixed similarly. In this case, a convention prefix + project namespace
works great, and developers
don't need to ask for the bucket name every time.
In the extended example above, we can set DOCKERIZER_AWS_S3_BUCKET_PREFIX=default-value-php-dept-
and skip passing the
-b
option. In such a case, the bucket name will be default-value-php-dept-acme
by the convention described above.
- docker:mysql:connect
- docker:mysql:export-db
- docker:mysql:import-db
- docker:mysql:upload-to-aws
- docker:mysql:generate-metadata
- docker:mysql:reconstruct-db
- docker:mysql:test-metadata
- magento:setup
- magento:reinstall
- magento:test-module-install
- magento:test-templates
- magento:test-dockerfiles
- MacOS and Docker Desktop support
- Bash aliases
- Install Symfony with Dockerizer
- Running-apps-with-existing-Docker-compositions
- Limitations
- Building MySQL images with DB: how it works
- Configure AWS Lambda
- Gitlab pipeline to build images
- Managing AWS S3 access
- Using AWS credentials with Dockerizer
- Access management cheat-sheet
- FAQ