|
| 1 | +export const meta = { |
| 2 | + title: "Migrating Formbricks to v1.1", |
| 3 | + description: |
| 4 | + "Formbricks v1.1 comes with an amazing set of features including the ability to define most environment variables at runtime itself! No need to build the image again! This guide will help you migrate your existing Formbricks instance to v1.1", |
| 5 | +}; |
| 6 | + |
| 7 | +#### Self-Hosting |
| 8 | + |
| 9 | +# Migrating to v1.1 |
| 10 | + |
| 11 | +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. |
| 12 | + |
| 13 | +## Changes in .env |
| 14 | + |
| 15 | +### Renamed Environment Variables |
| 16 | +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. |
| 17 | +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: |
| 18 | + |
| 19 | +| till v1.0 | v1.1 | |
| 20 | +| ------------------------------------------- | --------------------------- | |
| 21 | +| **NEXT_PUBLIC_**EMAIL_VERIFICATION_DISABLED | EMAIL_VERIFICATION_DISABLED | |
| 22 | +| **NEXT_PUBLIC_**PASSWORD_RESET_DISABLED | PASSWORD_RESET_DISABLED | |
| 23 | +| **NEXT_PUBLIC_**SIGNUP_DISABLED | SIGNUP_DISABLED | |
| 24 | +| **NEXT_PUBLIC_**INVITE_DISABLED | INVITE_DISABLED | |
| 25 | +| **NEXT_PUBLIC_**PRIVACY_URL | PRIVACY_URL | |
| 26 | +| **NEXT_PUBLIC_**TERMS_URL | TERMS_URL | |
| 27 | +| **NEXT_PUBLIC_**IMPRINT_URL | IMPRINT_URL | |
| 28 | +| **NEXT_PUBLIC_**GITHUB_AUTH_ENABLED | GITHUB_AUTH_ENABLED | |
| 29 | +| **NEXT_PUBLIC_**GOOGLE_AUTH_ENABLED | GOOGLE_AUTH_ENABLED | |
| 30 | +| **NEXT_PUBLIC_**WEBAPP_URL | WEBAPP_URL | |
| 31 | +| **NEXT_PUBLIC_**IS_FORMBRICKS_CLOUD | IS_FORMBRICKS_CLOUD | |
| 32 | +| **NEXT_PUBLIC_**SURVEY_BASE_URL | SURVEY_BASE_URL | |
| 33 | + |
| 34 | +<Note> |
| 35 | +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. |
| 36 | +</Note> |
| 37 | + |
| 38 | +### Deprecated Environment Variables |
| 39 | + |
| 40 | +- **NEXT_PUBLIC_VERCEL_URL**: Was used as Vercel URL (used instead of WEBAPP_URL), but from v1.1, you can just set the WEBAPP_URL environment variable to your Vercel URL. |
| 41 | +- **RAILWAY_STATIC_URL**: Was used as Railway Static URL (used instead of WEBAPP_URL), but from v1.1, you can just set the WEBAPP_URL environment variable. |
| 42 | +- **RENDER_EXTERNAL_URL**: Was used as an external URL to Render (used instead of WEBAPP_URL), but from v1.1, you can just set the WEBAPP_URL environment variable. |
| 43 | +- **HEROKU_APP_NAME**: Was used to build the App name on a Heroku hosted webapp, but from v1.1, you can just set the WEBAPP_URL environment variable. |
| 44 | +- **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. |
| 45 | +- **PRISMA_GENERATE_DATAPROXY**: Was used to tell Prisma that it should generate the runtime for Dataproxy usage. But its officially deprecated now. |
| 46 | + |
| 47 | +## Helper Shell Script |
| 48 | +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. |
| 49 | + |
| 50 | +### Building From Source |
| 51 | +The below script will: |
| 52 | +1. Create a backup of your existing .env file as `.env.old` |
| 53 | +2. Update the .env file to be compliant with the new naming conventions |
| 54 | + |
| 55 | +<CodeGroup title="Run the below in your terminal in the directory of your .env"> |
| 56 | +```shell {{ title: '.env file' }} |
| 57 | +for var in NEXT_PUBLIC_EMAIL_VERIFICATION_DISABLED NEXT_PUBLIC_PASSWORD_RESET_DISABLED NEXT_PUBLIC_SIGNUP_DISABLED NEXT_PUBLIC_INVITE_DISABLED NEXT_PUBLIC_PRIVACY_URL NEXT_PUBLIC_TERMS_URL NEXT_PUBLIC_IMPRINT_URL NEXT_PUBLIC_GITHUB_AUTH_ENABLED NEXT_PUBLIC_GOOGLE_AUTH_ENABLED NEXT_PUBLIC_WEBAPP_URL NEXT_PUBLIC_IS_FORMBRICKS_CLOUD NEXT_PUBLIC_SURVEY_BASE_URL; do sed -i.old "s/^$var=/$(echo $var | sed 's/NEXT_PUBLIC_//')=/" .env; done; echo "Formbricks environment variables have been migrated as per v1.1! You are good to go." |
| 58 | +``` |
| 59 | +</CodeGroup> |
| 60 | + |
| 61 | + |
| 62 | +### Docker & Single Script Setup |
| 63 | + |
| 64 | +Now that these variables can be defined at runtime, you can append them inside your `x-environment` in the `docker-compose.yml` itself. |
| 65 | +For a more detailed guide on these environment variables, please refer to the [Important Runtime Variables](/docs/self-hosting/from-source#important-run-time-variables) section. |
| 66 | + |
| 67 | +<CodeGroup title="docker-compose.yml"> |
| 68 | +```yaml {{ title: 'docker-compose.yml' }} |
| 69 | +version: "3.3" |
| 70 | +x-environment: &environment |
| 71 | + environment: |
| 72 | + # The url of your Formbricks instance used in the admin panel |
| 73 | + WEBAPP_URL: |
| 74 | + |
| 75 | + # PostgreSQL DB for Formbricks to connect to |
| 76 | + DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/formbricks?schema=public" |
| 77 | + |
| 78 | + # Uncomment to enable a dedicated connection pool for Prisma using Prisma Data Proxy |
| 79 | + # Cold boots will be faster and you'll be able to scale your DB independently of your app. |
| 80 | + # @see https://www.prisma.io/docs/data-platform/data-proxy/use-data-proxy |
| 81 | + # PRISMA_GENERATE_DATAPROXY=true |
| 82 | + PRISMA_GENERATE_DATAPROXY: |
| 83 | + |
| 84 | + # NextJS Auth |
| 85 | + # @see: https://next-auth.js.org/configuration/options#nextauth_secret |
| 86 | + # You can use: `openssl rand -base64 32` to generate one |
| 87 | + NEXTAUTH_SECRET: |
| 88 | + |
| 89 | + # Set this to your public-facing URL, e.g., https://example.com |
| 90 | + # You do not need the NEXTAUTH_URL environment variable in Vercel. |
| 91 | + NEXTAUTH_URL: http://localhost:3000 |
| 92 | + |
| 93 | + # PostgreSQL password |
| 94 | + POSTGRES_PASSWORD: postgres |
| 95 | + |
| 96 | + # Email Configuration |
| 97 | + MAIL_FROM: |
| 98 | + SMTP_HOST: |
| 99 | + SMTP_PORT: |
| 100 | + SMTP_SECURE_ENABLED: |
| 101 | + SMTP_USER: |
| 102 | + SMTP_PASSWORD: |
| 103 | + |
| 104 | + # Uncomment the below and set it to 1 to disable Email Verification for new signups |
| 105 | + # EMAIL_VERIFICATION_DISABLED: |
| 106 | + |
| 107 | + # Uncomment the below and set it to 1 to disable Password Reset |
| 108 | + # PASSWORD_RESET_DISABLED: |
| 109 | + |
| 110 | + # Uncomment the below and set it to 1 to disable Signups |
| 111 | + # SIGNUP_DISABLED: |
| 112 | + |
| 113 | + # Uncomment the below and set it to 1 to disable Invites |
| 114 | + # INVITE_DISABLED: |
| 115 | + |
| 116 | + # Uncomment the below and set a value to have your own Privacy Page URL on the signup & login page |
| 117 | + # PRIVACY_URL: |
| 118 | + |
| 119 | + # Uncomment the below and set a value to have your own Terms Page URL on the auth and the surveys page |
| 120 | + # TERMS_URL: |
| 121 | + |
| 122 | + # Uncomment the below and set a value to have your own Imprint Page URL on the auth and the surveys page |
| 123 | + # IMPRINT_URL: |
| 124 | + |
| 125 | + # Uncomment the below and set to 1 if you want to enable GitHub OAuth |
| 126 | + # GITHUB_AUTH_ENABLED: |
| 127 | + # GITHUB_ID: |
| 128 | + # GITHUB_SECRET: |
| 129 | + |
| 130 | + # Uncomment the below and set to 1 if you want to enable Google OAuth |
| 131 | + # GOOGLE_AUTH_ENABLED: |
| 132 | + # GOOGLE_CLIENT_ID: |
| 133 | + # GOOGLE_CLIENT_SECRET: |
| 134 | + |
| 135 | +``` |
| 136 | +</CodeGroup> |
| 137 | + |
| 138 | +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! |
0 commit comments