diff --git a/INSTALL b/INSTALL index f192f9f5..c41a5c8e 100644 --- a/INSTALL +++ b/INSTALL @@ -55,6 +55,11 @@ read the instructions below. python-lxml python-feedgen # python3 setup.py install +(FastAPI-Specific) + + # pacman -S redis python-redis + # systemctl enable --now redis + 5) Create a new MySQL database and a user and import the aurweb SQL schema: $ python -m aurweb.initdb diff --git a/docker-compose.yml b/docker-compose.yml index 56eff570..0e91d6eb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,6 +36,16 @@ services: 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: image: aurweb:latest init: true @@ -172,6 +182,8 @@ services: condition: service_started git: condition: service_healthy + redis: + condition: service_healthy mariadb: condition: service_healthy volumes: diff --git a/docker/fastapi-entrypoint.sh b/docker/fastapi-entrypoint.sh index c46a33eb..41a88206 100755 --- a/docker/fastapi-entrypoint.sh +++ b/docker/fastapi-entrypoint.sh @@ -7,6 +7,10 @@ bash $dir/test-mysql-entrypoint.sh sed -ri "s;^(aur_location) = .+;\1 = https://localhost:8444;" conf/config sed -ri 's/^(name) = .+/\1 = aurweb/' conf/config +# Setup Redis for FastAPI. +sed -ri 's/^(cache) = .+/\1 = redis/' conf/config +sed -ri 's|^(redis_address) = .+|\1 = redis://redis|' conf/config + sed -ri "s|^(git_clone_uri_anon) = .+|\1 = https://localhost:8444/%s.git|" conf/config.defaults sed -ri "s|^(git_clone_uri_priv) = .+|\1 = ssh://aur@localhost:2222/%s.git|" conf/config.defaults diff --git a/docker/health/redis.sh b/docker/health/redis.sh new file mode 100755 index 00000000..b5b442e8 --- /dev/null +++ b/docker/health/redis.sh @@ -0,0 +1,2 @@ +#!/bin/bash +exec pgrep redis-server diff --git a/docker/redis-entrypoint.sh b/docker/redis-entrypoint.sh new file mode 100755 index 00000000..e92be6c5 --- /dev/null +++ b/docker/redis-entrypoint.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -eou pipefail + +sed -ri 's/^bind .*$/bind 0.0.0.0 -::1/g' /etc/redis/redis.conf + +exec "$@" diff --git a/docker/scripts/install-deps.sh b/docker/scripts/install-deps.sh index 6edbff5a..6b0ec48b 100755 --- a/docker/scripts/install-deps.sh +++ b/docker/scripts/install-deps.sh @@ -14,6 +14,7 @@ pacman -Syu --noconfirm --noprogressbar \ python-pytest-asyncio python-coverage hypercorn python-bcrypt \ python-email-validator openssh python-lxml mariadb mariadb-libs \ python-isort flake8 cgit uwsgi uwsgi-plugin-cgi php php-fpm \ - python-asgiref uvicorn python-feedgen memcached php-memcached + python-asgiref uvicorn python-feedgen memcached php-memcached \ + python-redis redis exec "$@" diff --git a/docker/scripts/run-redis.sh b/docker/scripts/run-redis.sh new file mode 100755 index 00000000..8dc98b10 --- /dev/null +++ b/docker/scripts/run-redis.sh @@ -0,0 +1,2 @@ +#!/bin/bash +exec /usr/bin/redis-server /etc/redis/redis.conf