-
Notifications
You must be signed in to change notification settings - Fork 0
Document Vault bootstrap usage and extend helper configuration #174
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
Open
leynos
wants to merge
2
commits into
main
Choose a base branch
from
codex/implement-vault-appliance-bootstrap-helper
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| # Vault appliance bootstrap process | ||
|
|
||
| This guide explains how to initialise and maintain the DigitalOcean-hosted Vault | ||
| appliance with `scripts/bootstrap_vault_appliance.py`. The helper discovers the | ||
| appliance droplet, verifies Vault is running, initialises and unseals the | ||
| cluster when needed, enables the KV v2 engine, and provisions the AppRole used | ||
| by the DOKS deployment workflow. Re-running the script is safe: existing | ||
| configuration is reused whenever possible. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| Before running the helper ensure the following tools are installed and | ||
| authenticated on the workstation or CI runner executing the script: | ||
|
|
||
| - `doctl` logged in with access to the target DigitalOcean account. | ||
| - `vault` CLI able to reach the appliance network location. | ||
| - SSH access to the droplet using the user supplied via `--ssh-user` (defaults to | ||
| `root`). | ||
| - The Vault CA bundle and server credentials exported from the | ||
| `vault_appliance` OpenTofu module outputs. Save the CA certificate to disk so | ||
| it can be supplied through `--ca-cert-path`. | ||
|
|
||
| The DigitalOcean Secrets Manager namespace identified by `--secret-prefix` must | ||
| exist. The script will create or update individual secrets inside that | ||
| namespace. | ||
|
|
||
| ## Running the script | ||
|
|
||
| The helper may be launched directly thanks to the embedded [`uv`](https://github.com/astral-sh/uv) | ||
| metadata: | ||
|
|
||
| ```sh | ||
| ./scripts/bootstrap_vault_appliance.py \ | ||
| --environment dev \ | ||
| --droplet-tag vault-dev \ | ||
| --secret-prefix dev-vault \ | ||
| --vault-address https://vault.dev.example:8200 \ | ||
| --ca-cert-path /secure/path/vault-ca.pem | ||
| ``` | ||
|
|
||
| Key options: | ||
|
|
||
| - `--environment` and `--secret-prefix` scope the DigitalOcean Secrets Manager | ||
| entries used to persist unseal keys, the root token, and AppRole credentials. | ||
| - `--droplet-tag` locates the appliance droplet. The helper aborts if multiple | ||
| droplets share the tag to avoid operating on the wrong instance. | ||
| - `--vault-address` overrides the Vault API endpoint used by the CLI. When not | ||
| provided, the helper derives `https://<droplet-ip>:8200` automatically. | ||
| - `--ca-cert-path` writes the certificate bundle to `VAULT_CACERT` so the Vault | ||
| CLI trusts the appliance's TLS certificate. Omit the flag only when the CA is | ||
| already trusted by the host system. | ||
| - `--mount-path`, `--approle-name`, and `--policy-name` customise the KV engine | ||
| path and DOKS AppRole naming. | ||
|
|
||
| All options accept the values documented in `scripts/bootstrap_vault_appliance.py | ||
| --help`. | ||
|
|
||
| ## Secrets management | ||
|
|
||
| On the first run the helper: | ||
|
|
||
| 1. Initialises Vault with the requested number of key shares and threshold. | ||
| 2. Stores each unseal share and the generated root token inside the secrets | ||
| manager under `<secret-prefix>-unseal-N` and `<secret-prefix>-root-token`. | ||
| 3. Enables the KV v2 engine and writes the AppRole policy before generating a | ||
| role ID and secret ID. These are saved as `<secret-prefix>-role-id` and | ||
| `<secret-prefix>-secret-id`. | ||
|
|
||
| Subsequent executions read the stored secrets, unseal Vault if necessary, and | ||
| update the AppRole credentials in-place. Failed operations (for example missing | ||
| unseal shares or an unhealthy systemd unit) raise descriptive errors without | ||
| modifying the appliance. | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| - **`Vault remains sealed`** – verify that all unseal secrets exist in the | ||
| DigitalOcean Secrets Manager namespace. Missing shares cause the helper to | ||
| abort before any unseal attempts. | ||
| - **`certificate verify failed`** – ensure the CA bundle path supplied via | ||
| `--ca-cert-path` matches the file exported from the module outputs and that | ||
| the executing user can read it. | ||
| - **`No droplets tagged`** – confirm the OpenTofu module outputs include the tag | ||
| referenced by `--droplet-tag` and that the droplet is active in the target | ||
| account and region. | ||
|
|
||
| For advanced usage, including integrating the helper in GitHub Actions, see the | ||
| architecture notes in `docs/cloud-native-ephemeral-previews.md`. | ||
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,3 @@ | ||
| """Utility scripts package namespace for Wildside automation.""" | ||
|
|
||
| from __future__ import annotations |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct the filename typo.
The filename contains "applience" but should be "appliance". Rename the file to
vault-appliance-bootstrap-process.mdto match the correct spelling.🤖 Prompt for AI Agents