Skip to content

Commit 4774d70

Browse files
Chris Nuzumclaude
andcommitted
Add semantic versioning and automated release system
- Enhanced GitHub Actions workflow with semantic version Docker tags - Added automated release script with safety checks and version validation - Support for multiple Docker image tags: :latest, :1.0.0, :1.0, :1, :main, :dev - Multi-architecture builds (amd64 + arm64) with Cosign signing - NPM scripts for patch/minor/major releases - Comprehensive documentation for versioning and release process - Production-ready tagging strategy with proper latest tag management 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent d2e2779 commit 4774d70

4 files changed

Lines changed: 357 additions & 9 deletions

File tree

.github/workflows/docker-publish.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: Docker
33
on:
44
push:
55
branches: [ "main" ]
6+
tags: [ 'v*' ]
7+
pull_request:
8+
branches: [ "main" ]
69

710
env:
811
REGISTRY: ghcr.io
@@ -44,17 +47,24 @@ jobs:
4447
username: ${{ github.actor }}
4548
password: ${{ secrets.GITHUB_TOKEN }}
4649

47-
# Extract metadata (adds :latest and :main tags)
50+
# Extract metadata (adds semantic version tags)
4851
- name: Extract Docker metadata
4952
id: meta
5053
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
5154
with:
5255
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
5356
tags: |
54-
# Produce :latest on the default branch (main)
55-
type=raw,value=latest,enable={{is_default_branch}}
57+
# Produce :latest only on tagged releases
58+
type=raw,value=latest,enable={{is_default_branch}},enable=false
59+
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
5660
# Produce :main when pushing to the main branch
5761
type=ref,event=branch
62+
# Produce semantic version tags (v1.2.3, v1.2, v1)
63+
type=semver,pattern={{version}}
64+
type=semver,pattern={{major}}.{{minor}}
65+
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
66+
# Add development tag for main branch builds
67+
type=raw,value=dev,enable={{is_default_branch}}
5868
5969
# Build and push multi-arch image (amd64 + arm64)
6070
- name: Build and push Docker image

README.md

Lines changed: 143 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ A 1-1 check-in tracking application for monitoring team progress over time acros
1212
- **Team Management**: Local name storage and ID sharing for easy team coordination
1313
- **Recent IDs**: Unlimited history of all visited team member IDs for easy navigation
1414
- **URL-based Sharing**: Share unique check-in URLs with team members
15-
- **Persistent Storage**: SQLite database with Docker volume for data persistence
15+
- **Dual Database Support**: SQLite for development/local deployments, Azure SQL Database for production cloud deployments
16+
- **Persistent Storage**: SQLite with Docker volumes or Azure SQL Database with automatic failover
1617

1718
## Quick Start
1819

@@ -41,6 +42,59 @@ docker-compose up -d
4142

4243
The application will be available at http://localhost:3001
4344

45+
### Azure Container Apps Deployment (Recommended for Production)
46+
47+
For cloud-native deployments with high availability:
48+
49+
1. **Create Azure SQL Database**:
50+
```bash
51+
# Create resource group
52+
az group create --name checkin-rg --location eastus
53+
54+
# Create SQL Server
55+
az sql server create --name checkin-sql --resource-group checkin-rg \
56+
--location eastus --admin-user checkin_admin --admin-password YourSecurePassword123!
57+
58+
# Create database
59+
az sql db create --server checkin-sql --resource-group checkin-rg \
60+
--name checkin --service-objective Basic
61+
62+
# Configure firewall for Azure services
63+
az sql server firewall-rule create --server checkin-sql --resource-group checkin-rg \
64+
--name AllowAzure --start-ip-address 0.0.0.0 --end-ip-address 0.0.0.0
65+
```
66+
67+
2. **Deploy to Container Apps**:
68+
```bash
69+
# Create Container Apps environment
70+
az containerapp env create --name checkin-env --resource-group checkin-rg --location eastus
71+
72+
# Deploy with Azure SQL configuration
73+
az containerapp create \
74+
--name checkin-app \
75+
--resource-group checkin-rg \
76+
--environment checkin-env \
77+
--image your-registry/checkin:latest \
78+
--target-port 3001 \
79+
--ingress external \
80+
--secrets azure-sql-server="checkin-sql.database.windows.net" \
81+
azure-sql-database="checkin" \
82+
azure-sql-username="checkin_admin" \
83+
azure-sql-password="YourSecurePassword123!" \
84+
--env-vars AZURE_SQL_SERVER=secretref:azure-sql-server \
85+
AZURE_SQL_DATABASE=secretref:azure-sql-database \
86+
AZURE_SQL_USERNAME=secretref:azure-sql-username \
87+
AZURE_SQL_PASSWORD=secretref:azure-sql-password \
88+
NODE_ENV=production \
89+
ALLOWED_ORIGINS="https://your-domain.com"
90+
```
91+
92+
**Benefits of Azure SQL Deployment:**
93+
- Eliminates SQLite locking issues on shared persistent volumes
94+
- Automatic scaling and high availability (99.9% SLA)
95+
- Built-in backup and point-in-time restore
96+
- Advanced security features and encryption
97+
4498
## Usage
4599

46100
### Basic Check-ins
@@ -78,26 +132,71 @@ date,overall,wellbeing,growth,relationships,impact
78132
- Share URLs directly with team members
79133
- Names are stored locally in your browser
80134

81-
## Data Persistence
135+
## Database Configuration
136+
137+
The application supports dual database architectures:
82138

