From 5b0a8b16896fb8f9f7fbe91cf4c07849c53d17e8 Mon Sep 17 00:00:00 2001 From: Sebastian Silva Date: Fri, 5 Apr 2019 16:31:53 -0500 Subject: [PATCH] Roll back to using Debian 9 with custom built GDAL (#489) * Switch back to Debian 9 Stretch * Simplify docker image * Bump Ruby to 2.4.6 * Re-add dependency * Add dependency (zip) * Try pip install gdal * Install libgdal-dev * Revert attept to use pip * Bump ruby * Avoid naming containers in compose file * Avoid overwriting database on redeploy-container * Allow to load mysql dump * Include own GDAL packages * Disable ipv6 to prevent error * Add missing Amazon S3 yml to Makefile * Document unstable instance --- Dockerfile | 28 ++++++++++------------------ Gemfile | 2 +- Makefile | 2 ++ README.md | 3 +++ 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5fbfd32b1..967d32054 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,31 +2,26 @@ # https://github.com/publiclab/mapknitter/ # This image deploys Mapknitter! -FROM debian:buster +FROM ruby:2.4.6-stretch # Set correct environment variables. ENV HOME /root +# Backported GDAL +RUN echo "deb http://packages.laboratoriopublico.org/publiclab/ stretch main" > /etc/apt/sources.list.d/publiclab.list + +# Obtain key +RUN mkdir ~/.gnupg +RUN echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf +RUN apt-key adv --keyserver hkps.pool.sks-keyservers.net --recv-keys BF26EE05EA6A68F0 + # Install dependencies RUN apt-get update -qq && apt-get install -y \ - bundler ruby-rmagick libfreeimage3 \ - libfreeimage-dev zip nodejs gdal-bin \ - curl g++ gcc autoconf automake bison \ - libc6-dev libffi-dev libgdbm-dev \ - libncurses5-dev libsqlite3-dev libtool \ - libyaml-dev make pkg-config sqlite3 \ - zlib1g-dev libgmp-dev libreadline-dev libssl-dev \ - procps libmariadb-dev-compat libmariadb-dev git python-gdal \ - imagemagick - -# Ruby -RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && curl -sSL https://get.rvm.io | bash -s stable && usermod -a -G rvm root -RUN /bin/bash -l -c ". /etc/profile.d/rvm.sh && rvm install 2.4.4 && rvm use 2.4.4 --default" + nodejs gdal-bin curl procps git imagemagick python-gdal zip RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && apt-get install -y npm RUN npm install -g bower - # Install bundle of gems SHELL [ "/bin/bash", "-l", "-c" ] WORKDIR /tmp @@ -34,9 +29,6 @@ ADD Gemfile /tmp/Gemfile ADD Gemfile.lock /tmp/Gemfile.lock RUN bundle install -# HOTFIX Workaround for mysql2 gem incompatibility with libmariadb-dev -RUN sed -i "s/ LONG_PASSWORD |//g" /usr/local/rvm/gems/ruby-*/gems/mysql2-*/lib/mysql2/client.rb - # Add the Rails app WORKDIR /app COPY Gemfile /app/Gemfile diff --git a/Gemfile b/Gemfile index ac4bee5e7..1a4e65be5 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source "https://rubygems.org" -ruby "2.4.4" +ruby "2.4.6" gem "rails", "~>3.2" gem 'rake', '~> 12.3.2' diff --git a/Makefile b/Makefile index c04f5e046..a071d4400 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ export COMPOSE_HTTP_TIMEOUT=360 build: cp config/database.yml.example config/database.yml + cp config/amazon_s3.yml.example config/amazon_s3.yml cp db/schema.rb.example db/schema.rb docker-compose down --remove-orphans docker-compose build @@ -9,6 +10,7 @@ build: deploy-container: docker-compose run --rm web bash -l -c "sleep 10 && bower install --allow-root && rake db:setup && rake db:migrate && rake assets:precompile" docker-compose up -d + docker-compose exec -T web bash -l -c "sleep 10 && rake db:setup && rake db:migrate && rake assets:precompile" redeploy-container: docker-compose up --force-recreate -d diff --git a/README.md b/README.md index 560b85281..b200e0db6 100644 --- a/README.md +++ b/README.md @@ -116,3 +116,6 @@ Help improve Public Lab software! * Review contributor guidelines at http://publiclab.org/wiki/contributing-to-public-lab-software * Some devs hang out in http://publiclab.org/chat (irc webchat) +## Staging infrastructure and testing + +In addition automatic testing with Travis CI - we have a branch (`unstable`) is set to auto-build and deploy to [a staging instance](http://mapknitter-unstable.laboratoriopublico.org/). This instance includes a copy of the production database and is intended for experimenting or debugging purposes with a production-like environment.