-
Notifications
You must be signed in to change notification settings - Fork 6
refactor(ampd): standardize env var names with AMP_prefix #1702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+218
−51
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| --- | ||
| name: "app-ampd-migrate" | ||
| description: "ampd migrate command for metadata database migrations. Load when asking about database migrations, schema upgrades, or ampd migrate" | ||
| type: feature | ||
| status: "stable" | ||
| components: "app:ampd,crate:metadata-db,crate:config" | ||
| --- | ||
|
|
||
| # ampd Migrate | ||
|
|
||
| ## Summary | ||
|
|
||
| The `ampd migrate` command runs database migrations on the metadata database. It connects to the configured PostgreSQL instance, applies any pending schema migrations, and exits. This is a one-shot administrative command used during upgrades or initial setup. | ||
|
|
||
| ## Table of Contents | ||
|
|
||
| 1. [Key Concepts](#key-concepts) | ||
| 2. [Configuration](#configuration) | ||
| 3. [Usage](#usage) | ||
| 4. [References](#references) | ||
|
|
||
| ## Key Concepts | ||
|
|
||
| - **Metadata Database**: PostgreSQL database storing job state, worker registrations, dataset definitions, and table revisions | ||
| - **Schema Migration**: Automatic application of pending DDL changes to bring the database schema up to date | ||
| - **One-Shot Command**: Unlike other ampd subcommands, `migrate` runs to completion and exits | ||
|
|
||
| ## Configuration | ||
|
|
||
| `ampd migrate` requires `--config` (or `AMP_CONFIG`) to be provided. The config file must contain a valid | ||
| `metadata_db.url` (or the `AMP_CONFIG_METADATA_DB__URL` environment variable must be set). | ||
|
|
||
| | Setting | Source | Description | | ||
| |-------------------|----------------------------------------------|------------------------------| | ||
| | `metadata_db.url` | Config file or `AMP_CONFIG_METADATA_DB__URL` | PostgreSQL connection string | | ||
|
|
||
| ## Usage | ||
|
|
||
| ### Running Migrations | ||
|
|
||
| ```bash | ||
| # Apply pending migrations using a config file | ||
| ampd --config .amp/config.toml migrate | ||
|
|
||
| # Using the AMP_CONFIG environment variable | ||
| export AMP_CONFIG=.amp/config.toml | ||
| ampd migrate | ||
| ``` | ||
|
|
||
| ### When to Run | ||
|
|
||
| - **Initial setup**: Before starting any ampd service for the first time | ||
| - **After upgrades**: When a new ampd version includes schema changes | ||
| - **CI/CD pipelines**: As a pre-deployment step | ||
|
|
||
| ### Auto-Migration Alternative | ||
|
|
||
| In non-production environments, the metadata database connection can be configured with | ||
| `auto_migrate = true` in the config file (defaults to `true` in solo mode). When enabled, services automatically apply migrations on startup, making the explicit | ||
| `migrate` command unnecessary. | ||
|
|
||
LNSD marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ```toml | ||
| [metadata_db] | ||
| url = "postgresql://localhost/amp" | ||
| auto_migrate = true | ||
| ``` | ||
|
|
||
| ## References | ||
|
|
||
| - [app-ampd](app-ampd.md) - Base: ampd daemon overview | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.