Headless Craft CMS backend for the Rubin Observatory operational website with Docker support.
This project was created with Docker version 20.10.5.
-
Install Docker and the Google Cloud SDK
-
Clone this repository
-
Set the database password in the
DB_PASSWORD
environment variable locally, and set the site's security key to theSECURITY_KEY
env var. -
Bring the Docker compose file up:
docker-compose up
-
Go to http://localhost:8080/admin to administer the site
-
Install Docker and the Google Cloud SDK
-
Clone this repository
-
Set the database password in the
DB_PASSWORD
environment variable locally, and set the site's security key to theSECURITY_KEY
env var. -
Bring the Docker compose file up:
docker-compose -f docker-compose.yml -f integration.yml up
-
Go to http://localhost:8080/admin to administer the site
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
To list your local DBs:
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/rubinobs/
bucket:
make cloud-db-export dbname=prod_db
- The argument
dbname
is required and should be one of the databases listed frommake cloud-db-list
- You will need to go into the
prod
GCP project in the Google Cloud Storage resource to find the DB dump file - Once you download the DB dump file, move it to the
./db/
folder
To 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
- Once you download the DB dump file, move it to the
./db/
folder
To recreate a local DB from a dump file located within ./db/
:
make local-db dbname=my_new_local_db dbfile=prod.sql
- The argument
dbname
is required and will be the name of the newly created database - The argument
dbfile
is required and should be the name of the DB file to recreate, this file must be in the./db/
folder
- Uncomment the
COPY
line in./db/Dockerfile
- Install Docker
- Clone this repository
- Add a .env file (based on .env.sample) and provide values appropriate to your local dev environment
- If running for the first time, and no local database exists, ask a fellow dev for the Google Cloud Storage location of the
.sql
dump file - download it and put it in the/db
folder - You'll need to install php packages locally. You may do so with your local composer, but you can also run it all through docker:
docker run -v ${PWD}/api:/app composer install
- Build and bring up containers for the first time:
docker-compose -f docker-compose-local-db.yml up --build
- Subsequent bringing up of containers you've already built:
docker-compose -f docker-compose-local-db.yml up
- Go to http://localhost:8080/admin to administer the site
- Cleaning house:
docker volume prune
docker system prune
- Spin stuff down politely:
docker-compose -f docker-compose-local-db.yml down
- Peek inside your running docker containers:
docker container ls
docker exec -it <CONTAINER-ID> /bin/sh
- and then, for instance, to look at DB
psql -d craft -U craft
- To rebuild images and bring up the containers:
docker-compose -f docker-compose-local-db.yml up --build
- When you need to do composer stuff:
docker run -v ${PWD}/api:/app composer <blah>
- After ssh-ing into a live GAE instance, by way of the GCP console interface, you can ssh into a running container:
docker exec -ti gaeapp sh
- When working locally, in order to ensure the latest docker
craft-base-image
is used:docker pull us-central1-docker.pkg.dev/skyviewer/public-images/craft-base-image