Skip to content

Commit

Permalink
Roll back to using Debian 9 with custom built GDAL (#489)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
icarito authored and jywarren committed Apr 5, 2019
1 parent 647cafa commit 5b0a8b1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
28 changes: 10 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,33 @@
# 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
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
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -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'

Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ 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

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
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 5b0a8b1

Please sign in to comment.