-
Notifications
You must be signed in to change notification settings - Fork 914
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable the app to be built using Docker
- Loading branch information
1 parent
5f4dcd3
commit 4407104
Showing
7 changed files
with
117 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
* | ||
!Gemfile | ||
!Gemfile.lock | ||
!docker_postgres.sh | ||
!db/functions | ||
!lib/quad_tile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Using Docker to run OpenStreetMap | ||
|
||
Using [Docker](https://www.docker.com/) will allow you to install the OpenStreetMap application and all it's dependencies in a container. | ||
|
||
### Clone the repo | ||
|
||
``` | ||
git clone --depth=1 https://github.com/openstreetmap/openstreetmap-website.git | ||
``` | ||
|
||
### App configuration | ||
|
||
``` | ||
cp config/example.application.yml config/application.yml | ||
``` | ||
|
||
### Database | ||
|
||
``` | ||
cp config/example.database.yml config/database.yml | ||
``` | ||
|
||
Set `username` to postgres and `host` to db leave the password blank | ||
|
||
### Installation | ||
|
||
``` | ||
docker-compose up | ||
``` | ||
|
||
### Migrations | ||
|
||
``` | ||
docker-compose exec web bundle exec rake db:migrate | ||
``` | ||
|
||
### Tests | ||
|
||
``` | ||
docker-compose exec web bundle exec rake test:db | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
FROM ruby:2.3-slim | ||
MAINTAINER OpenStreetMap | ||
ENV REFRESHED_AT 2016-09-15 | ||
|
||
# Install packages | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
ruby-dev \ | ||
libgdbm-dev \ | ||
libncurses5-dev \ | ||
libffi-dev \ | ||
libyaml-dev \ | ||
libreadline-dev \ | ||
libpq-dev \ | ||
libxml2-dev \ | ||
imagemagick \ | ||
libmagickwand-dev \ | ||
postgresql-client \ | ||
nodejs \ | ||
file | ||
|
||
# Setup app location | ||
RUN mkdir -p /app | ||
WORKDIR /app | ||
|
||
# Install gems | ||
ADD Gemfile /app/Gemfile | ||
ADD Gemfile.lock /app/Gemfile.lock | ||
RUN bundle install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM postgres:9.4 | ||
|
||
ADD docker_postgres.sh docker-entrypoint-initdb.d/docker_postgres.sh | ||
ADD db/functions/ db/functions/ | ||
ADD lib/quad_tile/ lib/quad_tile/ | ||
|
||
RUN apt-get update && apt-get install -y make \ | ||
postgresql-server-dev-all \ | ||
build-essential |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
version: '2' | ||
services: | ||
web: | ||
image: openstreetmap-website:v1 | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
volumes: | ||
- .:/app | ||
ports: | ||
- "3000:3000" | ||
command: ./script/rails s -p 3000 -b '0.0.0.0' | ||
depends_on: | ||
- db | ||
db: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.postgres | ||
ports: | ||
- "5432:5432" | ||
environment: | ||
POSTGRES_DB: openstreetmap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
set -e | ||
psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -c "CREATE EXTENSION btree_gist" openstreetmap | ||
make -C db/functions libpgosm.so | ||
psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -c "CREATE FUNCTION maptile_for_point(int8, int8, int4) RETURNS int4 AS '${PWD}/db/functions/libpgosm', 'maptile_for_point' LANGUAGE C STRICT" openstreetmap | ||
psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -c "CREATE FUNCTION tile_for_point(int4, int4) RETURNS int8 AS '${PWD}/db/functions/libpgosm', 'tile_for_point' LANGUAGE C STRICT" openstreetmap | ||
psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -c "CREATE FUNCTION xid_to_int4(xid) RETURNS int4 AS '${PWD}/db/functions/libpgosm', 'xid_to_int4' LANGUAGE C STRICT" openstreetmap |