Skip to content

Commit 166fbf1

Browse files
committed
Clarify GitHub repository secrets for CI/CD deployment
Both TAILSCALE_AUTHKEY and FLY_API_TOKEN are GitHub repository secrets, not Fly.io secrets. The GitHub Actions workflow handles setting these as Fly.io secrets during deployment. ## Changes Made - **GitHub Actions workflow**: Add TAILSCALE_AUTHKEY environment variable - **Deployment step**: Automatically set Tailscale auth key in Fly.io secrets - **Documentation**: Clarify both secrets are GitHub repository secrets - **Admin procedures**: Update key rotation to use GitHub secrets first - **Deployment prerequisites**: Document both required GitHub secrets ## Required GitHub Repository Secrets 1. **FLY_API_TOKEN**: Fly.io deploy token for automated deployment 2. **TAILSCALE_AUTHKEY**: Ephemeral auth key for Tailscale mesh access ## GitHub Actions Workflow The workflow now: - Uses both secrets from GitHub repository settings - Automatically sets TAILSCALE_AUTHKEY as Fly.io secret for each app - Maintains existing FLY_API_TOKEN usage for deployment authentication This provides proper separation between GitHub CI/CD secrets and runtime Fly.io application secrets.
1 parent 7dc0243 commit 166fbf1

File tree

3 files changed

+34
-11
lines changed

3 files changed

+34
-11
lines changed

.github/workflows/fly.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99

1010
env:
1111
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
12+
TAILSCALE_AUTHKEY: ${{ secrets.TAILSCALE_AUTHKEY }}
1213

1314
jobs:
1415
test:
@@ -89,5 +90,10 @@ jobs:
8990
echo "PostgreSQL already attached to magnet-atheme"
9091
fi
9192
93+
- name: Set Tailscale Auth Key Secret
94+
run: |
95+
# Set Tailscale auth key as Fly.io secret
96+
flyctl secrets set TAILSCALE_AUTHKEY="${TAILSCALE_AUTHKEY}" --app ${{ matrix.app }}
97+
9298
- name: Deploy ${{ matrix.app }}
9399
run: flyctl deploy --config ${{ matrix.config }} --app ${{ matrix.app }} --remote-only

docs/admin-access-procedures.md

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,29 @@ The Magnet IRC Network uses Tailscale for secure administrative access to IRC se
2929
-**Pre-approved**: Skip manual device approval (optional)
3030
- ⏱️ **90-day expiration**: Set reasonable expiration time
3131

32-
### Fly.io Secrets Configuration
33-
Set the Tailscale auth key as a secret for each application:
32+
### GitHub Repository Secrets Configuration
33+
Set both Fly.io API token and Tailscale auth key as GitHub repository secrets for CI/CD deployment:
3434

3535
```bash
36-
# Generate ephemeral auth key (reuse for all services)
36+
# Generate ephemeral Tailscale auth key
3737
EPHEMERAL_KEY="tskey-auth-xxxxxx-xxxx"
3838

39-
# Set secrets for all apps
40-
fly secrets set TAILSCALE_AUTHKEY=$EPHEMERAL_KEY --app magnet-9rl
41-
fly secrets set TAILSCALE_AUTHKEY=$EPHEMERAL_KEY --app magnet-1eu
42-
fly secrets set TAILSCALE_AUTHKEY=$EPHEMERAL_KEY --app magnet-atheme
39+
# Generate Fly.io deploy token
40+
FLY_TOKEN="fo1_xxxxxxxxxxxxxxxxxxxxxx"
41+
42+
# Add to GitHub repository secrets at:
43+
# https://github.com/your-org/your-repo/settings/secrets/actions
44+
#
45+
# Required secrets:
46+
# Name: FLY_API_TOKEN
47+
# Value: fo1_xxxxxxxxxxxxxxxxxxxxxx
48+
#
49+
# Name: TAILSCALE_AUTHKEY
50+
# Value: tskey-auth-xxxxxx-xxxx
4351
```
4452

53+
**Note**: The GitHub Actions workflow will automatically set these as Fly.io secrets during deployment.
54+
4555
## Administrative Access Methods
4656

4757
### Method 1: Direct SSH via Tailscale (Recommended)
@@ -157,12 +167,18 @@ ssh root@magnet-9rl 'cat /proc/cpuinfo | grep flags'
157167
# Generate new ephemeral key
158168
NEW_KEY="tskey-auth-xxxxxx-yyyy"
159169

160-
# Update secrets (containers will auto-reconnect on restart)
170+
# Update GitHub repository secret
171+
# Go to: https://github.com/your-org/your-repo/settings/secrets/actions
172+
# Update TAILSCALE_AUTHKEY with new value
173+
174+
# Redeploy to apply new key (triggers via GitHub Actions)
175+
git commit --allow-empty -m "Rotate Tailscale auth key"
176+
git push
177+
178+
# Or manually update Fly.io secrets if needed
161179
fly secrets set TAILSCALE_AUTHKEY=$NEW_KEY --app magnet-9rl
162180
fly secrets set TAILSCALE_AUTHKEY=$NEW_KEY --app magnet-1eu
163181
fly secrets set TAILSCALE_AUTHKEY=$NEW_KEY --app magnet-atheme
164-
165-
# Restart containers to use new key
166182
fly machines restart --app magnet-9rl
167183
fly machines restart --app magnet-1eu
168184
fly machines restart --app magnet-atheme

docs/deployment-prerequisites.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,10 @@ fly tokens create deploy --app magnet-9rl
149149
fly tokens create deploy --app magnet-1eu
150150
fly tokens create deploy --app magnet-atheme
151151

152-
# Add to GitHub repository secrets as FLY_API_TOKEN
152+
# Add to GitHub repository secrets
153153
# Go to GitHub repo → Settings → Secrets → Actions
154154
# Create new secret: FLY_API_TOKEN = <your-deploy-token>
155+
# Create new secret: TAILSCALE_AUTHKEY = <your-ephemeral-auth-key>
155156
```
156157

157158
2. **Automatic Deployment**:

0 commit comments

Comments
 (0)