chore: add development compose and configs

This commit is contained in:
Fijxu
2025-05-21 16:36:10 -04:00
parent 7d0f3fab25
commit 9e4f78f360
4 changed files with 221 additions and 44 deletions

View File

@@ -1,56 +1,102 @@
# Docker compose file for inv.nadeko.net
# DEVELOPMENT DOCKER COMPOSE FILE! DO NOT USE ON PRODUCTION!
x-common-invidious-env: &common-invidious-env
INVIDIOUS_CONFIG_FILE: "/etc/invidious/config.yml"
x-common: &common-invidious
image: "git.nadeko.net/fijxu/invidious:latest"
restart: always
deploy:
replicas: 4
volumes:
- ./docker/config.yml:/etc/invidious/config.yml:ro
- valkey_socket:/tmp
x-common-haproxy: &common-haproxy
hostname: haproxy
image: haproxy:lts-alpine
restart: always
volumes:
- ./docker/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg
x-common-valkey: &common-valkey
image: valkey/valkey:7.2-alpine
hostname: valkey
restart: unless-stopped
volumes:
- ./docker/valkey.conf:/usr/local/etc/valkey/valkey.conf
- valkey_socket:/tmp
command: "valkey-server /usr/local/etc/valkey/valkey.conf"
services:
valkey:
image: valkey/valkey:7.2-alpine
restart: unless-stopped
volumes:
- "./valkey:/data"
invidious-refresher:
image: git.nadeko.net/fijxu/invidious:latest
restart: unless-stopped
volumes:
- ./config/config-refresher.yml:/etc/invidious/config.yml:ro
- ./logs:/var/log/invidious:rw
- /var/run/postgresql/.s.PGSQL.5432:/var/run/postgresql/.s.PGSQL.5432:rw
environment:
INVIDIOUS_CONFIG_FILE: /etc/invidious/config.yml
depends_on:
- valkey
healthcheck:
test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/trending || exit 1
interval: 30s
timeout: 5s
retries: 2
# INVIDIOUS SECTION #
invidious:
image: git.nadeko.net/fijxu/invidious:latest
restart: unless-stopped
deploy:
replicas: 8
volumes:
- ./config/config.yml:/etc/invidious/config.yml:ro
- ./logs:/var/log/invidious:rw
- /var/run/postgresql/.s.PGSQL.5432:/var/run/postgresql/.s.PGSQL.5432:rw
<<: *common-invidious
environment:
INVIDIOUS_CONFIG_FILE: /etc/invidious/config.yml
<<: *common-invidious-env
networks:
- invidious
depends_on:
- valkey
healthcheck:
test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/trending || exit 1
interval: 30s
timeout: 5s
retries: 2
- pgbouncer
- haproxy
# HAPROXY SECTION #
haproxy:
<<: *common-haproxy
ports:
# Port to expose invidious
- "127.0.0.1:11101:8001"
networks:
- invidious
invidious-nginx:
image: nginx:latest
valkey:
<<: *common-valkey
networks:
- invidious
postgres:
image: docker.io/library/postgres:17
restart: unless-stopped
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- /tmp/postgresdata:/var/lib/postgresql/data
- ./config/sql:/config/sql
- ./docker/init-invidious-db.sh:/docker-entrypoint-initdb.d/init-invidious-db.sh
environment:
POSTGRES_DB: invidious
POSTGRES_USER: kemal
POSTGRES_PASSWORD: kemal
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
networks:
- invidious
ports:
- "127.0.0.1:10011:3000"
# Pgbouncer to keep connections to the database open
pgbouncer:
image: edoburu/pgbouncer
restart: unless-stopped
environment:
- POOL_MODE=transaction
# Everything is being done locally
# https://www.pgbouncer.org/config.html
- AUTH_TYPE=scram-sha-256
- DB_HOST=postgres
- DB_USER=kemal
- DB_PASSWORD=kemal
- DB_NAME=invidious
- VERBOSE=3
- LISTEN_PORT=6432
networks:
- invidious
depends_on:
postgres:
condition: service_healthy
networks:
invidious:
name: invidious
volumes:
valkey_socket:
postgresdata: