Skip to content

Operations

Components

A deployment of proWES consists of:

  • the app, served by Gunicorn (gunicorn --config python:pro_wes.gunicorn pro_wes.wsgi:app, see Server), which serves the API and forwards runs to WES instances;
  • the Celery worker (celery -A pro_wes.celery_worker worker), from the same image, which tracks forwarded runs (see Run tracking);
  • MongoDB (4.4 or later; Docker Compose runs 7.0), which stores the runs;
  • RabbitMQ, the broker between the app and the worker;
  • a volume for the storage of the runs (/data), shared by the app and the worker, which holds the workflow attachments of each run.

Flower can be added to monitor the worker (the profile monitoring of the Docker Compose setup, see Getting started).

Run tracking

For each forwarded run, the app starts a Celery task that polls the state of the run at the WES instance every custom.post_runs.polling_wait seconds (default: 3). If the WES instance doesn't answer with a valid state custom.post_runs.polling_attempts times in a row (default: 100), the run gets the state SYSTEM_ERROR. Once the run has a final state (see Run states), the worker stores the outputs, the engine log and the task logs of the remote run log, each if it is valid (invalid ones, and run logs that can't be read, are logged as warnings); the run keeps its own identifier and state. Tasks run without a time limit unless custom.post_runs.timeout_job is set (in seconds); runs whose tracking takes longer get the state SYSTEM_ERROR, too, unless they have finished already (e.g., the limit is hit while the final run log is read). Runs that proWES sets to SYSTEM_ERROR this way may still run at the WES instance and can still be canceled (see Run states).

Failed requests to WES instances

Requests to WES instances are tried again as custom.wes.retry says, and new runs that a WES instance certainly didn't get go to the next one that can run them (see Retries); each retry and each such run is logged as a warning ("trying again", "sending it to the next WES instance"). Requests that still fail answer 500 Internal Server Error ("Could not reach remote WES service"; POST /runs also sets the run to SYSTEM_ERROR), and the worker counts them as failed polls. Besides WES instances that are down, causes are the limits of the guarded HTTP client (see WES instances): redirects, responses larger than custom.wes.max_response_size (logged as errors), timeouts, http URLs and private addresses where they aren't allowed, and certificates that REQUESTS_CA_BUNDLE or the public certificate authorities don't verify. Requests without credentials of proWES for the WES instance aren't sent, and not tried again (reason no_credentials): when its token can't be fetched (e.g., the identity provider is unavailable or refuses the client; FOCA retries failed token requests only after a short pause), the environment variables of the credentials aren't set (e.g., in the worker), or the backend list doesn't yield the WES instance (see Credentials of WES instances). The worker logs failed polls as warnings, with the error: EngineOutcomeUnknown if the WES instance may have got the request, EngineRequestNotSent if it certainly didn't, each caused by the error of the guarded client that names the cause. After EngineOutcomeUnknown on POST /runs (e.g., a timeout, a redirect or an answer that is no JSON), the run is SYSTEM_ERROR in proWES, but the WES instance may still have created and run it.

Database indexes

The app creates the indexes of the collection runs at start if they are missing (db.dbs.runStore.collections.runs.indexes in pro_wes/config.yaml):

Index Keys Purpose
run_log.run_id_1 run_log.run_id (unique, not sparse) Run identifiers are unique, also across instances of the app that share the database but not the storage: POST /runs tries another identifier if one is taken
user_id_1__id_-1 user_id, _id descending GET /runs with authentication finds the runs of the caller, newest first, without reading the runs of other users

Existing indexes are kept, also ones that are no longer configured (see Upgrading). The app doesn't start if a configured index can't be created: e.g., if stored runs share an identifier (as the index is not sparse, runs without run_log.run_id count as runs of the same identifier), or the database user may not create indexes. On large collections, the index builds make the first start take longer.

With db.create_indexes_on_startup: false (FOCA; default: true), the app creates no indexes: create them by hand before the first start, e.g., in mongosh, connected to the database of proWES (default: runStore):

db.runs.createIndex({ "run_log.run_id": 1 }, { unique: true })
db.runs.createIndex({ user_id: 1, _id: -1 })

