[openstreetmap/openstreetmap-website] [WIP] Add Docker Compose Support (#2406)
Jamie Alessio
notifications at github.com
Sun Oct 20 02:19:38 UTC 2019
This PR is primarily intended as a way of concretely demonstrating potential improvements / responding to reviewers in PR https://github.com/openstreetmap/openstreetmap-website/pull/2272 by @fazlerabbi37.
### Notable changes
- Reorganized the directory structure based on experience using this structure successfully on several other projects.
- Use a `postgis` Docker image instead of `postgres` since we definitely need PostGIS.
- Combine `RUN` commands to reduce the number of layers in Docker images.
- Don't compile Ruby or install gems in the `db` image. We just need a single header file in order to build `libpgosm.so`.
- Turns out the `docker_postgres.sh` script which installs the OSM-specific Postgres extensions wasn't actually being run because of a missing slash. Fixed that _(and renamed the file to include `openstreetmap` in the name to make its purpose clear).
- Switched from `ruby:2.5-slim` to `ruby:2.5` since we're installing so much stuff anyway _(ok, fine - it's mostly because it has `curl` installed by default which saves some bootstrapping trouble 😛)_. I'm happy to be talked out of this one.
### TODO
- [ ] Review and update `DOCKER.md`. I haven't touched this other than moving it to the top-level directory.
- [ ] I wonder if just using an Ubuntu image for `web` would be easier since we'd get sane Ruby and NodeJS defaults? Additionally, we could just copy/paste the current instructions from `INSTALL.md` and what is used for Vagrant instead of inventing a separate set of installation instructions.
- [ ] Get feedback on the addition of a `Makefile` at the top level for running `docker-compose` commands _(doesn't seem like that great of an idea)_.
- [ ] Deal with Postgres persistence. Instructions for this included at https://hub.docker.com/_/postgres
You can view, comment on, or merge this pull request online at:
https://github.com/openstreetmap/openstreetmap-website/pull/2406
-- Commit Summary --
* Add Dockerfile for rails app
* Modify Dockerfile to fix comment for postgresql-client installation error
* Modify Dockerfile to separate apt cache clean, npm comment, and removed jobs from bundle install
* Add docker_postgres.sh for PostgreSQL extension and functions
* Add Dockerfile.postgres for postgres app
* Add docker-compose.yml to build the complete app
* modify Dockerfile.postgres to fix script path
* modify Dockerfile.postgres to upgrade postgres image to 11
* modify Dockerfile to change postgresql-client package and install phantomjs via npm
* modify docker-compose.yml to fix context path
* add DOCKER.md file with docker setup instructions
* add .dockerignore file to list ignorable file for docker
* modify DOCKER.md to add database population
* modify DOCKER.md to add app config
* moved docker_postgres.sh to docker directory
* modify Dockerfile.postgres file to change pgsql script location
* modify Dockerfile.postgres file to add app location and gem install
* modify Dockerfile.postgres file to move db function directory
* modify docker_postgres.sh to fix libpgosm location
* modify Dockerfile to add osmosis
* modify DOCKER.md to add osmosis instructions
* modify Dockerfile.postgres to add ruby compilation
* modify Dockerfile.postgres to change owner to postgres
* Reorganize docker-compose files
* Require newer version of docker-compose
* Re-org includes following directory re-org
* Use currently 'supported' version of Postgres
* Move 'ADD' later in build process to preserve layer caches
* Dockerfile cleanup to minimize image layers
* Drop unneeded image names from docker-compose.yml
* Update build context for 'db'
* More re-org of main Dockerfile for better layer caching
* Remove dockerignore file for less build surprises
* Fix db Dockerfile path
* Port forward Postgres to a less common port to avoid conflicts
* Rename Postgres init script
* Build shared object in Dockerfile, not at run time
* Use PG11. Don't install Ruby - just get headers for PG extension.
* Add db name to database URL for docker-compose
* Temporary(?) Makefile for docker-compose shortcuts
-- File Changes --
A DOCKER.md (99)
A Dockerfile (52)
A Makefile (10)
A docker-compose.yml (24)
A docker/postgres/Dockerfile (25)
A docker/postgres/openstreetmap-postgres-init.sh (7)
-- Patch Links --
https://github.com/openstreetmap/openstreetmap-website/pull/2406.patch
https://github.com/openstreetmap/openstreetmap-website/pull/2406.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/2406
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20191019/46c37f4e/attachment.html>
More information about the rails-dev
mailing list