diff --git a/.env.example b/.env.example
index 753bf5305e..489410c7e3 100644
--- a/.env.example
+++ b/.env.example
@@ -10,18 +10,13 @@
WEBAPP_URL=http://localhost:3000
-SURVEY_BASE_URL=http://localhost:3000/s
-
# Set this if you want to have a shorter link for surveys
-SHORT_SURVEY_BASE_URL=
+SHORT_URL_BASE=
# Encryption keys
# Please set both for now, we will change this in the future
-# You can use: `openssl rand -base64 16` to generate one
-FORMBRICKS_ENCRYPTION_KEY=
-
-# You can use: `openssl rand -base64 24` to generate one
+# You can use: `openssl rand -hex 32` to generate one
ENCRYPTION_KEY=
##############
@@ -35,7 +30,7 @@ DATABASE_URL='postgresql://postgres:postgres@localhost:5432/formbricks?schema=pu
###############
# @see: https://next-auth.js.org/configuration/options#nextauth_secret
-# You can use: `openssl rand -base64 32` to generate one
+# You can use: `openssl rand -hex 32` to generate one
NEXTAUTH_SECRET=RANDOM_STRING
# Set this to your public-facing URL, e.g., https://example.com
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 4754bfeb63..f8b7d23c3d 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -27,7 +27,7 @@ jobs:
- name: Generate Random NEXTAUTH_SECRET
run: |
- SECRET=$(openssl rand -base64 24)
+ SECRET=$(openssl rand -hex 32)
echo "ENCRYPTION_KEY=$SECRET" >> $GITHUB_ENV
- name: Build Formbricks-web
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 5297463caf..51c8d82787 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -27,7 +27,7 @@ jobs:
- name: Generate Random NEXTAUTH_SECRET
run: |
- SECRET=$(openssl rand -base64 24)
+ SECRET=$(openssl rand -hex 32)
echo "ENCRYPTION_KEY=$SECRET" >> $GITHUB_ENV
- name: Lint
diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml
index 32f6d20650..20c372c234 100644
--- a/.github/workflows/release-docker.yml
+++ b/.github/workflows/release-docker.yml
@@ -16,12 +16,12 @@ jobs:
steps:
- name: Generate Random NEXTAUTH_SECRET
run: |
- SECRET=$(openssl rand -hex 16)
+ SECRET=$(openssl rand -hex 32)
echo "NEXTAUTH_SECRET=$SECRET" >> $GITHUB_ENV
- name: Generate Random NEXTAUTH_SECRET
run: |
- SECRET=$(openssl rand -base64 24)
+ SECRET=$(openssl rand -hex 32)
echo "ENCRYPTION_KEY=$SECRET" >> $GITHUB_ENV
- name: Checkout Repo
diff --git a/.gitpod.yml b/.gitpod.yml
index bba02a483d..a7fe60cea2 100644
--- a/.gitpod.yml
+++ b/.gitpod.yml
@@ -10,7 +10,7 @@ tasks:
gp sync-await init &&
turbo --filter "@formbricks/demo" go
- - name : website
+ - name: website
command: gp sync-await init && turbo --filter "@formbricks/formbricks-com" dev
- name: Init Formbricks
@@ -34,12 +34,10 @@ tasks:
cp .env.example .env &&
sed -i -r "s#^(WEBAPP_URL=).*#\1 $(gp url 3000)#" .env &&
sed -i -r "s#^(NEXTAUTH_URL=).*#\1 $(gp url 3000)#" .env &&
- RANDOM_FORMBRICKS_ENCRYPTION_KEY=$(openssl rand -base64 16)
- sed -i 's/^FORMBRICKS_ENCRYPTION_KEY=.*/FORMBRICKS_ENCRYPTION_KEY='"$RANDOM_FORMBRICKS_ENCRYPTION_KEY"'/' .env
- RANDOM_ENCRYPTION_KEY=$(openssl rand -base64 24)
+ RANDOM_ENCRYPTION_KEY=$(openssl rand -hex 32)
sed -i 's/^ENCRYPTION_KEY=.*/ENCRYPTION_KEY='"$RANDOM_ENCRYPTION_KEY"'/' .env
turbo --filter "@formbricks/web" go
-
+
image:
file: .gitpod.Dockerfile
@@ -62,7 +60,7 @@ ports:
- port: 8025
visibility: public
onOpen: open-browser
-
+
github:
prebuilds:
master: true
@@ -77,4 +75,4 @@ vscode:
- "dbaeumer.vscode-eslint"
- "esbenp.prettier-vscode"
- "Prisma.prisma"
- - "yzhang.markdown-all-in-one"
\ No newline at end of file
+ - "yzhang.markdown-all-in-one"
diff --git a/apps/formbricks-com/app/docs/contributing/setup/page.mdx b/apps/formbricks-com/app/docs/contributing/setup/page.mdx
index 6ddf3fbc29..ab7fbd2037 100644
--- a/apps/formbricks-com/app/docs/contributing/setup/page.mdx
+++ b/apps/formbricks-com/app/docs/contributing/setup/page.mdx
@@ -1,6 +1,7 @@
export const meta = {
title: "Formbricks Development Setup: Complete Guide to Local Environment Configuration for Dev",
- description: "Step-by-step guide to setting up your local development environment for Formbricks. Includes installing essential tools like Node.JS, pnpm, and Docker, and accessing the entire Formbricks stack including the Demo app and the main website",
+ description:
+ "Step-by-step guide to setting up your local development environment for Formbricks. Includes installing essential tools like Node.JS, pnpm, and Docker, and accessing the entire Formbricks stack including the Demo app and the main website",
};
#### Contributing
@@ -14,14 +15,15 @@ To get the project running locally on your machine you need to have the followin
- [Docker](https://www.docker.com/) (to run PostgreSQL / MailHog)
1. Clone the project:
-
+
+
```bash
git clone https://github.com/formbricks/formbricks
```
-
+
and move into the directory
@@ -31,48 +33,55 @@ To get the project running locally on your machine you need to have the followin
cd formbricks
```
-
+
+
1. Install Node.JS packages via pnpm. Don't have pnpm? Get it [here](https://pnpm.io/installation)
-
+
+
```bash
pnpm install
```
-
+
+
1. Create a `.env` file based on `.env.example`. It's already preset to work with the docker-compose setup but you can also change values if needed.
-
+
+
```bash
cp .env.example .env
```
-
+
+
1. Generate a secret value mandatory to be set for the key ENCRYPTION_KEY in the .env file. You can use the following command to generate the random string of required length:
-
+
+
```bash
- openssl rand -base64 24
+ openssl rand -hex 32
```
-
+
1. Make sure you have [`Docker`](https://docs.docker.com/compose/) & [`docker-compose`](https://docs.docker.com/compose/) installed and running on your machine. Then run the following command to start the formbricks dev setup:
-
+
+
```bash
pnpm go
```
-
+
This starts the Formbricks main app (plus all its dependencies) as well as the following services using Docker:
@@ -86,6 +95,7 @@ To get the project running locally on your machine you need to have the followin
### Build
To build all apps and packages and check for build errors, run the following command:
+
@@ -98,6 +108,7 @@ pnpm build
### Access Demo app
To run the [Demo app](/docs/contributing/demo), run the following command in a separate terminal window:
+
@@ -112,6 +123,7 @@ You can now access the Demo app on [http://localhost:3002](http://localhost:3002
### Access Formbricks website
If you want to make changes to the Formbricks website, e.g. to update the documentation, run the following command in a separate terminal window:
+
diff --git a/apps/formbricks-com/app/docs/self-hosting/deployment/page.mdx b/apps/formbricks-com/app/docs/self-hosting/deployment/page.mdx
index f2324afd72..a08592a491 100644
--- a/apps/formbricks-com/app/docs/self-hosting/deployment/page.mdx
+++ b/apps/formbricks-com/app/docs/self-hosting/deployment/page.mdx
@@ -8,7 +8,7 @@ export const meta = {
# Self Hosting Formbricks
-At Formbricks, we understand that different users have different needs, and we strive to cater to a wide variety of situations. This is why we currently provide three ways of running our application:
+At Formbricks, we understand that different users have different needs, and we strive to cater to a wide variety of situations. This is why we currently provide two ways of running our application:
1. **Production Instance Setup with Shell Script on Ubuntu**: If you want to quickly set up a production instance of Formbricks on a server running Ubuntu, we've got you covered! This method utilizes a convenient shell script that takes care of everything, including Docker, Postgres DB, and SSL certificate configuration. The shell script will automatically install all the required dependencies and configure your server, making the process a breeze. Visit the [Production Instance Setup with a Bash Script Documentation](/docs/self-hosting/production).
diff --git a/apps/formbricks-com/app/docs/self-hosting/docker/page.mdx b/apps/formbricks-com/app/docs/self-hosting/docker/page.mdx
index 9fc8a70338..f29f2caac0 100644
--- a/apps/formbricks-com/app/docs/self-hosting/docker/page.mdx
+++ b/apps/formbricks-com/app/docs/self-hosting/docker/page.mdx
@@ -21,98 +21,131 @@ Ensure `docker` & `docker compose` are installed on your server/system. Both are
Docker documentation.
-1. **Create a New Directory for Formbricks**
+1. **Create a New Directory for Formbricks**
- Open a terminal and create a new directory for Formbricks, then navigate into this new directory:
-
+ Open a terminal and create a new directory for Formbricks, then navigate into this new directory:
+
+
- ```bash
- mkdir formbricks-quickstart && cd formbricks-quickstart
- ```
+ ```bash
+ mkdir formbricks-quickstart && cd formbricks-quickstart
+ ```
-
-
-2. **Download the Docker-Compose File**
+
- Download the docker-compose file directly from the Formbricks repository:
-
+
+
+2. **Download the Docker-Compose File**
+
+ Download the docker-compose file directly from the Formbricks repository:
+
+
- ```bash
- curl -o docker-compose.yml https://raw.githubusercontent.com/formbricks/formbricks/main/docker/docker-compose.yml
- ```
+ ```bash
+ curl -o docker-compose.yml https://raw.githubusercontent.com/formbricks/formbricks/main/docker/docker-compose.yml
+ ```
-
-
-3. **Generate NextAuth Secret**
+
- Next, you need to generate a NextAuth secret. This will be used for session signing and encryption. The `sed` command below generates a random string using `openssl`, then replaces the `NEXTAUTH_SECRET:` placeholder in the `docker-compose.yml` file with this generated secret:
-
+
+
+3. **Generate NextAuth Secret**
+
+ Next, you need to generate a NextAuth secret. This will be used for session signing and encryption. The `sed` command below generates a random string using `openssl`, then replaces the `NEXTAUTH_SECRET:` placeholder in the `docker-compose.yml` file with this generated secret:
+
+
- ```bash
- sed -i "/NEXTAUTH_SECRET:$/s/NEXTAUTH_SECRET:.*/NEXTAUTH_SECRET: $(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | head -c 32)/" docker-compose.yml
- ```
+ ```bash
+ sed -i "/NEXTAUTH_SECRET:$/s/NEXTAUTH_SECRET:.*/NEXTAUTH_SECRET: $(openssl rand -hex 32)/" docker-compose.yml
+ ```
-
-
-4. **Start the Docker Setup**
+
- You're now ready to start the Formbricks Docker setup. The following command will start Formbricks together with a postgreSQL database using Docker Compose:
+
+
+4. **Generate Encryption Key**
+
+ Next, you need to generate an Encryption Key. This will be used for authenticating and verifying 2 Factor Authentication. The `sed` command below generates a random string using `openssl`, then replaces the `ENCRYPTION_KEY:` placeholder in the `docker-compose.yml` file with this generated secret:
+
+
+
+
+ ```bash
+ sed -i "/ENCRYPTION_KEY:$/s/ENCRYPTION_KEY:.*/ENCRYPTION_KEY: $(openssl rand -hex 32)/" docker-compose.yml
+ ```
+
+
+
+
+
+5. **Start the Docker Setup**
+
+ You're now ready to start the Formbricks Docker setup. The following command will start Formbricks together with a postgreSQL database using Docker Compose:
- We pass the `--env-file /dev/null` flag to docker-compose to prevent it from reading the .env file. This is because we're using environment variables directly in the docker-compose.yml file as the env file is currently in a format not well recognised by docker systems.
- ```bash
- docker compose --env-file /dev/null up -d
- ```
+```bash
+ docker compose up -d
+```
The `-d` flag will run the containers in detached mode, meaning they'll run in the background.
-5. **Visit Formbricks in Your Browser**
+6. **Visit Formbricks in Your Browser**
After starting the Docker setup, visit http://localhost:3000 in your browser to interact with the Formbricks application. The first time you access this page, you'll be greeted by a setup wizard. Follow the prompts to define your first user and get started.
## Updating Formbricks
-1. Stop the Formbricks stack
-
+1. Stop the Formbricks stack
+
+
- ```bash
- docker compose down
- ```
+ ```bash
+ docker compose down
+ ```
-
-
-2. Pull the latest changes
-
+
+
+
+
+2. Pull the latest changes
+
+
- ```bash
- docker compose pull
- ```
+ ```bash
+ docker compose pull
+ ```
-
-
-3. Update env vars as necessary in the docker-compose file.
-4. Re-start the Formbricks stack
-
+
+
+
+
+3. Update env vars as necessary in the docker-compose file.
+4. Re-start the Formbricks stack
+
+
- ```bash
- docker compose --env-file /dev/null up -d
- ```
+ ```bash
+ docker compose up -d
+ ```
+
+
+
+
-
-
## Debugging
If you encounter any issues, you can check the logs of the container with:
+
@@ -178,40 +211,39 @@ To edit any of the variables that start with `NEXT_PUBLIC_`, you need to rebuild
These variables can be provided at the runtime i.e. in your docker-compose file.
-| Variable | Description | Required | Default |
-| --------------------------- | -------------------------------------------------------------------------------------------- | ------------------------------------------------------- | ----------------------------------------------------------------------- |
-| WEBAPP_URL | Base URL of the site. | required | `http://localhost:3000` |
-| SURVEY_BASE_URL | Base URL of the link surveys. | required | `http://localhost:3000/s/` |
-| DATABASE_URL | Database URL with credentials. | required | `postgresql://postgres:postgres@postgres:5432/formbricks?schema=public` |
-| NEXTAUTH_SECRET | Secret for NextAuth, used for session signing and encryption. | required | (Generated by the user) |
-| NEXTAUTH_URL | Location of the auth server. By default, this is the Formbricks docker instance itself. | required | `http://localhost:3000` |
-| PRIVACY_URL | URL for privacy policy. | optional | |
-| TERMS_URL | URL for terms of service. | optional | |
-| IMPRINT_URL | URL for imprint. | optional | |
-| SIGNUP_DISABLED | Disables the ability for new users to create an account if set to `1`. | optional | |
-| PASSWORD_RESET_DISABLED | Disables password reset functionality if set to `1`. | optional | |
-| EMAIL_VERIFICATION_DISABLED | Disables email verification if set to `1`. | optional | |
-| INVITE_DISABLED | Disables the ability for invited users to create an account if set to `1`. | optional | |
-| MAIL_FROM | Email address to send emails from. | optional (required if email services are to be enabled) | |
-| SMTP_HOST | Host URL of your SMTP server. | optional (required if email services are to be enabled) | |
-| SMTP_PORT | Host Port of your SMTP server. | optional (required if email services are to be enabled) | |
-| SMTP_USER | Username for your SMTP Server. | optional (required if email services are to be enabled) | |
-| SMTP_PASSWORD | Password for your SMTP Server. | optional (required if email services are to be enabled) | |
-| SMTP_SECURE_ENABLED | SMTP secure connection. For using TLS, set to `1` else to `0`. | optional (required if email services are to be enabled) | |
-| GITHUB_AUTH_ENABLED | Enables GitHub login if set to `1`. | optional | |
-| GOOGLE_AUTH_ENABLED | Enables Google login if set to `1`. | optional | |
-| GITHUB_ID | Client ID for GitHub. | optional (required if GitHub auth is enabled) | |
-| GITHUB_SECRET | Secret for GitHub. | optional (required if GitHub auth is enabled) | |
-| GOOGLE_CLIENT_ID | Client ID for Google. | optional (required if Google auth is enabled) | |
-| GOOGLE_CLIENT_SECRET | Secret for Google. | optional (required if Google auth is enabled) | |
-| CRON_SECRET | API Secret for running cron jobs. | optional | |
-| STRIPE_SECRET_KEY | Secret key for Stripe integration. | optional | |
-| STRIPE_WEBHOOK_SECRET | Webhook secret for Stripe integration. | optional | |
-| TELEMETRY_DISABLED | Disables telemetry if set to `1`. | optional | |
-| INSTANCE_ID | Instance ID for Formbricks Cloud to be sent to Telemetry. | optional | |
-| INTERNAL_SECRET | Internal Secret (Currently we overwrite the value with a random value). | optional | |
-| IS_FORMBRICKS_CLOUD | Uses Formbricks Cloud if set to `1` | optional | |
-| DEFAULT_BRAND_COLOR | Default brand color for your app (Can be overwritten from the UI as well). | optional | `#64748b` |
+| Variable | Description | Required | Default |
+| --------------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------------- | ----------------------------------------------------------------------- |
+| WEBAPP_URL | Base URL of the site. | required | `http://localhost:3000` |
+| DATABASE_URL | Database URL with credentials. | required | `postgresql://postgres:postgres@postgres:5432/formbricks?schema=public` |
+| NEXTAUTH_SECRET | Secret for NextAuth, used for session signing and encryption. | required | (Generated by the user) |
+| NEXTAUTH_URL | Location of the auth server. By default, this is the Formbricks docker instance itself. | required | `http://localhost:3000` |
+| PRIVACY_URL | URL for privacy policy. | optional | |
+| TERMS_URL | URL for terms of service. | optional | |
+| IMPRINT_URL | URL for imprint. | optional | |
+| SIGNUP_DISABLED | Disables the ability for new users to create an account if set to `1`. | optional | |
+| PASSWORD_RESET_DISABLED | Disables password reset functionality if set to `1`. | optional | |
+| EMAIL_VERIFICATION_DISABLED | Disables email verification if set to `1`. | optional | |
+| INVITE_DISABLED | Disables the ability for invited users to create an account if set to `1`. | optional | |
+| MAIL_FROM | Email address to send emails from. | optional (required if email services are to be enabled) | |
+| SMTP_HOST | Host URL of your SMTP server. | optional (required if email services are to be enabled) | |
+| SMTP_PORT | Host Port of your SMTP server. | optional (required if email services are to be enabled) | |
+| SMTP_USER | Username for your SMTP Server. | optional (required if email services are to be enabled) | |
+| SMTP_PASSWORD | Password for your SMTP Server. | optional (required if email services are to be enabled) | |
+| SMTP_SECURE_ENABLED | SMTP secure connection. For using TLS, set to `1` else to `0`. | optional (required if email services are to be enabled) | |
+| GITHUB_AUTH_ENABLED | Enables GitHub login if set to `1`. | optional | |
+| GOOGLE_AUTH_ENABLED | Enables Google login if set to `1`. | optional | |
+| GITHUB_ID | Client ID for GitHub. | optional (required if GitHub auth is enabled) | |
+| GITHUB_SECRET | Secret for GitHub. | optional (required if GitHub auth is enabled) | |
+| GOOGLE_CLIENT_ID | Client ID for Google. | optional (required if Google auth is enabled) | |
+| GOOGLE_CLIENT_SECRET | Secret for Google. | optional (required if Google auth is enabled) | |
+| CRON_SECRET | API Secret for running cron jobs. | optional | |
+| STRIPE_SECRET_KEY | Secret key for Stripe integration. | optional | |
+| STRIPE_WEBHOOK_SECRET | Webhook secret for Stripe integration. | optional | |
+| TELEMETRY_DISABLED | Disables telemetry if set to `1`. | optional | |
+| INSTANCE_ID | Instance ID for Formbricks Cloud to be sent to Telemetry. | optional | |
+| INTERNAL_SECRET | Internal Secret (Currently we overwrite the value with a random value). | optional | |
+| IS_FORMBRICKS_CLOUD | Uses Formbricks Cloud if set to `1` | optional | |
+| DEFAULT_BRAND_COLOR | Default brand color for your app (Can be overwritten from the UI as well). | optional | `#64748b` |
## Build-time Variables
@@ -232,5 +264,4 @@ These variables must be provided at the time of the docker build and would requi
| NEXT_PUBLIC_FORMBRICKS_COM_DOCS_FEEDBACK_SURVEY_ID | Survey ID for the feedback survey on the docs site. | optional | |
| NEXT_PUBLIC_FORMBRICKS_COM_API_HOST | Host for the Formbricks API. | optional | |
-
Still facing issues? [Join our Discord!](https://formbricks.com/discord) and we'd be glad to assist you!
diff --git a/apps/formbricks-com/app/docs/self-hosting/migrating-to-1.1/page.mdx b/apps/formbricks-com/app/docs/self-hosting/migration-guide/page.mdx
similarity index 65%
rename from apps/formbricks-com/app/docs/self-hosting/migrating-to-1.1/page.mdx
rename to apps/formbricks-com/app/docs/self-hosting/migration-guide/page.mdx
index 082549ef46..2e5cb0064c 100644
--- a/apps/formbricks-com/app/docs/self-hosting/migrating-to-1.1/page.mdx
+++ b/apps/formbricks-com/app/docs/self-hosting/migration-guide/page.mdx
@@ -6,33 +6,53 @@ export const meta = {
#### Self-Hosting
-# Migrating to v1.1
+# Migration Guide
+
+## v1.1 -> v1.2
+
+Formbricks v1.2 ships a lot of features targeting our Link Surveys. We have also improved our security posture to be as robust as ever. However, it also comes with a few breaking changes specifically with the environment variables. This guide will help you migrate your existing Formbricks instance to v1.2 without any hassles or build errors.
+
+### New Environment Variables
+
+| Environment Variable | Required | Recommended Generation | Comments |
+| -------------------- | -------- | ------------------------------ | ----------------------------------------------------------- |
+| ENCRYPTION_KEY | true | `openssl rand -hex 32` | Needed for 2 Factor Authentication |
+| SHORT_URL_BASE | false | `` | Needed if you want to enable shorter links for Link Surveys |
+| ASSET_PREFIX_URL | false | `` | Needed if you have a separate URL for hosted assets |
+
+### Deprecated / Removed Environment Variables
+
+| Environment Variable | Comments |
+| -------------------- | ------------------------------------------------------------------------- |
+| SURVEY_BASE_URL | The WEBAPP_URL is now used to determine the survey base url in all places |
+
+## v1.0 -> v1.1
Formbricks v1.1 includes a lot of new features and improvements. However, it also comes with a few breaking changes specifically with the environment variables. This guide will help you migrate your existing Formbricks instance to v1.1 without losing any data.
-## Changes in .env
-
### Renamed Environment Variables
+
This was introduced because we got a lot of requests from our users for the ability to define some common environment variables at runtime itself i.e. without having to rebuild the image for the changes to take effect.
-This is now possible with v1.1. However, due to Next.JS best practices, we had to deprecate the prefix **NEXT_PUBLIC_** in the following environment variables:
+This is now possible with v1.1. However, due to Next.JS best practices, we had to deprecate the prefix **NEXT*PUBLIC*** in the following environment variables:
| till v1.0 | v1.1 |
| ------------------------------------------- | --------------------------- |
-| **NEXT_PUBLIC_**EMAIL_VERIFICATION_DISABLED | EMAIL_VERIFICATION_DISABLED |
-| **NEXT_PUBLIC_**PASSWORD_RESET_DISABLED | PASSWORD_RESET_DISABLED |
-| **NEXT_PUBLIC_**SIGNUP_DISABLED | SIGNUP_DISABLED |
-| **NEXT_PUBLIC_**INVITE_DISABLED | INVITE_DISABLED |
-| **NEXT_PUBLIC_**PRIVACY_URL | PRIVACY_URL |
-| **NEXT_PUBLIC_**TERMS_URL | TERMS_URL |
-| **NEXT_PUBLIC_**IMPRINT_URL | IMPRINT_URL |
-| **NEXT_PUBLIC_**GITHUB_AUTH_ENABLED | GITHUB_AUTH_ENABLED |
-| **NEXT_PUBLIC_**GOOGLE_AUTH_ENABLED | GOOGLE_AUTH_ENABLED |
-| **NEXT_PUBLIC_**WEBAPP_URL | WEBAPP_URL |
-| **NEXT_PUBLIC_**IS_FORMBRICKS_CLOUD | IS_FORMBRICKS_CLOUD |
-| **NEXT_PUBLIC_**SURVEY_BASE_URL | SURVEY_BASE_URL |
+| **NEXT*PUBLIC***EMAIL_VERIFICATION_DISABLED | EMAIL_VERIFICATION_DISABLED |
+| **NEXT*PUBLIC***PASSWORD_RESET_DISABLED | PASSWORD_RESET_DISABLED |
+| **NEXT*PUBLIC***SIGNUP_DISABLED | SIGNUP_DISABLED |
+| **NEXT*PUBLIC***INVITE_DISABLED | INVITE_DISABLED |
+| **NEXT*PUBLIC***PRIVACY_URL | PRIVACY_URL |
+| **NEXT*PUBLIC***TERMS_URL | TERMS_URL |
+| **NEXT*PUBLIC***IMPRINT_URL | IMPRINT_URL |
+| **NEXT*PUBLIC***GITHUB_AUTH_ENABLED | GITHUB_AUTH_ENABLED |
+| **NEXT*PUBLIC***GOOGLE_AUTH_ENABLED | GOOGLE_AUTH_ENABLED |
+| **NEXT*PUBLIC***WEBAPP_URL | WEBAPP_URL |
+| **NEXT*PUBLIC***IS_FORMBRICKS_CLOUD | IS_FORMBRICKS_CLOUD |
+| **NEXT*PUBLIC***SURVEY_BASE_URL | SURVEY_BASE_URL |
-Please note that their values and the logic remains exactly the same. Only the prefix has been deprecated. The other environment variables remain the same as well.
+ Please note that their values and the logic remains exactly the same. Only the prefix has been deprecated.
+ The other environment variables remain the same as well.
### Deprecated Environment Variables
@@ -44,13 +64,15 @@ Please note that their values and the logic remains exactly the same. Only the p
- **NEXT_PUBLIC_WEBAPP_URL**: Was used for the same purpose as WEBAPP_URL, but from v1.1, you can just set the WEBAPP_URL environment variable.
- **PRISMA_GENERATE_DATAPROXY**: Was used to tell Prisma that it should generate the runtime for Dataproxy usage. But its officially deprecated now.
-## Helper Shell Script
+### Helper Shell Script
+
For a seamless migration, below is a shell script for your self-hosted instance that will automatically update your environment variables to be compliant with the new naming conventions.
### Docker & Single Script Setup
Now that these variables can be defined at runtime, you can append them inside your `x-environment` in the `docker-compose.yml` itself.
For a more detailed guide on these environment variables, please refer to the [Important Runtime Variables](/docs/self-hosting/docker#important-run-time-variables) section.
+
```yaml {{ title: 'docker-compose.yml' }}
@@ -65,7 +87,7 @@ x-environment: &environment
# NextJS Auth
# @see: https://next-auth.js.org/configuration/options#nextauth_secret
- # You can use: `openssl rand -base64 32` to generate one
+ # You can use: `openssl rand -hex 32` to generate one
NEXTAUTH_SECRET:
# Set this to your public-facing URL, e.g., https://example.com
@@ -106,7 +128,7 @@ x-environment: &environment
# Uncomment the below and set to 1 if you want to enable GitHub OAuth
# GITHUB_AUTH_ENABLED:
- # GITHUB_ID:
+ # GITHUB_ID:
# GITHUB_SECRET:
# Uncomment the below and set to 1 if you want to enable Google OAuth
@@ -117,4 +139,5 @@ x-environment: &environment
```
-Did we miss something? Are you still facing issues migrating your app? [Join our Discord!](https://formbricks.com/discord) We'd be happy to help!
\ No newline at end of file
+Did we miss something? Are you still facing issues migrating your app? [Join our Discord!](https://formbricks.com/discord) We'd be happy to help!
+```
diff --git a/apps/formbricks-com/components/docs/Navigation.tsx b/apps/formbricks-com/components/docs/Navigation.tsx
index 673f7cd2ca..0d4bc88831 100644
--- a/apps/formbricks-com/components/docs/Navigation.tsx
+++ b/apps/formbricks-com/components/docs/Navigation.tsx
@@ -246,7 +246,8 @@ export const navigation: Array = [
{ title: "Deployment", href: "/docs/self-hosting/deployment" },
{ title: "Production", href: "/docs/self-hosting/production" },
{ title: "Docker", href: "/docs/self-hosting/docker" },
- { title: "Migration to v1.1", href: "/docs/self-hosting/migrating-to-1.1" },
+ { title: "From Source", href: "/docs/self-hosting/from-source" },
+ { title: "Migration Guide", href: "/docs/self-hosting/migration-guide" },
],
},
{
diff --git a/apps/formbricks-com/next.config.mjs b/apps/formbricks-com/next.config.mjs
index 80bfae9d00..5e42822e9c 100644
--- a/apps/formbricks-com/next.config.mjs
+++ b/apps/formbricks-com/next.config.mjs
@@ -145,12 +145,16 @@ const nextConfig = {
destination: "https://app.formbricks.com/s/clhys1p9r001cpr0hu65rwh17",
permanent: true,
},
+ {
+ source: "/docs/self-hosting/migrating-to-1.1",
+ destination: "/docs/self-hosting/migration-guide",
+ permanent: true,
+ },
{
source: "/cla",
destination: "https://formbricks.com/clmyhzfrymr4ko00hycsg1tvx",
permanent: true,
},
-
];
},
async rewrites() {
diff --git a/apps/web/app/(app)/environments/[environmentId]/actions.ts b/apps/web/app/(app)/environments/[environmentId]/actions.ts
index d11197298b..5e6b0378af 100644
--- a/apps/web/app/(app)/environments/[environmentId]/actions.ts
+++ b/apps/web/app/(app)/environments/[environmentId]/actions.ts
@@ -2,7 +2,7 @@
import { prisma } from "@formbricks/database";
import { authOptions } from "@formbricks/lib/authOptions";
-import { SHORT_SURVEY_BASE_URL, SURVEY_BASE_URL } from "@formbricks/lib/constants";
+import { SHORT_URL_BASE, WEBAPP_URL } from "@formbricks/lib/constants";
import { hasUserEnvironmentAccess } from "@formbricks/lib/environment/auth";
import { createMembership } from "@formbricks/lib/membership/service";
import { createProduct } from "@formbricks/lib/product/service";
@@ -19,13 +19,13 @@ export const createShortUrlAction = async (url: string) => {
const session = await getServerSession(authOptions);
if (!session) throw new AuthenticationError("Not authenticated");
- const regexPattern = new RegExp("^" + SURVEY_BASE_URL);
+ const regexPattern = new RegExp("^" + WEBAPP_URL);
const isValidUrl = regexPattern.test(url);
if (!isValidUrl) throw new Error("Only Formbricks survey URLs are allowed");
const shortUrl = await createShortUrl(url);
- const fullShortUrl = SHORT_SURVEY_BASE_URL + shortUrl.id;
+ const fullShortUrl = SHORT_URL_BASE + "/" + shortUrl.id;
return fullShortUrl;
};
diff --git a/apps/web/app/(app)/environments/[environmentId]/components/EnvironmentsNavbar.tsx b/apps/web/app/(app)/environments/[environmentId]/components/EnvironmentsNavbar.tsx
index 778206e943..41d8c5c3bb 100644
--- a/apps/web/app/(app)/environments/[environmentId]/components/EnvironmentsNavbar.tsx
+++ b/apps/web/app/(app)/environments/[environmentId]/components/EnvironmentsNavbar.tsx
@@ -1,7 +1,7 @@
export const revalidate = REVALIDATION_INTERVAL;
import Navigation from "@/app/(app)/environments/[environmentId]/components/Navigation";
-import { IS_FORMBRICKS_CLOUD, REVALIDATION_INTERVAL, SURVEY_BASE_URL } from "@formbricks/lib/constants";
+import { IS_FORMBRICKS_CLOUD, REVALIDATION_INTERVAL, WEBAPP_URL } from "@formbricks/lib/constants";
import { getEnvironment, getEnvironments } from "@formbricks/lib/environment/service";
import { getProducts } from "@formbricks/lib/product/service";
import { getTeamByEnvironmentId, getTeamsByUserId } from "@formbricks/lib/team/service";
@@ -43,7 +43,7 @@ export default async function EnvironmentsNavbar({ environmentId, session }: Env
environments={environments}
session={session}
isFormbricksCloud={IS_FORMBRICKS_CLOUD}
- surveyBaseUrl={SURVEY_BASE_URL}
+ webAppUrl={WEBAPP_URL}
/>
);
}
diff --git a/apps/web/app/(app)/environments/[environmentId]/components/Navigation.tsx b/apps/web/app/(app)/environments/[environmentId]/components/Navigation.tsx
index 6feb15aa6e..1bc258b12f 100644
--- a/apps/web/app/(app)/environments/[environmentId]/components/Navigation.tsx
+++ b/apps/web/app/(app)/environments/[environmentId]/components/Navigation.tsx
@@ -62,7 +62,7 @@ interface NavigationProps {
products: TProduct[];
environments: TEnvironment[];
isFormbricksCloud: boolean;
- surveyBaseUrl: string;
+ webAppUrl: string;
}
export default function Navigation({
@@ -73,7 +73,7 @@ export default function Navigation({
products,
environments,
isFormbricksCloud,
- surveyBaseUrl,
+ webAppUrl,
}: NavigationProps) {
const router = useRouter();
const pathname = usePathname();
@@ -495,7 +495,7 @@ export default function Navigation({
setShowLinkShortenerModal(val)}
- surveyBaseUrl={surveyBaseUrl}
+ webAppUrl={webAppUrl}
/>
)}
diff --git a/apps/web/app/(app)/environments/[environmentId]/components/UrlShortenerModal.tsx b/apps/web/app/(app)/environments/[environmentId]/components/UrlShortenerModal.tsx
index 646b5441ec..25cb1ffa6f 100644
--- a/apps/web/app/(app)/environments/[environmentId]/components/UrlShortenerModal.tsx
+++ b/apps/web/app/(app)/environments/[environmentId]/components/UrlShortenerModal.tsx
@@ -12,14 +12,14 @@ import { createShortUrlAction } from "../actions";
type UrlShortenerModalProps = {
open: boolean;
setOpen: (v: boolean) => void;
- surveyBaseUrl: string;
+ webAppUrl: string;
};
type UrlShortenerFormDataProps = {
url: string;
};
type UrlValidationState = "default" | "valid" | "invalid";
-export default function UrlShortenerModal({ open, setOpen, surveyBaseUrl }: UrlShortenerModalProps) {
+export default function UrlShortenerModal({ open, setOpen, webAppUrl }: UrlShortenerModalProps) {
const [urlValidationState, setUrlValidationState] = useState("default");
const [shortUrl, setShortUrl] = useState("");
const {
@@ -41,7 +41,7 @@ export default function UrlShortenerModal({ open, setOpen, surveyBaseUrl }: UrlS
return;
}
- const regexPattern = new RegExp("^" + surveyBaseUrl);
+ const regexPattern = new RegExp("^" + webAppUrl);
const isValid = regexPattern.test(value);
if (!isValid) {
setUrlValidationState("invalid");
@@ -99,7 +99,7 @@ export default function UrlShortenerModal({ open, setOpen, surveyBaseUrl }: UrlS
diff --git a/apps/web/app/i/[shortUrlId]/loading.tsx b/apps/web/app/[shortUrlId]/loading.tsx
similarity index 100%
rename from apps/web/app/i/[shortUrlId]/loading.tsx
rename to apps/web/app/[shortUrlId]/loading.tsx
diff --git a/apps/web/app/i/[shortUrlId]/page.tsx b/apps/web/app/[shortUrlId]/page.tsx
similarity index 100%
rename from apps/web/app/i/[shortUrlId]/page.tsx
rename to apps/web/app/[shortUrlId]/page.tsx
diff --git a/apps/web/app/s/[surveyId]/page.tsx b/apps/web/app/s/[surveyId]/page.tsx
index 77703d432d..23cf4fd18f 100644
--- a/apps/web/app/s/[surveyId]/page.tsx
+++ b/apps/web/app/s/[surveyId]/page.tsx
@@ -2,7 +2,7 @@ export const revalidate = REVALIDATION_INTERVAL;
import LinkSurvey from "@/app/s/[surveyId]/components/LinkSurvey";
import SurveyInactive from "@/app/s/[surveyId]/components/SurveyInactive";
-import { REVALIDATION_INTERVAL, WEBAPP_URL, SURVEY_BASE_URL } from "@formbricks/lib/constants";
+import { REVALIDATION_INTERVAL, WEBAPP_URL } from "@formbricks/lib/constants";
import { getOrCreatePersonByUserId } from "@formbricks/lib/person/service";
import { getProductByEnvironmentId } from "@formbricks/lib/product/service";
import { getSurvey } from "@formbricks/lib/survey/service";
@@ -56,7 +56,7 @@ export async function generateMetadata({ params }: LinkSurveyPageProps): Promise
openGraph: {
title: survey.name,
description: "Create your own survey like this with Formbricks' open source survey suite.",
- url: `${SURVEY_BASE_URL}/${survey.id}`,
+ url: `${WEBAPP_URL}/${survey.id}`,
siteName: "",
images: [ogImgURL],
locale: "en_US",
diff --git a/apps/web/env.mjs b/apps/web/env.mjs
index 8367da8ab2..64243ef201 100644
--- a/apps/web/env.mjs
+++ b/apps/web/env.mjs
@@ -9,8 +9,8 @@ export const env = createEnv({
server: {
WEBAPP_URL: z.string().url().optional(),
DATABASE_URL: z.string().url(),
- ENCRYPTION_KEY: z.string().length(32),
- FORMBRICKS_ENCRYPTION_KEY: z.string().length(24).or(z.string().length(0)),
+ ENCRYPTION_KEY: z.string().length(64).or(z.string().length(32)),
+ FORMBRICKS_ENCRYPTION_KEY: z.string().length(24).or(z.string().length(0)).optional(),
NEXTAUTH_SECRET: z.string().min(1),
NEXTAUTH_URL: z.string().url().optional(),
MAIL_FROM: z.string().email().optional(),
@@ -50,8 +50,7 @@ export const env = createEnv({
INVITE_DISABLED: z.enum(["1", "0"]).optional(),
IS_FORMBRICKS_CLOUD: z.enum(["1", "0"]).optional(),
VERCEL_URL: z.string().optional(),
- SURVEY_BASE_URL: z.string().url().optional(),
- SHORT_SURVEY_BASE_URL: z.string().url().optional().or(z.string().length(0)),
+ SHORT_URL_BASE: z.string().url().optional().or(z.string().length(0)),
GOOGLE_SHEETS_CLIENT_ID: z.string().optional(),
GOOGLE_SHEETS_CLIENT_SECRET: z.string().optional(),
GOOGLE_SHEETS_REDIRECT_URL: z.string().optional(),
@@ -94,7 +93,6 @@ export const env = createEnv({
WEBAPP_URL: process.env.WEBAPP_URL,
DATABASE_URL: process.env.DATABASE_URL,
ENCRYPTION_KEY: process.env.ENCRYPTION_KEY,
- FORMBRICKS_ENCRYPTION_KEY: process.env.FORMBRICKS_ENCRYPTION_KEY,
NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET,
NEXTAUTH_URL: process.env.NEXTAUTH_URL,
MAIL_FROM: process.env.MAIL_FROM,
@@ -134,8 +132,7 @@ export const env = createEnv({
NEXT_PUBLIC_POSTHOG_API_HOST: process.env.NEXT_PUBLIC_POSTHOG_API_HOST,
FORMBRICKS_ENCRYPTION_KEY: process.env.FORMBRICKS_ENCRYPTION_KEY,
VERCEL_URL: process.env.VERCEL_URL,
- SURVEY_BASE_URL: process.env.SURVEY_BASE_URL,
- SHORT_SURVEY_BASE_URL: process.env.SHORT_SURVEY_BASE_URL,
+ SHORT_URL_BASE: process.env.SHORT_URL_BASE,
NEXT_PUBLIC_SENTRY_DSN: process.env.NEXT_PUBLIC_SENTRY_DSN,
AZUREAD_AUTH_ENABLED: process.env.AZUREAD_AUTH_ENABLED,
AZUREAD_CLIENT_ID: process.env.AZUREAD_CLIENT_ID,
diff --git a/apps/web/next.config.mjs b/apps/web/next.config.mjs
index 10a2f08a3b..026e7ab912 100644
--- a/apps/web/next.config.mjs
+++ b/apps/web/next.config.mjs
@@ -34,9 +34,9 @@ const nextConfig = {
async redirects() {
return [
{
- source: "/api/v1/responses",
- destination: "/api/v1/management/responses",
- permanent: true,
+ source: "/i/:path*",
+ destination: "/:path*",
+ permanent: false,
},
{
source: "/api/v1/surveys",
@@ -48,6 +48,11 @@ const nextConfig = {
destination: "/api/v1/management/me",
permanent: true,
},
+ {
+ source: "/api/v1/me",
+ destination: "/api/v1/management/me",
+ permanent: true,
+ },
];
},
async headers() {
diff --git a/docker-compose.yml b/docker-compose.yml
index b5d14821a7..f03676968c 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -11,32 +11,32 @@ x-database-url: &database_url postgresql://postgres:postgres@postgres:5432/formb
# NextJS Auth
# @see: https://next-auth.js.org/configuration/options#nextauth_secret
-# You can use: `openssl rand -base64 32` to generate one
-x-nextauth-secret: &nextauth_secret luJthrnoDpVgGakjVYlccsZ1FdlwxIWogWIsrxzoQ6E=
+# You can use: `openssl rand -hex 32` to generate one
+x-nextauth-secret: &nextauth_secret 10ee8bc17d40a457544cf373affbab16
# Set this to your public-facing URL, e.g., https://example.com
# You do not need the NEXTAUTH_URL environment variable in Vercel.
x-nextauth-url: &nextauth_url http://localhost:3000
# Encryption key
-# You can use: `openssl rand -base64 16` to generate one
-x-formbricks-encryption-key: &formbricks_encryption_key
- # Necessary if email verification and password reset are enabled.
- # See further below if you want to disable these features.
+# You can use: `openssl rand -hex 32` to generate one
+x-encryption-key: &encryption_key 1b3d888592454d23b520040950654669
x-mail-from: &mail_from
x-smtp-host: &smtp_host
x-smtp-port: &smtp_port # Enable SMTP_SECURE_ENABLED for TLS (port 465)
+
x-smtp-secure-enabled: &smtp_secure_enabled
x-smtp-user: &smtp_user
-x-smtp-password: &smtp_password # Set the below value to your public-facing URL, e.g., https://example.com
+x-smtp-password: &smtp_password
+ # Set the below value to your public-facing URL, e.g., https://example.com
-x-survey-base-url: &survey_base_url http://localhost:3000/s
+ # Set the below value if you have and want to share a shorter base URL than the x-survey-base-url
+
+x-short-url-base:
+ &short_url_base # Email Verification. If you enable Email Verification you have to setup SMTP-Settings, too.
-# Set the below value if you have and want to share a shorter base URL than the x-survey-base-url
-x-short-survey-base-url:
- &short_survey_base_url # Email Verification. If you enable Email Verification you have to setup SMTP-Settings, too.
x-email-verification-disabled: &email_verification_disabled 1
@@ -54,21 +54,27 @@ x-privacy-url: &privacy_url
x-terms-url: &terms_url
x-imprint-url: &imprint_url # Configure Github Login
+
x-github-auth-enabled: &github_auth_enabled 0
x-github-id: &github_id
x-github-secret: &github_secret # Configure Google Login
+
x-google-auth-enabled: &google_auth_enabled 0
x-google-client-id: &google_client_id
x-google-client-secret: &google_client_secret # Disable Sentry warning
+
x-sentry-ignore-api-resolution-error: &sentry_ignore_api_resolution_error # Enable Sentry Error Tracking
+
x-next-public-sentry-dsn: &next_public_sentry_dsn # Cron Secret
+
x-cron-secret:
&cron_secret # Configure ASSET_PREFIX_URL when you want to ship JS & CSS files from a complete URL instead of the current domain
+
x-asset-prefix-url: &asset_prefix_url
services:
@@ -105,9 +111,8 @@ services:
SMTP_SECURE_ENABLED: *smtp_secure_enabled
SMTP_USER: *smtp_user
SMTP_PASSWORD: *smtp_password
- FORMBRICKS_ENCRYPTION_KEY: *formbricks_encryption_key
- SURVEY_BASE_URL: *survey_base_url
- SHORT_SURVEY_BASE_URL: *short_survey_base_url
+ ENCRYPTION_KEY: *encryption_key
+ SHORT_URL_BASE: *short_url_base
PRIVACY_URL: *privacy_url
TERMS_URL: *terms_url
IMPRINT_URL: *imprint_url
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
index 08a0444fac..d20e79efb3 100644
--- a/docker/docker-compose.yml
+++ b/docker/docker-compose.yml
@@ -9,39 +9,36 @@ x-environment: &environment
# NextJS Auth
# @see: https://next-auth.js.org/configuration/options#nextauth_secret
- # You can use: `openssl rand -base64 32` to generate one
+ # You can use: `openssl rand -hex 32` to generate one
NEXTAUTH_SECRET:
# Set this to your public-facing URL, e.g., https://example.com
# 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:
+ # Encryption Key is used for 2FA & Single use URLs for Link Surveys
+ # You can use: $(openssl rand -hex 32) to generate one
+ ENCRYPTION_KEY:
# PostgreSQL password
POSTGRES_PASSWORD: postgres
# Email Configuration
- MAIL_FROM:
- SMTP_HOST:
- SMTP_PORT:
- SMTP_SECURE_ENABLED:
- SMTP_USER:
- SMTP_PASSWORD:
-
- # Set the below value if you want to have another base URL apart from your Domain Name
- # SURVEY_BASE_URL:
+ # MAIL_FROM:
+ # SMTP_HOST:
+ # SMTP_PORT:
+ # SMTP_SECURE_ENABLED:
+ # SMTP_USER:
+ # SMTP_PASSWORD:
# 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:
+ # SHORT_URL_BASE:
- # Uncomment the below and set it to 1 to disable Email Verification for new signups
- # EMAIL_VERIFICATION_DISABLED:
+ # Set the below to 0 to enable Email Verification for new signups (will required Email Configuration)
+ EMAIL_VERIFICATION_DISABLED: 1
- # Uncomment the below and set it to 1 to disable Password Reset
- # PASSWORD_RESET_DISABLED:
+ # Set the below to 0 to enable Password Reset (will required Email Configuration)
+ PASSWORD_RESET_DISABLED: 1
# Uncomment the below and set it to 1 to disable Signups
# SIGNUP_DISABLED:
diff --git a/docker/production.sh b/docker/production.sh
index 4a4126b3b9..b56bd24a41 100644
--- a/docker/production.sh
+++ b/docker/production.sh
@@ -100,7 +100,7 @@ touch acme.json
chmod 600 acme.json
echo "💡 Created acme.json file with correct permissions."
-# Ask the user for their email address
+# Ask the user for their domain name
echo "🔗 Please enter your domain name for the SSL certificate (🚨 do NOT enter the protocol (http/https/etc)):"
read domain_name
@@ -136,143 +136,68 @@ else
smtp_secure_enabled=0
fi
-if [[ -n $mail_from ]]; then
- email_config=$(
- cat <docker-compose.yml
-version: "3.3"
-x-environment: &environment
- environment:
- # The url of your Formbricks instance used in the admin panel
- WEBAPP_URL: "https://$domain_name"
+echo "🚙 Updating docker-compose.yml with your custom inputs..."
+sed -i "/WEBAPP_URL:/s|WEBAPP_URL:.*|WEBAPP_URL: \"https://$domain_name\"|" docker-compose.yml
+sed -i "/NEXTAUTH_URL:/s|NEXTAUTH_URL:.*|NEXTAUTH_URL: \"https://$domain_name\"|" docker-compose.yml
- # PostgreSQL DB for Formbricks to connect to
- DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/formbricks?schema=public"
-
- # NextJS Auth
- # @see: https://next-auth.js.org/configuration/options#nextauth_secret
- # You can use: $(openssl rand -base64 32) to generate one
- NEXTAUTH_SECRET:
-
- # Set this to your public-facing URL, e.g., https://example.com
- # 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
-
- # Email configuration
- $email_config
-
- # 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:
-
- # Uncomment the below and set it to 1 to disable Password Reset
- # PASSWORD_RESET_DISABLED:
-
- # Uncomment the below and set it to 1 to disable Signups
- # SIGNUP_DISABLED:
-
- # Uncomment the below and set it to 1 to disable Invites
- # INVITE_DISABLED:
-
- # Uncomment the below and set a value to have your own Privacy Page URL on the signup & login page
- # PRIVACY_URL:
-
- # Uncomment the below and set a value to have your own Terms Page URL on the auth and the surveys page
- # TERMS_URL:
-
- # Uncomment the below and set a value to have your own Imprint Page URL on the auth and the surveys page
- # IMPRINT_URL:
-
- # Uncomment the below and set to 1 if you want to enable GitHub OAuth
- # GITHUB_AUTH_ENABLED:
- # GITHUB_ID:
- # GITHUB_SECRET:
-
- # Uncomment the below and set to 1 if you want to enable Google OAuth
- # GOOGLE_AUTH_ENABLED:
- # 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
- image: postgres:15-alpine
- volumes:
- - postgres:/var/lib/postgresql/data
- <<: *environment
-
- formbricks:
- restart: always
- image: formbricks/formbricks:latest
- depends_on:
- - postgres
- labels:
- - "traefik.enable=true" # Enable Traefik for this service
- - "traefik.http.routers.formbricks.rule=Host(\`$domain_name\`)" # Replace your_domain_name with your actual domain or IP
- - "traefik.http.routers.formbricks.entrypoints=websecure" # Use the websecure entrypoint (port 443 with TLS)
- - "traefik.http.services.formbricks.loadbalancer.server.port=3000" # Forward traffic to Formbricks on port 3000
- <<: *environment
-
- traefik:
- image: "traefik:v2.7"
- restart: always
- container_name: "traefik"
- depends_on:
- - formbricks
- ports:
- - "80:80"
- - "443:443"
- - "8080:8080"
- volumes:
- - ./traefik.yaml:/traefik.yaml
- - ./acme.json:/acme.json
- - /var/run/docker.sock:/var/run/docker.sock:ro
-
-volumes:
- postgres:
- driver: local
-EOT
-
-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
+nextauth_secret=$(openssl rand -hex 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!"
+encryption_key=$(openssl rand -hex 32) && sed -i "/ENCRYPTION_KEY:$/s/ENCRYPTION_KEY:.*/ENCRYPTION_KEY: $encryption_key/" docker-compose.yml
+echo "🚗 ENCRYPTION_KEY updated successfully!"
+if [[ -n $mail_from ]]; then
+ sed -i "s|# MAIL_FROM:|MAIL_FROM: \"$mail_from\"|" docker-compose.yml
+ sed -i "s|# SMTP_HOST:|SMTP_HOST: \"$smtp_host\"|" docker-compose.yml
+ sed -i "s|# SMTP_PORT:|SMTP_PORT: \"$smtp_port\"|" docker-compose.yml
+ sed -i "s|# SMTP_SECURE_ENABLED:|SMTP_SECURE_ENABLED: $smtp_secure_enabled|" docker-compose.yml
+ sed -i "s|# SMTP_USER:|SMTP_USER: \"$smtp_user\"|" docker-compose.yml
+ sed -i "s|# SMTP_PASSWORD:|SMTP_PASSWORD: \"$smtp_password\"|" docker-compose.yml
+fi
+
+awk -v domain_name="$domain_name" '
+/formbricks:/,/^ *$/ {
+ if ($0 ~ /depends_on:/) {
+ inserting_labels=1
+ }
+ if (inserting_labels && ($0 ~ /ports:/)) {
+ print " labels:"
+ print " - \"traefik.enable=true\" # Enable Traefik for this service"
+ print " - \"traefik.http.routers.formbricks.rule=Host(\`" domain_name "\`)\" # Use your actual domain or IP"
+ print " - \"traefik.http.routers.formbricks.entrypoints=websecure\" # Use the websecure entrypoint (port 443 with TLS)"
+ print " - \"traefik.http.services.formbricks.loadbalancer.server.port=3000\" # Forward traffic to Formbricks on port 3000"
+ inserting_labels=0
+ }
+ print
+ next
+}
+/^volumes:/ {
+ print " traefik:"
+ print " image: \"traefik:v2.7\""
+ print " restart: always"
+ print " container_name: \"traefik\""
+ print " depends_on:"
+ print " - formbricks"
+ print " ports:"
+ print " - \"80:80\""
+ print " - \"443:443\""
+ print " - \"8080:8080\""
+ print " volumes:"
+ print " - ./traefik.yaml:/traefik.yaml"
+ print " - ./acme.json:/acme.json"
+ print " - /var/run/docker.sock:/var/run/docker.sock:ro"
+ print ""
+}
+1
+' docker-compose.yml >tmp.yml && mv tmp.yml docker-compose.yml
+
newgrp docker <