Add Docker Compose Support#2406
Conversation
What's the rationale for that? Given that the rails-port definitely doesn't require PostGIS. |
|
With #2383 in place, most of docker/postgres/Dockerfile and docker/postgres/openstreetmap-postgres-init.sh will no longer be needed. |
@simonpoole During the course of working on this yesterday I somehow managed to convince myself that PostGIS was in fact needed... but you're right, it's not! I reverted back to Postgres in 3e5b8ce. |
07dc7b5 to
b0d9d03
Compare
@mmd-osm PR #2383 just merged by @tomhughes so I removed the additional PostgreSQL functions from the |
|
Hi! Looks great so far. I was able to get a couple of containers up using your instructions. Please let me know if there's anything I can do to help 😄 |
@zerebubuth Any thoughts on how to handle persistence of Postgres data? There is some background information in the "Where to Store Data" section here: https://hub.docker.com/_/postgres I personally prefer the "Let Docker manage the storage" approach but I have found that people find that confusing since their data vanishes when you run Because of that I'm inclined to do with the "Create a data directory on the host system (outside the container)" option. I find it weird to have a Thoughts? btw, right now it's using the "Let Docker manage the storage" approach |
|
Use a docker volume (managed via docker-compose.yml) for postgres persistance. In "production" one would not use postgres in the same way. A volume is not automatically removed on a |
|
Quick example of docker-compose.yml volume with postgres: https://gist.github.com/Firefishy/c6ba34c1eab11d5c3426137011d4869a |
| apt-get install --no-install-recommends -y \ | ||
| build-essential \ | ||
| curl \ | ||
| imagemagick \ |
There was a problem hiding this comment.
I wonder why imagemagick is still in the list. GPX preview image generation was moved to gd2-ffij earlier this year, and I'm not aware of other parts of the website depending on imagemagick.
There was a problem hiding this comment.
The imagemagick requirements are still listed in the "Minimum Requirements" section of INSTALL.md so if they are dropped here they should probably be dropped there as well.
There was a problem hiding this comment.
Right, it seems the INSTALL.md file also needs a bit of cleanup.
There was a problem hiding this comment.
@mmd-osm is there anything in the test suite which would verify whether this dependency is needed? If not, any suggestions on a suitable test I could add?
There was a problem hiding this comment.
I thought we got rid of imagemagick, but it seems that 6c20244 introduced mini_magick, which depends on imagemagick. This is only used to resize avatar images and might be a bit heavyweight for the task at hand. Maybe @tomhughes knows more.
There was a problem hiding this comment.
Well I don't believe there is any other supported approach. It only uses it via the command line though so there is no need for the development package.
| imagemagick \ | ||
| libarchive-dev \ | ||
| libffi-dev \ | ||
| libmagickwand-dev \ |
There was a problem hiding this comment.
This one should also be reviewed, not sure it is still needed.
I switched over to use a Docker volume for Postgres in 8d84170 |
added Dockerfile for the ruby on rails app inside a separate docker directory. this will build a image from the official ruby (specifically ruby:2.5-slim).
…rror postgresql-client throws a dpkg error when it can't create a softlink in for man page and aborts installation. found a solve at stack overflow and modified Dockerfile to add a comment to mention the problem with slove source.
…ed jobs from bundle install modified Dockerfile to separate apt-get cache cleaning command, added a comment explaining why and how npm is added and removed --jobs flag from bundle install command
added docker_postgres.sh for PostgreSQL extension and functions that installs PostgreSQL Btree-gist Extension, compiles libpgosm.so and installs maptile_for_point, tile_for_point and xid_to_int4 functions
added Dockerfile.postgres for the postgres database app. this will build a image from the official postgres (specifically postgres:9.4) image.
…ntomjs via npm modified Dockerfile to changes postgresql-client package from postgresql-client-10 to postgresql-client, and added phantomjs installation via npm
modified Dockerfile.postgres file to changes docker_postgres.sh location from db to docker
modified Dockerfile.postgres file to add app location setup and gem install via bundle
Until the Docker build context proves to be big enough to actually be a performance problem.
Fallout from changing build context for this image
This is no longer needed as of PR openstreetmap#2383
Without this there are permissions issues on the host filesystem.
Make it easy to get up and running quickly
c528202 to
cb2881c
Compare
|
It doesn't matter but if you're not aware you don't have to open a new PR just because you've rewritten the branch history - you can just force push and the existing PR will get the new clean history. |
This PR is primarily intended as a way of concretely demonstrating potential improvements / responding to reviewers in PR #2272 by @fazlerabbi37.
Notable changes
Use apostgisDocker image instead ofpostgressince we definitely need PostGIS.RUNcommands to reduce the number of layers in Docker images.Don't compile Ruby or install gems in thedbimage. We just need a single header file in order to buildlibpgosm.so.docker_postgres.shscript which installs the OSM-specific Postgres extensions wasn't actually being run because of a missing slash. Fixed that _(and renamed the file to includeopenstreetmapin the name to make its purpose clear).ruby:2.5-slimtoruby:2.5since we're installing so much stuff anyway (ok, fine - it's mostly because it hascurlinstalled by default which saves some bootstrapping trouble 😛). I'm happy to be talked out of this one.TODO
DOCKER.md.I haven't touched this other than moving it to the top-level directory.I wonder if just using an Ubuntu image forwebwould be easier since we'd get sane Ruby and NodeJS defaults? Additionally, we could just copy/paste the current instructions fromINSTALL.mdand what is used for Vagrant instead of inventing a separate set of installation instructions.Makefileat the top level for runningdocker-composecommands (doesn't seem like that great of an idea).