Upgrading tenement
This guide covers upgrading tenement with minimal or zero downtime.
Quick Upgrade (With Downtime)
Section titled “Quick Upgrade (With Downtime)”For development or when brief downtime is acceptable:
# Stop tenementsystemctl stop tenement
# Upgrade binarycargo install tenement-cli
# Start tenementsystemctl start tenementDowntime: ~10-30 seconds depending on instance count.
Zero-Downtime Upgrade
Section titled “Zero-Downtime Upgrade”For production deployments requiring continuous availability.
Prerequisites
Section titled “Prerequisites”- Two tenement binaries (old and new)
- Socket-based communication (Caddy/nginx proxying)
Procedure
Section titled “Procedure”1. Download new binary
# Download to temp locationcargo install tenement-cli --root /tmp/tenement-newNEW_BIN="/tmp/tenement-new/bin/ten"2. Test new binary
# Verify it runs$NEW_BIN --version
# Test config parsing$NEW_BIN config3. Graceful switchover
# Get current PIDOLD_PID=$(pgrep -f "ten serve")
# Start new instance on different port$NEW_BIN serve --port 8081 --domain $DOMAIN &NEW_PID=$!
# Wait for new instance to be readysleep 5curl -f http://localhost:8081/health || exit 1
# Update Caddy/nginx to point to new port# (Edit Caddyfile and reload)caddy reload
# Stop old instancekill -TERM $OLD_PID
# Move new binary to standard locationmv $NEW_BIN /usr/local/bin/ten
# Update systemd to use standard locationsystemctl daemon-reloadSimpler Alternative: Systemd Socket Activation
Section titled “Simpler Alternative: Systemd Socket Activation”If using systemd socket activation (advanced setup):
# Systemd handles the socket, just restart the servicesystemctl restart tenementDowntime: ~1-2 seconds (requests queue during restart).
Version Compatibility
Section titled “Version Compatibility”Config File Compatibility
Section titled “Config File Compatibility”tenement maintains backwards compatibility for config files:
runtimefield still works (alias forisolation)- New fields have sensible defaults
Database Compatibility
Section titled “Database Compatibility”The SQLite database schema is versioned:
- Upgrades run migrations automatically
- Downgrades may lose new features’ data
- Backup before major version upgrades
API Compatibility
Section titled “API Compatibility”REST API is stable within major versions:
- New endpoints may be added
- Existing endpoints maintain response format
- Breaking changes only in major versions
Rollback Procedure
Section titled “Rollback Procedure”If the new version has issues:
# Stop new versionsystemctl stop tenement
# Restore old binarymv /usr/local/bin/ten.bak /usr/local/bin/ten
# Start old versionsystemctl start tenementTip: Keep the previous binary around for quick rollbacks:
# Before upgradecp /usr/local/bin/ten /usr/local/bin/ten.bakChecking Current Version
Section titled “Checking Current Version”ten --versionChangelog
Section titled “Changelog”Check CHANGELOG.md for:
- Breaking changes
- New features
- Bug fixes
- Migration guides
Next Steps
Section titled “Next Steps”- Backup and Restore - Data preservation
- Monitoring Setup - Observability
- Troubleshooting - Common issues