Makefile: make check runs the backend, Python, Vue and compose checks that previously lived only in local notes. deploy.yaml: a test job runs the backend and Python suites in containers on every push, and deploy needs it. Deploy also refuses to run if main has moved past the tested commit. maintenance.yaml takes the env-apply lock around its compose steps, as deploy already did. nginx: the 24 proxied locations that production and dev both carried now live once in nginx_routes.conf.template, rendered by the entrypoint on every boot path. The effective config is unchanged for both. Remove the root package.json and lockfile, which nothing referenced. Co-Authored-By: Claude Opus 5.5 <[email protected]>
68 lines
2.6 KiB
YAML
68 lines
2.6 KiB
YAML
name: Weekly Maintenance
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "0 1 * * 0"
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
maintenance:
|
|
runs-on: self-hosted
|
|
steps:
|
|
- name: Show disk usage before
|
|
run: df -h /
|
|
|
|
- name: Update apt package index
|
|
run: sudo apt-get update
|
|
|
|
- name: Upgrade system packages
|
|
run: sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
|
|
|
|
- name: Autoremove obsolete packages
|
|
run: sudo apt-get -y autoremove --purge
|
|
|
|
# Both compose steps below take env-apply/run/lock, the same flock
|
|
# deploy.yaml and env-apply/apply.py hold while they run compose.
|
|
# Without it this weekly job could recreate containers at the same
|
|
# moment a .env edit from the admin panel is being applied (or a
|
|
# deploy is mid-build), and two `compose up`s racing over the same
|
|
# project can each recreate a container the other just started,
|
|
# ending with services built against a half-written .env. flock
|
|
# blocks until the other holder finishes, so the job waits rather
|
|
# than fails. The lock is taken per step, not across both: nothing
|
|
# needs pull and up to be atomic, and holding it for less time
|
|
# keeps an admin-panel change from waiting behind a long pull.
|
|
- name: Pull latest base images
|
|
working-directory: /home/adamf/deploy/web_server
|
|
env:
|
|
DOCKER_API_VERSION: "1.41"
|
|
run: flock env-apply/run/lock docker compose pull
|
|
|
|
- name: Rebuild and restart containers
|
|
working-directory: /home/adamf/deploy/web_server
|
|
env:
|
|
DOCKER_API_VERSION: "1.41"
|
|
run: flock env-apply/run/lock docker compose up -d --build --remove-orphans
|
|
|
|
- name: Prune unused Docker images
|
|
run: docker image prune -af
|
|
|
|
- name: Prune old Docker build cache
|
|
run: docker builder prune -f --filter until=336h
|
|
|
|
- name: Show running containers
|
|
run: docker compose ps
|
|
working-directory: /home/adamf/deploy/web_server
|
|
|
|
- name: Show disk usage after
|
|
run: df -h /
|
|
|
|
- name: Reboot if required
|
|
run: |
|
|
if [ -f /var/run/reboot-required ]; then
|
|
echo "Reboot required — scheduling in 1 minute"
|
|
sudo shutdown -r +1
|
|
else
|
|
echo "No reboot needed"
|
|
fi
|