Maintenance and Recovery
Run maintenance tasks inside Team Server’s container/environment with its configuration and database credentials. These are privileged local tasks.
Verify the Service
Check public readiness:
curl -f https://team-server.example.com/_readinessCheck database access and report environment, version, and build locally:
endura task system_checkRun both checks after deployment, configuration changes, upgrades, and restores.
Required Scheduled Maintenance
Keep these jobs in scheduler.jobs:
| Run command | Purpose |
|---|---|
statistics_calculate | Captures historical dashboard statistics |
status_reconcile | Reconciles status for Runtime Sensors, builds, workloads, pipelines, all email integrations, connected Slack integrations, and connected Microsoft Teams integrations |
log_prune confirm:true | Enforces Team Server log, submitted Runtime Sensor log, and integration run history retention settings |
Each configured CI/CD provider also needs <provider>_sync mode:pipelines trigger:scheduled and <provider>_sync mode:builds trigger:scheduled. The complete example and schedules are in Scheduler.
Pruning marks runs still running after 24 hours interrupted, then removes expired terminal runs and diagnostics.
Prune Historical Observations
data_prune deletes old builds, workloads, violations, or statistics. It retains active builds/workloads, pipelines, deployments, Sensors, policies, users, and integrations. It has no default schedule. Choose retention periods and preview before confirming:
endura task data_prune \
resources:builds,workloads,violations older_than_days:90
endura task data_prune \
resources:builds,workloads,violations older_than_days:90 confirm:trueUse one cutoff: positive older_than_days or RFC 3339 before. For observations, batches default to 500 per type (range 1–5,000); repeat preview/apply until complete. Statistics delete all matches. Violations use their own timestamps, even when their parent remains. See full arguments.
Before scheduling externally, record a representative preview, test restoration, and confirm resources/cutoff meet retention policy.
Back Up PostgreSQL
Use PostgreSQL tools compatible with the server major version. Keep credentials out of history and protect archives containing tenant data and integration credentials.
For backups containing encrypted credentials, separately preserve the then-active ENDURA_CREDENTIAL_ENCRYPTION_KEY and ENDURA_CREDENTIAL_ENCRYPTION_PREVIOUS_KEYS. Startup needs the current key; credentials cannot be recovered without the matching keyring.
Create a custom-format archive:
pg_dump \
--dbname="$DATABASE_URL" \
--format=custom \
--no-owner \
--file=team-server.dumpVerify that PostgreSQL can read the archive before relying on it:
pg_restore --list team-server.dump >/dev/nullStore the archive under your recovery/retention policy and test restoration; a successful dump alone is insufficient.
Restore PostgreSQL
Practice this procedure in an isolated environment before an incident:
- Stop Team Server and prevent Runtime Sensors or other clients from writing to the target database.
- Create or select the intended restore database and verify that its connection string cannot target production accidentally.
- Restore the archive with a compatible PostgreSQL client.
- If the backup came from a version that requires credential encryption, restore its matching keyring to the Team Server environment.
- Start the same Team Server version that created the backup. Allow its normal migrations to complete before upgrading further.
- Run
system_check, verify/_readiness, then validate representative users, policies, integrations, recent observations, and Runtime Sensor connectivity. For a backup from a version that encrypts credentials, also confirm that startup reportscredentials validated.
pg_restore \
--dbname="$RESTORE_DATABASE_URL" \
--clean \
--if-exists \
--no-owner \
team-server.dump--clean removes database objects represented by the archive before recreating them. Use it only with the explicitly verified restore target.
If the restored database contains plaintext integration credentials, keep its earlier Team Server version in place until a supported conversion is available. See Credential Encryption before upgrading.
Load Fixture Data
database_seed defaults to src/fixtures. refresh:true previews schema deletion/recreation; confirm:true applies it. The task is refused in production.
Team Server also rejects Loco’s destructive db down, db reset, db truncate, and db seed commands when the CLI explicitly selects --environment production.
endura task database_seed path:src/fixtures
endura task database_seed path:src/fixtures refresh:true
endura task database_seed path:src/fixtures refresh:true confirm:trueUse fixture data only with disposable development and test databases.