Repository navigation
69 lines (61 loc) · 2.4 KB
/
Copy pathdeploy-prober.yml
File metadata and controls
69 lines (61 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: deploy-prober
# Deploys the port-drift prober (docs/uptime-monitoring-prd.md §12) to dev2 on
# merges to master. It used to run on its own DigitalOcean droplet
# (scan.crawlproof.com) reaching dev2's Redis through an ssh tunnel; since
# 2026-10-06 it runs on dev2 itself, as the container crawlproof-prober.
#
# CI ships prober/ to /home/anthony/www/crawlproof.com/prober-src and rebuilds
# the container there (prober/deploy/docker-compose.dev2.yml). REDIS_URL lives
# in /home/anthony/www/crawlproof.com/prober.env on the box, never in CI.
#
# Secrets: the same DEV2_* set deploy-dev2.yml uses.
on:
push:
branches: [master]
paths:
- "prober/**"
- ".github/workflows/deploy-prober.yml"
workflow_dispatch:
# Never let two deploys race on the box.
concurrency:
group: deploy-prober
cancel-in-progress: false
env:
DEPLOY_PATH: /home/anthony/www/crawlproof.com/prober-src
jobs:
deploy:
name: build + restart prober on dev2
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Set up ssh
env:
SSH_KEY: ${{ secrets.DEV2_SSH_KEY }}
KNOWN_HOSTS: ${{ secrets.DEV2_KNOWN_HOSTS }}
run: |
install -d -m 700 ~/.ssh
printf '%s\n' "$SSH_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
printf '%s\n' "$KNOWN_HOSTS" > ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
- name: Ship prober/ to dev2
env:
TARGET: ${{ secrets.DEV2_USER }}@${{ secrets.DEV2_HOST }}
run: |
ssh -o BatchMode=yes "$TARGET" mkdir -p "$DEPLOY_PATH"
# node_modules/dist are built inside the image, never shipped.
rsync -az --delete -e "ssh -o BatchMode=yes" \
--exclude node_modules --exclude dist \
prober/ "$TARGET:$DEPLOY_PATH/"
- name: Build + restart, then check it is running
env:
TARGET: ${{ secrets.DEV2_USER }}@${{ secrets.DEV2_HOST }}
run: |
ssh -o BatchMode=yes "$TARGET" \
docker compose -f "$DEPLOY_PATH/deploy/docker-compose.dev2.yml" up -d --build
sleep 10
state=$(ssh -o BatchMode=yes "$TARGET" docker inspect -f '{{.State.Status}}/{{.RestartCount}}' crawlproof-prober)
echo "crawlproof-prober: $state"
ssh -o BatchMode=yes "$TARGET" docker logs --tail 5 crawlproof-prober
[ "$state" = "running/0" ]