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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
############################################################
# 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
# 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 and make deploy
WORKDIR /opt/repository/workspace/scripts
RUN make install_libs
# this uses the database
RUN make new_deploy
# 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
# install shibboleth
COPY commul-customization/shibboleth_sp_with_fastcgi.sh /tmp/
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
# create the test secure folder
RUN mkdir /opt/repository/sources/secure
# 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/shib_clear_headers /opt/nginx/conf/
COPY commul-customization/aai_config.js /opt/lindat-dspace/installation/webapps/xmlui/themes/UFAL/lib/js/
COPY commul-customization/aai.js /opt/repository/sources/lindat-aai-discovery/
WORKDIR /opt/repository/sources/lindat-aai-discovery/
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 6 lines
## 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/
# RUN grep -rl lindat-dev /opt/lindat-common/public/ | xargs -i perl -pi -e 's/lindat-dev/lindat/g' {}
# 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
#
# start background programs
# supervisord -c /etc/supervisord.conf
# /etc/init.d/postgresql start
#
# create dspace admin as tomcat8, so that the log files have the right owner
# su -s /bin/sh tomcat8
# /opt/lindat-dspace/installation/bin/dspace create-administrator
# (interactive)
# start the server
# cd /opt/repository/sources/dspace/utilities/project_helpers/scripts
# ./start_stack.sh