-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
203 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
#### | ||
#### This docker file is trying to run and install AmiGO/GOlr | ||
#### minimally as root on localhost: | ||
#### | ||
#### Build (from repo root): | ||
#### docker build -t geneontology/amigo-standalone:latest -t geneontology/amigo-standalone:`git log | head -1 | cut -d ' ' -f 2`_`date +%Y-%m-%dT%H%M%S` docker/amigo-standalone | ||
#### | ||
#### To push: | ||
#### docker push geneontology/amigo-standalone:latest | ||
#### docker push geneontology/amigo-standalone:636b4aea877d2585be8d5e2d26f1a59422e43c45_2019-06-05T195931 | ||
#### | ||
#### Run with ports exposed: | ||
#### docker run -p 8080:8080 -p 9999:9999 -v /tmp/srv-solr-data:/srv/solr/data -t geneontology/amigo-standalone:636b4aea877d2585be8d5e2d26f1a59422e43c45_2019-06-05T195931 | ||
#### | ||
#### Check on AmiGO and with port exposed: | ||
#### docker run -it -p 9999:9999 -p 8080:8080 -v /tmp/srv-solr-data:/srv/solr/data geneontology/amigo-standalone:636b4aea877d2585be8d5e2d26f1a59422e43c45_2019-06-05T195931 /bin/bash | ||
#### | ||
|
||
## Grab the latest(?) Ubuntu image. | ||
FROM ubuntu:18.04 | ||
|
||
## Quiet it down a little bit. | ||
ENV DEBIAN_FRONTEND noninteractive | ||
ENV TERM linux | ||
|
||
### | ||
### Packages, repos, and location. | ||
### | ||
|
||
## Get the system updated and QoL. | ||
RUN apt-get -qq update && apt-get -qq -y install \ | ||
libterm-readline-gnu-perl apt-utils \ | ||
software-properties-common netcat rsync \ | ||
build-essential wget curl pigz subversion \ | ||
less mg byobu htop iotop di git make kwalify vim \ | ||
libcgi-application-perl \ | ||
libcgi-application-plugin-session-perl \ | ||
libcgi-application-plugin-tt-perl \ | ||
libcgi-application-server-perl \ | ||
libclone-perl libconfig-yaml-perl libdbi-perl \ | ||
libdbd-sqlite3-perl libdbd-mysql-perl \ | ||
libdata-formvalidator-perl libossp-uuid-perl \ | ||
libfile-type-perl libfile-slurp-perl \ | ||
libfreezethaw-perl libgraph-perl libgraphviz-perl \ | ||
libjson-xs-perl liburi-perl libwww-mechanize-perl \ | ||
liburi-encode-perl libxml-libxml-perl libxml-xpath-perl \ | ||
dh-make-perl apache2 openjdk-8-jdk openjdk-8-jre jetty9 | ||
|
||
## AmiGO weirdness. | ||
ADD docker/libsql-tokenizer-perl_0.24-2_all.deb /tmp/libsql-tokenizer-perl_0.24-2_all.deb | ||
RUN dpkg -i /tmp/libsql-tokenizer-perl_0.24-2_all.deb | ||
|
||
## Node. | ||
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - | ||
RUN apt-get install -y nodejs | ||
|
||
## Grab the AmiGO/GOlr repo and change context. | ||
RUN mkdir -p /srv | ||
USER root:www-data | ||
# RUN git clone https://github.com/geneontology/amigo.git --branch master --single-branch /srv/amigo | ||
ADD . /srv/amigo | ||
WORKDIR /srv/amigo | ||
# RUN git pull | ||
USER root | ||
|
||
### | ||
### Apache. | ||
### | ||
|
||
## Get apache setup as a generic worker. Installation grouped above. | ||
RUN a2dismod mpm_event mpm_worker | ||
RUN a2enmod mpm_prefork | ||
RUN a2dismod cgid mpm_event mpm_worker | ||
RUN a2enmod alias mpm_prefork cgi rewrite proxy proxy_http proxy_html macro headers xml2enc | ||
|
||
### | ||
### GOlr/Jetty. | ||
### | ||
|
||
## GOlr/Jetty setup. Installation grouped above. | ||
RUN cp ./golr/solr/solr.war /var/lib/jetty9/webapps/ | ||
RUN chown jetty /var/lib/jetty9/webapps/solr.war | ||
RUN chgrp adm /var/lib/jetty9/webapps/solr.war | ||
RUN cp ./golr/jetty/jetty /etc/default/jetty9 | ||
RUN mkdir -p /srv/solr/data | ||
RUN mkdir -p /srv/solr/conf | ||
RUN cp ./golr/solr/conf/schema.xml /srv/solr/conf/schema.xml | ||
RUN cp ./golr/solr/conf/solrconfig.xml /srv/solr/conf/solrconfig.xml | ||
RUN chown -R jetty /srv/solr/ | ||
RUN chgrp -R adm /srv/solr/ | ||
|
||
## Custom runtime locations for jetty9/solr for the Docker environment. | ||
RUN mkdir -p /tmp/jetty9 | ||
RUN chown -R jetty /tmp/jetty9 | ||
RUN chgrp -R adm /tmp/jetty9 | ||
|
||
### | ||
### AmiGO. | ||
### | ||
|
||
## Final Apache setup. | ||
RUN cp ./conf/examples/apache2.18_04.localhost_root.conf /etc/apache2/sites-available/001-inline-amigo.conf | ||
RUN cp /srv/amigo/conf/examples/apache2.ports.conf /etc/apache2/ports.conf | ||
RUN a2ensite 001-inline-amigo | ||
|
||
## Get AmiGO docker config into place. | ||
RUN cp ./conf/examples/amigo.yaml.localhost_docker_loader ./conf/amigo.yaml | ||
|
||
## AmiGO install. | ||
USER root:www-data | ||
RUN npm install | ||
RUN ./node_modules/.bin/gulp install | ||
USER root | ||
|
||
## The root environment seems to do something funny with the perl5 | ||
## execution path; modify tp make sure everybody can get at it. | ||
RUN sed -i s,config.pl,/srv/amigo/perl/bin/config.pl,g /srv/amigo/perl/bin/* | ||
RUN sed -i s,config.pl,/srv/amigo/perl/bin/config.pl,g /srv/amigo/perl/lib/AmiGO.pm | ||
|
||
### | ||
### Finally. | ||
### | ||
|
||
## | ||
EXPOSE 8080 9999 | ||
#WORKDIR /usr/share/jetty9 | ||
|
||
#ADD docker/run-apache-solr.sh /tmp/run-apache-solr.sh | ||
#RUN ["chmod", "+x", "/tmp/run-apache-solr.sh"] | ||
#CMD "/tmp/run-apache-solr.sh" | ||
|
||
COPY ./docker/entrypoint.sh / | ||
RUN chmod +x /entrypoint.sh | ||
ENTRYPOINT [ "/entrypoint.sh" ] | ||
CMD ["tail", "-f", "/dev/null" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env bash | ||
|
||
### | ||
### AmiGO on Apache first. | ||
### | ||
|
||
if [ -z $GULP_INSTALL ]; then | ||
cp ./conf/examples/amigo.yaml.localhost_docker_loader ./conf/amigo.yaml | ||
npm install | ||
./node_modules/.bin/gulp install | ||
sed -i s,config.pl,/srv/amigo/perl/bin/config.pl,g /srv/amigo/perl/bin/* | ||
sed -i s,config.pl,/srv/amigo/perl/bin/config.pl,g /srv/amigo/perl/lib/AmiGO.pm | ||
fi | ||
|
||
echo "Starting the apache2 server with amigo installed" | ||
cd /srv/amigo | ||
/etc/init.d/apache2 start | ||
|
||
echo "Launched, waiting for server response" | ||
|
||
COUNTER=0 | ||
while ! nc -z localhost 9999; do | ||
echo "Not found on 9999, rechecking after 2 sec" | ||
sleep 2 # wait for 1 second before check again | ||
COUNTER=$((COUNTER + 1)) | ||
|
||
if [ $COUNTER -gt 10 ] | ||
then | ||
echo "Something is wrong, exiting" | ||
exit 1 ; | ||
fi | ||
done | ||
|
||
echo "Server found on 9999" | ||
|
||
SOLR_MEM=${GOLR_SOLR_MEMORY:="4G"} | ||
|
||
echo "Starting the jetty server with Solr installed ($SOLR_MEM)" | ||
cd /usr/share/jetty9 | ||
java -Xms$SOLR_MEM -Xmx$SOLR_MEM -DentityExpansionLimit=8172000 -Djava.awt.headless=true -Dsolr.solr.home=/srv/solr -Djava.io.tmpdir=/tmp/jetty9 -Djava.library.path=/usr/lib -Djetty.home=/usr/share/jetty9 -Djetty.logs=/var/log/jetty9 -Djetty.state=/tmp/jetty.state -Djetty.host=0.0.0.0 -Djetty.port=8080 -jar /usr/share/jetty9/start.jar --daemon /etc/jetty9/jetty-started.xml & | ||
|
||
cd /srv/amigo | ||
exec "$@" |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
- name: build docker images | ||
hosts: all | ||
vars_files: | ||
- vars.yaml | ||
vars: | ||
repo_dir: '{{ stage_dir }}/amigo' | ||
|
||
tasks: | ||
- name: Checkout repos | ||
git: | ||
repo: '{{ repo }}' | ||
dest: '{{ repo_dir }}' | ||
version: '{{ branch }}' | ||
force: yes | ||
|
||
- name: build image | ||
shell: "docker build -f {{ repo_dir }}/docker/Dockerfile -t 'amigo:{{ tag }}' {{ repo_dir }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
############### | ||
# Point stage_dir to a different locatiom. By default it will reside in the current directory. | ||
############## | ||
stage_dir: "{{ lookup('env', 'PWD') }}/stage_dir" | ||
branch: master | ||
tag: latest | ||
repo: https://github.com/geneontology/amigo.git |