commit ecb5658616fd8019e59bb322a7fbd0547921c539 Author: Storozhenko Evgeny Vladimirovich Date: Sat Jun 6 14:34:55 2026 +0000 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cd44214 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +redis/ +postgres/ +runner/ +gitea/ +.env diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8aa0bb0 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,132 @@ +# Gitea с PostgreSQL, Redis и Action Runner +# Запуск: docker compose up -d + +services: + # PostgreSQL база данных + db: + image: postgres:16-alpine + container_name: gitea-db + restart: always + environment: + - POSTGRES_DB=gitea + - POSTGRES_USER=gitea + - POSTGRES_PASSWORD=gitea-secret-2026-nixg.ru + - PGDATA=/var/lib/postgresql/data + volumes: + - ./postgres:/var/lib/postgresql/data + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + networks: + - gitea-net + healthcheck: + test: ["CMD-SHELL", "pg_isready -U gitea -d gitea"] + interval: 10s + timeout: 5s + retries: 5 + labels: + - "caddy=off" + + # Redis для кэширования + redis: + image: redis:7-alpine + container_name: gitea-redis + restart: always + command: ["redis-server", "--appendonly", "yes"] + volumes: + - ./redis:/data + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + networks: + - gitea-net + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 10s + timeout: 3s + retries: 5 + labels: + - "caddy=off" + + # Gitea основной сервис + gitea: + image: docker.gitea.com/gitea:1.26.2 + container_name: gitea + restart: always + environment: + - USER_UID=1000 + - USER_GID=1000 + # База данных PostgreSQL + - GITEA__database__DB_TYPE=postgres + - GITEA__database__HOST=gitea-db:5432 + - GITEA__database__NAME=gitea + - GITEA__database__USER=gitea + - GITEA__database__PASSWD=gitea-secret-2026-nixg.ru + # Redis кэш + - GITEA__cache__ENABLED=true + - GITEA__cache__ADAPTER=redis + - GITEA__cache__HOST=redis://gitea-redis:6379/0 + # Session + - GITEA__session__PROVIDER=redis + - GITEA__session__PROVIDER_CONFIG=redis://gitea-redis:6379/0 + # Сервер настройки + - GITEA__server__DOMAIN=gitea.nixg.ru + - GITEA__server__HTTP_PORT=3000 + - GITEA__server__ROOT_URL=https://gitea.nixg.ru/ + - GITEA__server__SSH_PORT=2222 + - GITEA__server__SSH_DOMAIN=gitea.nixg.ru + # Gitea Actions + - GITEA__actions__ENABLED=true + # Безопасность + - GITEA__server__DISABLE_REGISTRATION=true + - GITEA__server__REQUIRE_SIGNIN_VIEW=false + - GITEA__service__ENABLE_NOTIFY_MAIL=false + depends_on: + db: + condition: service_healthy + redis: + condition: service_healthy + networks: + - gitea-net + volumes: + - ./gitea:/data + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + ports: + - "3000:3000" + - "2222:22" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:3000"] + interval: 30s + timeout: 10s + retries: 3 + labels: + - "caddy=https://gitea.nixg.ru" + - "caddy.reverse_proxy={{upstreams 3000}}" + + # Gitea Action Runner + act-runner: + image: gitea/act_runner:latest + container_name: gitea-act-runner + restart: always + depends_on: + - gitea + environment: + - GITEA_INSTANCE_URL=https://gitea.nixg.ru + - GITEA_RUNNER_REGISTRATION_TOKEN=${GITEA_RUNNER_TOKEN} + - GITEA_RUNNER_NAME=bigbox-runner + - GITEA_RUNNER_LABELS=ubuntu-24.04:docker://node:20,ubuntu-24.04:docker://python:3.12,ubuntu-24.04:docker://golang:1.22 + # Пропуск проверки SSL для самоподписанных сертификатов + - GITEA_INSECURE_SKIP_VERIFY=true + volumes: + - ./runner:/data + - /var/run/docker.sock:/var/run/docker.sock + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + networks: + - gitea-net + labels: + - "caddy=off" + +networks: + gitea-net: + driver: bridge + name: gitea-net