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

How to use datadir ? #318

Closed
Gaetanbrl opened this issue Dec 19, 2024 · 1 comment
Closed

How to use datadir ? #318

Gaetanbrl opened this issue Dec 19, 2024 · 1 comment
Assignees
Labels

Comments

@Gaetanbrl
Copy link
Contributor

Gaetanbrl commented Dec 19, 2024

For a development stack,
I'd like to understand how datadir works with docker.

Docker compose create a Container :

docker-copy-datadir-1

(dunno why each contaneur end with -1 - this seems not a real issue)

Some questions about :

  • Do I need to modify the configs submodule files ?
  • If not, is modifying .env-xxx files enough ? (as detail in README).
  • Why this container ?
  • If i need to changes a datadir value, what is the process ? Need I to recreate container ?

Thanks :)

@edevosc2c
Copy link
Member

History

Copy-datadir container was born because we use a script called envsubst which allow injecting environment variables in the config files that do not support environment variables. Let's say you want to avoid storing some database credentials in git, so you use an env, but the application does not support envs. So we had to use envsubst to replace the specific string with the env BEFORE the application starts.

The workflow is this way:

  1. Copy-datadir copy the datadir in a separate Docker volume.
  2. The script envsubst starts and replace everything needed in the separate Docker volume
  3. The application starts using the datadir from the separate Docker volume.

Unfortunately, this is not very practical and user-friendly. We actually tried to implement a functionality that exist in Kubernetes but not in Docker compose, but this didn't work like we really wanted.

We actually want to get rid of this specific "copy-datadir" container: #291.

Answer to the technical problems

  • Do I need to modify the configs submodule files ?
    The config directory is the datadir so if you want to modify some files then you need to do it in the directory.
  • If not, is modifying .env-xxx files enough ? (as detail in README).
    You should prefer modifying the .envs files over modifying the datadir if the parameter exists through an env. Like the DB setting.
  • If i need to changes a datadir value, what is the process ? Need I to recreate container ?
    Yes you need to relaunch the container so that it copy the data to the separate Docker volume.
    I think if you do docker compose down then docker compose up -d then everything should be synced with the new changes done in the datadir.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants