Skip to content
Snippets Groups Projects
Commit 326c481d authored by Dimitar Nedev's avatar Dimitar Nedev
Browse files

Migrate to CentOS 7 and upgrade to MonetDB July2015

Also:
- create a monetdb user/group with id 5000
- install the GLS extension
- provide more robust database init process
parent ebc8fab0
No related branches found
No related tags found
No related merge requests found
############################################################ ############################################################
# Dockerfile to build MonetDB container images # Dockerfile to build MonetDB and R images
# Based on Fedora (latest) # Based on CentOS 7
############################################################ ############################################################
FROM centos:7
FROM fedora:latest
MAINTAINER Dimitar Nedev, dimitar.nedev@monetdbsolutions.com MAINTAINER Dimitar Nedev, dimitar.nedev@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 # Enables repos, update system, install packages and clean up
############################################################# #############################################################
# Enable MonetDB repo RUN yum install -y \
RUN yum install -y https://dev.monetdb.org/downloads/Fedora/MonetDB-release-1.1-1.monetdb.noarch.rpm wget \
nano
RUN wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
RUN rpm -ivh epel-release-7-5.noarch.rpm
# Update & upgrade # Update & upgrade
RUN yum update -y && \ RUN yum update -y && \
yum upgrade -y yum upgrade -y
# Install supervisor #############################################################
RUN yum install -y supervisor # MonetDB installation
#############################################################
# Create users and groups
RUN groupadd -g 5000 monetdb && \
useradd -u 5000 -g 5000 monetdb
# Enable MonetDB repo
RUN yum install -y http://dev.monetdb.org/downloads/epel/MonetDB-release-epel-1.1-1.monetdb.noarch.rpm
# Update & upgrade
RUN yum update -y && \
yum upgrade -y
# Install MonetDB # Install MonetDB
RUN yum install -y MonetDB-SQL-server5 MonetDB-client RUN yum install -y MonetDB-SQL-server5-hugeint-11.21.5
RUN yum install -y MonetDB-client
# Install the MonetDB/GEOM module # Install the MonetDB/GEOM module
RUN yum install -y MonetDB-geom-MonetDB5 RUN yum install -y MonetDB-geom-MonetDB5
# Install MonetDB/R (R is installed as a dependency) # Install MonetDB/R (R is installed as a dependency)
RUN yum install -y MonetDB-R RUN yum install -y MonetDB-R
# Install MonetDB/GSL module
RUN yum install -y MonetDB-gsl-MonetDB5
# Clean up # Clean up
RUN yum -y clean all RUN yum -y clean all
#######################################################
# Setup supervisord
#######################################################
# Create a log dir for the supervisor
RUN mkdir -p /var/log/supervisor
# Copy the config
COPY supervisord.ini /etc/supervisord.d/supervisord.ini
####################################################### #######################################################
# Setup MonetDB # Setup MonetDB
####################################################### #######################################################
# Setup using the monetdb user # Add helper scripts
USER monetdb COPY scripts/set-monetdb-password.sh /home/monetdb/set-monetdb-password.sh
# Start the dbfarm, create a new database, enable R integration and release it
RUN monetdbd start /var/monetdb5/dbfarm && \
monetdb create db && \
monetdb set embedr=true db && \
monetdb start db && \
monetdb release db && \
monetdb stop db
#######################################################
# Helper scripts
#######################################################
COPY set-monetdb-password.sh /home/monetdb/set-monetdb-password.sh
# Switch back to root for the rest
USER root
RUN chmod +x /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
# Expose ports # We will need this one to authenticate when running init-db.sh, as well
####################################################### COPY configs/.monetdb /home/monetdb/.monetdb
EXPOSE 50000
# Copy the database init scripts
COPY scripts/init-db.sh /home/monetdb/init-db.sh
RUN chmod +x /home/monetdb/init-db.sh
# Set the owner to monetdbs
RUN chown -R monetdb:monetdb /home/monetdb
# Init the db in a scipt to allow more than one process to run in the container
# We need two: one for monetdbd and one for mserver
# The sript will init the database with using the unpreveledged user monetdb
RUN sh /home/monetdb/init-db.sh
####################################################### #######################################################
# Startup scripts # Startup scripts
####################################################### #######################################################
CMD ["/usr/bin/supervisord", "-n"] CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
...@@ -2,7 +2,7 @@ monetdb-r-docker ...@@ -2,7 +2,7 @@ monetdb-r-docker
=========================== ===========================
Docker container for [MonetDB with R](https://www.monetdb.org/content/embedded-r-monetdb) Docker container for [MonetDB with R](https://www.monetdb.org/content/embedded-r-monetdb)
Based on Fedora (latest) Based on CentOS 7
![docker-badge](http://dockeri.co/image/monetdb/monetdb-r-docker) ![docker-badge](http://dockeri.co/image/monetdb/monetdb-r-docker)
...@@ -46,13 +46,14 @@ docker build --rm -t <yourname>/monetdb-r-docker . ...@@ -46,13 +46,14 @@ docker build --rm -t <yourname>/monetdb-r-docker .
# Details # Details
## Base image ## Base image
The MonetDB image is based on the latest Fedora (at the time of image generation). There are plans to migrate to CentOS (latest) once certain system.d issue is resolved The MonetDB image is based on the CentOS 7. We migrated from Fedora (latest).
## Software ## Software
The image includes the latest stable version (at the time of image generation, again) of: The image includes the latest stable version (July2015 or 11.21.5) of:
* MonetDB * MonetDB
* GEOS module * R module for embedded R support
* R integration module
* R * R
* GEOS module
* GSL module
The default database on the image has R integration enabled. The default database on the image has R integration enabled.
......
user=monetdb
password=monetdb
File moved
#!/bin/bash
function test_monetdb_connection() {
runuser -l monetdb -c "mclient -d db -s 'SELECT 1'" &> /dev/null
local status=$?
if [ $status -ne 0 ]; then
return 0
fi
return 1
}
chown -R monetdb:monetdb /var/monetdb5
cd /home/monetdb
if [ ! -d "/var/monetdb5/dbfarm" ]; then
runuser -l monetdb -c 'monetdbd create /var/monetdb5/dbfarm'
else
echo "Existing dbfarm found in '/var/monetdb5/dbfarm'"
fi
runuser -l monetdb -c 'monetdbd start /var/monetdb5/dbfarm'
sleep 5
if [ ! -d "/var/monetdb5/dbfarm/db" ]; then
runuser -l monetdb -c 'monetdb create db && \
monetdb set embedr=true db && \
monetdb release db'
else
echo "Existing database found in '/var/monetdb5/dbfarm/db'"
fi
runuser -l monetdb -c 'monetdb start db'
for i in {30..0}; do
echo 'Testing MonetDB connection ' $i
if test_monetdb_connection ; then
echo 'Waiting for MonetDB to start...'
sleep 1
else
echo 'MonetDB is running'
break
fi
done
if [ "$i" = 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"
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment