mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
The default recursion limit used by Docker's archlinux:base-devel Python package becomes problematic in some cases when running tests against our FastAPI application using starlette.testclient.TestClient (aliased to fastapi.testclient.TestClient). starlette ends up with test failures because it exceeds the recursion limit, but this only happens when using the `TestClient`. When the ASGI servers are run, this is not an issue and so in that case, the recursion limit has not been touched. This change uses a `TEST_RECURSION_LIMIT` environment variable to modify the recursion limit of the FastAPI application. This variable is, by default, only supplied when running pytests in Docker, but can be force-supplied by the user. TEST_RECURSION_LIMIT=10000 has been added to `.env` and `.gitlab-ci.yml`. Signed-off-by: Kevin Morris <kevr@0cost.org>
291 lines
7.6 KiB
YAML
291 lines
7.6 KiB
YAML
#
|
|
# Docker service definitions for the aurweb project.
|
|
#
|
|
# Notable services:
|
|
# - `sharness` - Run sharness test suites
|
|
# - `pytest-mysql` - Run pytest suites with MariaDB
|
|
# - `pytest-sqlite` - Run pytest suites with SQLite
|
|
# - `test` - Run sharness, pytest-mysql and pytest-sqlite
|
|
# - `mariadb` - `port 13306` - MariaDB server for docker
|
|
# - `ca` - Certificate Authority generation
|
|
# - `git` - `port 2222` - Git over SSH server
|
|
# - `fastapi` - hypercorn service for aurweb's FastAPI app
|
|
# - `php-fpm` - Execution server for PHP aurweb
|
|
# - `nginx` - `ports 8444 (FastAPI), 8443 (PHP)` - Everything
|
|
# - You can reach `nginx` via FastAPI at `https://localhost:8444/`
|
|
# or via PHP at `https://localhost:8443/`. CGit can be reached
|
|
# via the `/cgit/` request uri on either server.
|
|
#
|
|
# Copyright (C) 2021 aurweb Development
|
|
# All Rights Reserved.
|
|
version: "3.8"
|
|
|
|
services:
|
|
aurweb-image:
|
|
build: .
|
|
image: aurweb:latest
|
|
|
|
ca:
|
|
image: aurweb:latest
|
|
init: true
|
|
entrypoint: /docker/ca-entrypoint.sh
|
|
command: echo
|
|
|
|
memcached:
|
|
image: aurweb:latest
|
|
init: true
|
|
command: /docker/scripts/run-memcached.sh
|
|
healthcheck:
|
|
test: "bash /docker/health/memcached.sh"
|
|
|
|
redis:
|
|
image: aurweb:latest
|
|
init: true
|
|
entrypoint: /docker/redis-entrypoint.sh
|
|
command: /docker/scripts/run-redis.sh
|
|
healthcheck:
|
|
test: "bash /docker/health/redis.sh"
|
|
ports:
|
|
- "16379:6379"
|
|
|
|
mariadb_init:
|
|
image: aurweb:latest
|
|
init: true
|
|
entrypoint: /docker/mariadb-init-entrypoint.sh
|
|
command: echo "MariaDB tables initialized."
|
|
volumes:
|
|
- mariadb_run:/var/run/mysqld
|
|
|
|
git:
|
|
image: aurweb:latest
|
|
init: true
|
|
environment:
|
|
- AUR_CONFIG=/aurweb/conf/config
|
|
entrypoint: /docker/git-entrypoint.sh
|
|
command: /docker/scripts/run-sshd.sh
|
|
ports:
|
|
- "2222:2222"
|
|
healthcheck:
|
|
test: "bash /docker/health/sshd.sh"
|
|
depends_on:
|
|
mariadb_init:
|
|
condition: service_started
|
|
volumes:
|
|
- mariadb_run:/var/run/mysqld
|
|
|
|
smartgit:
|
|
image: aurweb:latest
|
|
init: true
|
|
environment:
|
|
- AUR_CONFIG=/aurweb/conf/config
|
|
entrypoint: /docker/smartgit-entrypoint.sh
|
|
command: /docker/scripts/run-smartgit.sh
|
|
healthcheck:
|
|
test: "bash /docker/health/smartgit.sh"
|
|
|
|
cgit-php:
|
|
image: aurweb:latest
|
|
init: true
|
|
environment:
|
|
- AUR_CONFIG=/aurweb/conf/config
|
|
- CGIT_CLONE_PREFIX=$CGIT_CLONE_PREFIX_PHP
|
|
entrypoint: /docker/cgit-entrypoint.sh
|
|
command: /docker/scripts/run-cgit.sh 3000
|
|
healthcheck:
|
|
test: "bash /docker/health/cgit.sh 3000"
|
|
depends_on:
|
|
git:
|
|
condition: service_healthy
|
|
ports:
|
|
- "13000:3000"
|
|
volumes:
|
|
- git_data:/aurweb/aur.git
|
|
|
|
cgit-fastapi:
|
|
image: aurweb:latest
|
|
init: true
|
|
environment:
|
|
- AUR_CONFIG=/aurweb/conf/config
|
|
- CGIT_CLONE_PREFIX=$CGIT_CLONE_PREFIX_FASTAPI
|
|
entrypoint: /docker/cgit-entrypoint.sh
|
|
command: /docker/scripts/run-cgit.sh 3000
|
|
healthcheck:
|
|
test: "bash /docker/health/cgit.sh 3000"
|
|
depends_on:
|
|
git:
|
|
condition: service_healthy
|
|
ports:
|
|
- "13001:3000"
|
|
volumes:
|
|
- git_data:/aurweb/aur.git
|
|
|
|
php-fpm:
|
|
image: aurweb:latest
|
|
init: true
|
|
environment:
|
|
- AUR_CONFIG=/aurweb/conf/config
|
|
entrypoint: /docker/php-entrypoint.sh
|
|
command: /docker/scripts/run-php.sh
|
|
healthcheck:
|
|
test: "bash /docker/health/php.sh"
|
|
depends_on:
|
|
ca:
|
|
condition: service_started
|
|
git:
|
|
condition: service_healthy
|
|
memcached:
|
|
condition: service_healthy
|
|
volumes:
|
|
- mariadb_run:/var/run/mysqld
|
|
ports:
|
|
- "19000:9000"
|
|
|
|
fastapi:
|
|
image: aurweb:latest
|
|
init: true
|
|
environment:
|
|
- AUR_CONFIG=conf/config
|
|
- FASTAPI_WORKERS=${FASTAPI_WORKERS}
|
|
entrypoint: /docker/fastapi-entrypoint.sh
|
|
command: /docker/scripts/run-fastapi.sh "${FASTAPI_BACKEND}"
|
|
healthcheck:
|
|
test: "bash /docker/health/fastapi.sh ${FASTAPI_BACKEND}"
|
|
depends_on:
|
|
ca:
|
|
condition: service_started
|
|
git:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
volumes:
|
|
- mariadb_run:/var/run/mysqld
|
|
ports:
|
|
- "18000:8000"
|
|
|
|
nginx:
|
|
image: aurweb:latest
|
|
init: true
|
|
environment:
|
|
- AUR_CONFIG=conf/config
|
|
entrypoint: /docker/nginx-entrypoint.sh
|
|
command: /docker/scripts/run-nginx.sh
|
|
ports:
|
|
- "8443:8443" # PHP
|
|
- "8444:8444" # FastAPI
|
|
healthcheck:
|
|
test: "bash /docker/health/nginx.sh"
|
|
depends_on:
|
|
cgit-php:
|
|
condition: service_healthy
|
|
cgit-fastapi:
|
|
condition: service_healthy
|
|
smartgit:
|
|
condition: service_healthy
|
|
fastapi:
|
|
condition: service_healthy
|
|
php-fpm:
|
|
condition: service_healthy
|
|
|
|
sharness:
|
|
image: aurweb:latest
|
|
profiles: ["dev"]
|
|
init: true
|
|
environment:
|
|
- AUR_CONFIG=conf/config.sqlite
|
|
entrypoint: /docker/test-sqlite-entrypoint.sh
|
|
command: /docker/scripts/run-sharness.sh
|
|
stdin_open: true
|
|
tty: true
|
|
depends_on:
|
|
git:
|
|
condition: service_healthy
|
|
volumes:
|
|
- git_data:/aurweb/aur.git
|
|
- ./cache:/cache
|
|
- ./aurweb:/aurweb/aurweb
|
|
- ./migrations:/aurweb/migrations
|
|
- ./test:/aurweb/test
|
|
- ./web/html:/aurweb/web/html
|
|
- ./web/template:/aurweb/web/template
|
|
- ./web/lib:/aurweb/web/lib
|
|
- ./templates:/aurweb/templates
|
|
|
|
pytest-mysql:
|
|
image: aurweb:latest
|
|
profiles: ["dev"]
|
|
init: true
|
|
environment:
|
|
- AUR_CONFIG=conf/config
|
|
- TEST_RECURSION_LIMIT=${TEST_RECURSION_LIMIT}
|
|
entrypoint: /docker/test-mysql-entrypoint.sh
|
|
command: /docker/scripts/run-pytests.sh clean
|
|
stdin_open: true
|
|
tty: true
|
|
depends_on:
|
|
mariadb_init:
|
|
condition: service_started
|
|
volumes:
|
|
- mariadb_run:/var/run/mysqld
|
|
- git_data:/aurweb/aur.git
|
|
- ./cache:/cache
|
|
- ./aurweb:/aurweb/aurweb
|
|
- ./migrations:/aurweb/migrations
|
|
- ./test:/aurweb/test
|
|
- ./web/html:/aurweb/web/html
|
|
- ./web/template:/aurweb/web/template
|
|
- ./web/lib:/aurweb/web/lib
|
|
- ./templates:/aurweb/templates
|
|
|
|
pytest-sqlite:
|
|
image: aurweb:latest
|
|
profiles: ["dev"]
|
|
init: true
|
|
environment:
|
|
- AUR_CONFIG=conf/config.sqlite
|
|
- TEST_RECURSION_LIMIT=${TEST_RECURSION_LIMIT}
|
|
entrypoint: /docker/test-sqlite-entrypoint.sh
|
|
command: setup-sqlite.sh run-pytests.sh clean
|
|
stdin_open: true
|
|
tty: true
|
|
volumes:
|
|
- git_data:/aurweb/aur.git
|
|
- ./cache:/cache
|
|
- ./aurweb:/aurweb/aurweb
|
|
- ./migrations:/aurweb/migrations
|
|
- ./test:/aurweb/test
|
|
- ./web/html:/aurweb/web/html
|
|
- ./web/template:/aurweb/web/template
|
|
- ./web/lib:/aurweb/web/lib
|
|
- ./templates:/aurweb/templates
|
|
|
|
test:
|
|
image: aurweb:latest
|
|
profiles: ["dev"]
|
|
init: true
|
|
environment:
|
|
- AUR_CONFIG=conf/config
|
|
- TEST_RECURSION_LIMIT=${TEST_RECURSION_LIMIT}
|
|
entrypoint: /docker/tests-entrypoint.sh
|
|
command: setup-sqlite.sh run-tests.sh
|
|
stdin_open: true
|
|
tty: true
|
|
depends_on:
|
|
mariadb_init:
|
|
condition: service_started
|
|
volumes:
|
|
- mariadb_run:/var/run/mysqld
|
|
- git_data:/aurweb/aur.git
|
|
- ./cache:/cache
|
|
- ./aurweb:/aurweb/aurweb
|
|
- ./migrations:/aurweb/migrations
|
|
- ./test:/aurweb/test
|
|
- ./web/html:/aurweb/web/html
|
|
- ./web/template:/aurweb/web/template
|
|
- ./web/lib:/aurweb/web/lib
|
|
- ./templates:/aurweb/templates
|
|
|
|
volumes:
|
|
mariadb_run: {} # Share /var/run/mysqld/mysqld.sock
|
|
mariadb_data: {} # Share /var/lib/mysql
|
|
git_data: {} # Share aurweb/aur.git
|
|
smartgit_run: {}
|