Newer
Older
Alexander König
committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
############################################################
# Dockerfile to build LINDAT Dspace container images
# Based on Ubuntu
############################################################
FROM ubuntu
LABEL maintainer="Alexander König <Alexander.Koenig@eurac.edu>"
# set Dspace environment variables
#ENV DSPACE_INSTANCE_NAME=repository
#ENV DSPACE_SOURCE_DIRECTORY=/opt/repository/sources/dspace
#ENV DSPACE_WORKSPACE=/opt/repository/workspace
#ENV DSPACE_INSTALLATION_DIRECTORY=/opt/lindat-dspace/installation
ENV CI=true
# install jdk, ant, psql, mvn, make, libxml, xsltproc, zip, wget
RUN apt-get update &&\
apt-get -y upgrade &&\
apt-get -y install openjdk-8-jdk ant maven make libxml2-utils xsltproc unzip wget locales
# set up a proper locale
RUN locale-gen en_US.UTF-8
COPY commul-customization/default_locale /etc/default/locale
RUN chmod 0755 /etc/default/locale
ENV LC_ALL=en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US.UTF-8
# build tomcat 8.0.35, version recommended by LINDAT
RUN wget -O /tmp/apache-tomcat-8.0.35.tar.gz https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.35/bin/apache-tomcat-8.0.35.tar.gz
RUN mkdir /opt/tomcat8
RUN tar xvzf /tmp/apache-tomcat-8.0.35.tar.gz -C /opt/tomcat8/ --strip-components=1
RUN groupadd tomcat8
RUN useradd -s /bin/false -g tomcat8 -d /opt/tomcat8/ tomcat8
# doesn't this make more sense?
RUN chown -R tomcat8:tomcat8 /opt/tomcat8
# RUN chgrp -R tomcat8 /opt/tomcat8/
# RUN chmod -R g+r /opt/tomcat8/conf/
# RUN chmod g+x /opt/tomcat8/conf/
# RUN chown -R tomcat8 /opt/tomcat8/webapps/ /opt/tomcat8/work/ /opt/tomcat8/temp/ /opt/tomcat8/logs/
# copy the init script and the modified catalina.sh
COPY commul-customization/tomcat8 /etc/init.d/
RUN chmod a+x /etc/init.d/tomcat8
COPY commul-customization/catalina.sh /opt/tomcat8/bin/
COPY commul-customization/setenv.sh /opt/tomcat8/bin/
# build nginx
RUN apt-get install -y gcc zlib1g zlib1g-dev libpcre3 libpcre3-dev curl cpanminus
RUN cpanm File::Spec::Functions
RUN cpanm Term::ReadLine
COPY commul-customization/nginx_build.sh /tmp/nginx_build.sh
RUN chmod a+x /tmp/nginx_build.sh
WORKDIR /tmp/
RUN ./nginx_build.sh
# copy the init script
COPY commul-customization/nginx /etc/init.d/
RUN chmod a+x /etc/init.d/nginx
# add a symlink
RUN ln -s /opt/nginx/sbin/nginx /usr/sbin/nginx
# copy over static html
RUN mkdir /opt/nginx/html/img
COPY commul-customization/index.html /opt/nginx/html/
COPY commul-customization/eurac.png /opt/nginx/html/img/
# create the test secure folder
RUN mkdir /opt/nginx/html/secure
COPY commul-customization/shib_test.pl /opt/nginx/html/secure/
Alexander König
committed
# get aai project
RUN apt-get install -y git
RUN git clone https://github.com/ufal/lindat-aai-discovery.git /opt/repository/sources/lindat-aai-discovery
# install Dspace
RUN git clone https://github.com/commul/clarin-dspace.git -b clarin /opt/repository/sources/dspace
WORKDIR /opt/repository/sources/dspace/utilities/project_helpers
RUN ./setup.sh /opt/repository/workspace
COPY commul-customization/variable.makefile /opt/repository/workspace/config/variable.makefile
# installing backup2l, this might be unnecessary
RUN apt-get install -y devscripts
RUN git clone https://github.com/gkiefer/backup2l.git /tmp/backup2l
WORKDIR /tmp/backup2l/
RUN ./install-sh -fc
RUN mkdir -p /home/backup
# copy over configs and startup scripts
COPY commul-customization/start_stack.sh /opt/repository/workspace/scripts/
COPY commul-customization/stop_stack.sh /opt/repository/workspace/scripts/
COPY commul-customization/local.properties /opt/repository/workspace/sources/
COPY commul-customization/tomcat-server.xml /opt/tomcat8/conf/server.xml
RUN chmod u+x /opt/repository/workspace/scripts/*_stack.sh
# install libs
Alexander König
committed
WORKDIR /opt/repository/workspace/scripts
RUN make install_libs
# convenience apps for debug purposes (vim and jsbeautifier)
RUN apt-get -y install vim
RUN apt-get -y install python-pip
RUN pip install --upgrade pip
RUN pip install jsbeautifier
COPY commul-customization/__init__.py /usr/local/lib/python2.7/dist-packages/jsbeautifier/
Alexander König
committed
# install shibboleth
COPY commul-customization/shibboleth_sp_with_fastcgi.sh /tmp/
Alexander König
committed
WORKDIR /tmp
Alexander König
committed
RUN chmod u+x /tmp/shibboleth_sp_with_fastcgi.sh
RUN /tmp/shibboleth_sp_with_fastcgi.sh
# copy the init script
RUN cp /opt/shibboleth-sp-fastcgi/etc/shibboleth/shibd-debian /etc/init.d/shibd
RUN chmod a+x /etc/init.d/shibd
Alexander König
committed
# install supervisor
RUN apt-get install -y python-setuptools
RUN easy_install supervisor
COPY commul-customization/supervisord.conf /etc/
RUN mkdir -p /var/log/supervisor
# copy over config files
COPY commul-customization/default-ssl /opt/nginx/conf/
COPY commul-customization/nginx.conf /opt/nginx/conf/
COPY commul-customization/repository_auth /opt/nginx/conf/
COPY commul-customization/shibboleth2.xml /opt/shibboleth-sp-fastcgi/etc/shibboleth/
COPY commul-customization/lindat.eurac.edu.template.metadata.xml /opt/shibboleth-sp-fastcgi/etc/shibboleth/
Alexander König
committed
COPY commul-customization/shib_clear_headers /opt/nginx/conf/
COPY commul-customization/aai_config.js /tmp/
Alexander König
committed
COPY commul-customization/aai.js /opt/repository/sources/lindat-aai-discovery/
WORKDIR /opt/repository/sources/lindat-aai-discovery/
# this line only is necessary until https://github.com/ufal/lindat-aai-discovery/issues/6 is resolved
RUN perl -pi -e 's/http/https/' /opt/repository/sources/lindat-aai-discovery/Makefile
RUN touch /opt/repository/sources/lindat-aai-discovery/aai.js
Alexander König
committed
RUN make aai.min.js
# copy certificate for lindat-dev
COPY commul-customization/certs/lindat-dev.key /etc/ssl/private/
COPY commul-customization/certs/lindat-dev_eurac_edu.pem /etc/ssl/certs/
# if deployed on lindat instead of lindat-dev comment the two lines above and uncomment the following lines
Alexander König
committed
## copy certificate for lindat
# COPY commul-customization/certs/lindat_eurac_edu.key /etc/ssl/private/
# COPY commul-customization/certs/lindat_eurac_edu.crt /etc/ssl/certs/
# convenience setting of workdir
WORKDIR /opt/repository/workspace/scripts
ENTRYPOINT ["/usr/local/bin/supervisord", "-c", "/etc/supervisord.conf"]
# afterwards log into the container
# docker run -h lindat-dev.eurac.edu -p 8080:8080 -p 80:80 -p 443:443 -ti eurac_lindat
#
# and do these things by hand
#
# make new_deploy
## create dspace admin as tomcat8, so that the log files have the right owner
Alexander König
committed
# su -s /bin/sh tomcat8
# /opt/lindat-dspace/installation/bin/dspace create-administrator
## (interactive)
Alexander König
committed
# start the server
# cd /opt/repository/sources/dspace/utilities/project_helpers/scripts
# ./start_stack.sh