83-
The application uses SQLite for data storage. In Docker deployments, data is persisted using a named volume (`checkin-data`) mounted to `/data` in the container.
139+
### SQLite (Development/Local)
140+
- **Default**: Automatically used when no Azure SQL credentials are provided
141+
- **Local development**: Database stored at `./checkin.db`
142+
- **Docker deployment**: Uses named volume (`checkin-data`) mounted to `/data/checkin.db`
143+
- **Pros**: Simple setup, no external dependencies
144+
- **Cons**: File locking issues on shared storage systems
145+
146+
### Azure SQL Database (Production)
147+
- **Auto-detection**: Used when all Azure SQL environment variables are provided
148+
- **Environment Variables**:
149+
- `AZURE_SQL_SERVER` - Server hostname (e.g., `myserver.database.windows.net`)
150+
- `AZURE_SQL_DATABASE` - Database name (e.g., `checkin`)
151+
- `AZURE_SQL_USERNAME` - Database username
152+
- `AZURE_SQL_PASSWORD` - Database password
153+
- **Pros**: High availability, automatic scaling, no file locking issues
154+
- **Recommended**: For production cloud deployments
84155

85156
## API Endpoints
86157

158+
### Core API
87159
- `GET /api/generate-id` - Generate a new user GUID
88160
- `GET /api/checkins/:userId` - Get all check-ins for a user
89161
- `GET /api/checkins/:userId/:date` - Get check-in for specific user and date
90162
- `POST /api/checkins` - Create or update a check-in
91163
- `PUT /api/checkins/:userId/bulk` - Replace all check-ins for a user with provided data
92164
- `DELETE /api/checkins/:userId/bulk` - Delete all check-ins for a user
93165

166+
### Health Check & Monitoring
167+
- `GET /health` - Basic health check (returns 200 OK regardless of database status)
168+
- `GET /ready` - Readiness probe (returns 200 only when database is ready)
169+
170+
**Docker Health Checks:**
171+
```dockerfile
172+
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
173+
CMD curl -f http://localhost:3001/health || exit 1
174+
```
175+
176+
**Kubernetes Probes:**
177+
```yaml
178+
livenessProbe:
179+
httpGet:
180+
path: /health
181+
port: 3001
182+
initialDelaySeconds: 30
183+
periodSeconds: 10
184+
readinessProbe:
185+
httpGet:
186+
path: /ready
187+
port: 3001
188+
initialDelaySeconds: 5
189+
periodSeconds: 5
190+
```
191+
94192
## Technology Stack
95193
96194
- **Frontend**: React, Material-UI, Chart.js
97195
- **Backend**: Node.js, Express
98-
- **Database**: SQLite
196+
- **Database**: SQLite (development) / Azure SQL Database (production)
197+
- **Security**: Helmet.js, rate limiting, input validation, CORS protection
99198
- **Testing**: Playwright (cross-browser end-to-end testing)
100-
- **Deployment**: Docker, Docker Compose
199+
- **Deployment**: Docker, Docker Compose, Azure Container Apps
101200
102201
## Testing
103202
@@ -112,6 +211,45 @@ npm run test:report # View HTML test reports
112211

113212
The test suite includes stable end-to-end tests covering core functionality across Chromium, Firefox, and WebKit browsers.
114213

214+
## Releases & Versioning
215+
216+
This project follows [semantic versioning](https://semver.org/) and uses automated Docker builds with proper version tags.
217+
218+
### Creating a Release
219+
220+
Use the provided release script to create tagged releases:
221+
222+
```bash
223+
# Create a patch release (1.0.0 -> 1.0.1)
224+
npm run release:patch
225+
226+
# Create a minor release (1.0.0 -> 1.1.0)
227+
npm run release:minor
228+
229+
# Create a major release (1.0.0 -> 2.0.0)
230+
npm run release:major
231+
232+
# Or use the script directly for custom versions
233+
./scripts/release.sh patch 1.2.3
234+
```
235+
236+
### Docker Images
237+
238+
Each release automatically publishes multi-architecture Docker images to GitHub Container Registry:
239+
240+
- `ghcr.io/heliotrip/checkin:latest` - Latest stable release
241+
- `ghcr.io/heliotrip/checkin:1.2.3` - Specific version
242+
- `ghcr.io/heliotrip/checkin:1.2` - Minor version series
243+
- `ghcr.io/heliotrip/checkin:1` - Major version series
244+
- `ghcr.io/heliotrip/checkin:main` - Main branch builds
245+
- `ghcr.io/heliotrip/checkin:dev` - Development builds
246+
247+
**Supported Architectures:**
248+
- `linux/amd64` (x86_64)
249+
- `linux/arm64` (ARM64/AArch64)
250+
251+
All images are signed with [Cosign](https://github.com/sigstore/cosign) for supply chain security.
252+
115253
## Authors
116254

117255
Chris Nuzum @heliotrip

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
"test": "playwright test",
1414
"test:headed": "playwright test --headed",
1515
"test:ui": "playwright test --ui",
16-
"test:report": "playwright show-report"
16+
"test:report": "playwright show-report",
17+
"release:patch": "./scripts/release.sh patch",
18+
"release:minor": "./scripts/release.sh minor",
19+
"release:major": "./scripts/release.sh major"
1720
},
1821
"dependencies": {
1922
"body-parser": "^1.20.2",

0 commit comments

Comments
 (0)