To list the local databases for this project, first bring up the postgres container if it's not already up:
docker-compose -f docker-compose-local-db.yml up --build postgres
Then, list your local databases:
make db-list
To list the databases sitting around in the prod
environment so that you can know which dbname
to supply in make cloud-db-export dbname=(which db you want to export)
:
make cloud-db-list
To export a prod
database to the gs://release_db_sql_files/investigations/
bucket:
make cloud-db-export dbname=prod_db
dbname
is required and should be one of the databases listed from make cloud-db-list
prod
GCP project in the Google Cloud Storage resource to find the DB dump file./db/
folderTo provision a new local database, first bring up the postgres container if it's not already up:
docker-compose -f docker-compose-local-db.yml up --build postgres
Ensure that the dump file is located within ./db/
, then run:
make local-db dbname=my_new_local_db dbfile=prod.sql
dbname
is required and will be the name of the newly created databasedbfile
is required and should be the name of the DB file to recreate, this file must be in the ./db/
folder
COPY
line in ./db/Dockerfile
db.sql
file in /db
docker run -v ${PWD}/api:/app composer install
docker-compose -f docker-compose-local-db.yml up --build
docker-compose -f docker-compose-local-db.yml up
example / password
These and other most used docker commands for bringing containers up/down are aliased in a Makefile:
make start
is equivalent to docker-compose -f docker-compose-local-db.yml up --build
make clean
is equivalent to docker system prune -f && docker volume prune -f
make clean-images
is equivalent to docker images prune
docker volume prune
docker system prune
docker-compose -f docker-compose-local-db.yml down
docker container ls
docker exec -it <CONTAINER-ID> /bin/sh
psql -d craft -U craft
docker-compose -f docker-compose-local-db.yml up --build
docker run -v ${PWD}/api:/app composer <blah>
docker exec -ti gaeapp sh
craft-base-image
is used: docker pull us-central1-docker.pkg.dev/skyviewer/public-images/craft-base-image