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

Dockerfile does not build #12

Closed
mcatanzaro opened this issue Apr 22, 2020 · 8 comments
Closed

Dockerfile does not build #12

mcatanzaro opened this issue Apr 22, 2020 · 8 comments

Comments

@mcatanzaro
Copy link
Contributor

This is a companion issue to endlessm/azafea#103. The azafea-metrics-proxy Dockerfile does not build. The following are the minimal changes I required to get a successful build (using docker rather than podman):

diff --git a/Dockerfile b/Dockerfile
index 989096c..c9ee696 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM ubuntu:disco
+FROM debian:buster
 
 ENV LANG C.UTF-8
 
@@ -12,6 +12,7 @@ RUN apt --quiet --assume-yes update \
         python3 \
         python3-dev \
         python3-pip \
+        python3-setuptools \
     && pip3 install pipenv \
     && pipenv install --ignore-pipfile \
     && apt --quiet --assume-yes autoremove --purge \
@dbnicholson
Copy link
Member

@mcatanzaro can you try again with the Dockerfile there now?

@mcatanzaro
Copy link
Contributor Author

I see I need to edit the Dockerfile now:

ENV REDIS_HOST=localhost
ENV REDIS_PASSWORD="CHANGE ME!!"

But how do I set the port to use?

I guess that obsoletes /etc/azafea-metrics/proxy/config.toml? Then the installation instructions will need to be updated accordingly?

@adarnimrod
Copy link
Contributor

@mcatanzaro you don't need to edit the Dockerfile, instead you have 2 options. You can either create a configuration file and run just like the documentation instructs. Alternatively, you can use environment variables and forgo the configuration file like so:

sudo docker run -e 'REDIS_HOST=localhost' -e 'REDIS_PASSWORD=' proxy run -c /tmp/config.toml

The 2nd option uses a configuration file that is generated from the environment variables you set when running the image (no need to rebuild the image).

@mcatanzaro
Copy link
Contributor Author

OK, I understand now. It contains the placeholder REDIS_HOST and REDIS_PASSWORD variables set to localhost and "CHANGE ME!!", which strongly suggests that they should be changed. But when following the installation instructions, they should be ignored and not changed. It's very confusing tbh to have 'change me' variables in the Dockerfile that are supposed to be ignored and not changed when following the instructions.

But how do I set the port to use?

I understand that, if I wanted to follow your second configuration option, instead of following the instructions, then it would not be possible to use a redis instance on a non-default port, because you provide REDIS_HOST and REDIS_PASSWORD environment variables, but not a REDIS_PORT variable. The sample configuration file in the installation instructions does not have this problem.

@mcatanzaro
Copy link
Contributor Author

I tested the new Dockerfile but it really doesn't work when following the installation instructions.

Using my modified Dockerfile from my first post, sudo docker run --volume=/etc/azafea-metrics-proxy:/etc/azafea-metrics-proxy:ro azafea-metrics-proxy print-config prints the expected configuration (I've snipped out host and port):

$ sudo docker run --volume=/etc/azafea-metrics-proxy:/etc/azafea-metrics-proxy:ro azafea-metrics-proxy print-config
----- BEGIN -----
[main]
verbose = false

[redis]
host = <snipped>
port = <snipped>
password = "** hidden **"
------ END ------

But with your new Dockerfile, the same command fails:

$ sudo docker run --volume=/etc/azafea-metrics-proxy:/etc/azafea-metrics-proxy:ro azafea-metrics-proxy print-config
+ template config.toml.j2 -o /tmp/config.toml
+ eval exec pipenv run print-config
+ exec pipenv run print-config
Error: the command print-config could not be found within PATH or Pipfile's [scripts].

@mcatanzaro
Copy link
Contributor Author

Note that your new Dockerfile in endlessm/azafea#103 does NOT have this problem. That one works fine. (I was expecting them both to fail in the same way.)

@adarnimrod
Copy link
Contributor

@mcatanzaro instead of running the container with the command print-config run with proxy print-config.

@mcatanzaro
Copy link
Contributor Author

Yes, that works. Will update my PR in #13.

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

No branches or pull requests

3 participants