mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
feat(gitlab-ci): Add logic for deploying aur-dev with docker-compose
The infrastructure changes are here[1]. [1] https://gitlab.archlinux.org/archlinux/infrastructure/-/merge_requests/492
This commit is contained in:
parent
1f2347c6b4
commit
651c1cd8c6
2 changed files with 49 additions and 15 deletions
|
@ -11,22 +11,22 @@ variables:
|
||||||
DB_HOST: localhost
|
DB_HOST: localhost
|
||||||
TEST_RECURSION_LIMIT: 10000
|
TEST_RECURSION_LIMIT: 10000
|
||||||
|
|
||||||
before_script:
|
|
||||||
- export PATH="$HOME/.poetry/bin:${PATH}"
|
|
||||||
- ./docker/scripts/install-deps.sh
|
|
||||||
- ./docker/scripts/install-python-deps.sh
|
|
||||||
- useradd -U -d /aurweb -c 'AUR User' aur
|
|
||||||
- ./docker/mariadb-entrypoint.sh
|
|
||||||
- (cd '/usr' && /usr/bin/mysqld_safe --datadir='/var/lib/mysql') &
|
|
||||||
- 'until : > /dev/tcp/127.0.0.1/3306; do sleep 1s; done'
|
|
||||||
- ./docker/test-mysql-entrypoint.sh # Create mysql AUR_CONFIG.
|
|
||||||
- ./docker/test-sqlite-entrypoint.sh # Create sqlite AUR_CONFIG.
|
|
||||||
- make -C po all install
|
|
||||||
- python -m aurweb.initdb # Initialize MySQL tables.
|
|
||||||
- AUR_CONFIG=conf/config.sqlite python -m aurweb.initdb
|
|
||||||
- make -C test clean
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
|
stage: test
|
||||||
|
before_script:
|
||||||
|
- export PATH="$HOME/.poetry/bin:${PATH}"
|
||||||
|
- ./docker/scripts/install-deps.sh
|
||||||
|
- ./docker/scripts/install-python-deps.sh
|
||||||
|
- useradd -U -d /aurweb -c 'AUR User' aur
|
||||||
|
- ./docker/mariadb-entrypoint.sh
|
||||||
|
- (cd '/usr' && /usr/bin/mysqld_safe --datadir='/var/lib/mysql') &
|
||||||
|
- 'until : > /dev/tcp/127.0.0.1/3306; do sleep 1s; done'
|
||||||
|
- ./docker/test-mysql-entrypoint.sh # Create mysql AUR_CONFIG.
|
||||||
|
- ./docker/test-sqlite-entrypoint.sh # Create sqlite AUR_CONFIG.
|
||||||
|
- make -C po all install
|
||||||
|
- python -m aurweb.initdb # Initialize MySQL tables.
|
||||||
|
- AUR_CONFIG=conf/config.sqlite python -m aurweb.initdb
|
||||||
|
- make -C test clean
|
||||||
script:
|
script:
|
||||||
- make -C test sh pytest # sharness tests use sqlite & pytest w/ mysql.
|
- make -C test sh pytest # sharness tests use sqlite & pytest w/ mysql.
|
||||||
- AUR_CONFIG=conf/config.sqlite make -C test pytest
|
- AUR_CONFIG=conf/config.sqlite make -C test pytest
|
||||||
|
@ -41,3 +41,21 @@ test:
|
||||||
artifacts:
|
artifacts:
|
||||||
reports:
|
reports:
|
||||||
cobertura: coverage.xml
|
cobertura: coverage.xml
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
stage: deploy
|
||||||
|
tags:
|
||||||
|
- secure
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_BRANCH == "pu"
|
||||||
|
when: manual
|
||||||
|
script:
|
||||||
|
- pacman -Syu --noconfirm docker-compose socat openssh
|
||||||
|
- chmod 600 ${SSH_KEY}
|
||||||
|
- socat "UNIX-LISTEN:/tmp/docker.sock,reuseaddr,fork" EXEC:"ssh -o UserKnownHostsFile=${SSH_KNOWN_HOSTS} -Ti ${SSH_KEY} ${SSH_USER}@${SSH_HOST}" &
|
||||||
|
- export DOCKER_HOST="unix:///tmp/docker.sock"
|
||||||
|
- docker-compose build
|
||||||
|
- docker-compose -f docker-compose.yml -f docker-compose.aur-dev.yml up -d
|
||||||
|
environment:
|
||||||
|
name: development
|
||||||
|
url: https://aur-dev.archlinux.org
|
||||||
|
|
|
@ -5,32 +5,47 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- cache:/cache
|
- cache:/cache
|
||||||
|
|
||||||
|
memcached:
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
redis:
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
mariadb:
|
||||||
|
restart: always
|
||||||
|
|
||||||
git:
|
git:
|
||||||
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- ${GIT_DATA_DIR}:/aurweb/aur.git
|
- ${GIT_DATA_DIR}:/aurweb/aur.git
|
||||||
- cache:/cache
|
- cache:/cache
|
||||||
- ${MARIADB_SOCKET_DIR}:/var/run/mysqld
|
- ${MARIADB_SOCKET_DIR}:/var/run/mysqld
|
||||||
|
|
||||||
smartgit:
|
smartgit:
|
||||||
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- ${GIT_DATA_DIR}:/aurweb/aur.git
|
- ${GIT_DATA_DIR}:/aurweb/aur.git
|
||||||
- cache:/cache
|
- cache:/cache
|
||||||
- smartgit_run:/var/run/smartgit
|
- smartgit_run:/var/run/smartgit
|
||||||
|
|
||||||
cgit-php:
|
cgit-php:
|
||||||
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- ${GIT_DATA_DIR}:/aurweb/aur.git
|
- ${GIT_DATA_DIR}:/aurweb/aur.git
|
||||||
|
|
||||||
cgit-fastapi:
|
cgit-fastapi:
|
||||||
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- ${GIT_DATA_DIR}:/aurweb/aur.git
|
- ${GIT_DATA_DIR}:/aurweb/aur.git
|
||||||
|
|
||||||
php-fpm:
|
php-fpm:
|
||||||
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- cache:/cache
|
- cache:/cache
|
||||||
- ${MARIADB_SOCKET_DIR}:/var/run/mysqld
|
- ${MARIADB_SOCKET_DIR}:/var/run/mysqld
|
||||||
|
|
||||||
fastapi:
|
fastapi:
|
||||||
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
- FASTAPI_BACKEND="gunicorn"
|
- FASTAPI_BACKEND="gunicorn"
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -42,6 +57,7 @@ services:
|
||||||
- ${MARIADB_SOCKET_DIR}:/var/run/mysqld
|
- ${MARIADB_SOCKET_DIR}:/var/run/mysqld
|
||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- ${GIT_DATA_DIR}:/aurweb/aur.git
|
- ${GIT_DATA_DIR}:/aurweb/aur.git
|
||||||
- cache:/cache
|
- cache:/cache
|
Loading…
Add table
Reference in a new issue