2014-11-15 23:32:19 +08:00
|
|
|
#
|
|
|
|
# Cartodb container
|
|
|
|
#
|
2018-06-22 21:20:16 +08:00
|
|
|
FROM ubuntu:18.04
|
2018-06-22 17:24:28 +08:00
|
|
|
LABEL maintainer="Stefan Verhoeven <s.verhoeven@esciencecenter.nl>"
|
2014-11-15 23:32:19 +08:00
|
|
|
|
|
|
|
# Configuring locales
|
2015-07-24 18:24:28 +08:00
|
|
|
ENV DEBIAN_FRONTEND noninteractive
|
2018-06-22 16:28:11 +08:00
|
|
|
RUN apt-get update && apt-get install -y -q apt-utils software-properties-common locales && dpkg-reconfigure locales && \
|
2014-11-15 23:32:19 +08:00
|
|
|
locale-gen en_US.UTF-8 && \
|
|
|
|
update-locale LANG=en_US.UTF-8
|
2015-07-24 18:24:28 +08:00
|
|
|
ENV LANG en_US.UTF-8
|
|
|
|
ENV LANGUAGE en_US:en
|
2014-11-15 23:32:19 +08:00
|
|
|
ENV LC_ALL en_US.UTF-8
|
|
|
|
|
2018-07-02 02:37:07 +08:00
|
|
|
#ENV CARTODB_VERSION=v4.11.152
|
|
|
|
ENV CARTODB_VERSION=v4.12.9
|
|
|
|
ENV SQLAPI_VERSION=master
|
|
|
|
ENV CRANKSHAFT_VERSION=master
|
|
|
|
ENV WINDSHAFT_VERSION=master
|
|
|
|
#ENV SQLAPI_VERSION=1.47.2
|
|
|
|
#ENV CRANKSHAFT_VERSION=0.8.1
|
|
|
|
#ENV WINDSHAFT_VERSION=5.4.0
|
|
|
|
ENV DATASERVICES_VERSION=master
|
|
|
|
ENV DATAERVICESAPI_VERSION=master
|
|
|
|
#ENV DATASERVICES_VERSION=0.0.2
|
|
|
|
#ENV DATAERVICESAPI_VERSION=0.30.5-server
|
|
|
|
ENV OBSERVATORY_VERSION=master
|
|
|
|
#ENV OBSERVATORY_VERSION=1.9.0
|
|
|
|
|
2016-09-17 17:38:53 +08:00
|
|
|
RUN useradd -m -d /home/cartodb -s /bin/bash cartodb && \
|
2015-07-24 18:24:28 +08:00
|
|
|
apt-get install -y -q \
|
|
|
|
build-essential \
|
|
|
|
autoconf \
|
|
|
|
automake \
|
|
|
|
libtool \
|
|
|
|
checkinstall \
|
|
|
|
unp \
|
|
|
|
zip \
|
|
|
|
unzip \
|
|
|
|
git-core \
|
|
|
|
git \
|
|
|
|
subversion \
|
|
|
|
curl \
|
2016-09-17 17:38:53 +08:00
|
|
|
libgeos-c1v5 \
|
2015-07-24 18:24:28 +08:00
|
|
|
libgeos-dev \
|
2018-06-22 21:20:16 +08:00
|
|
|
libjson-c-dev \
|
2015-07-24 18:24:28 +08:00
|
|
|
python-simplejson \
|
|
|
|
proj-bin \
|
|
|
|
proj-data \
|
|
|
|
libproj-dev \
|
|
|
|
gdal-bin \
|
2017-04-04 04:46:52 +08:00
|
|
|
libgdal-dev \
|
2018-06-22 21:20:16 +08:00
|
|
|
postgresql-10 \
|
|
|
|
postgresql-client-10 \
|
|
|
|
postgresql-contrib-10 \
|
|
|
|
postgresql-server-dev-10 \
|
|
|
|
postgresql-plpython-10 \
|
|
|
|
postgresql-10-plproxy \
|
|
|
|
postgresql-10-postgis-2.4 \
|
|
|
|
postgresql-10-postgis-scripts \
|
2015-07-24 18:24:28 +08:00
|
|
|
postgis \
|
2018-06-22 21:20:16 +08:00
|
|
|
liblwgeom-2.4-0 \
|
2016-02-08 04:59:26 +08:00
|
|
|
ca-certificates \
|
2015-07-24 18:24:28 +08:00
|
|
|
redis-server \
|
|
|
|
python2.7-dev \
|
|
|
|
python-setuptools \
|
|
|
|
imagemagick \
|
|
|
|
libmapnik-dev \
|
|
|
|
mapnik-utils \
|
|
|
|
python-mapnik \
|
|
|
|
python-argparse \
|
|
|
|
python-gdal \
|
|
|
|
python-chardet \
|
2017-04-04 04:46:52 +08:00
|
|
|
python-all-dev \
|
|
|
|
python-docutils \
|
2015-07-24 18:24:28 +08:00
|
|
|
openssl \
|
2018-06-22 21:20:16 +08:00
|
|
|
libreadline7 \
|
2015-07-24 18:24:28 +08:00
|
|
|
zlib1g \
|
|
|
|
zlib1g-dev \
|
|
|
|
libssl-dev \
|
|
|
|
libyaml-dev \
|
|
|
|
libsqlite3-dev \
|
|
|
|
sqlite3 \
|
|
|
|
libxml2-dev \
|
|
|
|
libxslt-dev \
|
|
|
|
libc6-dev \
|
|
|
|
ncurses-dev \
|
|
|
|
bison \
|
|
|
|
pkg-config \
|
|
|
|
libpq5 \
|
|
|
|
libpq-dev \
|
|
|
|
libcurl4-gnutls-dev \
|
|
|
|
libffi-dev \
|
|
|
|
libgdbm-dev \
|
|
|
|
gnupg \
|
|
|
|
libreadline6-dev \
|
|
|
|
libcairo2-dev \
|
|
|
|
libjpeg8-dev \
|
|
|
|
libpango1.0-dev \
|
|
|
|
libgif-dev \
|
2016-02-08 04:59:26 +08:00
|
|
|
libgmp-dev \
|
|
|
|
libicu-dev \
|
2017-04-04 04:46:52 +08:00
|
|
|
wget \
|
|
|
|
nginx-light \
|
|
|
|
net-tools \
|
2018-06-22 21:20:16 +08:00
|
|
|
ruby2.5-dev \
|
2016-09-17 17:38:53 +08:00
|
|
|
--no-install-recommends && \
|
2015-07-24 18:24:28 +08:00
|
|
|
rm -rf /var/lib/apt/lists/*
|
2014-11-15 23:32:19 +08:00
|
|
|
|
2016-07-10 04:18:36 +08:00
|
|
|
RUN git config --global user.email you@example.com
|
|
|
|
RUN git config --global user.name "Your Name"
|
|
|
|
|
2018-06-22 21:20:16 +08:00
|
|
|
# Varnish 3, Ubuntu:17.04 comes with Varnish 5.1 which can't be run with anonymous admin telnet
|
2017-04-04 04:46:52 +08:00
|
|
|
RUN cd /opt && \
|
2017-09-09 01:03:45 +08:00
|
|
|
wget http://varnish-cache.org/_downloads/varnish-3.0.7.tgz && \
|
|
|
|
tar -zxf varnish-3.0.7.tgz && \
|
2017-04-04 04:46:52 +08:00
|
|
|
cd varnish-3.0.7 && \
|
|
|
|
./configure --prefix=/opt/varnish && \
|
|
|
|
make && \
|
2017-04-04 14:21:59 +08:00
|
|
|
make install && \
|
|
|
|
cd /opt && \
|
2017-09-09 01:03:45 +08:00
|
|
|
rm -rf varnish-3.0.7 varnish-3.0.7.tgz
|
2017-04-04 04:46:52 +08:00
|
|
|
|
2016-02-08 04:59:26 +08:00
|
|
|
# Install NodeJS
|
2017-06-25 01:18:06 +08:00
|
|
|
RUN curl https://nodejs.org/download/release/v6.9.2/node-v6.9.2-linux-x64.tar.gz| tar -zxf - --strip-components=1 -C /usr && \
|
2017-04-04 04:46:52 +08:00
|
|
|
npm install -g grunt-cli && \
|
2017-06-25 01:18:06 +08:00
|
|
|
npm install -g npm@3.10.9 && \
|
2017-04-05 04:06:48 +08:00
|
|
|
rm -r /tmp/npm-* /root/.npm
|
2016-02-08 04:59:26 +08:00
|
|
|
|
2014-11-15 23:32:19 +08:00
|
|
|
# Setting PostgreSQL
|
2018-06-22 21:20:16 +08:00
|
|
|
RUN sed -i 's/\(peer\|md5\)/trust/' /etc/postgresql/10/main/pg_hba.conf && \
|
2017-04-04 04:46:52 +08:00
|
|
|
service postgresql start && \
|
|
|
|
createuser publicuser --no-createrole --no-createdb --no-superuser -U postgres && \
|
|
|
|
createuser tileuser --no-createrole --no-createdb --no-superuser -U postgres && \
|
|
|
|
service postgresql stop
|
|
|
|
|
2017-04-05 03:13:53 +08:00
|
|
|
# Crankshaft: CARTO Spatial Analysis extension for PostgreSQL
|
|
|
|
RUN cd / && \
|
2018-06-22 16:28:11 +08:00
|
|
|
curl https://bootstrap.pypa.io/get-pip.py | python && \
|
2017-04-05 03:13:53 +08:00
|
|
|
git clone https://github.com/CartoDB/crankshaft.git && \
|
|
|
|
cd /crankshaft && \
|
2018-07-02 02:37:07 +08:00
|
|
|
git checkout $CRANKSHAFT_VERSION && \
|
2017-04-05 03:13:53 +08:00
|
|
|
make install && \
|
|
|
|
cd ..
|
|
|
|
|
2017-04-04 04:46:52 +08:00
|
|
|
# Initialize template postgis db
|
2014-11-15 23:32:19 +08:00
|
|
|
ADD ./template_postgis.sh /tmp/template_postgis.sh
|
|
|
|
RUN service postgresql start && /bin/su postgres -c \
|
|
|
|
/tmp/template_postgis.sh && service postgresql stop
|
|
|
|
|
|
|
|
ADD ./cartodb_pgsql.sh /tmp/cartodb_pgsql.sh
|
|
|
|
|
|
|
|
# Install CartoDB API
|
|
|
|
RUN git clone git://github.com/CartoDB/CartoDB-SQL-API.git && \
|
2017-04-05 04:06:48 +08:00
|
|
|
cd CartoDB-SQL-API && \
|
2018-07-02 02:37:07 +08:00
|
|
|
git checkout $SQLAPI_VERSION && \
|
2017-04-05 04:06:48 +08:00
|
|
|
npm install && \
|
|
|
|
rm -r /tmp/npm-* /root/.npm
|
2014-11-15 23:32:19 +08:00
|
|
|
|
|
|
|
# Install Windshaft
|
|
|
|
RUN git clone git://github.com/CartoDB/Windshaft-cartodb.git && \
|
2017-04-05 04:06:48 +08:00
|
|
|
cd Windshaft-cartodb && \
|
2018-07-02 02:37:07 +08:00
|
|
|
git checkout $WINDSHAFT_VERSION && \
|
2018-02-17 20:53:49 +08:00
|
|
|
npm install -g yarn@0.27.5 && \
|
|
|
|
yarn install && \
|
2017-04-05 04:06:48 +08:00
|
|
|
rm -r /tmp/npm-* /root/.npm && \
|
|
|
|
mkdir logs
|
2017-04-04 04:46:52 +08:00
|
|
|
|
|
|
|
# Install CartoDB
|
|
|
|
RUN git clone --recursive git://github.com/CartoDB/cartodb.git && \
|
|
|
|
cd cartodb && \
|
2018-07-02 02:37:07 +08:00
|
|
|
git checkout $CARTODB_VERSION && \
|
2017-07-01 23:19:27 +08:00
|
|
|
# Install cartodb extension
|
|
|
|
cd lib/sql && \
|
|
|
|
PGUSER=postgres make install && \
|
|
|
|
service postgresql start && /bin/su postgres -c \
|
|
|
|
/tmp/cartodb_pgsql.sh && service postgresql stop && \
|
|
|
|
cd - && \
|
2017-04-04 04:46:52 +08:00
|
|
|
npm install && \
|
2017-04-05 04:06:48 +08:00
|
|
|
rm -r /tmp/npm-* /root/.npm && \
|
2018-06-22 21:20:16 +08:00
|
|
|
perl -pi -e 's/gdal==1\.10\.0/gdal==2.2.2/' python_requirements.txt && \
|
2017-07-02 00:34:08 +08:00
|
|
|
pip install --no-binary :all: -r python_requirements.txt && \
|
2018-06-22 21:20:16 +08:00
|
|
|
gem install bundler bundle compass archive-tar-minitar && \
|
2017-04-04 04:46:52 +08:00
|
|
|
/bin/bash -l -c 'bundle install' && \
|
2017-09-09 01:03:45 +08:00
|
|
|
cp config/grunt_development.json ./config/grunt_true.json && \
|
2018-07-02 02:37:07 +08:00
|
|
|
/bin/bash -l -c 'bundle exec grunt'
|
|
|
|
# && \
|
|
|
|
#rm -rf .git /root/.cache/pip node_modules
|
2014-11-15 23:32:19 +08:00
|
|
|
|
2016-02-08 04:59:26 +08:00
|
|
|
# Geocoder SQL client + server
|
2017-04-07 04:24:10 +08:00
|
|
|
RUN git clone https://github.com/CartoDB/data-services.git && \
|
2018-07-02 02:37:07 +08:00
|
|
|
cd /data-services/geocoder/extension && \
|
|
|
|
git checkout $DATASERVICES_VERSION && \
|
|
|
|
PGUSER=postgres make all install && cd / && \
|
2016-09-17 17:38:53 +08:00
|
|
|
git clone https://github.com/CartoDB/dataservices-api.git && \
|
2017-04-07 04:24:10 +08:00
|
|
|
cd /dataservices-api/server/extension && \
|
2018-07-02 02:37:07 +08:00
|
|
|
git checkout $DATAERVICESAPI_VERSION && \
|
2017-04-07 04:24:10 +08:00
|
|
|
PGUSER=postgres make install && \
|
|
|
|
cd ../lib/python/cartodb_services && \
|
|
|
|
pip install -r requirements.txt && pip install . && \
|
|
|
|
cd ../../../../client && PGUSER=postgres make install
|
2016-07-10 04:18:36 +08:00
|
|
|
|
2018-06-22 21:20:16 +08:00
|
|
|
# Observatory extension
|
2018-02-17 20:54:15 +08:00
|
|
|
RUN cd / && git clone --recursive https://github.com/CartoDB/observatory-extension.git && \
|
|
|
|
cd observatory-extension && \
|
2018-07-02 02:37:07 +08:00
|
|
|
git checkout $OBSERVATORY_VERSION && \
|
2018-02-17 20:54:15 +08:00
|
|
|
PGUSER=postgres make deploy
|
|
|
|
|
2014-11-15 23:32:19 +08:00
|
|
|
# Copy confs
|
2015-07-24 18:24:28 +08:00
|
|
|
ADD ./config/CartoDB-dev.js \
|
|
|
|
/CartoDB-SQL-API/config/environments/development.js
|
|
|
|
ADD ./config/WS-dev.js \
|
|
|
|
/Windshaft-cartodb/config/environments/development.js
|
2014-11-15 23:32:19 +08:00
|
|
|
ADD ./config/app_config.yml /cartodb/config/app_config.yml
|
|
|
|
ADD ./config/database.yml /cartodb/config/database.yml
|
|
|
|
ADD ./create_dev_user /cartodb/script/create_dev_user
|
2015-02-18 16:51:25 +08:00
|
|
|
ADD ./setup_organization.sh /cartodb/script/setup_organization.sh
|
2017-04-04 04:46:52 +08:00
|
|
|
ADD ./config/cartodb.nginx.proxy.conf /etc/nginx/sites-enabled/default
|
|
|
|
ADD ./config/varnish.vcl /etc/varnish.vcl
|
2017-04-07 04:24:10 +08:00
|
|
|
ADD ./geocoder.sh /cartodb/script/geocoder.sh
|
|
|
|
ADD ./geocoder_server.sql /cartodb/script/geocoder_server.sql
|
2017-07-02 00:34:08 +08:00
|
|
|
ADD ./fill_geocoder.sh /cartodb/script/fill_geocoder.sh
|
2017-08-02 04:07:30 +08:00
|
|
|
ADD ./sync_tables_trigger.sh /cartodb/script/sync_tables_trigger.sh
|
2014-11-15 23:32:19 +08:00
|
|
|
ENV PATH /usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
2017-04-04 04:46:52 +08:00
|
|
|
RUN mkdir -p /cartodb/log && touch /cartodb/log/users_modifications && \
|
|
|
|
/opt/varnish/sbin/varnishd -a :6081 -T localhost:6082 -s malloc,256m -f /etc/varnish.vcl && \
|
2018-06-22 21:20:16 +08:00
|
|
|
perl -pi.bak -e 's/^bind 127.0.0.1 ::1$/bind 0.0.0.0/' /etc/redis/redis.conf && \
|
2017-04-04 04:46:52 +08:00
|
|
|
service postgresql start && service redis-server start && \
|
2018-07-02 02:37:07 +08:00
|
|
|
perl -pi -e 's/0\.22\.0/0.22.2/' /cartodb/app/models/user/db_service.rb && \
|
2017-07-01 23:19:27 +08:00
|
|
|
bash -l -c "cd /cartodb && bash script/create_dev_user && \
|
2017-04-07 04:24:10 +08:00
|
|
|
bash script/setup_organization.sh && bash script/geocoder.sh" && \
|
2017-07-02 03:50:13 +08:00
|
|
|
service postgresql stop && service redis-server stop && \
|
2017-08-02 04:07:30 +08:00
|
|
|
chmod +x /cartodb/script/fill_geocoder.sh && \
|
|
|
|
chmod +x /cartodb/script/sync_tables_trigger.sh
|
2014-11-15 23:32:19 +08:00
|
|
|
|
2017-04-04 04:46:52 +08:00
|
|
|
EXPOSE 80
|
2015-02-13 21:50:03 +08:00
|
|
|
|
2017-04-04 04:46:52 +08:00
|
|
|
ENV GDAL_DATA /usr/share/gdal/1.11
|
2016-03-26 01:36:59 +08:00
|
|
|
|
2017-08-02 04:07:30 +08:00
|
|
|
# Number of seconds between a sync tables task is run
|
|
|
|
# Default interval is an hour, use `docker run -e SYNC_TABLES_INTERVAL=60 ...` to change it
|
|
|
|
ENV SYNC_TABLES_INTERVAL 3600
|
|
|
|
|
2014-11-15 23:32:19 +08:00
|
|
|
ADD ./startup.sh /opt/startup.sh
|
|
|
|
|
|
|
|
CMD ["/bin/bash", "/opt/startup.sh"]
|
2017-07-02 03:54:37 +08:00
|
|
|
HEALTHCHECK CMD curl -f http://localhost || exit 1
|