diff --git a/tmp/Dockerfile b/tmp/Dockerfile deleted file mode 100644 index 64704d11c3a33cfa5b6a98041c2ec676bbbc9af4..0000000000000000000000000000000000000000 --- a/tmp/Dockerfile +++ /dev/null @@ -1,102 +0,0 @@ -############################################################ -# Dockerfile to build MonetDB and R images -# Based on CentOS 7 -############################################################ -FROM centos:7 -MAINTAINER Panagiotis Koutsourakis <panagiotis.koutsourakis@monetdbsolutions.com> - -####################################################### -# Expose ports -####################################################### -EXPOSE 50000 - -####################################################### -# Setup supervisord -####################################################### -# Install supervisor -RUN yum install -y python-setuptools -RUN easy_install supervisor -# Create a log dir for the supervisor -RUN mkdir -p /var/log/supervisor -# Copy the config -COPY configs/supervisord.conf /etc/supervisor/conf.d/supervisord.conf - -############################################################# -# Enables repos, update system, install packages and clean up -############################################################# -RUN yum -y install epel-release numpy - -# Update & upgrade -RUN yum update -y && \ - yum upgrade -y - -############################################################# -# MonetDB installation -############################################################# -# Create users and groups -RUN groupadd -g 5000 monetdb && \ - useradd -u 5000 -g 5000 monetdb - -# Enable MonetDB repo -RUN yum install -y https://www.monetdb.org/downloads/epel/MonetDB-release-epel.noarch.rpm - -# Update & upgrade -RUN yum update -y && \ - yum upgrade -y - -ARG MonetDBVersion=11.33.3 - -# Install MonetDB server -RUN yum install -y MonetDB-$MonetDBVersion \ - MonetDB-stream-$MonetDBVersion \ - MonetDB-client-$MonetDBVersion \ - MonetDB-SQL-server5-$MonetDBVersion \ - MonetDB-SQL-server5-hugeint-$MonetDBVersion \ - MonetDB5-server-$MonetDBVersion \ - MonetDB5-server-hugeint-$MonetDBVersion - -# Install MonetDB extensions -RUN yum install -y MonetDB-geom-MonetDB5-$MonetDBVersion \ - MonetDB-R-$MonetDBVersion \ - MonetDB-python2-$MonetDBVersion - -# Clean up -RUN yum -y clean all - -####################################################### -# Setup MonetDB -####################################################### -# Add helper scripts -COPY scripts/set-monetdb-password.sh /home/monetdb/set-monetdb-password.sh -RUN chmod +x /home/monetdb/set-monetdb-password.sh - -# Add a monetdb config file to avoid prompts for username/password -# We will need this one to authenticate when running init-db.sh, as well -COPY configs/.monetdb /home/monetdb/.monetdb - -# Copy the database init scripts -COPY scripts/init-db.sh /home/monetdb/init-db.sh -RUN chmod +x /home/monetdb/init-db.sh - -# As of the Jun2016 release, we have to set the property listenaddr to any host -# because now it only listens to the localhost by default -RUN echo "listenaddr=0.0.0.0" >> /var/monetdb5/dbfarm/.merovingian_properties - -# Init the db in a script to allow more than one process to run in the container -# We need two: one for monetdbd and one for mserver -# The script will init the database with using the unprivileged user monetdb -RUN su -c 'sh /home/monetdb/init-db.sh' monetdb - -CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] - -# CUSTOM - -ENV MONETDB_NAME dbmonet -ENV MONETDB_USER dbmonet -ENV MONETDB_PASSWORD dbmonet - -WORKDIR /home/monetdb - -COPY script.sh /etc/script/script.sh - -CMD ["/bin/bash", "/etc/script/script.sh"] diff --git a/tmp/configs/supervisord.conf b/tmp/configs/supervisord.conf deleted file mode 100644 index 9af0220d18409e848c7db6aca1c234f47dab6da0..0000000000000000000000000000000000000000 --- a/tmp/configs/supervisord.conf +++ /dev/null @@ -1,12 +0,0 @@ -[supervisord] -nodaemon=true - -[program:monetdbd] -command=monetdbd start /var/monetdb5/dbfarm -autorestart=false -user=monetdb -redirect_stderr=true -stdout_logfile=/var/log/supervisor/monetdbd.log -priority=1 -exitcodes=0 -startsecs=0 diff --git a/tmp/script.sh b/tmp/script.sh deleted file mode 100644 index a6b0a2614c537ccfb4729b603f93af89e3cf520b..0000000000000000000000000000000000000000 --- a/tmp/script.sh +++ /dev/null @@ -1,25 +0,0 @@ -/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf & -# the first argument will the database name -condition=true -while $condition ; do -# it will create a database called monetdb -monetdb create $MONETDB_NAME -# $? is the result 0 for sucess 1 for err -try=$? -if [ $try == "0" ] - then - # the test has succeed - condition=false - else - # the test has failed will try again in 5s - sleep 5s -fi -done -monetdb release $MONETDB_NAME -# .monetdb will be read when mclient is called without user and password -echo "user=monetdb" > .monetdb -echo "password=monetdb" >> .monetdb -mclient -d $MONETDB_NAME -s "create user \"$MONETDB_USER\" with password '$MONETDB_PASSWORD' name 'ci' schema \"sys\""; -echo "user=$MONETDB_USER" > .monetdb -echo "password=$MONETDB_PASSWORD" >> .monetdb -wait \ No newline at end of file diff --git a/tmp/scripts/init-db.sh b/tmp/scripts/init-db.sh deleted file mode 100644 index 64f6bb15d2aeb8ac462f1e781251e45edf49f27b..0000000000000000000000000000000000000000 --- a/tmp/scripts/init-db.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -chown -R monetdb:monetdb /var/monetdb5 - -if [ ! -d "/var/monetdb5/dbfarm" ]; then - monetdbd create /var/monetdb5/dbfarm -else - echo "Existing dbfarm found in '/var/monetdb5/dbfarm'" -fi - -monetdbd start /var/monetdb5/dbfarm - -sleep 5 -if [ ! -d "/var/monetdb5/dbfarm/db" ]; then - monetdb create db && \ - monetdb set embedr=true db && \ - monetdb set embedpy=true db && \ - monetdb release db -else - echo "Existing database found in '/var/monetdb5/dbfarm/db'" -fi - -for i in {30..0}; do - echo 'Testing MonetDB connection ' $i - mclient -d db -s 'SELECT 1' &> /dev/null - if [ $? -ne 0 ] ; then - echo 'Waiting for MonetDB to start...' - sleep 1 - else - echo 'MonetDB is running' - break - fi -done -if [ $i -eq 0 ]; then - echo >&2 'MonetDB startup failed' - exit 1 -fi - -mkdir -p /var/log/monetdb -chown -R monetdb:monetdb /var/log/monetdb - -echo "Initialization done" diff --git a/tmp/scripts/set-monetdb-password.sh b/tmp/scripts/set-monetdb-password.sh deleted file mode 100644 index 85589422053ac4234e83d4726d93476fe44ee618..0000000000000000000000000000000000000000 --- a/tmp/scripts/set-monetdb-password.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -dbname="db" -username="monetdb" - -if [ -n "$1" ]; then - password=$1 - echo "Setting new password for database '$dbname' and user '$username'." - echo -e "user=monetdb\npassword=monetdb" > .monetdb - mclient $dbname -s "ALTER USER SET PASSWORD '$password' USING OLD PASSWORD 'monetdb'"; - rm -f .monetdb -else - echo "No password provided, aborting." -fi diff --git a/tmp/update-postgis.sh b/tmp/update-postgis.sh deleted file mode 100644 index 57c2f904c2635043530d664e1ebf09deb29d9b01..0000000000000000000000000000000000000000 --- a/tmp/update-postgis.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -set -e - -# Perform all actions as $POSTGRES_USER -export PGUSER="$POSTGRES_USER" - -POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" - -# Load PostGIS into both template_database and $POSTGRES_DB -for DB in template_postgis "$POSTGRES_DB" "${@}"; do - echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" - psql --dbname="$DB" -c " - -- Upgrade PostGIS (includes raster) - CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; - -- Upgrade Topology - CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; - -- Install Tiger dependencies in case not already installed - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - -- Upgrade US Tiger Geocoder - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; - " -done \ No newline at end of file