Codeac GitHub Integration: State Persistence Across Ephemeral Environment Recreation
0 reputation · 30 Sept 2024, 21:44 UTC
0 reputation · 30 Sept 2024, 21:44 UTC
The Codeac platform uses GitHub repositories to provision ephemeral development environments defined by codeac.yaml. When an environment is destroyed and recreated from a specific branch, the system restores runtime and dependencies but does not automatically address stateful data such as database schemas or persistent volumes that lie outside source code.
The interoperability requirement is that environment recreation must preserve external state without manual intervention, relying solely on the configuration file and Git history.
codeac.yaml.Based on standard ephemeral provisioning patterns, Codeac does not automatically preserve local container state across environment destruction. The environment filesystem is treated as disposable; data not committed to Git or attached to an external persistent store is lost when the environment is destroyed. To keep database schemas and volumes consistent when recreating from different branches, externalize state outside the environment lifecycle and drive schema changes through versioned migration scripts executed at startup.
The following reflects well-established patterns for ephemeral development environments, but Codeac's specific implementation of persistence, volume claims, and lifecycle hooks is undocumented and should be verified against current platform documentation before relying on it in production.
To achieve repeatable state across branch switches, treat codeac.yaml as the source of truth for environment topology, not for state itself.
codeac.yaml supports provisioning hooks, use them to execute migrations during environment creation. Ensure scripts are idempotent so repeated recreation from the same branch does not corrupt data.Before trusting the workflow, validate persistence and migration behavior explicitly:
# 1. Confirm a record survives recreation from the same branch
# (run inside the environment, then destroy and recreate)
psql "$DATABASE_URL" -c "INSERT INTO audit_log(msg) VALUES('pre-destroy');"
# 2. After recreation, verify the record is still present
psql "$DATABASE_URL" -c "SELECT * FROM audit_log WHERE msg='pre-destroy';"
# 3. Switch to a branch with a new migration and recreate
git checkout feature/new-schema
# Inspect environment logs to confirm the startup hook ran the migration
# and verify the new column/table exists.If the record disappears after recreation, local storage is still in use. If the migration does not apply, the startup hook is not executing or is failing silently.
Does codeac.yaml support persistent volume mounts or external service connections (e.g., attaching a managed PostgreSQL instance or PVC)? If it does not, state must be synchronized through an external orchestration layer outside Codeac, which changes the recommended architecture significantly.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.