[Refactor/Chore] Split the environment configuration files to make docker compose clean again. #21912

Open
opened 2026-02-21 20:14:49 -05:00 by yindo · 7 comments
Owner

Originally created by @crazywoola on GitHub (Jan 26, 2026).

Originally assigned to: @DoiiarX, @macatizm on GitHub.

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for refactors or chores; if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Description

For example, inspired by https://x.com/Daiiors

x-shared-config: &shared-config
  env_file:
    - ./envs/global.env
    - ./envs/security.env
  networks:
    - app-network
  restart: always

services:
  web:
    <<: *shared-config
    image: nginx

  api:
    <<: *shared-config
    image: node-app

Motivation

Well, the file is quite long, and it's hard to read. It works but not elegant.

Additional Context

No response

Originally created by @crazywoola on GitHub (Jan 26, 2026). Originally assigned to: @DoiiarX, @macatizm on GitHub. ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for refactors or chores; if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Description For example, inspired by https://x.com/Daiiors ```yaml x-shared-config: &shared-config env_file: - ./envs/global.env - ./envs/security.env networks: - app-network restart: always services: web: <<: *shared-config image: nginx api: <<: *shared-config image: node-app ``` - [ ] Please do consider the compatibility - [ ] https://github.com/langgenius/dify/blob/0ef8b5a0ca664ab2be14d4aa74c2b4caa13011c8/docker/docker-compose-template.yaml - [ ] https://github.com/langgenius/dify/blob/5362f69083f7ee3ae6b69bce92488421ae5b8793/docker/docker-compose.middleware.yaml - [ ] https://github.com/langgenius/dify/blob/e80d76af15c1be25213139cf3b2bf9289e180ac4/docker/docker-compose.yaml - [ ] https://github.com/langgenius/dify/blob/fbf5deda2152286d085c080f748ac5c2aa83e99e/docker/generate_docker_compose - [ ] https://github.com/langgenius/dify/blob/e80d76af15c1be25213139cf3b2bf9289e180ac4/docker/.env.example - [ ] Please remove useless scripts if these changes are made - [ ] PRs are welcome ### Motivation Well, the file is quite long, and it's hard to read. It works but not elegant. ### Additional Context _No response_
yindo added the good first issue label 2026-02-21 20:14:49 -05:00
Author
Owner

@crazywoola commented on GitHub (Jan 27, 2026):

@macatizm I suggest splitting it as described below, and some general configurations are placed under security.

Core Services

  • init_permissions
  • api
  • worker
  • worker_beat
  • web
  • sandbox
  • plugin_daemon

Databases

  • db_postgres
  • db_mysql
  • redis

Vector Stores

  • weaviate
  • qdrant
  • oceanbase
  • seekdb
  • couchbase-server
  • pgvector
  • vastbase
  • pgvecto-rs
  • chroma
  • iris
  • oracle
  • opengauss
  • myscale
  • matrixone
  • elasticsearch
  • opensearch

Infrastructure

  • nginx
  • certbot
  • ssrf_proxy
  • etcd
  • minio
  • milvus-standalone
@crazywoola commented on GitHub (Jan 27, 2026): @macatizm I suggest splitting it as described below, and some general configurations are placed under security. ## Core Services - init_permissions - api - worker - worker_beat - web - sandbox - plugin_daemon ## Databases - db_postgres - db_mysql - redis ## Vector Stores - weaviate - qdrant - oceanbase - seekdb - couchbase-server - pgvector - vastbase - pgvecto-rs - chroma - iris - oracle - opengauss - myscale - matrixone - elasticsearch - opensearch ## Infrastructure - nginx - certbot - ssrf_proxy - etcd - minio - milvus-standalone
Author
Owner

@macatizm commented on GitHub (Jan 27, 2026):

Hi, @crazywoola
you mean make env file per each item?
env file for core service/web
env file for core service/api
...

@macatizm commented on GitHub (Jan 27, 2026): Hi, @crazywoola you mean make env file per each item? env file for core service/web env file for core service/api ...
Author
Owner

@crazywoola commented on GitHub (Jan 27, 2026):

A single service would be ideal, but for now, splitting it into these modules might be better.

@crazywoola commented on GitHub (Jan 27, 2026): A single service would be ideal, but for now, splitting it into these modules might be better.
Author
Owner

@macatizm commented on GitHub (Jan 27, 2026):

I finished the requirements

@macatizm commented on GitHub (Jan 27, 2026): I finished the requirements
Author
Owner

@crazywoola commented on GitHub (Jan 27, 2026):

I need to discuss this with our team internally. Will get back to you soon.

@crazywoola commented on GitHub (Jan 27, 2026): I need to discuss this with our team internally. Will get back to you soon.
Author
Owner

@DoiiarX commented on GitHub (Jan 27, 2026):

good job, bro

@DoiiarX commented on GitHub (Jan 27, 2026): good job, bro
Author
Owner

@crazywoola commented on GitHub (Jan 27, 2026):

Please feel free to track this thread @DoiiarX

@crazywoola commented on GitHub (Jan 27, 2026): Please feel free to track this thread @DoiiarX
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#21912