Commit Graph

22 Commits

Author SHA1 Message Date
root f716b394c2 fix(ci): add full docker PATH in SSH pre-flight and deploy commands
The NAS 'admin' user has docker at
/share/CACHEDEV1_DATA/.qpkg/container-station/usr/bin/docker which
isn't in the default PATH for non-interactive SSH. Set the PATH
explicitly in both the pre-flight check and the actual deploy.
2026-07-10 12:40:53 +00:00
root 94477d46ef fix(ci): extract host and port from NAS_HOST secret
NAS_HOST can be either 'host' or 'host:port'. The previous workflow
passed the whole value as the SSH target, which fails with
'Could not resolve hostname 192.168.1.21:222' when the port is included.

Parse the secret into NAS_SSH_HOST and NAS_SSH_PORT and pass them
explicitly to ssh.
2026-07-10 12:39:52 +00:00
root 6ff7bc5fda fix(ci): deploy via SSH to NAS instead of Portainer API
act_runner v0.6.1 does not propagate the runner's network namespace
to job containers, so the job can never resolve 'portainer' or reach
'192.168.1.30:9000'. After trying every combination of
container.network_mode / container.network / options in the runner
config, the only reliable solution is to skip the in-cluster Portainer
API call and do the deploy via SSH directly on the NAS.

- New secrets: NAS_SSH_KEY, NAS_HOST, NAS_USER.
- The new 'Redeploy stack on Portainer via SSH' step writes the SSH key
  to ~/.ssh, then pipes docker-compose.prod.yml to
  'docker compose -p davidaragon-portfolio -f - up -d' over SSH.
- The old Portainer-API step is removed.

Smoke-test at the end hits the public port on the host (3001) and
logs the HTTP code; we don't fail the job if the public proxy
upstream isn't reachable from the runner's network.
2026-07-10 12:37:16 +00:00
root 89150ed41f fix(ci): hardcode PORTAINER_URL to http://portainer:9000
Drop the secret indirection and just use the service name directly.
All services share the portainer_default Docker network so 'portainer'
resolves to Portainer from any container in that network.
2026-07-10 12:19:38 +00:00
root 687e4d9f2d fix(ci): use container name 'portainer' instead of IP
All services (Gitea, the 3 runners and Portainer itself) are in the
same Docker network 'portainer_default', so the service name 'portainer'
resolves directly from inside any container in that network. The previous
auto-discovery dance with IPs and routes is no longer needed.

- Set the PORTAINER_URL secret to 'http://portainer:9000'.
- Replace the entire 'Step 0' auto-discovery with a simple check that
  the configured URL is reachable.
- Drop the debug Step 0a that was added during troubleshooting.

The runner's job container can now reach Portainer the same way the
runner itself does — by name.
2026-07-10 12:17:40 +00:00
root d14b719bd2 debug(ci): print hostname/route on auto-discover failure
- Drop 'set -euo pipefail' from the redeploy step so the auto-discovery
  loop and the diagnostic echos can run to completion even if a probe
  fails or a command returns empty output.
- On failure to find Portainer, also print the container's hostname,
  hostname -I, and ip route to stderr. This is what we'll need if the
  host-net job container approach doesn't work and we need to debug
  further.
2026-07-10 11:41:54 +00:00
root dcfb7805cd debug(ci): print job container network info before auto-discovery
Adds Step 0a that prints hostname -I, ip route, and a direct curl to
192.168.1.30:9000. This is to verify whether the runner external (in
network_mode: host) is actually propagating host networking to the job
containers it spawns. Symptom: deploy step fails with 'Failed to
connect to 192.168.1.30 port 9000' even from the external runner.
To be removed once we know.
2026-07-10 11:36:59 +00:00
root 06ad8edf18 fix(ci): auto-discover reachable Portainer URL from job container
CI/CD Pipeline / Build & Deploy (pull_request) Successful in 21s
The act_runner on the QNAP creates an ephemeral docker bridge per job.
That network can't always reach the canonical PORTAINER_URL
(http://192.168.1.30:9000) — first deploy run failed with
'Failed to connect to 192.168.1.30 port 9000 after 130317 ms'.

New step 0 probes several candidate URLs (container's own IPs, default
gateways, then the secret value as fallback) against /api/status and
uses the first one that returns 200. The reachable host is then reused
for the DELETE+CREATE calls and the smoke-test on :3001.
2026-07-10 11:21:52 +00:00
root ab6b4677b4 ci: gate redeploy step on workflow_dispatch.deploy=true
- Build pushes both :latest and :0.0.1 tags so the redeploy step uses the
  pinned version regardless of how the runner happened to be tagged before.
- Add a 4th step 'Redeploy stack on Portainer' that runs ONLY when the
  workflow is manually dispatched with deploy=true.
- Step does idempotent DELETE+CREATE on the existing stack via Portainer REST
  (PUT-edit would require more plumbing for a single-service stack).
- Smoke-tests http://<host>:3001/ after the stack recreates; logs the code
  but does not hard-fail the job (network-proxy reachable via NPM upstream).

Required new secrets (in addition to existing DOCKER_USERNAME/DOCKER_PASSWORD):
- PORTAINER_URL         e.g. http://192.168.1.30:9000
- PORTAINER_TOKEN       API access token from a Portainer user
- PORTAINER_ENDPOINT_ID numeric endpoint ID (usually 1)
- PORTAINER_STACK_ID    numeric stack ID to delete before recreating
2026-07-10 10:54:17 +00:00
root f152379882 fix(ci): add concurrency guard + PR trigger + workflow_dispatch
CI/CD Pipeline / Build & Deploy (pull_request) Successful in 22s
Apply the same concurrency pattern used in the python-project-template:
- cancel-in-progress: false prevents the shared act_runner from
  cancelling in-progress steps when a new push lands
- pull_request trigger ensures PRs are validated before merge
- workflow_dispatch allows manual re-runs
2026-07-09 15:23:40 +00:00
wh-leader 21a63b6947 fix(ci): remove Portainer deployment step (runner network isolated)
CI/CD Pipeline / Build & Deploy (push) Successful in 23s
2026-05-11 13:49:10 +02:00
wh-leader 58f0a00d4c fix(ci): use plain docker build instead of buildx (runner /dev/null issue)
CI/CD Pipeline / Build & Deploy (push) Failing after 17s
2026-05-11 13:33:30 +02:00
wh-leader 83845f4894 fix(ci): use exact WarrantyHub working pattern with Docker actions
CI/CD Pipeline / Build & Deploy (push) Failing after 36s
2026-05-11 13:14:46 +02:00
wh-leader 7e90812373 fix(ci): use GITEATOKEN secret name
CI/CD Pipeline / Build & Deploy (push) Failing after 15s
2026-05-11 13:13:41 +02:00
wh-leader 1037f6a4ed fix(ci): add auth token to git clone + consolidate steps
CI/CD Pipeline / Build & Deploy (push) Failing after 16s
2026-05-11 13:13:12 +02:00
wh-leader 8176b0b09b fix(ci): use plain docker + git instead of GitHub actions
CI/CD Pipeline / Build & Deploy (push) Failing after 28s
2026-05-11 13:09:48 +02:00
wh-leader 42873ad9cc fix(ci): force image pull via Portainer API (stop + pull + start)
CI/CD Pipeline / Build & Deploy (push) Failing after 41s
2026-05-11 13:06:15 +02:00
wh-leader 35f3ba8767 fix: use exact working CI pattern from WarrantyHub
CI/CD Pipeline / Build & Deploy (push) Failing after 42s
2026-05-11 13:03:04 +02:00
wh-leader 47bf985a79 fix: use official Docker actions like WarrantyHub workflow
CI/CD Pipeline / Build & Deploy (push) Failing after 41s
2026-05-11 11:25:29 +02:00
wh-leader 8d85589f0c fix: use direct Docker build to avoid runner filesystem issues
CI/CD Pipeline / Build & Deploy (push) Failing after 24s
Gitea Actions runner has filesystem mount issue preventing Node.js extraction.
Solution: Build entire image with Docker (includes Node) instead of setup-node action.
Simpler and more reliable - build happens inside container.
2026-05-11 09:32:53 +02:00
wh-leader c31692bae0 fix: remove npm cache from Gitea Actions
CI/CD Pipeline / Build Astro Site (push) Failing after 22s
CI/CD Pipeline / Deploy to Portainer (push) Has been skipped
Gitea Actions may not support npm cache like GitHub Actions does.
Simplify to just node version.
2026-05-11 09:29:28 +02:00
wh-leader cc7043148a ci: add Gitea Actions CI/CD with Portainer deployment
CI/CD Pipeline / Build Astro Site (push) Failing after 1m8s
CI/CD Pipeline / Deploy to Portainer (push) Has been skipped
Add complete CI/CD pipeline:
- Gitea Actions workflow (build + deploy)
- Multi-stage Dockerfile (Node build + nginx serve)
- nginx config with SPA routing and cache headers
- docker-compose.yml for local testing
- .dockerignore to optimize build

Pipeline flow:
1. Build job: npm ci + npm build + upload artifact
2. Deploy job (main only): Docker build + push to registry + Portainer webhook

Requires Gitea secrets:
- DOCKER_USERNAME
- DOCKER_PASSWORD
- PORTAINER_WEBHOOK_URL
2026-05-11 09:23:29 +02:00