Giter Site home page Giter Site logo

Comments (4)

pierresouchay avatar pierresouchay commented on June 10, 2024

Hello @simongareste ,

Indeed, by default, on docker, environment variables are not exported.
As explained in https://hub.docker.com/r/discoverycriteo/consul-templaterb, you have to run it with docker with docker run --env CONSUL_HTTP_ADDR=$CONSUL_HTTP_ADDR -p 8080:80/tcp discoverycriteo/consul-templaterb in your case (since $CONSUL_HTTP_ADDR contains the server you want to reach.

The reason why it works without docker is that consul-templaterb uses by default CONSUL_HTTP_ADDR from the environment unless you use the flag -c. If the flag -c is not specified and CONSUL_HTTP_ADDR is not present either, then, it will use by default http://localhost:8500.

I am gonna check for the issues you mentioned: about navBarDecorator and fetchedResponseDecorator. (It is a plugin system we are using internally at Criteo, so, it migt be a little bit less tested). Still, is the UI correctly responding or does it breaks everything?

from consul-templaterb.

pierresouchay avatar pierresouchay commented on June 10, 2024

@simongareste,

Indeed, thank you for you bug report: there was a bug fixed by 3a1dea9 (a missing resource containing the decorator) in the Dockerfile.

I released a new Docker version 1.26.2 - should work on your machine now.

I will work with this new version, human tested a few seconds ago!

Sorry for such lame bug (to be fair, we don't use docker for this app in our real-world deployments, that's why).

To test again:
docker pull discoverycriteo/consul-templaterb
and run again with:
docker run --env CONSUL_HTTP_ADDR=$CONSUL_HTTP_ADDR -p 8080:80/tcp discoverycriteo/consul-templaterb

Thanks a lot for the bug report and feel free to create Pull Request if you modify the templates and want your changes included in the default version.

You can also have a look at https://github.com/criteo/consul-templaterb/blob/master/samples/consul-ui/decorators.js.erb to customize your UI (for instance, linking some metadata of your Consul nodes/services with internal services of yours).

from consul-templaterb.

simongareste avatar simongareste commented on June 10, 2024

Hi,

Indeed, with the javascript fixed it works as expected (I wasn't clear in my previous post, I did had everything working in the container, except the view displayed in my browser - the files were all valid, my env variable was correctly interpretated).

However, I believe you still have an issue in the repository, as the Gemfile.lock provided here states

BUNDLED WITH
   2.1.4

whereas the docker image ruby:2.5 comes with bundler 1.17.2. Because of this, building the image by directly building the Dockerfile upon clone won't work :

[...]
Step 5/10 : RUN bundle install
 ---> Running in 6507a122ed1f
You must use Bundler 2 or greater with this lockfile.
The command '/bin/sh -c bundle install' returned a non-zero code: 20

I see a few options to fix this:

  • update rubygems in the Dockerfile before running bundle install: RUN gem update --system. This leads to a warning (Warning: the running version of Bundler (2.1.2) is older than the version that created the lockfile (2.1.4). We suggest you to upgrade to the version that created the lockfile by running gem install bundler:2.1.4.), but compiles successfully, and works (my consul-ui is working fine)
  • do not ship the Gemfile.lock in the image, by adding Gemfile.lock to the .dockerignore file (or even remove the Gemfile.lock altogether). This would lead to a variation of gems in the image, depending on the time/date of the build, which may or may not be a super idea. May I suggest, however, to lighten the image and speed up the build by removing everything that is not necessary, starting with the .git folder and a few others files? I can do a pull request for this one.
  • upgrade the ruby image used, to one that is using the same bundle version as the one in your Gemfile.lock. This looks messy.
  • rebuild and recommit the Gemfile.lock with a 1.17.x version.
  • other options: I'm pretty sure there are a lot more options, these are the simplest that come to mind :)

from consul-templaterb.

pierresouchay avatar pierresouchay commented on June 10, 2024

@simongareste Arf... dependencies management with Ruby... I'll have a look, thank you!

Since you seem to know more than I do about dependency managemen with Ruby and Docker, would you like to create a Pull-Request?

from consul-templaterb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.