Skip to content
This repository was archived by the owner on Mar 19, 2025. It is now read-only.

Stop depending on automatically created environment variables #25

Open
jpbaril opened this issue Jan 21, 2018 · 4 comments
Open

Stop depending on automatically created environment variables #25

jpbaril opened this issue Jan 21, 2018 · 4 comments

Comments

@jpbaril
Copy link

jpbaril commented Jan 21, 2018

To work, the ttrss-configure-db.php script depends on the environment variables automatically created by the "--link" flag of the docker run command. Example: DB_PORT_5432_TCP_ADDR (

$config['DB_HOST'] = env($ename . '_PORT_' . $eport . '_TCP_ADDR');
)

Per the Docker documentation, the --link flag is a legacy feature (https://docs.docker.com/engine/userguide/networking/default_network/dockerlinks/). In addition, when creating the TTRSS and POSTGRESSQL containers with a docker-compose file instead of the run command, a bridge network is automatically created and used by these services instead of using the default bridge network. With "user-defined" networks (or docker-compose created networks), as opposed to the default bridge network, those automatic environment variables are not created even when using the "link:" config in the docker-compose file.

I think the script should be changed to use user-specified variables (DB_HOST=postgres, DB_PORT=5432, DB_TYPE=pgsql) if present in the docker-compose file, and if not, continue to be generated by the script from the legacy automatic environment variable.

I think a way of implementing this could be how it was done there around the lines 11-45 https://github.com/clue/docker-ttrss/blob/master/configure-db.php#L28

In the mean time, to make it work I just manually specified in my docker-compose file the environment variables the legacy --link flag was creating, which are:

DB_PORT=tcp://db:5432
DB_PORT_5432_TCP=tcp://db:5432
DB_PORT_5432_TCP_ADDR=db
DB_PORT_5432_TCP_PORT=5432
DB_PORT_5432_TCP_PROTO=tcp

@languitar
Copy link

Please fix this and update the docs to not use link anymore.

@bobberb
Copy link

bobberb commented Jun 17, 2018 via email

@ghost
Copy link

ghost commented Aug 29, 2018

This should be mentioned in the documentation. Maybe also provide an example docker-compose?

@jpbaril
Copy link
Author

jpbaril commented Dec 2, 2018

I did not try it myself yet, but https://github.com/sheveko/docker-ttrss seems to have corrected this issue with sheveko@21fd22a.

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

No branches or pull requests

3 participants