|
1 | 1 | --- |
2 | 2 | name: deploy |
3 | | -description: Build, push, and deploy the API to production |
| 3 | +description: "Build, push, and deploy to production. Usage: /deploy api | /deploy roster | /deploy (defaults to api)" |
4 | 4 | disable-model-invocation: true |
5 | 5 | allowed-tools: Bash, Read |
6 | 6 | --- |
7 | 7 |
|
8 | | -Deploy the battletech API to production. Run these steps in order, stopping on any failure: |
| 8 | +Deploy a service to production. Accepts one argument: `api` (default) or `roster`. |
| 9 | + |
| 10 | +## Service: api |
| 11 | + |
| 12 | +Run from the battletech repo root. Stop on any failure: |
9 | 13 |
|
10 | 14 | 1. Push commits to origin: |
11 | 15 | ``` |
@@ -36,4 +40,36 @@ Deploy the battletech API to production. Run these steps in order, stopping on a |
36 | 40 | -d '{"query":"{ metadata { version } }"}' | python3 -m json.tool |
37 | 41 | ``` |
38 | 42 |
|
| 43 | +## Service: roster |
| 44 | + |
| 45 | +Run from the `../battletech-roster-builder/` repo root. Stop on any failure: |
| 46 | + |
| 47 | +1. Push commits to origin: |
| 48 | + ``` |
| 49 | + git push origin main |
| 50 | + ``` |
| 51 | + |
| 52 | +2. Build the amd64 Docker image and push to GHCR: |
| 53 | + ``` |
| 54 | + docker buildx build --platform linux/amd64 \ |
| 55 | + -t ghcr.io/graylikeme/battletech-roster:sha-$(git rev-parse --short HEAD) \ |
| 56 | + -t ghcr.io/graylikeme/battletech-roster:latest \ |
| 57 | + --push . |
| 58 | + ``` |
| 59 | + |
| 60 | +3. Restart the K8s deployment to pull the new image: |
| 61 | + ``` |
| 62 | + KUBECONFIG=~/.kube/battletech.yaml kubectl rollout restart deployment/battletech-roster -n battletech |
| 63 | + ``` |
| 64 | + |
| 65 | +4. Wait for rollout to complete: |
| 66 | + ``` |
| 67 | + KUBECONFIG=~/.kube/battletech.yaml kubectl rollout status deployment/battletech-roster -n battletech --timeout=120s |
| 68 | + ``` |
| 69 | + |
| 70 | +5. Verify the site is healthy: |
| 71 | + ``` |
| 72 | + curl -sf -o /dev/null -w '%{http_code}' https://roster.battledroids.ru/ |
| 73 | + ``` |
| 74 | + |
39 | 75 | Report the result of each step. If the Docker build takes a while, run it in the background and check on it. |
0 commit comments