Commit a78760e2 authored by Luca Cinquini's avatar Luca Cinquini
Browse files

Modulairzing the data-node

parent da2c19db
Loading
Loading
Loading
Loading

dashboard/Dockerfile

0 → 100644
+58 −0
Original line number Diff line number Diff line
# Docker image containing 
# the ESGF Dashboard and the esgf-stats web application

# Note: dashboard application accesses the postgres database via credentials
# stored in /esg/config/esg.ini and /esg/config/.esg_pg_pass

ARG ESGF_IMAGES_HUB=esgfhub
ARG ESGF_VERSION=devel

FROM $ESGF_IMAGES_HUB/esgf-tomcat:$ESGF_VERSION

MAINTAINER ESGF <esgf-devel@lists.llnl.gov>

# default ESGF repository
ARG ESGF_REPO=http://distrib-coffee.ipsl.jussieu.fr/pub/esgf

ENV DASHBOARD_HOME /usr/local/esgf-dashboard-ip

# install library dependencies
RUN yum -y install epel-release
RUN yum install -y libxml2-devel libxslt-devel \
                   curl-devel \
                   GeoIP \
                   GeoIP-devel
RUN yum clean all

# install additional GeoLiteCity database
ADD $ESGF_REPO/dist/geoip/GeoLiteCity.dat.gz /tmp/GeoLiteCity.dat.gz
RUN mkdir -p /usr/local/geoip/share/GeoIP && \
     cd /tmp && \
     gunzip -c GeoLiteCity.dat.gz > /usr/local/geoip/share/GeoIP/GeoLiteCity.dat

# install esgf-stats-api war file
#COPY dashboard/esgf-stats-api.war /usr/local/tomcat/webapps/esgf-stats-api/esgf-stats-api.war
ADD $ESGF_REPO/dist/esgf-stats-api/esgf-stats-api.war /usr/local/tomcat/webapps/esgf-stats-api/esgf-stats-api.war
RUN cd /usr/local/tomcat/webapps/esgf-stats-api && \
    jar xvf esgf-stats-api.war && \
    rm esgf-stats-api.war && \
    chown -R tomcat:tomcat /usr/local/tomcat/webapps/esgf-stats-api

# execute dashboard installation script (without the postgres schema)
COPY scripts/ /usr/local/bin/
RUN mkdir $DASHBOARD_HOME && \
    /usr/local/bin/dashboard_ipservice.sh

# create non-privileged user to run the dashboard application
RUN groupadd dashboard && \
    useradd -s /sbin/nologin -g dashboard -d /usr/local/dashboard dashboard && \
    chown -R dashboard:dashboard /usr/local/esgf-dashboard-ip
RUN chmod a+w /var/run

# install the supervisor configuration for the dashboard
# must start esgf-dashboard-ip in the foreground as non-daemon (no '&' to background the process)
ADD scripts/ip.service $DASHBOARD_HOME/bin/ip.service
ADD conf/supervisord.dashboard.conf /etc/supervisor/conf.d/supervisord.dashboard.conf 
RUN mkdir -p $DASHBOARD_HOME/logs

ENTRYPOINT /usr/local/bin/docker-entrypoint.sh
+10 −0
Original line number Diff line number Diff line
[program:dashboard]

#command=sh -c "/usr/local/bin/wait_for_postgres.sh && %(ENV_DASHBOARD_HOME)s/bin/ip.service start"
command=%(ENV_DASHBOARD_HOME)s/bin/ip.service start
process_name=%(program_name)s
startsecs=5
user=dashboard
numprocs=1 
stdout_logfile=%(ENV_DASHBOARD_HOME)s/logs/esgf_dashboard.log
redirect_stderr=true
+78 −0
Original line number Diff line number Diff line
#!/bin/bash
# Script to install the dashboard component of the ESGF monitoring system)
# Author: CMCC (sandro.fiore@cmcc.it)
# Creation date: 20/09/2016
# Last update: 08/12/2016 by CMCC

#default values
DashDir="/usr/local/esgf-dashboard-ip"
GeoipDir="/usr/local/geoip"
Fed="no"

