-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (42 loc) · 1.59 KB
/
Copy pathdeploy.yml
File metadata and controls
50 lines (42 loc) · 1.59 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
name: Deploy
on:
push:
branches: [main]
workflow_dispatch:
inputs:
health_timeout:
description: "Seconds to wait for the container to report healthy. Raise it for a deploy that has to replay a large WAL (i.e. one following a hard kill)."
required: false
default: "120"
concurrency:
group: deploy-main
cancel-in-progress: false
jobs:
deploy:
name: Deploy to self-hosted runner
runs-on: [self-hosted, flopsstuff, docker]
env:
COMPOSE_PROJECT_NAME: cotel
CLOUDFLARE_TUNNEL_TOKEN: ${{ secrets.CLOUDFLARE_TUNNEL_TOKEN }}
COTEL_PUBLIC_INGEST_URL: ${{ secrets.COTEL_PUBLIC_INGEST_URL }}
steps:
- uses: actions/checkout@v5
- name: Build image
run: docker compose build --pull
- name: Recreate container
run: docker compose up -d --remove-orphans
# `up -d` returns once the container has started, not once it works, so
# without this the job reports success on a container that is still — or
# forever — `health: starting`. The script dumps container logs on failure.
- name: Wait for healthy
env:
# Via env, not inline `${{ }}`: a dispatch input expanded straight into
# the run script is a shell-injection sink, and this runner is the
# production host.
HEALTH_TIMEOUT: ${{ github.event.inputs.health_timeout || '120' }}
run: scripts/wait-for-healthy.sh cotel "$HEALTH_TIMEOUT"
- name: Show status
run: docker compose ps
- name: Prune dangling images
if: always()
run: docker image prune -f