Without the unique index, run identifiers are unique only by the working directory of each run in the storage.

Logs

The app and the worker log to standard error, in the format of the section log of the configuration ([<time>: <level>] <message> [<logger>]). With Docker Compose, docker compose logs shows them.

Image

The Dockerfile builds the image on FOCA's image (elixircloud/foca, with the FOCA release that uv.lock locks), pinned by digest:

  • Locked installs: the runtime dependencies and the build requirements (dependency group build-system of pyproject.toml) are installed at the versions of uv.lock, checked against their hashes, as wheels only; the app is built as a wheel in a separate stage, offline, and installed without its build tools, pip or uv.
  • User: the image runs as the non-root user 1000 (group 0); the app files are read-only for it. The only writable directory is /data, the storage of the runs (custom.post_runs.storage_path), owned by the user and writable for group 0, for platforms that run images with an arbitrary user ID in group 0 (e.g., OpenShift). Volumes mounted at /data must be writable for the user (see Deployment); the app refuses to start if it can't write to the storage of the runs.
  • Command: gunicorn --config python:pro_wes.gunicorn pro_wes.wsgi:app; the Celery worker runs celery -A pro_wes.celery_worker worker with the same image.
  • Health check: probes the Swagger UI (http://localhost:8080/ga4gh/wes/v1/ui/); set HEALTHCHECK_URL if the port, the base path or the Swagger UI setting change. Containers of the Celery worker need their own health check (see docker-compose.yaml).
  • Version: the build argument SETUPTOOLS_SCM_PRETEND_VERSION sets the version of the package, which the service info reports unless service_info.service.version is set; without it, 0.0.0.dev0.
  • Labels: OCI annotations (org.opencontainers.image.*); CI adds the version, the commit and the creation date.

Verifying images and charts

Images on Docker Hub (elixircloud/prowes) are built by this repository's workflows on GitHub Actions and pushed by digest, with an SBOM and the build provenance attached as attestations. Each image is scanned for known vulnerabilities with Trivy in a job of its own, and only once the scan has passed does it get a GitHub artifact attestation of its provenance and a keyless Sigstore signature, and then its tags:

  • Releases (X.Y.Z; for pre-releases, e.g., X.Y.Zrc1): the release workflow (.github/workflows/release.yml), for a signed version tag vX.Y.Z, after approval in the environment release (see Versioning and releases). Releases never tag latest.
  • Commits on dev (dev and sha-<commit>, the full commit hash): CI (jobs push, scan and publish of .github/workflows/ci.yml), once the scan and all other checks have passed (the images of pull requests are built and scanned too, but not pushed). Only a commit that is still the head of dev when publish runs is signed, attested and tagged: the digests of commits that a newer push overtook stay on Docker Hub untagged and unsigned, so not every commit has a sha-<commit> tag.

Images published before (latest, and tags by date, YYYYMMDD) are neither scanned, signed nor attested; latest is not updated any more.

To check that an image was built by the release workflow for release X.Y.Z (replace X.Y.Z with the version), run (with the GitHub CLI or cosign 3 or later, which reads the signatures in the Sigstore bundle format):

gh attestation verify oci://docker.io/elixircloud/prowes:X.Y.Z \
    --repo elixir-cloud-aai/prowes \
    --signer-workflow elixir-cloud-aai/prowes/.github/workflows/release.yml \
    --source-ref refs/tags/vX.Y.Z
cosign verify docker.io/elixircloud/prowes:X.Y.Z \
    --certificate-oidc-issuer https://token.actions.githubusercontent.com \
    --certificate-identity https://github.com/elixir-cloud-aai/prowes/.github/workflows/release.yml@refs/tags/vX.Y.Z

To check that an image was built by CI for this repository's branch dev, run:

gh attestation verify oci://docker.io/elixircloud/prowes:dev \
    --repo elixir-cloud-aai/prowes \
    --signer-workflow elixir-cloud-aai/prowes/.github/workflows/ci.yml \
    --source-ref refs/heads/dev
cosign verify docker.io/elixircloud/prowes:dev \
    --certificate-oidc-issuer https://token.actions.githubusercontent.com \
    --certificate-identity https://github.com/elixir-cloud-aai/prowes/.github/workflows/ci.yml@refs/heads/dev

Replace the tag dev with sha-<commit> to check the image of a given commit. --source-ref and the ref in --certificate-identity check that the workflow ran for the release tag or for branch dev, not for another branch. To show an image's SBOM or provenance, run:

docker buildx imagetools inspect docker.io/elixircloud/prowes:dev \
    --format '{{ json .SBOM }}'
docker buildx imagetools inspect docker.io/elixircloud/prowes:dev \
    --format '{{ json .Provenance }}'

The Helm chart of a release is published by the release workflow too, as an OCI artifact (oci://ghcr.io/elixir-cloud-aai/charts/prowes, version X.Y.Z; for pre-releases, e.g., X.Y.Z-rc1) and as a file attached to the GitHub release (prowes-X.Y.Z.tgz, e.g., prowes-X.Y.Z-rc1.tgz). Both have a GitHub artifact attestation of their provenance and a Sigstore signature: the OCI artifact in the registry, the file in a Sigstore bundle (prowes-X.Y.Z.tgz.sigstore.json, attached too). To check the OCI artifact (replace X.Y.Z with the chart version):

gh attestation verify oci://ghcr.io/elixir-cloud-aai/charts/prowes:X.Y.Z \
    --repo elixir-cloud-aai/prowes \
    --signer-workflow elixir-cloud-aai/prowes/.github/workflows/release.yml \
    --source-ref refs/tags/vX.Y.Z
cosign verify ghcr.io/elixir-cloud-aai/charts/prowes:X.Y.Z \
    --certificate-oidc-issuer https://token.actions.githubusercontent.com \
    --certificate-identity https://github.com/elixir-cloud-aai/prowes/.github/workflows/release.yml@refs/tags/vX.Y.Z

For pre-releases, the tag in --source-ref and in --certificate-identity is the release tag (e.g., vX.Y.Zrc1), not the chart version. To check the file:

gh release download vX.Y.Z --repo elixir-cloud-aai/prowes \
    --pattern 'prowes-X.Y.Z.tgz*'
gh attestation verify prowes-X.Y.Z.tgz \
    --repo elixir-cloud-aai/prowes \
    --signer-workflow elixir-cloud-aai/prowes/.github/workflows/release.yml \
    --source-ref refs/tags/vX.Y.Z
cosign verify-blob prowes-X.Y.Z.tgz \
    --bundle prowes-X.Y.Z.tgz.sigstore.json \
    --certificate-oidc-issuer https://token.actions.githubusercontent.com \
    --certificate-identity https://github.com/elixir-cloud-aai/prowes/.github/workflows/release.yml@refs/tags/vX.Y.Z

The scans fail on critical and high vulnerabilities that have a fix, whose findings are listed in the repository's code scanning alerts; the release workflow scans the release image again before it is published, and a weekly workflow (scan.yml) scans the image of the highest release, from the first release on (and keeps a full report, findings without a fix included, as a workflow artifact of each run). Accepted findings are listed, each with a reason and an expiry date, in .trivyignore.yaml.

Images published to another Docker Hub organization (forks that set DOCKERHUB_ORG) are verified the same way, with that organization and the fork's repository in place of elixircloud and elixir-cloud-aai/prowes; the charts of forks go to the GHCR namespace of the fork's owner (ghcr.io/<owner>/charts/prowes).

Secrets

Secrets (e.g., passwords, tokens, private keys) are never part of the image: pass them only at runtime, as environment variables or mounted secrets (e.g., Kubernetes Secrets), never as build arguments, which are recorded in the image history. The image build receives only the files it needs (an allowlist in .dockerignore). As a safety net, common secret files are left out even within pro_wes/: .env files (except .env.example), key, certificate and keystore files (e.g., *.pem, *.key, *.p12, *.jks), SSH keys, .netrc, .pgpass, .aws/ and kubeconfig files. Don't keep other secrets in the working tree either.