delightful-sugar-84666
11/07/2024, 1:57 PMNo authorization token was found
. I am using NODE_ENV as production and have added sufficient length JWT_SECRET and ENCRYPTION_KEY variablesorange-terabyte-33302
11/07/2024, 1:57 PMorange-terabyte-33302
11/07/2024, 1:57 PMJWT_SECRET
and ENCRYPTION_KEY
environment variables. These should be long, random strings. If you've recently changed these, you may need to restart your GrowthBook container for the changes to take effect [Self-host > Environment Variables](https://docs.growthbook.io/self-host/env#production-settings). 2. Check that your APP_ORIGIN
and API_HOST
environment variables are correctly set to match your server's URL and port configuration [Forum Conversation > T > 10375254](https://linen.growthbook.io/t/10375254/hi-i-m-trying-to-get-production-setup-working-for-self-hoste). 3. Verify that you can access the API directly. Try to open the API URL (usually on port 3100) in your browser or via a tool like Postman. You should receive a small JSON object if it's working correctly [Forum Conversation > T > 12033426](https://linen.growthbook.io/t/12033426/so-i-am-trying-to-run-growthbook-self-hosted-on-my-server-bu). 4. If you're using a reverse proxy or load balancer, ensure that it's correctly configured to forward requests to the appropriate GrowthBook ports (typically 3000 for the frontend and 3100 for the API) [Forum Conversation > T > 12646808](https://linen.growthbook.io/t/12646808/hi-we-want-to-test-a-self-hosted-growthbook-via-docker-caddy). 5. Check your Docker logs for any error messages related to JWT or authentication. There might be additional information about why the token is not being recognized [Forum Conversation > T > 2454510](https://linen.growthbook.io/t/2454510/wave-hello-team-i-am-getting-started-with-self-hosted-growth). If you've verified all of these points and are still experiencing issues, you may need to review your entire configuration. Make sure all required environment variables are set correctly, including MONGODB_URI
(or the individual MongoDB connection variables) [Self-host > Environment Variables](https://docs.growthbook.io/self-host/env#production-settings). If the problem persists, you might want to consider restarting your GrowthBook container or even rebuilding it to ensure all changes are properly applied.delightful-sugar-84666
11/07/2024, 2:05 PMorange-terabyte-33302
11/07/2024, 2:05 PMorange-terabyte-33302
11/07/2024, 2:06 PMdocker-compose.yml
file with the following content [Self Hosting GrowthBook](https://docs.growthbook.io/self-host):
yaml
version: "3"
services:
growthbook:
image: "growthbook/growthbook:latest"
ports:
- "3000:3000"
- "3100:3100"
environment:
- MONGODB_URI=<mongodb://your_mongodb_connection_string>
- APP_ORIGIN=<https://your-growthbook-domain.com>
- API_HOST=<https://your-growthbook-api-domain.com>
- NODE_ENV=production
- JWT_SECRET=your_long_random_string
- ENCRYPTION_KEY=another_long_random_string
volumes:
- uploads:/usr/local/src/app/packages/back-end/uploads
volumes:
uploads:
3. Configure environment variables:
Replace the placeholder values in the docker-compose.yml
file with your actual settings [Using > Security > Self-hosted deployments](https://docs.growthbook.io/using/security#self-hosted-deployments):
- `MONGODB_URI`: Your MongoDB connection string
- `APP_ORIGIN`: The public URL for your GrowthBook frontend
- `API_HOST`: The public URL for your GrowthBook API
- `JWT_SECRET`: A long, random string for JWT token signing
- `ENCRYPTION_KEY`: Another long, random string for encrypting sensitive data
4. Set up a reverse proxy:
Configure a reverse proxy (e.g., Nginx) to handle HTTPS and forward requests to the appropriate GrowthBook ports (3000 for frontend, 3100 for API).
5. Start GrowthBook:
Run the following command in the directory containing your docker-compose.yml
file:
docker-compose up -d
6. Verify the installation:
- Check if the frontend is accessible at your configured domain.
- Verify the API is working by visiting <https://your-growthbook-api-domain.com/>
(it should return a JSON object with basic info).
7. Set up initial user account:
Visit your GrowthBook frontend URL and create the first user account.
8. Regular updates:
To keep GrowthBook updated, periodically run:
docker-compose pull
docker-compose up -d
orange-terabyte-33302
11/07/2024, 2:06 PMdocker-compose.yml
file with the following content [Self Hosting GrowthBook](https://docs.growthbook.io/self-host): yaml version: "3" services: growthbook: image: "growthbook/growthbook:latest" ports: - "3000:3000" - "3100:3100" environment: - MONGODB_URI=<mongodb://your_mongodb_connection_string> - APP_ORIGIN=<https://your-growthbook-domain.com> - API_HOST=<https://your-growthbook-api-domain.com> - NODE_ENV=production - JWT_SECRET=your_long_random_string - ENCRYPTION_KEY=another_long_random_string volumes: - uploads:/usr/local/src/app/packages/back-end/uploads volumes: uploads:
3. Configure environment variables: Replace the placeholder values in the docker-compose.yml
file with your actual settings [Using > Security > Self-hosted deployments](https://docs.growthbook.io/using/security#self-hosted-deployments): - `MONGODB_URI`: Your MongoDB connection string - `APP_ORIGIN`: The public URL for your GrowthBook frontend - `API_HOST`: The public URL for your GrowthBook API - `JWT_SECRET`: A long, random string for JWT token signing - `ENCRYPTION_KEY`: Another long, random string for encrypting sensitive data 4. Set up a reverse proxy: Configure a reverse proxy (e.g., Nginx) to handle HTTPS and forward requests to the appropriate GrowthBook ports (3000 for frontend, 3100 for API). 5. Start GrowthBook: Run the following command in the directory containing your docker-compose.yml
file: docker-compose up -d
6. Verify the installation: - Check if the frontend is accessible at your configured domain. - Verify the API is working by visiting <https://your-growthbook-api-domain.com/>
(it should return a JSON object with basic info). 7. Set up initial user account: Visit your GrowthBook frontend URL and create the first user account. 8. Regular updates: To keep GrowthBook updated, periodically run: docker-compose pull docker-compose up -d
9. (Optional) Set up GrowthBook Proxy: For improved performance and security, consider setting up GrowthBook Proxy [Self-host > GrowthBook Proxy > Installation](https://docs.growthbook.io/self-host/proxy#installation): yaml version: "3" services: growthbook: # ... (your existing growthbook service configuration) environment: # ... (your existing environment variables) - PROXY_ENABLED=1 - PROXY_HOST_PUBLIC=<https://your-growthbook-proxy-domain.com> - SECRET_API_KEY=your_secret_api_key gbproxy: image: growthbook/proxy:latest ports: - "3300:3300" environment: - GROWTHBOOK_API_HOST=<https://your-growthbook-api-domain.com> - SECRET_API_KEY=your_secret_api_key
10. Security considerations: - Keep GrowthBook behind a firewall and accessible via a VPN if possible. - Regularly update GrowthBook to ensure you have the latest security patches. - Use strong, unique passwords for all accounts. Remember to replace all placeholder values (like your_mongodb_connection_string
, <http://your-growthbook-domain.com|your-growthbook-domain.com>
, etc.) with your actual production values. This guide provides a basic production setup. Depending on your specific requirements and infrastructure, you might need to make additional adjustments. Always ensure you're following best practices for security and scalability in your production environment.delightful-sugar-84666
11/07/2024, 2:17 PMorange-terabyte-33302
11/07/2024, 2:17 PMorange-terabyte-33302
11/07/2024, 2:17 PM/api/init
endpoint requiring an authorization token is not the expected behavior for GrowthBook. Let's examine this issue more closely: 1. Multiple instances in the provided logs show errors related to "No authorization token was found" when accessing the /api/init
endpoint [Github Issue (closed): [Bug] Cannot open the UI or backend properly on Kubernetes](https://github.com/growthbook/growthbook/issues/1045). This suggests that this is a recurring issue that users have faced. 2. In one of the forum conversations, a user mentioned that the request to /auth/refresh
was returning a 401 error, which they found unexpected because they understood that the token should not exist initially and should be generated on the first refresh [Forum Conversation > T > 23130947](https://linen.growthbook.io/t/23130947/hi-all-i-m-trying-to-run-growthbook-self-hosted-on-aws-and-i). 3. In the same conversation, the user managed to solve the issue by adding TLS to the endpoints and using a subdomain rather than a path to route to the subdomain [Forum Conversation > T > 23130947](https://linen.growthbook.io/t/23130947/host). Given this information, it appears that the /api/init
endpoint should not require an authorization token under normal circumstances. The requirement for an authorization token at this stage might indicate a configuration issue or a problem with how the requests are being routed to your GrowthBook instance. If you're experiencing this issue, you might want to check the following: 1. Ensure that your API and frontend URLs are correctly configured in your environment variables. 2. Verify that you're using HTTPS for both your API and frontend URLs. 3. If you're using a reverse proxy or load balancer, make sure it's correctly configured to forward requests to GrowthBook. 4. Check that your JWT_SECRET
and ENCRYPTION_KEY
environment variables are set correctly. If the problem persists after verifying these points, it might be worth reaching out to the GrowthBook community or support for further assistance, as this behavior is not expected for the /api/init
endpoint.