Commit Graph

146 Commits

Author SHA1 Message Date
S
b2520bec0e fix: remove unused runner data path variables from .env.example 2026-03-02 08:12:04 -05:00
S
13f73b850f docs: fix stale references in PLAN, contracts, README
- README.md: update prompt count ~65 to ~70
- contracts/gitea-api.md: fix "Used in" annotations — POST
  branch_protections is Phase 7 only (not Phase 9), DELETE
  branch_protections is Phase 7 teardown only (Phase 9 uses PATCH),
  add missing used-in entries for GET commits and GET contents
- PLAN.md: replace stale UNRAID_GITEA_PORT/FEDORA_GITEA_PORT with
  macvlan vars, update REPO_N_NAME to REPO_NAMES, fix version defaults
  (1.23->1.25, 0.2.11->0.3.0), add missing setup/ files to tree,
  fix prompt table to match current ~70 variables, update require_vars
  lists to match actual scripts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 13:21:40 -05:00
S
9494645b3a fix: resolve 10 bugs across scripts
- manage_runner.sh: fix RUNNER_DEFAULT_IMAGE clobbering by renaming
  per-runner var to RUNNER_SECTION_IMAGE; .env fallback now works
- manage_runner.sh: render native runner config.yaml before registration
  so act_runner can read it during --config flag
- manage_runner.sh: add SSH credential validation for remote hosts
  (fail early with clear error instead of cryptic SSH failure)
- phase1/phase2: add UNRAID_DB_IP/FEDORA_DB_IP to conditional
  require_vars when DB_TYPE != sqlite3
- cleanup.sh: only clear manifest when all actions for host succeeded;
  failed actions are preserved for retry
- phase8_cutover.sh: strip empty environment: block from Caddy
  docker-compose when TLS_MODE=existing
- phase5_migrate_pipelines.sh, phase5_teardown.sh, phase9_teardown.sh:
  wrap cd+git in subshells so working directory is always restored
- phase3_post_check.sh: handle both string and numeric runner status
  from Gitea API (offline vs 2)
- configure_env.sh: fix TOTAL_PROMPTS base count (63->64) and move
  DB/repo count adjustments before their prompts are shown

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 13:21:30 -05:00
S
045283be50 docs: fix stale references across all documentation
README.md: add missing configure_runners.sh, fix check count 22→24
USAGE_GUIDE.md: fix check refs 23-24→21-22, add CAP column to
  manage_runner list example
PLAN.md: fix mirror-sync→push_mirrors-sync endpoint
contracts/gitea-api.md: add 5 missing endpoints (DELETE tokens,
  repo-scoped runner registration, PUT/POST GitHub Pages, GitHub
  commits), remove unused actions/workflows endpoint, fix
  GET /settings/api Used-in to include Phase 2

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 12:55:23 -05:00
S
6f97f5f08f fix: add MIGRATION_POLL vars to validation arrays and wizard
MIGRATION_POLL_INTERVAL_SEC and MIGRATION_POLL_TIMEOUT_SEC were in
.env.example and used by phase4, but missing from validate_env()
arrays and configure_env.sh prompts. Preflight would not catch
invalid values. Now validated as positive_integer and prompted
in the REPOSITORIES section of the wizard.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 12:55:16 -05:00
S
01f11df417 fix: wire CADDY_DOMAIN into Caddyfile template for wildcard cert
CADDY_DOMAIN was required/validated/prompted but never used — the
Caddyfile only referenced GITEA_DOMAIN, producing a single-domain
cert. Now the template uses *.CADDY_DOMAIN as the site address
(wildcard cert) with a host matcher routing GITEA_DOMAIN to Gitea.
This means the cert covers all subdomains under the base domain.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 12:18:53 -05:00
S
61b46eb876 fix: handle per-repo failures in phase9 instead of aborting
Previously, a failure on any repo (clone, commit, push) would kill the
entire script via set -e. Remaining repos were never processed and the
FAILED counter was always 0. Now clone and commit/push failures
increment FAILED and continue to the next repo, matching the pattern
used in phase4_migrate_repos.sh.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 12:15:16 -05:00
S
95eeb698da docs: fix stale counts and preflight check numbering
README.md: 10 templates→9, ~6500 lines→~8000, 25 checks→22, ~50 prompts→~65
CLAUDE.md: ~55 env vars→~70
PLAN.md: mark all tracker items DONE, fix Nginx→Caddy/SSL→TLS refs,
  add missing setup scripts and template entries
