docs: add deployment instructions for staging and production
This commit is contained in:
parent
ffb61641bb
commit
c0546814aa
1 changed files with 106 additions and 0 deletions
106
CLAUDE.md
106
CLAUDE.md
|
|
@ -242,6 +242,112 @@ kubectl rollout restart deployment/towerops -n towerops
|
||||||
|
|
||||||
**Deployment**: FluxCD auto-applies `k8s/` manifests. Manual: `kubectl apply -k k8s/`
|
**Deployment**: FluxCD auto-applies `k8s/` manifests. Manual: `kubectl apply -k k8s/`
|
||||||
|
|
||||||
|
## Deployment
|
||||||
|
|
||||||
|
### Branch-Based Deployment Strategy
|
||||||
|
|
||||||
|
Towerops uses branch-based deployment with Forgejo CI/CD:
|
||||||
|
|
||||||
|
**Staging (Dokku):**
|
||||||
|
- Push to `main` branch triggers automatic deploy to Dokku staging server
|
||||||
|
- Direct git push to Dokku (no Docker build)
|
||||||
|
- Buildpack-based deployment (detects Elixir/Phoenix)
|
||||||
|
- URL: staging.towerops.app (or configured Dokku domain)
|
||||||
|
|
||||||
|
**Production (Kubernetes):**
|
||||||
|
- Push to `production` branch triggers Docker build + k8s deployment
|
||||||
|
- Builds Docker image from `k8s/Dockerfile`
|
||||||
|
- Pushes to container registry
|
||||||
|
- Updates `k8s/deployment.yaml` with new image tag
|
||||||
|
- FluxCD detects change and applies to cluster
|
||||||
|
|
||||||
|
### Deploying Changes
|
||||||
|
|
||||||
|
**To staging:**
|
||||||
|
```bash
|
||||||
|
git push origin main
|
||||||
|
# CI automatically deploys to Dokku
|
||||||
|
# Watch: https://git.mcintire.me/graham/towerops-web/actions
|
||||||
|
```
|
||||||
|
|
||||||
|
**To production:**
|
||||||
|
```bash
|
||||||
|
# Merge main → production
|
||||||
|
git checkout production
|
||||||
|
git merge main
|
||||||
|
git push origin production
|
||||||
|
|
||||||
|
# Or fast-forward if no conflicts
|
||||||
|
git push origin main:production
|
||||||
|
|
||||||
|
# CI builds Docker image and updates k8s manifests
|
||||||
|
# FluxCD applies within ~5 minutes
|
||||||
|
```
|
||||||
|
|
||||||
|
**Direct Dokku deploy (bypass CI):**
|
||||||
|
```bash
|
||||||
|
# Add Dokku remote (one-time)
|
||||||
|
git remote add dokku dokku@204.110.191.231:towerops
|
||||||
|
|
||||||
|
# Force push to deploy
|
||||||
|
git push dokku main:main --force
|
||||||
|
```
|
||||||
|
|
||||||
|
**Manual production deploy:**
|
||||||
|
```bash
|
||||||
|
# Apply k8s manifests directly
|
||||||
|
kubectl apply -k k8s/
|
||||||
|
|
||||||
|
# Or trigger rollout restart
|
||||||
|
kubectl rollout restart deployment/towerops -n towerops
|
||||||
|
```
|
||||||
|
|
||||||
|
### Deployment Verification
|
||||||
|
|
||||||
|
**Staging:**
|
||||||
|
```bash
|
||||||
|
# Check Dokku logs
|
||||||
|
ssh dokku@204.110.191.231 logs towerops --tail 100
|
||||||
|
|
||||||
|
# Check app status
|
||||||
|
ssh dokku@204.110.191.231 ps:report towerops
|
||||||
|
```
|
||||||
|
|
||||||
|
**Production:**
|
||||||
|
```bash
|
||||||
|
# Check pod status
|
||||||
|
kubectl get pods -n towerops
|
||||||
|
|
||||||
|
# Check logs
|
||||||
|
kubectl logs -n towerops -l app=towerops --tail=100 -f
|
||||||
|
|
||||||
|
# Check deployment status
|
||||||
|
kubectl rollout status deployment/towerops -n towerops
|
||||||
|
```
|
||||||
|
|
||||||
|
### Rollback
|
||||||
|
|
||||||
|
**Staging (Dokku):**
|
||||||
|
```bash
|
||||||
|
# Revert git commit, push to main
|
||||||
|
git revert <bad-commit>
|
||||||
|
git push origin main
|
||||||
|
|
||||||
|
# Or rebuild previous release
|
||||||
|
ssh dokku@204.110.191.231 ps:rebuild towerops <release-id>
|
||||||
|
```
|
||||||
|
|
||||||
|
**Production (Kubernetes):**
|
||||||
|
```bash
|
||||||
|
# Rollback deployment
|
||||||
|
kubectl rollout undo deployment/towerops -n towerops
|
||||||
|
|
||||||
|
# Or revert git commit on production branch
|
||||||
|
git checkout production
|
||||||
|
git revert <bad-commit>
|
||||||
|
git push origin production
|
||||||
|
```
|
||||||
|
|
||||||
## Common Patterns
|
## Common Patterns
|
||||||
|
|
||||||
### Pagination in LiveView
|
### Pagination in LiveView
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue