paper-dynasty-discord/DEPLOYMENT.md
2025-11-11 13:22:06 -06:00

100 lines
2.1 KiB
Markdown

# Paper Dynasty Deployment Guide
## Current Deployment Process (Shell Script)
### Quick Start
From the `discord-app` directory:
```bash
./deploy.sh 1.3.0
```
Or let it prompt you for version:
```bash
./deploy.sh
```
### What It Does
1. **Validates version format** (X.Y or X.Y.Z)
2. **Builds Docker image** with both `latest` and version tags
3. **Pushes to Docker Hub** (manticorum67/paper-dynasty)
4. **Creates git tag** (v1.3.0)
5. **Deploys to sba-bots** via SSH
6. **Cleans up old images**
### Version Numbering
- **Bug fixes**: Increment patch (1.2.0 → 1.2.1)
- **New features**: Increment minor (1.2.1 → 1.3.0)
- **Breaking changes**: Increment major (1.3.0 → 2.0.0)
### Examples
```bash
# Deploy a bug fix
./deploy.sh 1.2.1
# Deploy a new feature
./deploy.sh 1.3.0
# Deploy with 'v' prefix (works either way)
./deploy.sh v1.3.0
```
### Rollback Process
If something goes wrong:
```bash
ssh sba-bots
cd /container-data/paper-dynasty
# Check available versions
docker image ls | grep paper-dynasty
# Update docker-compose.yml to use specific version
# Change: image: manticorum67/paper-dynasty:latest
# To: image: manticorum67/paper-dynasty:1.2.0
docker compose up -d
```
## Future: Automated CI/CD (GitHub Actions + Watchtower)
When ready to automate further, we'll:
1. Add GitHub Actions workflow to auto-build on git tags
2. Install Watchtower on sba-bots to auto-deploy
3. Push tags and walk away ☕
Files ready in `.github/workflows/` when you're ready to switch.
## Troubleshooting
### "Permission denied" when running script
```bash
chmod +x deploy.sh
```
### "Docker build failed"
- Check Dockerfile syntax
- Ensure all required files are present
- Check Docker daemon is running
### "Failed to push to Docker Hub"
- Verify you're logged in: `docker login`
- Check Docker Hub credentials
### "SSH connection failed"
- Verify SSH key is configured: `ssh sba-bots`
- Check ~/.ssh/config has sba-bots entry
### Remote deployment fails but build succeeds
- SSH into sba-bots manually
- Check disk space: `df -h`
- Check docker-compose.yml is present in `/container-data/paper-dynasty/`
- Run docker compose commands manually to see error