Move CI runners to Droplet and enable application HTTPS
vpn-dns-gateway/pipeline/pr-main This commit looks good
vpn-dns-gateway/pipeline/pr-main This commit looks good
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
# Manual runner migration evidence
|
||||
|
||||
Requested by Vincent on 14 November 2026, Eastern time. Server timestamps below
|
||||
are UTC on 15 November. No commit, push, new registration or scope change occurred.
|
||||
|
||||
- Baseline 04:24 UTC: 1,967 MiB RAM, 860 MiB available, 338 MiB swap used;
|
||||
root disk 55% used, 11 GiB available (rounded by df).
|
||||
- Exported the existing compiler image, verified the transfer archive SHA-256
|
||||
`faf56b61af1187b6dad0f1e27b1ec47bed282ffe52aee9c458c13a88ee02849a`,
|
||||
then loaded it on The-Ocean. Image ID matches the original tested image:
|
||||
`sha256:5d24657a4578977fc7709165b82fc869f09a654a58ab4a0c8defd9d2cd662d5d`.
|
||||
- Stopped the idle laptop runner before copying its existing registration
|
||||
directly over pinned SSH into the remote Docker volume. Identity was
|
||||
validated quietly, mode 0600; no value was output or written into the repo.
|
||||
Name `ssw590-vince-local`, label `latex-local`, capacity one and repository
|
||||
scope remain unchanged. The laptop volume/image are retained as fallback.
|
||||
- At 04:31 UTC the remote daemon declared successfully. The initial 96 MiB
|
||||
daemon cap was insufficient during action setup: Docker recorded an OOM
|
||||
event at 04:32:18 and restart count 1. Run 12 attempt 2 / job 13 was canceled.
|
||||
Its failure log is retained; its orphan container, network and two task-only
|
||||
volumes were removed after validation, preserving shared volumes.
|
||||
- Raised only the daemon to 192 MiB RAM / 256 MiB RAM+swap, with GOMEMLIMIT
|
||||
128 MiB and 0.25 CPU. Compiler job caps remain 512 MiB / 768 MiB, 0.5 CPU,
|
||||
256 PIDs, no published ports and no automatic job Docker socket mount.
|
||||
- [Run 12, attempt 3, job 14](https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/actions/runs/12/jobs/14)
|
||||
succeeded on the remote runner. Source is reviewed main commit
|
||||
`8beefde2a4983888effb79526e527303e60a1a82`; this reruns Assignment 7 source,
|
||||
not the uncommitted Assignment 8 preparation. Setup 2m33s, checkout 9s,
|
||||
compile 1m42s, PDF upload 5s, diagnostics upload 2s, completion 1s; total 4m32s.
|
||||
- Diagnostics supplied by Vincent in `build/evidence/run-12/` confirm source
|
||||
SHA, run 12, suffix `+build.12.8beefde`, TeX Live 2022, latexmk 4.79,
|
||||
Git 2.39.5 and Node 22.23.3. The PDF is 9,059,039 bytes and its SHA-256
|
||||
matches diagnostics:
|
||||
`f81fd73d8fd975d8d61164948a977c4048ee93e38b656904334835f6b5c29c8b`.
|
||||
Its title was visually verified as `5.1+build.12.8beefde`.
|
||||
- Browser download waiting timed out and the debugger then detached. Vincent
|
||||
supplied diagnostics; the exact attempt-3 PDF was retrieved using read-only
|
||||
artifact metadata and gzip payload over pinned administrator SSH, without
|
||||
changing server data. Original expired attempt-1 metadata was preserved.
|
||||
- At 04:41 UTC during compilation: 738 MiB host RAM available, 354 MiB swap
|
||||
used; sampled compiler working set 142.4 MiB, daemon 20.43 MiB. A later
|
||||
idle check found no active jobs, daemon restarts 0 and no current OOM flag.
|
||||
These samples do not prove concurrency capacity or uninterrupted service.
|
||||
- The idle daemon restarted and declared successfully again at 04:55:52 UTC.
|
||||
`unless-stopped` is configured; a complete Droplet reboot was not performed.
|
||||
- Final post-migration check: all ten service/agent/builder containers running;
|
||||
Gitea, Jenkins login and Grafana login returned private HTTP 200. Host RAM
|
||||
available 840 MiB, swap used 358 MiB, root disk 61% used with 9.2 GiB
|
||||
available after removing the verified compiler transfer archive. Both laptop
|
||||
daemons were confirmed exited. Protected identities and prior evidence remain.
|
||||
|
||||
Raw logs, runtime checks and artifact verification are under ignored
|
||||
`build/evidence/assignment8-manual-runner/`; the user-provided diagnostics and
|
||||
verified CI PDF remain in `build/evidence/run-12/`. Existing service checks and
|
||||
the final local manual build are recorded separately. Both active runners
|
||||
now run on The-Ocean; keep manual compilation and delivery releases sequential.
|
||||
The assignment's actual app releases and recovery evidence remain pending.
|
||||
@@ -0,0 +1,78 @@
|
||||
# Manual Actions runner on The-Ocean
|
||||
|
||||
Vincent requested this migration on 14 November 2026 after moving the Jenkins
|
||||
delivery agent. This replaces the active laptop runner; it does not create
|
||||
another registration or expand its repository scope. The historical runner
|
||||
name `ssw590-vince-local` and label `latex-local` remain for workflow compatibility.
|
||||
The container is `ssw590-manual-runner`, under `/opt/ssw590-manual-runner`.
|
||||
|
||||
## Configuration and ownership
|
||||
|
||||
- Gitea runner 2.3.0, pinned to the same official image digest as the laptop.
|
||||
- Same tested compiler image `ssw590-manual-ci:20261007`, ID
|
||||
`sha256:5d24657a4578977fc7709165b82fc869f09a654a58ab4a0c8defd9d2cd662d5d`.
|
||||
- Runner: 192 MiB RAM / 256 MiB RAM+swap, 0.25 CPU, one job at a time.
|
||||
The first 96 MiB trial was killed during action setup; that attempt is retained
|
||||
in migration evidence. Compiler jobs have a separate 512 MiB / 768 MiB cap,
|
||||
0.5 CPU and 256 PID cap. Resource limits are ceilings, not reserved memory.
|
||||
- Runner and job containers publish no ports. Existing Gitea HTTPS and TLS
|
||||
verification remain enabled. Cache server stays disabled.
|
||||
- Registration lives in the host's `ssw590-local-runner-data` Docker volume,
|
||||
`/data/.runner`, mode 0600 in a 0700 directory. Never print it, place it in
|
||||
Git or share it as evidence. The stopped laptop copy is an intentional fallback.
|
||||
- `unless-stopped` reconnects the daemon after Docker/host restarts. No server
|
||||
reboot is needed for installation. Only restart an idle runner.
|
||||
- Admission checks pause new jobs below 3 GiB free disk or 600 MiB available
|
||||
host RAM. This does not reserve resources or lock Jenkins out. Run manual
|
||||
builds and Jenkins delivery releases sequentially on this single-CPU host.
|
||||
- VS maintains the runner; BY retains Droplet administration. Existing Droplet
|
||||
billing applies; no new instance or plan change was made.
|
||||
|
||||
The runner can administer host Docker. Automatic socket mounting into jobs is
|
||||
disabled, jobs are not privileged, capabilities are dropped, and arbitrary
|
||||
workflow bind mounts remain disallowed. Runner 2.x does not comprehensively
|
||||
filter workflow container options, so only the trusted team may edit these
|
||||
workflows. Co-location gives a compromised Docker-authorized workflow a path
|
||||
to the shared host; these settings are not strong isolation from untrusted code.
|
||||
See [official runner configuration](https://docs.gitea.com/runner/2/configuration/).
|
||||
|
||||
## Reconnect and stop
|
||||
|
||||
From an authorized administrator SSH session:
|
||||
|
||||
```sh
|
||||
sh /opt/ssw590-manual-runner/start.sh
|
||||
cd /opt/ssw590-manual-runner
|
||||
docker compose ps
|
||||
docker compose logs --tail 30
|
||||
python3 verify.py
|
||||
# Only when idle:
|
||||
docker compose stop
|
||||
```
|
||||
|
||||
The start helper requires existing identity and compiler image; it never
|
||||
registers a new runner. `verify.py` validates identity quietly and prints only
|
||||
non-secret runtime settings. It can capture compiler-job limits while a job runs.
|
||||
No account token is required in shell arguments, environment or repository.
|
||||
|
||||
## Migration and fallback
|
||||
|
||||
The migration exported the existing compiler image, verified the transfer
|
||||
archive SHA-256 and loaded image ID, stopped the laptop daemon, then streamed
|
||||
its existing registration directly from Docker Desktop through pinned SSH into
|
||||
the remote Docker volume using `import-identity.sh`. The import refuses to
|
||||
overwrite an identity. It is a one-time operation; do not rerun it here.
|
||||
Original laptop volumes and images remain intact.
|
||||
|
||||
To return temporarily to the laptop, first stop the remote runner while idle,
|
||||
then use `gitea/local-runner/runner.ps1 -Action Start -AllowLaptopFallback`.
|
||||
Stop the laptop copy before restarting the remote one. Never connect both
|
||||
copies of the registration. The label intentionally remains `latex-local`.
|
||||
|
||||
After grading, only when instructed, retain needed evidence, stop this runner
|
||||
and remove only its explicitly identified container, network and state volume.
|
||||
Retire the Gitea registration only when no fallback is needed. Never prune the
|
||||
host or remove shared Gitea/Jenkins/proxy/monitoring state.
|
||||
|
||||
Source for image/state handling:
|
||||
[Gitea Docker installation](https://docs.gitea.com/runner/2/installation/docker/).
|
||||
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
# Pause fetching new jobs when the shared host has less than 600 MiB available.
|
||||
# This is admission control, not a reservation or cross-engine execution lock.
|
||||
set -eu
|
||||
awk '/^MemAvailable:/ { found=1; if ($2 < 614400) exit 1 } END { if (!found) exit 1 }' /proc/meminfo
|
||||
@@ -0,0 +1,32 @@
|
||||
name: ssw590-manual-runner
|
||||
services:
|
||||
runner:
|
||||
image: docker.io/gitea/runner@sha256:66d80966792e621c9761c47919644198d35fd1c297e9a01e69ed3c1ae37db0c7
|
||||
container_name: ssw590-manual-runner
|
||||
working_dir: /data
|
||||
entrypoint: ["gitea-runner"]
|
||||
command: ["--config", "/config.yaml", "daemon"]
|
||||
restart: unless-stopped
|
||||
stop_grace_period: 70s
|
||||
environment:
|
||||
GOMEMLIMIT: 128MiB
|
||||
volumes:
|
||||
- runner-data:/data
|
||||
- ./config.yaml:/config.yaml:ro
|
||||
- ./admission-check.sh:/admission-check.sh:ro
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
mem_limit: 192m
|
||||
memswap_limit: 256m
|
||||
cpus: 0.25
|
||||
pids_limit: 128
|
||||
security_opt: ["no-new-privileges:true"]
|
||||
cap_drop: ["ALL"]
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
volumes:
|
||||
runner-data:
|
||||
external: true
|
||||
name: ssw590-local-runner-data
|
||||
@@ -0,0 +1,24 @@
|
||||
log:
|
||||
level: info
|
||||
runner:
|
||||
file: /data/.runner
|
||||
capacity: 1
|
||||
timeout: 30m
|
||||
shutdown_timeout: 60s
|
||||
insecure: false
|
||||
labels:
|
||||
- "latex-local:docker://ssw590-manual-ci:20261007"
|
||||
cache:
|
||||
enabled: false
|
||||
container:
|
||||
privileged: false
|
||||
valid_volumes: []
|
||||
docker_host: "-"
|
||||
force_pull: false
|
||||
options: "--memory=512m --memory-swap=768m --cpus=0.5 --pids-limit=256 --cap-drop=ALL --security-opt=no-new-privileges"
|
||||
health_check:
|
||||
enabled: true
|
||||
min_free_disk_space_mb: 3072
|
||||
script: /admission-check.sh
|
||||
interval: 15s
|
||||
timeout: 5s
|
||||
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# Root-operated, one-time stdin import. Never print or stage registration in Git.
|
||||
set -eu
|
||||
test "$(id -u)" = 0
|
||||
docker volume create ssw590-local-runner-data >/dev/null
|
||||
docker run --rm -i --network none --user 0:0 --entrypoint sh \
|
||||
--mount type=volume,source=ssw590-local-runner-data,target=/data \
|
||||
docker.io/gitea/runner@sha256:66d80966792e621c9761c47919644198d35fd1c297e9a01e69ed3c1ae37db0c7 \
|
||||
-c 'set -eu; test ! -e /data/.runner; umask 077; cat > /data/.runner; test -s /data/.runner; chmod 700 /data; chmod 600 /data/.runner'
|
||||
echo 'Registration imported into protected Docker volume; values not printed.'
|
||||
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# Root-operated reconnect only; an existing protected registration is required.
|
||||
set -eu
|
||||
cd /opt/ssw590-manual-runner
|
||||
docker image inspect ssw590-manual-ci:20261007 >/dev/null
|
||||
docker volume inspect ssw590-local-runner-data >/dev/null
|
||||
docker compose config --quiet
|
||||
docker compose run --rm -T --no-deps --entrypoint sh runner -c 'test -s /data/.runner'
|
||||
docker compose up -d
|
||||
docker compose ps
|
||||
@@ -0,0 +1,59 @@
|
||||
"""Read-only, non-secret runner/runtime checks. Run as root on The-Ocean."""
|
||||
import json
|
||||
import stat
|
||||
import subprocess
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def run(*args):
|
||||
return subprocess.check_output(args, text=True).strip()
|
||||
|
||||
|
||||
template = ('{"state":{{json .State}},"host":{{json .HostConfig}},'
|
||||
'"mounts":{{json .Mounts}},"image":{{json .Config.Image}},'
|
||||
'"restart_count":{{.RestartCount}}}')
|
||||
|
||||
|
||||
def inspect(name):
|
||||
# Fetch selected fields, never container environment variables.
|
||||
info = json.loads(run('docker', 'inspect', '--format', template, name))
|
||||
state, host = info['state'], info['host']
|
||||
return {
|
||||
'name': name, 'image': info['image'], 'running': state['Running'],
|
||||
'oom_killed': state['OOMKilled'], 'memory_bytes': host['Memory'],
|
||||
'restart_count': info['restart_count'],
|
||||
'memory_swap_bytes': host['MemorySwap'], 'nano_cpus': host['NanoCpus'],
|
||||
'restart_policy': host['RestartPolicy']['Name'],
|
||||
'port_bindings': host['PortBindings'],
|
||||
'mount_destinations': [mount['Destination'] for mount in info['mounts']],
|
||||
}
|
||||
|
||||
|
||||
root = Path(run('docker', 'volume', 'inspect', '--format', '{{.Mountpoint}}', 'ssw590-local-runner-data'))
|
||||
identity = root / '.runner'
|
||||
registration = json.loads(identity.read_text())
|
||||
assert registration.get('name') == 'ssw590-vince-local'
|
||||
assert registration.get('address', '').rstrip('/') == 'https://git.yebilly.me'
|
||||
assert isinstance(registration.get('token'), str) and registration['token']
|
||||
assert stat.S_IMODE(identity.stat().st_mode) == 0o600
|
||||
# Registration is checked in memory only. Do not serialize any of its values.
|
||||
report = {'observed_at': datetime.now(timezone.utc).isoformat(),
|
||||
'registration_validated_without_output': True, 'identity_mode': '0600',
|
||||
'runner': inspect('ssw590-manual-runner'), 'active_jobs': []}
|
||||
assert report['runner']['running'] and not report['runner']['oom_killed']
|
||||
for name in run('docker', 'ps', '--format', '{{.Names}}').splitlines():
|
||||
if name.startswith('GITEA-ACTIONS-TASK-'):
|
||||
job = inspect(name)
|
||||
assert job['memory_bytes'] == 512 * 1024 * 1024
|
||||
assert job['memory_swap_bytes'] == 768 * 1024 * 1024
|
||||
assert job['nano_cpus'] == 500000000
|
||||
assert '/var/run/docker.sock' not in job['mount_destinations']
|
||||
report['active_jobs'].append(job)
|
||||
report['admission_check'] = run('docker', 'exec', 'ssw590-manual-runner', 'sh', '-c', '/admission-check.sh && echo passed')
|
||||
report['compiler_image_id'] = run('docker', 'image', 'inspect', '--format', '{{.Id}}', 'ssw590-manual-ci:20261007')
|
||||
assert report['compiler_image_id'] == 'sha256:5d24657a4578977fc7709165b82fc869f09a654a58ab4a0c8defd9d2cd662d5d'
|
||||
report['memory'] = run('free', '-m')
|
||||
report['disk'] = run('df', '-h', '/')
|
||||
report['result'] = 'passed'
|
||||
print(json.dumps(report, indent=2))
|
||||
Reference in New Issue
Block a user