Files
Kamino/roles/gitea/templates/app.ini.j2
T
Defame1297andClaude Opus 5.5 f060461152
Build / build (pull_request) Successful in 12s
Lint / lint (pull_request) Failing after 43s
Molecule / molecule (pull_request) Successful in 1m20s
feat(gitea): add the gitea role
Moves the gitea role from the environment repository, the second wave 2 role and the
second caller of the internal _binary_update role.

Against the source:
- The update path stages the downloaded, signature-verified binary in a directory next to
  the live one and hands the stop, backup, swap, restart, version check and rollback to
  mortis.kamino._binary_update (include_role with apply tags, so --tags update reaches
  it). A download or signature failure still leaves the running service untouched and
  says so; a failure in the swap keeps the rollback message of _binary_update. Its default
  version regex is the one the source used.
- The same two small behaviour changes as for traefik come with _binary_update: the backup
  is taken whenever a live binary exists, and a failure before the stop no longer
  restarts the running service.
- The update no longer removes a PID file between the stop and the start, and
  gitea_pid_file is gone: the unit runs `gitea web` without --pid and has no PIDFile=,
  so Gitea writes no PID file and systemd reads none.
- The database-migration warning of the source's rollback message (the previous binary
  may refuse a migrated schema) moves to the gitea_update docs in the README and the
  argument_specs, since _binary_update owns the failure message.
- The legacy name guard (pre-rename variables of the environment) is dropped, as in the
  wave 1 roles, and the argument_specs and README no longer mention it. The jwt secret,
  mailer and e-mail confirmation asserts stay.
- Environment references are gone from comments, app.ini.j2, the README and the
  argument_specs: issue numbers, decision records, host names, inventory paths,
  playbooks, the network and proxy layout and other roles' copies of the paths. The
  Renovate comment on gitea_version is dropped; the README and argument_specs recommend
  pinning the version in inventory. The mint messages no longer name a playbook.
- On a fresh host the token assert and the SSH-key upload ran before the unit was
  written and Gitea started, so a first install could never complete. Both now run after
  the service check, and the upload first waits (up to 60 s, not under --check) for the
  local listener; the listener address is resolved once for both.
- REVERSE_PROXY_LIMIT, hard-coded to 2, is now gitea_reverse_proxy_limit with default 1:
  a limit above the real number of proxies lets a client forge the address Gitea logs and
  Fail2Ban bans. A setup with two proxies sets it to 2.
- The gitea commands with user-supplied values (migrate, admin user list and create, and
  the token mint) take argv instead of a command string; still run through sudo -u.
- gitea_version is asserted at role start to be a plain X.Y.Z, with no leading v.
- meta namespace mortis; the scenario follows the Kamino conventions (header,
  test_sequence, no provisioner env) and calls the role by FQCN, also in the child
  ansible-playbook of the mint CI-guard cases. Coverage is unchanged.

No other default changed; DISABLE_REGISTRATION stays hard-coded to true.

Changelog fragment, README Roadmap and the CLAUDE.md role list updated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-21 21:53:20 +00:00

64 lines
2.1 KiB
Django/Jinja

WORK_PATH = {{ gitea_data_dirs[0] }}
[server]
PROTOCOL = http
HTTP_PORT = {{ gitea_http_port }}
HTTP_ADDR = {{ gitea_http_addr }}
DOMAIN = {{ gitea_domain }}
ROOT_URL = https://{{ gitea_domain }}/
# The built-in SSH server stays off: SSH clones go through the host's own sshd.
# SSH_DOMAIN defaults to {{ gitea_domain }}, so the SSH clone URL in the UI only
# works where that name reaches the host's SSH port; elsewhere use the HTTPS clone
# URL (with a token).
START_SSH_SERVER = false
DISABLE_SSH = false
OFFLINE_MODE = false
PROXY_PROTOCOL = false
ENABLE_PPROF = false
[repository]
ROOT = {{ gitea_data_dirs[2] }}/gitea-repositories
[database]
DB_TYPE = sqlite3
PATH = {{ gitea_data_dirs[0] }}/gitea.db
[security]
INSTALL_LOCK = true
SECRET_KEY = {{ gitea_secret_key }}
INTERNAL_TOKEN = {{ gitea_internal_token }}
# A reverse proxy on the same host reaches this listener over loopback: trust
# that hop so Gitea resolves the real client IP from X-Forwarded-For instead of
# logging every request as coming from itself. REVERSE_PROXY_LIMIT is the number of
# trusted proxy hops in X-Forwarded-For: set it to the real number of proxies, since a
# higher value lets a client forge the address Gitea logs (and Fail2Ban bans).
REVERSE_PROXY_TRUSTED_PROXIES = 127.0.0.1/32,::1/128
REVERSE_PROXY_LIMIT = {{ gitea_reverse_proxy_limit }}
# REQUIRE_SIGNIN_VIEW is left unset on purpose: public repositories stay
# readable without signing in.
[oauth2]
JWT_SECRET = {{ gitea_jwt_secret }}
[service]
REGISTER_EMAIL_CONFIRM = {{ 'true' if gitea_register_email_confirm | bool else 'false' }}
ENABLE_NOTIFY_MAIL = {{ 'true' if gitea_mailer_enabled | bool else 'false' }}
DISABLE_REGISTRATION = true
{% if gitea_mailer_enabled | bool %}
[mailer]
ENABLED = true
PROTOCOL = {{ gitea_mailer_protocol }}
SMTP_ADDR = {{ gitea_mailer_smtp_addr }}
SMTP_PORT = {{ gitea_mailer_smtp_port }}
FROM = {{ gitea_mailer_from }}
USER = {{ gitea_mailer_user }}
PASSWD = `{{ gitea_mailer_passwd }}`
{% if gitea_mailer_subject_prefix | length > 0 %}
SUBJECT_PREFIX = {{ gitea_mailer_subject_prefix }}
{% endif %}
[admin]
DEFAULT_EMAIL_NOTIFICATIONS = {{ gitea_default_email_notifications }}
{% endif %}