games_app/deploy/gitea-stack/finalize2.sh
Your Name e802ee23d5
Some checks failed
CI / test-and-build (push) Failing after 33s
Harden tloto-deploy and document Gitea CI/CD runbook
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-17 20:07:47 +02:00

31 lines
1.2 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
cp ~/games_app/deploy/release/tloto-deploy.sh /tmp/tloto-deploy.sh 2>/dev/null || true
# expect scripts already uploaded beside this file in ~/gitea
if [[ -f ~/gitea/tloto-deploy.sh ]]; then
cp ~/gitea/tloto-deploy.sh ~/games_app/deploy/release/tloto-deploy.sh
fi
sudo cp ~/games_app/deploy/release/tloto-deploy.sh /opt/tloto/bin/tloto-deploy
sudo chmod 755 /opt/tloto/bin/tloto-deploy
bash ~/gitea/write-fetch-url.sh
SHA="$(cd ~/games_app && git rev-parse HEAD)"
/opt/tloto/bin/tloto-deploy --ref "$SHA" --mode http --skip-migrate
echo "--- current.json ---"
cat /var/lib/tloto/current.json
echo
bash ~/gitea/cleanup-oneshots.sh
curl -fsS http://127.0.0.1:9080/health | head -c 100; echo
cd ~/games_app
sudo npm run db:migrate
echo MIGRATE_CMD_OK
sudo -u postgres psql -d gitea -c "SELECT id, left(title,40) AS title, status FROM action_run ORDER BY id DESC LIMIT 5;"
sudo docker logs tloto_act_runner --tail 40
# edge
mkdir -p ~/edge/certs
cp -a ~/games_app/deploy/edge/docker-compose.yml ~/edge/ 2>/dev/null || true
cp -a ~/games_app/deploy/edge/nginx.conf ~/edge/ 2>/dev/null || true
cd ~/edge && sudo docker compose --profile edge up -d || true
curl -fsS http://127.0.0.1:3000/api/v1/version; echo
echo FINALIZE2_OK