Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(env): docker compose variable interpolation issue for COMPOSE_PRO… #12093

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hanktrizz
Copy link

@hanktrizz hanktrizz commented Dec 25, 2024

Updated file docker/.env.example

Summary

Added extra $ symbol for the environment variable COMPOSE_PROFILES so that variable interpolation works as expected. Otherwise, it will fail upon running docker compose up -d

Apologies, in advance, if I missed any contributing guidelines as this is my first issue. 🙏

Fixes #12081

Screenshots

Before After
image Screenshot 2024-12-25 at 8 33 07 PM

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Dec 25, 2024
@crazywoola
Copy link
Member

x-shared-env: &shared-api-worker-env

You should modify this file instead of modify the .env.example directly.
The new .env.example is generated by this command
https://github.com/langgenius/dify/blob/1885d3df9968d778664bacdde4ea7a4d9448070f/docker/generate_docker_compose

@hanktrizz
Copy link
Author

x-shared-env: &shared-api-worker-env

You should modify this file instead of modify the .env.example directly. The new .env.example is generated by this command https://github.com/langgenius/dify/blob/1885d3df9968d778664bacdde4ea7a4d9448070f/docker/generate_docker_compose

Correct me if I'm wrong @crazywoola but it seems the sequence of generation goes like this (as per main() inside generate-docker-compose file:

Reads .env.example -> creates the shared env variables block -> substitutes the anchor with the shared block -> generate the template.yaml -> re-generate the final docker-compose.yaml.

There is nowhere in the docker-compose-template.yaml that is dealing with the env variables COMPOSE_PROFILES or VECTOR_STORE directly.
As I am relatively new to this codebase, I am happy to stand corrected and keen to learn if you can help clarify this.

@crazywoola crazywoola requested a review from laipz8200 December 26, 2024 15:29
@laipz8200
Copy link
Member

It seems that COMPOSE_PROFILES shouldn’t appear in the docker-compose.yaml file. You should modify the generate-docker-compose script to ignore this key.

@hanktrizz
Copy link
Author

Okay. I'll try and ignore that specific key. Will commit soon-ish due to the fact it's Xmas season 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid interpolation format for x-shared-env.COMPOSE_PROFILES
3 participants