Skip to content

Commit 6835fc4

Browse files
committed
Add to bluegren
1 parent becadc0 commit 6835fc4

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

docs/bluegreen.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,4 +196,23 @@ jobs:
196196
GHCR_PAT: ${{ secrets.GHCR_PAT }}
197197
```
198198

199+
If you want to auto-flip between blue and green, add this extra task:
200+
201+
```yaml
202+
- name: Flip traffic
203+
uses: appleboy/ssh-action@v1.0.3
204+
with:
205+
host: ${{ secrets.VPS_HOST }}
206+
username: ${{ secrets.VPS_USER }}
207+
key: ${{ secrets.VPS_SSH_KEY }}
208+
script: |
209+
if [ "${{ steps.idle.outputs.IDLE }}" = "blue" ]; then
210+
sed -i 's/green_caddy/blue_caddy/g' caddy/Caddyfile
211+
else
212+
sed -i 's/blue_caddy/green_caddy/g' caddy/Caddyfile
213+
fi
214+
docker exec front-proxy caddy reload --config /etc/caddy/Caddyfile
215+
echo "${{ steps.idle.outputs.IDLE }}" > active_stack
216+
```
217+
199218
</details>

0 commit comments

Comments
 (0)