How to set ENV?
Self Checks
- [X] I have searched for existing issues search for existing issues, including closed ones.
- [X] I confirm that I am using English to submit report (我已阅读并同意 Language Policy).
- [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
- [X] Please do not modify this template :) and fill in all the required fields.
Provide a description of requested docs changes
Whether I set.env in the api directory or the docker directory, the configuration does not take effect
docker compose down docker compose up -d
To ensure that the environment variables are correctly set and applied in your Docker setup for the dify repository, follow these steps:
-
Clone the Dify Repository:
git clone https://github.com/langgenius/dify.git -
Navigate to the Docker Directory:
cd dify/docker -
Copy the Example Environment File:
cp .env.example .env -
Edit the
.envFile: Open the.envfile in a text editor and customize the environment variable values as needed. Refer to the.env.examplefile for detailed configuration options. -
Start Dify with Docker Compose:
docker compose up -d -
Restart Dify After Editing Environment Variables: If you make any changes to the
.envfile, restart Dify to apply the changes:docker compose down docker compose up -d
Additional Tips:
- Persistent Environment Variables: The
.envfile ensures that your configurations persist across deployments. - Vector Database Configuration: You can switch between different vector databases by setting the
VECTOR_STOREenvironment variable in your.envfile to your desired service, such asmilvus,weaviate, oropensearch. - Middleware Services: For setting up essential middleware services like databases and caches, use the
docker-compose.middleware.yamlfile and ensure themiddleware.envfile is created by runningcp middleware.env.example middleware.env.
The full set of annotated environment variables can be found in the docker/.env.example file. Make sure to review and set these variables according to your requirements. For more detailed instructions, refer to the docker/README.md file in the repository [1][2][3][4].
Specific Instructions for the api Directory:
For the api directory, ensure you have set the environment variables in the .env file located in the api directory. Here are some key configurations:
- SECRET_KEY: Generate a strong key using
openssl rand -base64 42and set it in theSECRET_KEYenvironment variable. - API URLs: Set the base URLs for various services.
- Celery and Redis Configuration: Set the
CELERY_BROKER_URLand other Redis-related variables. - Database Configuration: Set the PostgreSQL database connection details.
- Storage Configuration: Configure the storage type and related settings.
- CORS Configuration: Set allowed origins for CORS.
- Vector Database Configuration: Configure the vector database and its connection details.
- Upload Configuration: Set limits for file uploads.
- Mail Configuration: Configure the mail service.
- Sentry Configuration: Set the Sentry DSN.
- Debugging and Logging: Configure debugging and logging settings.
- Notion Import Configuration: Set Notion integration details.
- ETL and SSRF Proxy Configuration: Configure ETL and SSRF proxy settings.
- Batch Upload and Keyword Data Source Configuration: Set limits for batch uploads and keyword data sources.
- Code Execution Configuration: Set limits for code execution.
- API Tool and HTTP Node Configuration: Configure API tool and HTTP node settings.
- Indexing Configuration: Set the maximum segmentation tokens length.
- Workflow Runtime Configuration: Configure workflow execution limits.
- App Configuration: Set the maximum execution time for the app.
These configurations should be set in the .env file in the api directory based on your deployment requirements [5][6].
After setting the environment variables, restart the Docker containers to apply the changes:
docker compose down
docker compose up -d
To continue talking to Dosu, mention @dosu.
我的问题任然没有解决!我就是按照这个方式去做的,但是没有生效的,我的截图已经说明情况了!
Your image doesn't give any useful information, the API environment variables you modify won't work for Docker, and if you follow the documentation, your environment variables won't have just 4 lines. And you didn't say what you were going to do with the environment variables
Environment variables As I understand it, the ones that are not set will use the default value, right? I just want to set the maximum workflow execution time to 1 hour instead of the current 20 minutes, and it doesn't actually work whether I set the .env file in docker or the .env file in api
Your image doesn't give any useful information, the API environment variables you modify won't work for Docker, and if you follow the documentation, your environment variables won't have just 4 lines. And you didn't say what you were going to do with the environment variables