Skip to content

Interacting with the stack using Make

The Makefile contains a number of make targets that make interacting the stack more user-friendly. All Makefile commands need to be run from the root directory of the CanDIGv2 repo.

Stopping services

All services can be stopped with:

Terminal window
make stop-all

Individual services can be stopped using the docker command:

Terminal window
docker container stop candigv2_<name of module>_1

eg. to stop the ingest container this would be:

Terminal window
docker container stop candigv2_candig-ingest_1

Starting services

Logging must be started first, postgres should be started before any relying services

When all containers are stopped the following command can be used to start all CanDIGv2 containers

Terminal window
make start-all

To start a single container, the following docker command can be used:

Terminal window
docker container start candigv2_<name of module>_1

e.g. for the ingest container:

Terminal window
docker container start candigv2_candig-ingest_1

Cleaning and rebuilding individual services

If any individual services are updated, they will need to be cleaned, rebuilt and recomposed.

Any individual service can be cleaned with:

Terminal window
make recompose-<name of module>

This command runs all the steps needed to clean and rebuild the service, the commands are explained in more detail below:

Terminal window
make clean-<name of module>

for example:

Terminal window
make clean-htsget

This stops the container, deletes the container and deletes the image.

To rebuild and recompose a service first run:

Terminal window
make build-<name of module>

Then compose the container with:

Terminal window
make compose-<name of module>

Some services can’t be rebuilt individually without causing issues with the stack, if you are facing issues with modules related to auth, it is recommended to rebuild the entire stack to ensure everything is in sync.

Non-destructive Rebuild

To rebuild the CanDIGv2 without destroying data in postgres or keycloak the make target rebuild-keep-data with:

Terminal window
make rebuild-keep-data

Destructive Cleanup

Use the following steps to clean up running CanDIGv2 services in a docker-compose configuration.

The following steps are performed by make clean-all:

Terminal window
# 1. delete log files
make clean-logs
# 2. stop and remove running stacks
make clean-compose
# 3. stop and remove remaining containers
make clean-containers
# 4. remove all configs/secrets from docker and local dir
make clean-secrets
# 5. remove all docker volumes and local data dir
make clean-volumes
# 6. delete all cached images
make clean-images

See the Makefile for the exact commands that each of these targets runs.

Rebuild entire stack from scratch

  1. Perform any backups of data necessary if in a non-testing environment. (see backup and restore doc for detailed instructions.)

  2. Clean up the current containers with make clean-all

  3. When complete, build all containers again with make build-all