Step 1: wire migrate-on-boot (RELEASE-001).

4caab400f31c · AtlantisPleb · · parent ed2fe38199f7

Step 1: wire migrate-on-boot (RELEASE-001).

- Adds :migrate_on_boot config, default false in config/test.exs,
  true in runtime.exs :prod, and calls OpenAgents.Release.migrate/0
  from OpenAgents.Application.start/2 when enabled.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By
Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Deploy story

What this commit did to the running system — joined from the forge receipt chain, the part a commit page elsewhere cannot show.

Not deployed through the forge lane

No push, promotion, build, or deploy receipt references this commit (receipts are scanned over a bounded recent window). Changes shipped by full node replacement carry their proof in the release gate receipt instead.

Changed files

  • modified config/config.exs
  • modified config/runtime.exs
  • modified config/test.exs
  • modified lib/openagents/application.ex

Diff

4 files changed, +16 -0

config/config.exs modified +1

@@ -11,6 +11,7 @@ config :openagents,

11 11
  namespace: OpenAgents,
12 12
  ecto_repos: [OpenAgents.Repo],
13 13
  generators: [timestamp_type: :utc_datetime],
14
  migrate_on_boot: false,
14 15
  conversation_page_size: 40,
15 16
  maximum_message_bytes: 8_000,
16 17
  turn_rate_limit: 50,
config/runtime.exs modified +6

@@ -139,6 +139,12 @@ if config_env() == :prod do

139 139
140 140
  config :openagents, OpenAgents.Repo, repo_config
141 141
142
  # Always migrate on boot in production so the schema precedes traffic
143
  # (RELEASE-001). Ecto.Migrator.with_repo takes the advisory lock, so
144
  # concurrent fleet nodes serialize safely and an already-migrated DB is a
145
  # no-op.
146
  config :openagents, :migrate_on_boot, true
147
142 148
  # The secret key base is used to sign/encrypt cookies and other secrets.
143 149
  # A default value is used in config/dev.exs and config/test.exs but you
144 150
  # want to use a different value for prod and you most likely don't want
config/test.exs modified +2

@@ -49,3 +49,5 @@ config :phoenix_live_view,

49 49
# Sort query params output of verified routes for robust url comparisons
50 50
config :phoenix,
51 51
  sort_verified_routes_query_params: true
52
53
config :openagents, :migrate_on_boot, false
lib/openagents/application.ex modified +7

@@ -7,6 +7,13 @@ defmodule OpenAgents.Application do

7 7
8 8
  @impl true
9 9
  def start(_type, _args) do
10
    # Releases migrate on boot (RELEASE-001): the schema must precede traffic.
11
    # Ecto.Migrator.with_repo takes the migration advisory lock, so concurrent
12
    # fleet nodes serialize safely and an already-migrated DB is a no-op.
13
    if Application.get_env(:openagents, :migrate_on_boot, false) do
14
      OpenAgents.Release.migrate()
15
    end
16
10 17
    # Install immutable release artifacts before any traffic can reach them.
11 18
    OpenAgents.Persona.install!(OpenAgents.Persona.SourceManifest.load!())
12 19
    OpenAgents.ProgramArtifacts.install!()

This page updates live while a promote is in flight · changelog