Upgrading
Safely upgrade your Semaphor self-hosted deployment
Overview
When you upgrade Semaphor, database schema changes are applied automatically on container startup. This guide covers how to upgrade safely, back up your data, and roll back if needed.
Key principles:
- All three services (api-service, data-service, data-service-sidecar) must run the same version
- Schema migrations run on the first startup after pulling new images
- Always back up your data before upgrading
Semaphor applies schema changes automatically when the container starts. Some upgrades include destructive changes (table or column removals) that cannot be undone without a backup. Always back up before upgrading.
Check Your Current Version
Development / Testing (Embedded Database)
If you're using the default embedded PostgreSQL (no DATABASE_URL configured), your data is stored in the semaphor-data Docker volume. This volume persists across container restarts and image upgrades — pulling a new image does not wipe your data.
Quick Upgrade
For test or evaluation environments where data loss is acceptable:
Safe Upgrade (Preserve Data)
For development environments where you want to keep your data:
1. Back up the Docker volume:
2. Pull new images:
Use a specific version tag rather than latest:
3. Start services:
Schema changes are applied automatically during startup.
4. Verify the upgrade:
Rollback (Embedded Database)
If something goes wrong after upgrading:
Replace YYYYMMDD with your backup date.
Production (External Database)
If you're using an external PostgreSQL (DATABASE_URL is configured), the same automatic schema sync applies — but you have more control over backups and can test upgrades in a staging environment first.
Production upgrades require a database backup. Schema changes are applied automatically on startup and may include destructive changes (dropped tables or columns). Without a backup, these changes cannot be reversed.
Pre-Upgrade Checklist
Before upgrading a production deployment:
- Take a full database backup (see below)
- Back up your configuration (
semaphor.env,docker-compose.yml) - Review the Release Notes for your target version to check for breaking schema changes
- Test the upgrade in a staging environment first if possible
- Pin all 3 services to the same version tag — never mix versions
Step-by-Step Upgrade
1. Back up your database:
2. Back up your configuration:
3. Update to the new version:
Edit docker-compose.yml to use specific version tags:
4. Pull and restart:
5. Monitor the upgrade:
You should see output like:
6. Verify health:
Rollback (External Database)
If the upgrade causes issues:
1. Stop services:
2. Restore your database:
3. Revert to the previous version:
How Schema Migrations Work
Understanding how Semaphor handles database changes helps you plan upgrades with confidence.
Automatic Schema Sync
On every container startup, the API service compares the expected database schema (bundled in the Docker image) against the actual database and applies any differences. This process:
- Adds new tables and columns automatically
- Removes tables and columns that are no longer in the schema
- Runs before the application starts accepting requests
Schema changes are applied on the first startup after pulling new images. Restarting the same version does not re-apply changes.
When Data Loss Can Occur
Most upgrades only add new tables or columns — these are non-destructive. However, some upgrades may include:
- Column removals: Data in removed columns is permanently deleted
- Table removals: All data in removed tables is permanently deleted
- Column type changes: May cause data truncation or conversion
These destructive changes are documented in the Release Notes for each version.
Version Pinning
For production deployments, always pin to specific version tags instead of using latest:
This ensures:
- All services run the same version
- Upgrades only happen when you explicitly change the version
- You can roll back to a known-good version
Troubleshooting
Schema sync failed on startup
Check the API service logs for error messages:
If schema sync fails, the container will exit. Restore from your backup and contact support.
Container won't start after upgrade
- Check logs:
docker-compose logs api-service - Verify all 3 services use the same version tag
- If the error is license-related, check that your license key is still valid
- Restore from backup and try the previous version
Checking which version is running
Support
If you encounter issues during an upgrade:
- Email: support@semaphor.cloud
- Documentation: docs.semaphor.cloud