-
Notifications
You must be signed in to change notification settings - Fork 234
feat(deploy): minimal server bootstrap with optional settings overrides #751
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
Merged
Changes from all commits
Commits
Show all changes
3 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
Some comments aren't visible on the classic Files Changed page.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| "nostream": patch | ||
| --- | ||
|
|
||
| deploy: minimal server bootstrap with optional settings overrides | ||
|
|
||
| Add deploy/bootstrap.sh, document what operators must keep locally vs what | ||
| ships in the image, and stop seeding a full settings.yaml on first boot so | ||
| release defaults merge with optional overrides only. |
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 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| # Bootstrap a production nostream host from this repository's deploy/ directory. | ||
| # | ||
| # Usage: | ||
| # ./deploy/bootstrap.sh [/opt/nostream] | ||
| # | ||
| # Creates the server layout, copies release-managed files from deploy/, and | ||
| # prepares .env for secrets. settings.yaml is optional — the relay uses image | ||
| # defaults until you add overrides (admin UI/API or .nostr/settings.yaml). | ||
|
|
||
| TARGET="${1:-/opt/nostream}" | ||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" | ||
|
|
||
| require_file() { | ||
| if [[ ! -f "$1" ]]; then | ||
| echo "error: required file not found: $1" >&2 | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| require_file "$SCRIPT_DIR/docker-compose.prod.yml" | ||
| require_file "$SCRIPT_DIR/env.example" | ||
| require_file "$REPO_ROOT/postgresql.conf" | ||
|
|
||
| mkdir -p "$TARGET/.nostr/data" "$TARGET/.nostr/db-logs" | ||
|
|
||
| install -m 644 "$SCRIPT_DIR/docker-compose.prod.yml" "$TARGET/docker-compose.yml" | ||
| install -m 644 "$REPO_ROOT/postgresql.conf" "$TARGET/postgresql.conf" | ||
|
|
||
| if [[ ! -f "$TARGET/.env" ]]; then | ||
| install -m 600 "$SCRIPT_DIR/env.example" "$TARGET/.env" | ||
| echo "Created $TARGET/.env — edit secrets before starting the stack." | ||
| else | ||
| echo "Keeping existing $TARGET/.env" | ||
| fi | ||
|
|
||
| if [[ ! -f "$TARGET/.nostr/settings.yaml" ]]; then | ||
| echo "No settings.yaml created — relay will use defaults from the container image." | ||
| echo "Add overrides later via the admin API or copy deploy/settings.yaml.example." | ||
| else | ||
| echo "Keeping existing $TARGET/.nostr/settings.yaml" | ||
| fi | ||
|
|
||
| # The relay container runs as node (uid 1000) and writes settings.yaml, backups, | ||
| # and the audit log directly under .nostr. Deliberately not recursive: .nostr/data | ||
| # and .nostr/db-logs are owned by the postgres image's own user. | ||
| if [[ "$(id -u)" -eq 0 ]]; then | ||
| chown 1000:1000 "$TARGET/.nostr" | ||
| fi | ||
|
|
||
| chmod 755 "$TARGET/.nostr" | ||
|
|
||
| cat <<EOF | ||
|
|
||
| Bootstrap complete: $TARGET | ||
|
|
||
| Next steps: | ||
| 1. Edit $TARGET/.env (SECRET, DB_PASSWORD, REDIS_PASSWORD) | ||
| 2. Load ghcr.io/cameri/nostream:main on this host | ||
| 3. cd $TARGET && docker compose up -d | ||
|
|
||
| Optional relay overrides: | ||
| cp $SCRIPT_DIR/settings.yaml.example $TARGET/.nostr/settings.yaml | ||
| chown 1000:1000 $TARGET/.nostr/settings.yaml | ||
| chmod 600 $TARGET/.nostr/settings.yaml | ||
|
|
||
| EOF | ||
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 |
|---|---|---|
| @@ -1,26 +1,18 @@ | ||
| # Copy to .nostr/settings.yaml on the server and edit for your relay. | ||
| # Values here override resources/default-settings.yaml from the image. | ||
| # Optional relay overrides — copy to .nostr/settings.yaml only when needed. | ||
| # Omit this file entirely to run with resources/default-settings.yaml from the image. | ||
| # Values here override image defaults (deep merge). New release keys come from the image automatically. | ||
|
|
||
| info: | ||
| relay_url: wss://relay.tnsor.network | ||
| name: relay.tnsor.network | ||
| relay_url: wss://relay.example.com | ||
| name: relay.example.com | ||
| description: A Nostr relay powered by nostream. | ||
| pubkey: "" | ||
| contact: mailto:operator@tnsor.network | ||
| terms_of_service: https://relay.tnsor.network/terms | ||
| privacy_policy: https://relay.tnsor.network/privacy | ||
| contact: mailto:operator@example.com | ||
|
|
||
| payments: | ||
| enabled: false | ||
| # payments: | ||
| # enabled: false | ||
|
|
||
| nip45: | ||
| enabled: true | ||
| # nip66: | ||
| # enabled: false | ||
|
|
||
| nip66: | ||
| enabled: false | ||
|
|
||
| workers: | ||
| count: 2 | ||
|
|
||
| admin: | ||
| enabled: false | ||
| # admin: | ||
| # enabled: false |
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.
Uh oh!
There was an error while loading. Please reload this page.