feat: auto generate formbricks encryption key in one click setup (#953)

* fix: docker env parsing & response bug when built w docker

* chore: bring back env example

* fix: docker compose envs are now single place defined

* add: renaming of .env in docs

* remove: existence of prisma_generate_data_proxy

* fix: use newer env vars and a smarter way to handle existing .env file

* fix: remove text to remove existing .enb

* fix: remove comments, local testing, and mention of more updating via echo in prod script

* fix: env ending

* fix: finalllyyy the docker compose works

* wip

* fix: update self host docker compose

* fix: echo log rename
This commit is contained in:
Shubham Palriwala
2023-10-05 19:44:23 +05:30
committed by GitHub
parent 7e74cfa0d6
commit 09f885d365
2 changed files with 22 additions and 0 deletions

View File

@@ -16,6 +16,10 @@ x-environment: &environment
# You do not need the NEXTAUTH_URL environment variable in Vercel.
NEXTAUTH_URL: http://localhost:3000
# Formbricks Encryption Key is used to generate encrypted single use URLs for Link Surveys
# You can use: $(openssl rand -base64 16) to generate one
# FORMBRICKS_ENCRYPTION_KEY:
# PostgreSQL password
POSTGRES_PASSWORD: postgres
@@ -27,6 +31,12 @@ x-environment: &environment
SMTP_USER:
SMTP_PASSWORD:
# Set the below value if you want to have another base URL apart from your Domain Name
# SURVEY_BASE_URL:
# Set the below value if you have and want to use a custom URL for the links created by the Link Shortener
# SHORT_SURVEY_BASE_URL:
# Uncomment the below and set it to 1 to disable Email Verification for new signups
# EMAIL_VERIFICATION_DISABLED:
@@ -58,6 +68,9 @@ x-environment: &environment
# GOOGLE_CLIENT_ID:
# GOOGLE_CLIENT_SECRET:
# Configure ASSET_PREFIX_URL when you want to ship JS & CSS files from a complete URL instead of the current domain
# ASSET_PREFIX_URL: *asset_prefix_url
services:
postgres:
restart: always

View File

@@ -170,6 +170,10 @@ x-environment: &environment
# You do not need the NEXTAUTH_URL environment variable in Vercel.
NEXTAUTH_URL: "https://$domain_name"
# Formbricks Encryption Key is used to generate encrypted single use URLs for Link Surveys
# You can use: $(openssl rand -base64 16) to generate one
FORMBRICKS_ENCRYPTION_KEY:
# PostgreSQL password
POSTGRES_PASSWORD: postgres
@@ -261,6 +265,11 @@ echo "🚙 Updating NEXTAUTH_SECRET in the Formbricks container..."
nextauth_secret=$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | head -c 32) && sed -i "/NEXTAUTH_SECRET:$/s/NEXTAUTH_SECRET:.*/NEXTAUTH_SECRET: $nextauth_secret/" docker-compose.yml
echo "🚗 NEXTAUTH_SECRET updated successfully!"
echo "🚙 Updating FORMBRICKS_ENCRYPTION_KEY in the Formbricks container..."
formbricks_encryption_key=$(openssl rand -base64 16 | tr -dc 'a-zA-Z0-9' | head -c 16) && sed -i "/FORMBRICKS_ENCRYPTION_KEY:$/s/FORMBRICKS_ENCRYPTION_KEY:.*/FORMBRICKS_ENCRYPTION_KEY: $formbricks_encryption_key/" docker-compose.yml
echo "🚗 FORMBRICKS_ENCRYPTION_KEY updated successfully!"
newgrp docker <<END
docker compose --env-file /dev/null up