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

Update Dockerfiles to add backend.enable option to Postgres #1492

Merged
merged 1 commit into from
Jun 5, 2018
Merged

Update Dockerfiles to add backend.enable option to Postgres #1492

merged 1 commit into from
Jun 5, 2018

Conversation

jason-fox
Copy link
Contributor

@jason-fox jason-fox commented Jun 4, 2018

I have been attempting to run a Dockerized Cygnus to connect to a Postgres database. The changes in this PR enable me to do so.

Currently when I docker-compose using default values, I can't successfully add any data to Postgres since I get the #1467 issue. This is because the default value (postgresql-sink.backend.enable_cache = false ) causes a null pointer error since the cache is uninitialized.

A value for postgresql-sink.backend.enable_cache does not exist in the agent.conf which is copied over when the entrypoint point is run, and no environment variable exists to override it, therefore I'm stuck with the broken default value without creating my own custom Docker file.

This amendment adds the default value (false) to the Docker agent.conf and ensures that the dummy file agent.conf in the same folder as the Dockerfile gets copied into the image correctly. Note that agent.conf must be copied twice , since the docker-cygnus agent version is used if CYGNUS_MULTIAGENT is not set. The default value can be overwritten using an environment variable (CYGNUS_POSTGRESQL_ENABLE_CACHE)

The entrypoint has been amended to copy the external configuration files into the container using the Docker COPY command rather than copying the internal files from within the downloaded github repository using the bash cp command. This allows a user to more easily override the default dummy agent.conf with their own files regardless of whether CYGNUS_MULTIAGENT is set.

Using Docker COPY is preferred, since ordinary users won't have push rights to the git repo - see #1418 which proposes similar changes.

* Add default `postgresql-sink.backend.enable_cache = false` to `agent.conf` file
* Amend entrypoint to overwrite default if `CYGNUS_POSTGRESQL_ENABLE_CACHE` environment variable is set.
* Amend Dockerfile to use COPY rather than bash cp.

Note that `agent.conf` must be copied twice, since the docker-cygnus agent version is used if `CYGNUS_MULTIAGENT` is not set.
Copy link
Member

@AlvaroVega AlvaroVega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@AlvaroVega AlvaroVega merged commit 8b32b57 into telefonicaid:master Jun 5, 2018
@AlvaroVega
Copy link
Member

AlvaroVega commented Jun 5, 2018

Hi @jason-fox, It seems that your PR has introduced a failure in docker image creation:
https://hub.docker.com/r/telefonicaiot/fiware-cygnus/builds/b7ylztxzajv8ezyrsyod8de/

COPY: command not found

I guess that the problem is: COPY should be before RUN command.

Could you fix that? Thanks!

@jason-fox
Copy link
Contributor Author

Whoops - I'd left a line concatenation hanging on the committed Dockerfile it was therefore attempting to RUN the COPY command
Fixed in commit #784b28fd

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

Successfully merging this pull request may close these issues.

2 participants