| # This file composes a full service running LNT. A LNT service is comprised of: |
| # - A container running a Postgres database |
| # - A LNT webserver using gunicorn connected to that database |
| # - Optionally, a Nginx reverse proxy in front of the webserver |
| # |
| # The webserver is built from source and binds to localhost:8000, which is useful |
| # for local development. |
| # |
| # When desired, the 'nginx' profile can be used, which adds the Nginx reverse proxy. |
| # |
| # In order to compose the full service, some secrets are required. They are taken |
| # as environment variables, which means they can be stored in a file and included |
| # via `--env-file <secrets-file>`. These environment variables are: |
| # |
| # LNT_DB_PASSWORD |
| # The password to use for logging into the database. |
| # |
| # LNT_AUTH_TOKEN |
| # The authentication token used to require authentication to |
| # perform destructive actions. |
| # |
| # Additionally, the following aspects can be customized: |
| # |
| # LNT_HOST_PORT |
| # The host port to expose the webserver on. Defaults to '8000'. |
| # |
| # LNT_NGINX_CONFIG |
| # The path to the configuration file to use for Nginx. By default, './nginx.conf' |
| # is used, however this must be specified whenever running from a host where the |
| # source tree is not available, or when a fundamentally different configuration |
| # is desired. |
| # |
| # LNT_NGINX_EXTERNAL_PORT |
| # The externally-visible port that will be exposed by the Nginx reverse proxy. |
| # This defaults to '80', which is the convention for HTTP servers. |
| |
| name: llvm-lnt |
| |
| services: |
| webserver: |
| build: |
| context: ../ |
| dockerfile: docker/lnt.dockerfile |
| environment: |
| - DB_USER=lntuser |
| - DB_HOST=db |
| - DB_NAME=lnt |
| - DB_PASSWORD_FILE=/run/secrets/lnt-db-password |
| - AUTH_TOKEN_FILE=/run/secrets/lnt-auth-token |
| secrets: |
| - lnt-db-password |
| - lnt-auth-token |
| depends_on: |
| - db |
| deploy: |
| restart_policy: |
| condition: on-failure |
| volumes: |
| - instance:/var/lib/lnt |
| ports: |
| - "${LNT_HOST_PORT:-8000}:8000" |
| networks: |
| - lnt_network |
| platform: linux/amd64 |
| |
| db: |
| image: docker.io/postgres:18-alpine |
| environment: |
| - POSTGRES_PASSWORD_FILE=/run/secrets/lnt-db-password |
| - POSTGRES_USER=lntuser |
| - POSTGRES_DB=lnt |
| secrets: |
| - lnt-db-password |
| volumes: |
| - database:/var/lib/postgresql |
| networks: |
| - lnt_network |
| |
| nginx: |
| profiles: [nginx] |
| container_name: nginx_reverse_proxy |
| image: docker.io/nginx:latest |
| restart: unless-stopped |
| volumes: |
| - ${LNT_NGINX_CONFIG:-./nginx.conf}:/etc/nginx/conf.d/default.conf:ro |
| depends_on: |
| - webserver |
| ports: |
| - "${LNT_NGINX_EXTERNAL_PORT:-80}:80" |
| networks: |
| - lnt_network |
| logging: |
| driver: "json-file" |
| options: |
| max-size: "10m" |
| max-file: "3" |
| |
| volumes: |
| instance: |
| database: |
| |
| secrets: |
| lnt-db-password: |
| environment: "LNT_DB_PASSWORD" |
| lnt-auth-token: |
| environment: "LNT_AUTH_TOKEN" |
| |
| networks: |
| lnt_network: |
| driver: bridge |