if [ "$1" == "-h" ]; then
    echo "*****************************************"
    echo "Installer for the ESGF Dashboard"
    echo "Author: CMCC"
    echo "*****************************************"
    echo "Usage: $0 param1 param2"
    echo "* param1: <install dir of dashboard>"
    echo "* param2: <install dir of geoip library>"
    echo "* param3: <enable the federation>"
    echo "* default values:" 
    echo "	param1=$DashDir"
    echo "	param2=$GeoipDir"
    echo "	param3=$Fed"
    echo "To run with default values:"
    echo "	./dashboard.sh"
    echo "Enjoj!"
    echo "*****************************************"
    exit 0
fi

if [ "$1" != "" ]; then
        DashDir=$1
fi
if [ "$2" != "" ]; then
        GeoipDir=$2
fi

if [ "$3" != "" ]; then
        Fed=$3
fi

git clone https://github.com/ESGF/esgf-dashboard.git

cd esgf-dashboard/

git checkout -b work_plana origin/work_plana

cd src/c/esgf-dashboard-ip

./configure --prefix=$DashDir --with-geoip-prefix-path=$GeoipDir --with-allow-federation=$Fed

make
make install

cd -
cd ..

psql -d esgcet -U dbsuper < esgf-dashboard/src/python/esgf/esgf-dashboard/schema_migration/versions/007_postgres_upgrade.sql
psql -d esgcet -U dbsuper < esgf-dashboard/src/python/esgf/esgf-dashboard/schema_migration/versions/008_postgres_upgrade.sql

filename="/esg/config/esgf.properties"
declare regex="esgf.host="
while IFS='' read -r line || [[ -n "$line" ]]; do
if [[ " $line " =~ $regex ]]
    then
        host=`echo $line | cut -d \= -f 2`
        size=${#host}
fi
done < "$filename"

sed "s/FQDN/$size/g" esgf-dashboard/src/python/esgf/esgf-dashboard/schema_migration/versions/009_postgres_upgrade.sql > esgf-dashboard/src/python/esgf/esgf-dashboard/schema_migration/versions/009_postgres_upgrade_new.sql

mv esgf-dashboard/src/python/esgf/esgf-dashboard/schema_migration/versions/009_postgres_upgrade_new.sql esgf-dashboard/src/python/esgf/esgf-dashboard/schema_migration/versions/009_postgres_upgrade.sql

psql -d esgcet -U dbsuper < esgf-dashboard/src/python/esgf/esgf-dashboard/schema_migration/versions/009_postgres_upgrade.sql

psql -d esgcet -U dbsuper < esgf-dashboard/src/python/esgf/esgf-dashboard/schema_migration/versions/010_postgres_upgrade.sql
+59 −0
Original line number Diff line number Diff line
#!/bin/bash
# Script to install the dashboard component of the ESGF monitoring system)
# Author: CMCC (sandro.fiore@cmcc.it)
# Creation date: 20/09/2016
# Last update: 08/12/2016 by CMCC

#default values
DashDir="/usr/local/esgf-dashboard-ip"
GeoipDir="/usr/local/geoip"
Fed="no"

if [ "$1" == "-h" ]; then
    echo "*****************************************"
    echo "Installer for the ESGF Dashboard"
    echo "Author: CMCC"
    echo "*****************************************"
    echo "Usage: $0 param1 param2"
    echo "* param1: <install dir of dashboard>"
    echo "* param2: <install dir of geoip library>"
    echo "* param3: <enable the federation>"
    echo "* default values:" 
    echo "	param1=$DashDir"
    echo "	param2=$GeoipDir"
    echo "	param3=$Fed"
    echo "To run with default values:"
    echo "	./dashboard.sh"
    echo "Enjoj!"
    echo "*****************************************"
    exit 0
fi

if [ "$1" != "" ]; then
        DashDir=$1
fi
if [ "$2" != "" ]; then
        GeoipDir=$2
fi

if [ "$3" != "" ]; then
        Fed=$3
fi

cd /usr/local

git clone https://github.com/ESGF/esgf-dashboard.git

cd esgf-dashboard/

git checkout -b devel origin/devel

cd src/c/esgf-dashboard-ip

./configure --prefix=$DashDir --with-geoip-prefix-path=$GeoipDir --with-allow-federation=$Fed

make
make install

cd -
cd ..
+7 −0
Original line number Diff line number Diff line
#!/bin/bash

# deploy esgf config files
/usr/local/bin/process_esgf_config_archive.sh

# start supervisor to keep the container going
supervisord --nodaemon -c /etc/supervisord.conf
Loading