Configuring Docker Compose
This page describes how to use the provided compose.yaml file to start AnyVar alongside its dependencies, and highlights some configuration options you can customize for your environment.
Overview
The compose file defines four main services:
seqrepo– provides a SeqRepo instance on a Docker volumeuta– UTA database in a PostgreSQL containeranyvar_db– PostgreSQL database for AnyVaranyvar– the AnyVar web API, configured to use SeqRepo, UTA, and the AnyVar DB
It also defines three Docker volumes:
seqrepo_vol– storage for SeqRepo datauta_vol– storage for the UTA PostgreSQL data directoryanyvar_vol– storage for the AnyVar PostgreSQL data directory
All three volumes are declared as external: true, so they must exist before
you run docker compose up. For example:
docker volume create seqrepo_vol
docker volume create uta_vol
docker volume create anyvar_vol
SeqRepo Options
The compose file supports several patterns for providing a SeqRepo database to AnyVar, depending on whether you want Docker to manage the data or reuse an existing SeqRepo on your local filesystem.
Using the bundled SeqRepo container (default)
By default, the compose file runs a seqrepo container that mounts the
seqrepo_vol volume at /usr/local/share/seqrepo:
seqrepo:
image: biocommons/seqrepo:2024-12-20
volumes:
- seqrepo_vol:/usr/local/share/seqrepo
The anyvar service then mounts the same volume and points its configuration
at the 2024-12-20 snapshot:
anyvar:
volumes:
- seqrepo_vol:/usr/local/share/seqrepo
environment:
- SEQREPO_INSTANCE_DIR=/usr/local/share/seqrepo/2024-12-20
- SEQREPO_DATAPROXY_URI=seqrepo+file:///usr/local/share/seqrepo/2024-12-20
This is the simplest option if you are happy to let Docker manage the SeqRepo storage in an external volume.
Using a host SeqRepo directory directly
If you already have a SeqRepo database on your local filesystem and want AnyVar
to use it directly (without a dedicated seqrepo container), you can bind
mount your existing directory into the anyvar container.
Comment out the
seqreposervice in the compose file.Replace the volume mapping under
anyvar:anyvar: volumes: - $SEQREPO_ROOT_DIR:/usr/local/share/seqrepo
Export
SEQREPO_ROOT_DIRbefore running compose, pointing it at the root of your local SeqRepo installation:export SEQREPO_ROOT_DIR=/path/to/my/seqrepo docker compose up
Keep the environment variables as they are, or adjust if your SeqRepo snapshot directory name differs:
environment: - SEQREPO_INSTANCE_DIR=/usr/local/share/seqrepo/2024-12-20 - SEQREPO_DATAPROXY_URI=seqrepo+file:///usr/local/share/seqrepo/2024-12-20
Make sure the snapshot path (e.g. 2024-12-20) exists under $SEQREPO_ROOT_DIR and matches SEQREPO_INSTANCE_DIR.
Copying a host SeqRepo into a Docker volume
If you have a local SeqRepo and prefer to copy it into a Docker-managed
volume (seqrepo_vol) rather than bind mounting your host directory each
time, you can use the optional seqrepo_local_populator service.
This service is commented out by default. To enable this pattern:
Comment out the
seqreposervice.Uncomment
seqrepo_local_populator.Adjust the
rsynccommand if your snapshot directory name is different from2024-12-20.Change the
depends_onforanyvarto depend onseqrepo_local_populatorinstead ofseqrepo:anyvar: depends_on: anyvar_db: required: true condition: service_started seqrepo_local_populator: required: true condition: service_completed_successfully
Export
SEQREPO_ROOT_DIRbefore running compose:export SEQREPO_ROOT_DIR=/path/to/my/seqrepo docker compose up
On startup, the seqrepo_local_populator container will copy your local SeqRepo snapshot into seqrepo_vol. The anyvar container will then use the volume just as in the default configuration.
UTA Service Configuration
The uta service runs a UTA PostgreSQL instance with its data directory on the uta_vol volume.
You must download uta_20241220.pgd.gz from https://dl.biocommons.org/uta/ using a web browser and move it to the root of the repository.
You can test that UTA is running and populated by using the example psql command in the compose file comments.
AnyVar Database Configuration
The anyvar_db service runs PostgreSQL and mounts anyvar_vol. If you expose the AnyVar API publicly, you must change these defaults to secure values.
Running the stack
After creating the external volumes and configuring any optional environment variables (such as SEQREPO_ROOT_DIR), you can start the stack with:
docker compose up
The AnyVar API will be available on http://127.0.0.1:8010 by default, under the ports mapping.