- name: Prepare Database
run: |
docker-compose run --rm web rake db:migrate
+ docker-compose run web bundle exec rake i18n:js:export
docker-compose run --rm web osmosis --rx docker/null-island.osm.xml --wd host=db database=openstreetmap user=openstreetmap password=openstreetmap validateSchemaVersion=no
- name: Test Basic Website
run: |
curl -siL http://127.0.0.1:3000 | egrep '^HTTP/1.1 200 OK'
curl -siL http://127.0.0.1:3000 | grep 'OpenStreetMap is the free wiki world map'
curl -siL http://127.0.0.1:3000/api/0.6/node/1 | grep 'Null Island'
+ - name: Test Complete Suite
+ run: |
+ docker-compose run --rm web bundle exec rails test:db
ENV DEBIAN_FRONTEND=noninteractive
# Install system packages
-RUN apt-get update && \
- apt-get install --no-install-recommends -y \
+RUN apt-get update \
+ && apt-get install --no-install-recommends -y \
build-essential \
curl \
default-jre-headless \
+ file \
firefox-geckodriver \
imagemagick \
libarchive-dev \
libffi-dev \
+ libgd-dev \
libmagickwand-dev \
libpq-dev \
libsasl2-dev \
ruby2.7 \
ruby2.7-dev \
tzdata \
- yarnpkg && \
- apt-get clean && \
- rm -rf /var/lib/apt/lists/*
+ unzip \
+ yarnpkg \
+ && apt-get clean \
+ && rm -rf /var/lib/apt/lists/*
# Install current Osmosis
-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
+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
ENV DEBIAN_FRONTEND=dialog
# Install Ruby packages
ADD Gemfile Gemfile.lock /app/
-RUN gem install bundler && \
- bundle install
+RUN gem install bundler \
+ && bundle install
# Install NodeJS packages
ADD package.json yarn.lock /app/
# Add db init script to install OSM-specific Postgres functions/extensions.
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
# Create 'openstreetmap' user
psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" <<-EOSQL
- CREATE USER openstreetmap PASSWORD 'openstreetmap';
+ CREATE USER openstreetmap SUPERUSER PASSWORD 'openstreetmap';
GRANT ALL PRIVILEGES ON DATABASE openstreetmap TO openstreetmap;
EOSQL
# Create btree_gist extensions
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