openfoodfacts / openfoodfacts-server

Open Food Facts database, API server and web interface - 🐪🦋 Perl, CSS and JS coders welcome 😊 For helping in Python, see Robotoff or taxonomy-editor
http://openfoodfacts.github.io/openfoodfacts-server/
GNU Affero General Public License v3.0
661 stars 389 forks source link

Make Product Opener deployable via Docker #306

Closed teolemon closed 6 years ago

teolemon commented 8 years ago

@nicolasleger

hangy commented 8 years ago

Should also be interesting for automated builds with Bitbucket Pipelines.

teolemon commented 7 years ago

We moved to github, so should be easier to find something. Travis build is already kind of up.

nicolasleger commented 7 years ago

OpenFoodFacts resources :

Some Docker resources:

hangy commented 7 years ago

Unfortunately, that's just one step. Stitching together Config.pm, Config2.pm, Apache2 site, nginx site, etc. dynamically (based on a wildcard domain … supplied by whom?) sounds quite fragile. I'll admit that I have no experience with Docker, so it might be easier than I think. 😄

hangy commented 7 years ago

I have a somewhat runnable version of Product Opener on Docker in the 306 branch with a simple README. Is this about what you had in mind @teolemon @nicolasleger?

nicolasleger commented 7 years ago

@hangy please share it with us, I was trying a lot to have a proper local env working via Docker.

nicolasleger commented 7 years ago

@hangy I tried at https://github.com/openfoodfacts/openfoodfacts-server/compare/master...nicolasleger:docker?expand=1

hangy commented 7 years ago

@nicolasleger Thanks for the hint. I like that approach as well. Right now, I'm thinking we should just add all variants to the official repo and have them available as options. For the time being, I don't see any other use than using them for local development (which is really useful 👍), so that should be fine.

I saw that you have https://github.com/nicolasleger/openfoodfacts-server/blob/ae78aab9b62566caebb302595f834c401f06c744/Dockerfile#L66 as an open TODO. With the changes of 302347d890ad6ea8802b1145223fd4dab7ecf55b, you could remove MongoDB from the app container.

In your example, I noticed that Docker compose can also build images (how could I miss that? 😆), so I think I'll adjust my Dockerfile accordingly.

nicolasleger commented 7 years ago

Thanks ! Yes it is better to split services in Docker compose if config between them can be dynamic. Via environment variables or default local for Mongo for example. See The Twelve Factors principles https://12factor.net/ for inspiration.

hangy commented 7 years ago

That's basically what I tried in https://github.com/openfoodfacts/openfoodfacts-server/compare/issue/306-docker?expand=1 - also as a proof of concept that ProductOpener still works with nginx and apache on different machines, as long as some volumes are shared. :wink: