Files
ansible/roles/docker/templates/gitea-compose.yml.j2
T
PhilandClaude Opus 5.5 41e9428412 crowdsec: host sshd + Gitea logs, nftables firewall bouncer (SSH bans only for now), weekly hub update
- crowdsec image -> latest-debian (journalctl); reads host journal (sshd)
  and Gitea's log file (LePresidente/gitea); LAPI on 127.0.0.1:8080
- gitea also logs to /data/gitea/log/gitea.log (router lines console only)
- host: crowdsec-firewall-bouncer-nftables from packagecloud any/any, own
  nft tables on input+forward hooks; limited to local ssh detections and
  manual bans until crowdsec_firewall_all_decisions
- weekly cscli hub update/upgrade + SIGHUP

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 13:26:00 -07:00

107 lines
4.1 KiB
Django/Jinja

version: "3"
services:
server:
# :latest crosses feature releases. Gitea renumbered 1.27 -> 28 and
# doesn't patch old lines, so a :28-style tag would freeze like :1 did.
image: gitea/gitea:latest
container_name: gitea
environment:
- USER_UID=1000
- USER_GID=1000
- GITEA__mailer__ENABLED=true
- GITEA__mailer__FROM=git@{{ email_domains.updates }}
- GITEA__mailer__PROTOCOL=smtps
- GITEA__mailer__SMTP_ADDR={{ smtp.host }}
- GITEA__mailer__SMTP_PORT=465
- GITEA__mailer__USER={{ smtp.username }}
- GITEA__mailer__PASSWD={{ vault_smtp.password }}
# Legacy OpenID 2.0 login let anyone register despite DISABLE_REGISTRATION. Logins go through Pocket ID.
- GITEA__openid__ENABLE_OPENID_SIGNIN=false
- GITEA__openid__ENABLE_OPENID_SIGNUP=false
# v28 deletes Actions runs older than 400 days by default; keep them all
- GITEA__actions__RUN_RETENTION_DAYS=0
# Only Caddy may set X-Forwarded-For (was "*")
- GITEA__security__REVERSE_PROXY_TRUSTED_PROXIES={{ docker.hairpin_ip }}/32
# Rehashed to argon2 at each user's next password login
- GITEA__security__PASSWORD_HASH_ALGO=argon2
# New accounts hide their email address
- GITEA__service__DEFAULT_KEEP_EMAIL_PRIVATE=true
# No HTTP Basic auth with account passwords. Tokens (PATs, OAuth,
# Actions job tokens) sent via Basic auth still work.
- GITEA__service__ENABLE_BASIC_AUTHENTICATION=false
# Web logins only through Pocket ID (sign-in page redirects there).
# phil (Pocket ID) is admin; git_admin is a CLI-only fallback:
# docker exec -u git gitea gitea admin ...
- GITEA__service__ENABLE_PASSWORD_SIGNIN_FORM=false
- GITEA__service__ENABLE_PASSKEY_AUTHENTICATION=false
# Also log to /data/gitea/log/gitea.log for CrowdSec (failed logins);
# request lines stay on the console only.
- GITEA__log__MODE=console,file
- GITEA__log__logger_0X2E_router_0X2E_MODE=console
restart: unless-stopped
labels:
mag37.dockcheck.update: true
volumes:
- gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- 222:22
extra_hosts:
- '{{ subdomains.pocketid }}:{{ docker.hairpin_ip }}'
- '{{ subdomains.git }}:{{ docker.hairpin_ip }}'
{% if lava_reserved | default(false) | bool %}
networks:
default:
ipv4_address: {{ docker.gitea_ip }}
{% endif %}
runner:
# gitea/act_runner was renamed to gitea/runner (and stopped updating)
image: gitea/runner:latest
restart: unless-stopped
depends_on:
- server
environment:
- CONFIG_FILE=/config.yaml
- GITEA_INSTANCE_URL=http://gitea:3000
- GITEA_RUNNER_REGISTRATION_TOKEN={{ vault_infrastructure.gitea_runner_key }}
- GITEA_RUNNER_NAME=runner_1
- GITEA_RUNNER_LABELS=docker
extra_hosts:
- '{{ subdomains.git }}:{{ docker.hairpin_ip }}'
labels:
mag37.dockcheck.update: true
volumes:
- ./runner-config.yaml:/config.yaml
- ./data:/data
# No Docker socket: jobs run inside this container (label docker:host),
# and the socket would give every workflow root on the server.
# Image builds go to the rootless BuildKit below through its socket at
# /run/buildkit/buildkit/buildkitd.sock.
- buildkit-run:/run/buildkit
- {{ paths.stacks }}/caddy/site:/sites
buildkitd:
image: moby/buildkit:rootless
restart: unless-stopped
# Rootless BuildKit in an unprivileged container (see BuildKit's
# docs/rootless.md). It listens only on a unix socket shared with the runner.
command: ["--oci-worker-no-process-sandbox"]
security_opt:
- seccomp=unconfined
- apparmor=unconfined
extra_hosts:
- '{{ subdomains.git }}:{{ docker.hairpin_ip }}'
labels:
mag37.dockcheck.update: true
volumes:
- buildkit-run:/run/user/1000
- buildkit-cache:/home/user/.local/share/buildkit
volumes:
gitea:
driver: local
buildkit-run:
buildkit-cache:
networks:
default:
external: true
name: {{ docker.network_name }}