tangled
alpha
login
or
join now
dunkirk.sh
/
traverse
1
fork
atom
snatching amp's walkthrough for my own purposes mwhahaha
traverse.dunkirk.sh/diagram/6121f05c-a5ef-4ecf-8ffc-02534c5e767c
1
fork
atom
overview
issues
pulls
pipelines
feat: add deploy workflow
dunkirk.sh
1 month ago
12a46941
31de3417
verified
This commit was signed with the committer's
known signature
.
dunkirk.sh
SSH Key Fingerprint:
SHA256:DqcG0RXYExE26KiWo3VxJnsxswN1QNfTBvB+bdSpk80=
+66
1 changed file
expand all
collapse all
unified
split
.github
workflows
deploy-traverse.yaml
+66
.github/workflows/deploy-traverse.yaml
···
1
1
+
name: Deploy Traverse
2
2
+
3
3
+
on:
4
4
+
push:
5
5
+
branches:
6
6
+
- main
7
7
+
workflow_dispatch:
8
8
+
9
9
+
jobs:
10
10
+
deploy:
11
11
+
runs-on: ubuntu-latest
12
12
+
steps:
13
13
+
- uses: actions/checkout@v3
14
14
+
15
15
+
- name: Setup Tailscale
16
16
+
uses: tailscale/github-action@v3
17
17
+
with:
18
18
+
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
19
19
+
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
20
20
+
tags: tag:ci
21
21
+
use-cache: "true"
22
22
+
23
23
+
- name: Configure SSH
24
24
+
run: |
25
25
+
mkdir -p ~/.ssh
26
26
+
echo "StrictHostKeyChecking no" >> ~/.ssh/config
27
27
+
28
28
+
- name: Deploy to server
29
29
+
run: |
30
30
+
ssh traverse@terebithia << 'EOF'
31
31
+
cd /var/lib/traverse/app
32
32
+
git fetch --all
33
33
+
git reset --hard origin/main
34
34
+
bun install
35
35
+
sudo /run/current-system/sw/bin/systemctl restart traverse.service
36
36
+
EOF
37
37
+
38
38
+
- name: Wait for service to start
39
39
+
run: sleep 10
40
40
+
41
41
+
- name: Health check
42
42
+
run: |
43
43
+
HEALTH_URL="https://traverse.dunkirk.sh"
44
44
+
MAX_RETRIES=6
45
45
+
RETRY_DELAY=5
46
46
+
47
47
+
for i in $(seq 1 $MAX_RETRIES); do
48
48
+
echo "Health check attempt $i/$MAX_RETRIES..."
49
49
+
50
50
+
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" "$HEALTH_URL" || echo "000")
51
51
+
52
52
+
if [ "$HTTP_CODE" = "200" ]; then
53
53
+
echo "✅ Service is healthy"
54
54
+
exit 0
55
55
+
fi
56
56
+
57
57
+
echo "❌ Health check failed with HTTP $HTTP_CODE"
58
58
+
59
59
+
if [ $i -lt $MAX_RETRIES ]; then
60
60
+
echo "Retrying in ${RETRY_DELAY}s..."
61
61
+
sleep $RETRY_DELAY
62
62
+
fi
63
63
+
done
64
64
+
65
65
+
echo "❌ Health check failed after $MAX_RETRIES attempts"
66
66
+
exit 1