From: Andy Allan Date: Wed, 17 Feb 2021 10:22:11 +0000 (+0000) Subject: Merge pull request #3083 from migurski/migurski/docker-compose-cleanups X-Git-Tag: live~2783 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/5761371a561f785e17e5403cd47f76ecd3604eff?hp=2d50a840049e0634ebc548026c41a397747af061 Merge pull request #3083 from migurski/migurski/docker-compose-cleanups Post-merge Docker Compose cleanup issues --- diff --git a/DOCKER.md b/DOCKER.md index d5a673bbe..ce0430939 100644 --- a/DOCKER.md +++ b/DOCKER.md @@ -71,6 +71,7 @@ You can now use Docker to load this extract into your local Docker-based OSM ins docker-compose run --rm web osmosis \ -verbose \ --read-pbf district-of-columbia-latest.osm.pbf \ + --log-progress \ --write-apidb \ host="db" \ database="openstreetmap" \ diff --git a/Dockerfile b/Dockerfile index 33812d25d..e8ff01387 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM ubuntu:20.04 ENV DEBIAN_FRONTEND=noninteractive -# Install system packages +# Install system packages then clean up to minimize image size RUN apt-get update \ && apt-get install --no-install-recommends -y \ build-essential \ @@ -30,7 +30,7 @@ RUN apt-get update \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -# Install current Osmosis +# Install compatible Osmosis to help users import sample data in a new instance RUN curl -OL https://github.com/openstreetmap/osmosis/releases/download/0.47.2/osmosis-0.47.2.tgz \ && tar -C /usr/local -xzf osmosis-0.47.2.tgz @@ -45,6 +45,7 @@ ADD Gemfile Gemfile.lock /app/ RUN gem install bundler \ && bundle install -# Install NodeJS packages +# Install NodeJS packages using yarnpkg +# `bundle exec rake yarn:install` will not work ADD package.json yarn.lock /app/ RUN yarnpkg install diff --git a/config/boot.rb b/config/boot.rb index 630904bfc..988a5ddc4 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,4 +1,4 @@ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) require "bundler/setup" # Set up gems listed in the Gemfile. -require "bootsnap/setup" if ENV.fetch("ENABLE_BOOTSNAP", "true") == "true" # Speed up boot time by caching expensive operations. +require "bootsnap/setup" # Speed up boot time by caching expensive operations. diff --git a/docker-compose.yml b/docker-compose.yml index 1111ad010..8f67212eb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,9 +14,6 @@ services: - web-images:/home/osm/images ports: - "3000:3000" - environment: - # https://github.com/Shopify/bootsnap/issues/262 - ENABLE_BOOTSNAP: 'false' command: bundle exec rails s -p 3000 -b '0.0.0.0' depends_on: - db diff --git a/docker/postgres/Dockerfile b/docker/postgres/Dockerfile index 9faddd841..8358e6e7f 100644 --- a/docker/postgres/Dockerfile +++ b/docker/postgres/Dockerfile @@ -4,4 +4,4 @@ FROM postgres:11 ADD docker/postgres/openstreetmap-postgres-init.sh /docker-entrypoint-initdb.d/ # Custom database functions are in a SQL file. -ADD db/functions/functions.sql /usr/local/sbin/osm-db-functions.sql +ADD db/functions/functions.sql /usr/local/share/osm-db-functions.sql diff --git a/docker/postgres/openstreetmap-postgres-init.sh b/docker/postgres/openstreetmap-postgres-init.sh index 3973311c1..1a7c58857 100755 --- a/docker/postgres/openstreetmap-postgres-init.sh +++ b/docker/postgres/openstreetmap-postgres-init.sh @@ -2,6 +2,7 @@ set -ex # Create 'openstreetmap' user +# Password and superuser privilege are needed to successfully run test suite psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" <<-EOSQL CREATE USER openstreetmap SUPERUSER PASSWORD 'openstreetmap'; GRANT ALL PRIVILEGES ON DATABASE openstreetmap TO openstreetmap; @@ -11,4 +12,4 @@ EOSQL psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -c "CREATE EXTENSION btree_gist" openstreetmap # Define custom functions -psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -f "/usr/local/sbin/osm-db-functions.sql" openstreetmap +psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -f "/usr/local/share/osm-db-functions.sql" openstreetmap