Giter VIP home page Giter VIP logo

Comments (11)

ArnaudPel avatar ArnaudPel commented on May 26, 2024 2

I just lost an hour trying to migrate from the official nginx image to openresty because of this.
I agree this should be done in openresty itself for good practice, but when talking about a docker image it's an absolute must.

With the 'include' as suggested by @duanzhanling above, the user can simply mount conf.d as a shared volume and manage his config without more hassle.

As of now, we need to overwrite the default config file inside the image to add that line manually (and it can't be a simple append because it has to be inside the braces). The only way I can think of to achieve this is to create a Dockerfile, then do some annoying manipulation of the default config file. On top of being more pain, it's also more brittle: changes in the default config might break aforementioned manipulation.

In short, this image doesn't have an extendable configuration.

from docker-openresty.

neomantra avatar neomantra commented on May 26, 2024 1

I have added a custom nginx config that includes /etc/nginx/conf.d/*.conf in changeset 93c65ad
Enjoy!

from docker-openresty.

neomantra avatar neomantra commented on May 26, 2024

That file is supplied directly from the upstream OpenResty installation and I don't intend on modifying it. The current file is very basic and almost any use of OpenResty will require modification.

I see that the Nginx Docker images include the line you are suggesting. Maybe you are suggesting this change will just require end users to add files and not modify any?

from docker-openresty.

neomantra avatar neomantra commented on May 26, 2024

@ArnaudPel I think your line regarding mounting conf.d is what I was looking for from the original reporter. This image isn't intended to be a drop-in replacement for nginx images but a base to build application servers. That said, I certainly want it to be easy to use and that use case makes sense.

I don't deploy like this, so I want to be complete... did you try adding this line to your own image?
include /usr/local/openresty/nginx/conf/conf.d/*.conf;
Was there anything else missing from the default nginx.conf needed to get it going?

from docker-openresty.

ArnaudPel avatar ArnaudPel commented on May 26, 2024

Yes I think adding this line was enough to let me set my own configuration by using the following bind mount:
- /host/path/conf.d:/usr/local/openresty/nginx/conf/conf.d

Here the Dockerfile I put together to add the line, as you can see it's very brittle, and also quite annoying to have to build another image layer just for that. I'm no bash expert so there's probably a better way to do it.

FROM openresty/openresty:stretch
WORKDIR /usr/local/openresty

# The 'sed' will only work if the file ends with } then a new line (first part of the command), so it's very brittle
RUN echo "" >> nginx/conf/nginx.conf && \
    sed -i 'x;${s/}$/    include \/usr\/local\/openresty\/nginx\/conf\/conf.d\/*.conf;\n}/;p;x;};1d' nginx/conf/nginx.conf

I should mention that in the end I won't be using openresty, what I wanted to achieve with Lua is simply too complicated for an nginx conf to handle. I have to use a fully-fledged app that allows me to run as many nested if/else as I want.

from docker-openresty.

neomantra avatar neomantra commented on May 26, 2024

Reopening this... the changes are on the tree and work, but because of how the Docker Hub build system works, the nginx.conf files are not being found.

I've been working on revamping the build system to use Google Cloud Builder (which will give a lot more flexibility with the builds) and should have that ready by the end of next weekend.

from docker-openresty.

neomantra avatar neomantra commented on May 26, 2024

The "master" images are now built on GCP and pushed to Docker Hub, see #62.

Thus the recent images at https://hub.docker.com/r/openresty/openresty/tags/ have the conf.d feature.

from docker-openresty.

neomantra avatar neomantra commented on May 26, 2024

Can people who use this conf.d feature please test it further and give me feedback?
If I get some confirmation, I will retag 1.13.6.1 to include it.

from docker-openresty.

tushar00jain avatar tushar00jain commented on May 26, 2024

@neomantra usedalpine-fat to verify and it works fine

from docker-openresty.

francoispluchino avatar francoispluchino commented on May 26, 2024

@neomantra Works for me with the alpine-fat tag. Can you retag the the 1.13.6.1 version?

from docker-openresty.

neomantra avatar neomantra commented on May 26, 2024

I've updated the tagging convention to include a <docker build> number and have automated builds again using Travis CI (#62).

This feature is is now tagged as 1.13.6.1-<flavor> as well as 1.13.6.1-1-<flavor>.

The OpenResty 1.13.6.1 without this feature (for those who have conflicts with this setup, if any) is tagged at 1.13.6.1-0-<flavor>.

from docker-openresty.

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.