USAGE_GUIDE.md: add configure_runners.sh mention, fix check 15→14 ref
preflight.sh: renumber checks to fill gaps at 14 and 19 (now 1-22)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 11:59:35 -05:00
S
663376e1cc chore: remove 4 dead functions from lib/common.sh
get_repo_list() — never called, scripts use read -ra directly
wait_for_ssh() — never called, scripts use ssh_check
validate_optional() — never called, optional type unused in arrays
manifest_exists() — never called

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 11:59:25 -05:00
S
8cf762c465 refactor: extract set_db_vars and strip_template_block to lib/common.sh
Identical copies of _set_db_vars() and _strip_block() existed in
phase1, phase2, and phase8. Moved to lib/common.sh as set_db_vars()
and strip_template_block() (public API, no underscore prefix).
Removed dead _strip_block definition from phase8 (defined but never called).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 11:39:20 -05:00
S
b573b77ab1 fix: remove unused FEDORA_CADDY_IP from validation and wizard
No phase script deploys Caddy on Fedora — only Unraid gets a Caddy
container. Removed from .env.example, validation arrays, preflight
required vars, IP ping check, wizard prompts, and doc references.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 11:39:15 -05:00
S
33f9845dd6 fix: remove unnecessary GITEA_ADMIN_PASSWORD from phase5 require_vars
Phase 5 authenticates via GITEA_ADMIN_TOKEN only (git_with_auth uses
the token, not the password). Phase 9 already correctly omits it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 11:39:10 -05:00
S
08b2a9f5e4 fix: add conditional require_vars for DB credentials in restore script
restore_to_primary.sh uses GITEA_DB_USER, GITEA_DB_PASSWD, and
GITEA_DB_NAME for external DB restore but never required them upfront.
Adds conditional require_vars when GITEA_DB_TYPE != sqlite3.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 11:39:05 -05:00
S
f916f12b90 docs: update gitea-api.md — remove hardcoded 3-repo pagination assumption
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 11:08:33 -05:00
S
e737128028 docs: update USAGE_GUIDE.md — Nginx→Caddy, ports→IPs, dynamic repos
- Prerequisites: Nginx container→Cloudflare API token, ports→macvlan IPs
- Edge cases: replaced Nginx/Certbot troubleshooting with Caddy/TLS_MODE
- Rollback: Nginx config removal→Caddy container/config removal
- Day-to-day: replaced certbot renewal with Caddy auto-renewal
- Adding repos: REPO_4_NAME→append to REPO_NAMES

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 11:08:10 -05:00
S
4ec30ca3e6 docs: update PLAN.md — Nginx→Caddy, SSL_MODE→TLS_MODE, port→IP checks
- Added note that plan describes original architecture with diffs noted
- Architecture table: Nginx+Certbot→Caddy+Cloudflare DNS-01
- File structure: nginx-gitea.conf.tpl→Caddyfile.tpl + caddy compose
- Variable table: NGINX_*/SSL_MODE/SSL_EMAIL→TLS_MODE/CADDY_*/CLOUDFLARE_*
- Preflight checks: port checks→container IP availability, Nginx→Caddy path
- Phase 8: complete rewrite from 10-step Nginx flow to 6-step Caddy flow
- Template section: replaced nginx template spec with Caddy template spec
- Removed stale port variables from "Not checked" list

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 11:06:53 -05:00
S
f87acc5664 docs: update README.md — Nginx→Caddy, dynamic repos, macvlan networking
- Architecture diagram: Gitea+Nginx→Gitea+Caddy, Let's Encrypt→macvlan
- Phase 8 description: Nginx→Caddy with Cloudflare DNS-01
- Template listing: nginx-gitea.conf.tpl→Caddyfile.tpl + caddy compose
- Design rationale: replaced "Why Nginx" with "Why Caddy"
- Compromises: replaced SSL cron section with Caddy auto-renewal
- Prerequisites: removed "existing Nginx container", added Cloudflare
- Removed hardcoded "3 repos" references throughout

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 11:04:11 -05:00
S
89bfc8a70f docs: update CLAUDE.md — Nginx→Caddy, 3 repos→dynamic, ssl_mode→tls_mode
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 11:02:29 -05:00
S
f15ab8c18c fix: remove stale RUNNER_DEFAULT_IMAGE_ENV fallback in manage_runner.sh
RUNNER_DEFAULT_IMAGE_ENV was never defined anywhere in the codebase.
The nested default was dead code left from a prior refactor.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 11:01:56 -05:00
S
16892d633f fix: correct case-sensitive host match in runner capacity defaults
The case statement matched uppercase UNRAID/FEDORA but $r_host is always
lowercase from validate_runner_host(). Unraid and Fedora runners were
silently falling through to the default capacity of 1 instead of 2.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 11:01:50 -05:00
S
d2e5a62510 fix: resolve shellcheck warnings (SC2168, SC2089, SC2090, SC2016, SC2329)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:39:38 -05:00
S
a037f22dcd fix: correct TOTAL_PROMPTS base count to 62 (including TLS conditional slots)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:37:13 -05:00
S
07d2d5ffdd chore: fix stale SSL_MODE comments in configure_env.sh
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:35:07 -05:00
S
01e67eb5c0 chore: remove stale validate_ssl_mode() and ssl_mode hint from common.sh
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:35:02 -05:00
S
734bfa8b3a feat: replace Nginx/SSL checks with Caddy/TLS checks in preflight.sh
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:34:28 -05:00
S
f46773a264 chore: remove obsolete nginx-gitea.conf.tpl (replaced by Caddyfile.tpl)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:33:44 -05:00
S
e8000a2f4f feat: replace Nginx/SSL prompts with Caddy/TLS prompts in configure_env.sh
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:33:36 -05:00
S
9f8822bc62 feat: replace Nginx/Certbot teardown with Caddy teardown in phase8_teardown.sh
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:32:51 -05:00
S
391c07a2de feat: rewrite phase8_cutover.sh from Nginx to Caddy reverse proxy
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:32:07 -05:00
S
cbfbff1447 feat: replace Nginx/SSL validation with TLS/Caddy in common.sh
Add validate_tls_mode() (cloudflare|existing). Replace
NGINX_CONTAINER_NAME, NGINX_CONF_PATH, SSL_MODE in validation arrays
with TLS_MODE, CADDY_DOMAIN, CADDY_DATA_PATH. Update conditional
arrays from SSL_MODE-based to TLS_MODE-based (CLOUDFLARE_API_TOKEN
for cloudflare, SSL_CERT_PATH/SSL_KEY_PATH for existing).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:28:41 -05:00
S
76ac854d65 feat: replace Nginx vars with Caddy/TLS vars in .env.example
Remove NGINX_CONTAINER_NAME, NGINX_CONF_PATH, SSL_MODE, SSL_EMAIL.
Add TLS_MODE (cloudflare|existing), CADDY_DOMAIN, CADDY_DATA_PATH,
CLOUDFLARE_API_TOKEN. Keep SSL_CERT_PATH/SSL_KEY_PATH for existing
cert mode.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:27:38 -05:00
S
744c70b534 feat: add docker-compose-caddy template
Caddy reverse proxy container using slothcroissant/caddy-cloudflaredns
image for DNS-01 TLS. Joins the macvlan gitea_net network with a
static IP. CADDY_ENV_VARS and CADDY_EXTRA_VOLUMES are populated by
phase8 based on TLS_MODE (cloudflare vs existing cert paths).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:27:13 -05:00
S
0555c8d8e9 feat: add Caddyfile template for reverse proxy
Template uses TLS_BLOCK placeholder that phase8 populates based on
TLS_MODE: cloudflare (DNS-01 wildcard via Cloudflare API) or
existing (manual cert/key paths). Reverse proxies to Gitea container
on its macvlan IP.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:26:53 -05:00
S
df297334ff feat: replace port prompts with macvlan networking in configure_env.sh
Remove UNRAID_GITEA_PORT, UNRAID_GITEA_SSH_PORT, FEDORA_GITEA_PORT,
FEDORA_GITEA_SSH_PORT prompts. Add DOCKER NETWORKING section with 14
macvlan prompts (parent NIC, subnet, gateway, IP range, container
IPs for gitea/db/caddy on each host). Update TOTAL_PROMPTS to 59.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:26:31 -05:00
S
3b98844973 feat: update preflight for macvlan networking
Add macvlan vars to REQUIRED_VARS. Replace port-free checks (13/14)
with container IP availability check that pings requested IPs to
verify they're not already in use on the LAN.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:25:15 -05:00
S
d202f75d87 feat: switch phase2 to macvlan networking
Replace host port vars with macvlan vars in require_vars. Add Step 2
to create macvlan gitea_net network on Fedora. Update docker-compose
rendering to use GITEA_CONTAINER_IP and DB_CONTAINER_IP. Use
FEDORA_GITEA_IP as domain for backup instance app.ini. Renumber steps.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:24:25 -05:00
S
64e7fd1bff feat: switch phase1 to macvlan networking
Replace host port vars with macvlan vars in require_vars. Add Step 2
to create the macvlan gitea_net network on Unraid. Update
docker-compose rendering to use GITEA_CONTAINER_IP and
DB_CONTAINER_IP instead of port mapping. Renumber steps accordingly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:23:17 -05:00
S
54eab1bf89 feat: switch docker-compose template from port mapping to macvlan
Remove ports: section (no more host port mapping). Add networks:
with static ipv4_address for gitea and db containers. Reference
external gitea_net network (macvlan created by phase scripts).
Add DB_CONTAINER_IP for database service networking.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:22:02 -05:00
S
6ed1cff3f6 feat: update validation arrays for macvlan networking in common.sh
Remove UNRAID_GITEA_PORT, UNRAID_GITEA_SSH_PORT, FEDORA_GITEA_PORT,
FEDORA_GITEA_SSH_PORT from required validation. Add macvlan vars
(parent, subnet, gateway, ip_range, gitea_ip, caddy_ip) for both
hosts. Add UNRAID_DB_IP and FEDORA_DB_IP as optional validated vars.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:21:39 -05:00
S
927ba37661 feat: add macvlan networking vars, remove host port mapping from .env.example
Remove UNRAID_GITEA_PORT, UNRAID_GITEA_SSH_PORT, FEDORA_GITEA_PORT,
FEDORA_GITEA_SSH_PORT — containers now use their own LAN IPs on
standard ports. Add DOCKER NETWORKING section with macvlan config
(parent interface, subnet, gateway, IP range) and per-container
static IPs (gitea, db, caddy) for both hosts. Update internal URL
comments to reference container IPs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:21:06 -05:00
S
2a89c49733 docs: update README database section for multi-DB support
Replace single-DB rationale with description of all four supported
backends (sqlite3, mysql, postgres, mssql) and how the toolkit
handles each.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:20:03 -05:00
S
ba1a373ec9 feat: add conditional DB vars check to preflight.sh
When GITEA_DB_TYPE is not sqlite3, validate that GITEA_DB_HOST,
GITEA_DB_PORT, GITEA_DB_NAME, GITEA_DB_USER, and GITEA_DB_PASSWD
are set in the required vars check.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:19:45 -05:00
S
a44b49283b feat: add external database import to restore_to_primary.sh
After extracting the archive, import gitea-db.sql into the running
DB container for postgres/mysql/mssql. Each DB type uses its native
CLI tool inside the container. SQLite restores remain unchanged.
Add GITEA_DB_TYPE to require_vars.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:19:22 -05:00
S
f098abbe55 feat: add conditional database prompts to configure_env.sh wizard
Add db_type validation case. After GITEA_DB_TYPE prompt, conditionally
show 5 database connection prompts (host, port, name, user, passwd)
when DB type is not sqlite3. Auto-suggest default port per DB type
(mysql=3306, postgres=5432, mssql=1433). Update TOTAL_PROMPTS
dynamically.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:18:52 -05:00
S
b4b0d1b056 feat: add database support to phase2_gitea_fedora.sh
Mirror phase1 DB support: add _set_db_vars() and _strip_block()
helpers, conditional require_vars for DB connection, DB data directory
creation, and conditional template rendering for docker-compose and
app.ini based on GITEA_DB_TYPE.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:18:27 -05:00
S
2c900b7e4f feat: add database support to phase1_gitea_unraid.sh
Add _set_db_vars() helper to configure DB-specific docker-compose
vars (image, env, healthcheck, data dir) for postgres/mysql/mssql.
Add _strip_block() to remove conditional template markers. Update
docker-compose and app.ini rendering to strip/populate DB blocks
based on GITEA_DB_TYPE. Conditionally require DB connection vars.
Create DB data directory for external databases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:17:37 -05:00
S
35aeb504c4 feat: add DB service block to docker-compose-gitea template
Add DB_SERVICE_START/END markers for the database container and
DB_DEPENDS_START/END for the gitea service depends_on. Phase scripts
strip these blocks for sqlite3 and populate DB-specific vars
(image, env, healthcheck, data dir) for mysql/postgres/mssql.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:16:37 -05:00
S
5be95ff98a feat: add conditional SQLITE/EXTDB blocks to app.ini template
Phase scripts strip the irrelevant block after render_template:
sqlite3 removes EXTDB_BLOCK, external DBs remove SQLITE_BLOCK.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:16:05 -05:00
S
02ffddf072 feat: add conditional database connection vars to .env.example
Add GITEA_DB_HOST, GITEA_DB_PORT, GITEA_DB_NAME, GITEA_DB_USER, and
GITEA_DB_PASSWD. These are only required when GITEA_DB_TYPE is not
sqlite3. Update DB_TYPE comment to list all valid options.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:15:53 -05:00
S
5cc8d14a29 feat: add database type validation and conditional DB vars to common.sh
Add validate_db_type() accepting sqlite3/mysql/postgres/mssql. Update
GITEA_DB_TYPE validator from nonempty to db_type. Add conditional DB
validation arrays (host, port, name, user, passwd) required when DB
type is not sqlite3. Rename SSL conditional arrays for clarity.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 10:15:35 -05:00