Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Roll back to using Debian 9 with custom built GDAL #489

Merged
merged 16 commits into from
Apr 5, 2019
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
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ 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 build
docker-compose run --rm web bash -l -c "sleep 10 && bower install --allow-root && rake db:setup && rake db:migrate && rake assets:precompile"

deploy-container:
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.
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
version: '3.3'
services:
db:
container_name: db
image: mysql:5.7
env_file:
- mapknitter.env
volumes:
- ../mysql:/var/lib/mysql
- ../dump:/docker-entrypoint-initdb.d
web:
container_name: web
build: .
env_file:
- mapknitter.env
Expand Down