docker-ttrss icon indicating copy to clipboard operation
docker-ttrss copied to clipboard

Stop depending on automatically created environment variables

Open jpbaril opened this issue 7 years ago • 4 comments

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 (https://github.com/x86dev/docker-ttrss/blob/d3ff6b028c03a6eb5fdb24790f4c693ba2457a42/root/srv/ttrss-configure-db.php#L27)

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

jpbaril avatar Jan 21 '18 05:01 jpbaril

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

languitar avatar Jun 11 '18 09:06 languitar

Try

talmai/docker-ttrss latest c605e9789115 7 weeks ago 403MB

On Mon, Jun 11, 2018 at 5:58 AM, Johannes Wienke [email protected] wrote:

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

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/x86dev/docker-ttrss/issues/25#issuecomment-396189233, or mute the thread https://github.com/notifications/unsubscribe-auth/ABzd_MCP1PoLB17JvL2jmGFQBFSBz2iOks5t7j8tgaJpZM4Rls-z .

bobberb avatar Jun 17 '18 04:06 bobberb

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

ghost avatar Aug 29 '18 16:08 ghost

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

jpbaril avatar Dec 02 '18 18:12 jpbaril