-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix for Issue1182 #1203
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
mbajji
wants to merge
7
commits into
getmaxun:develop
Choose a base branch
from
mbajji:issue1182
base: develop
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.
+173
−40
Open
Fix for Issue1182 #1203
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4f589dd
fixed docs to have the correct shell commands to run
mbajji 07a3fcb
created a script to make a .env file
mbajji 0be17fa
uploaded the script
mbajji e617a77
code rabbit fixes
mbajji b2afe67
docs: fix generate-env.sh shebang, guards, and script paths
mbajji f98cec5
test upload code rabbit
mbajji 98c7db2
Revise self-hosting Docker documentation
mbajji 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # Generates a .env file with freshly generated secrets. | ||
| # | ||
| # ./docs/generate-env.sh # writes ./.env | ||
| # ./docs/generate-env.sh --print # prints to stdout instead | ||
| # | ||
| # Every generated value is hex or base64, neither of which contains "$". | ||
| # A literal "$" in a value would be read by Docker Compose as a variable | ||
| # reference and silently dropped, so avoid one if you edit these by hand. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| OUT=".env" | ||
| PRINT_ONLY=0 | ||
|
|
||
| for arg in "$@"; do | ||
| case "$arg" in | ||
| --print) PRINT_ONLY=1 ;; | ||
| -h|--help) sed -n '2,12p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;; | ||
| *) echo "unknown option: $arg" >&2; exit 1 ;; | ||
| esac | ||
| done | ||
|
|
||
| if ! command -v openssl >/dev/null 2>&1; then | ||
| echo "openssl is required but was not found on PATH." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ "$PRINT_ONLY" -eq 0 ] && { [ -e "$OUT" ] || [ -L "$OUT" ]; }; then | ||
| echo "$OUT already exists. Move or delete it first, or use --print." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # ENCRYPTION_KEY must be exactly 64 hex characters; the others are free-form. | ||
| JWT_SECRET="$(openssl rand -base64 48)" | ||
| DB_PASSWORD="$(openssl rand -base64 24)" | ||
| ENCRYPTION_KEY="$(openssl rand -hex 32)" | ||
| SESSION_SECRET="$(openssl rand -base64 48)" | ||
| MINIO_SECRET_KEY="$(openssl rand -base64 24)" | ||
|
|
||
| render() { | ||
| cat <<ENV | ||
| # Generated by docs/generate-env.sh | ||
| # | ||
| # Secrets below are freshly generated. Replace the URLs with your own domain | ||
| # before starting the stack. | ||
| # | ||
| # Do not put a literal dollar sign in any value: Docker Compose reads it as a | ||
| # variable reference and silently drops it. Double it to escape one. | ||
|
|
||
| NODE_ENV=production | ||
| JWT_SECRET=${JWT_SECRET} | ||
| DB_NAME=maxun | ||
| DB_USER=postgres | ||
| DB_PASSWORD=${DB_PASSWORD} | ||
| DB_HOST=postgres | ||
| DB_PORT=5432 | ||
| ENCRYPTION_KEY=${ENCRYPTION_KEY} | ||
| SESSION_SECRET=${SESSION_SECRET} | ||
| MINIO_ENDPOINT=minio | ||
| MINIO_PORT=9000 | ||
| MINIO_CONSOLE_PORT=9001 | ||
| MINIO_ACCESS_KEY=minio | ||
| MINIO_SECRET_KEY=${MINIO_SECRET_KEY} | ||
| REDIS_HOST=maxun-redis | ||
| REDIS_PORT=6379 | ||
| REDIS_PASSWORD= | ||
| BACKEND_PORT=8080 | ||
| FRONTEND_PORT=5173 | ||
| BACKEND_URL=https://maxun.my.domain | ||
| PUBLIC_URL=https://maxun.my.domain | ||
| VITE_BACKEND_URL=https://maxun.my.domain | ||
| VITE_PUBLIC_URL=https://maxun.my.domain | ||
| GOOGLE_CLIENT_ID= | ||
| GOOGLE_CLIENT_SECRET= | ||
| GOOGLE_REDIRECT_URI= | ||
| AIRTABLE_CLIENT_ID= | ||
| AIRTABLE_REDIRECT_URI= | ||
| MAXUN_TELEMETRY=true | ||
| ENV | ||
| } | ||
|
|
||
| if [ "$PRINT_ONLY" -eq 1 ]; then | ||
| render | ||
| else | ||
| (umask 077; render > "$OUT") | ||
| chmod 600 "$OUT" | ||
| echo "Wrote $OUT with generated secrets." | ||
| echo "Edit the BACKEND_URL / PUBLIC_URL lines to match your domain before starting." | ||
| fi |
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
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.