Skip to content

Commit 5acd314

Browse files
committed
Merge branch 'dev' into master
2 parents 3e422f1 + d524d0e commit 5acd314

File tree

11 files changed

+593
-135
lines changed

11 files changed

+593
-135
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
FROM openjdk:8-jdk
2+
3+
RUN apt-get update \
4+
&& apt-get install -y wget \
5+
&& apt-get install -y git \
6+
&& apt-get install -y maven \
7+
&& apt-get install -y python \
8+
&& apt-get install -y gcc \
9+
&& apt-get install -y python-dev \
10+
&& apt-get install -y python-setuptools \
11+
&& /usr/bin/easy_install -U pip \
12+
&& /usr/local/bin/pip install crcmod
13+
14+
MAINTAINER MacArthur Lab
15+
16+
ADD settings.xml /root/.m2/settings.xml
17+
ADD entrypoint.sh /root/bin/entrypoint.sh
18+
19+
env MVN=mvn
20+
21+
#first get Exomiser built in the local maven for matchbox to import in
22+
#---------------------------------------------------------------------------
23+
# _n.b._ check that the tag here is the same as the exomiser.version declared in the pom
24+
25+
RUN git clone https://github.com/exomiser/Exomiser
26+
WORKDIR Exomiser
27+
RUN $MVN -DskipTests=true clean install
28+
29+
#now matchbox (and it will see Exomiser in local maven repo)
30+
#---------------------------------------------------------------------------
31+
32+
RUN git clone https://github.com/macarthur-lab/matchbox
33+
WORKDIR matchbox
34+
RUN $MVN -Dmaven.test.skip=true clean install package
35+
36+
env MATCHBOX_JAR=/Exomiser/matchbox/target/matchbox-0.1.0.jar
37+
env MATCHBOX_CONFIG_DIR=/Exomiser/matchbox/config
38+
env MATCHBOX_DEPLOYMENT_CONFIG_DIR=/matchbox_deployment/config
39+
40+
41+
#Now get support data for Exomiser models (for now, cpying, switch with wget)
42+
#-----------------------------------------------------
43+
44+
#----first get gsutils to interface with google
45+
RUN wget https://storage.googleapis.com/pub/gsutil.tar.gz \
46+
&& mkdir /root/gsutils_dir \
47+
&& tar xfz gsutil.tar.gz -C /root/gsutils_dir \
48+
&& rm gsutil.tar.gz \
49+
&& export PATH=${PATH}:/root/gsutils_dir/gsutil
50+
51+
52+
#----now get the data and untar it
53+
54+
WORKDIR data
55+
RUN /root/gsutils_dir/gsutil/gsutil -m -o GSUtil:parallel_composite_upload_threshold=150M cp gs://seqr-reference-data/1711_phenotype.tar.gz data.local.tar.gz \
56+
&& tar -xzf data.local.tar.gz \
57+
&& rm data.local.tar.gz \
58+
&& pwd \
59+
&& ls -l
60+
61+
62+
#Now set matchbox up for deployment and copy over jar and config files
63+
#---------------------------------------------------------------------------
64+
WORKDIR /matchbox_deployment
65+
RUN cp -rf $MATCHBOX_CONFIG_DIR . \
66+
&& cp $MATCHBOX_JAR .
67+
68+
69+
70+
#############################################
71+
# #
72+
# Please note the EXOMISER_DATA_DIR #
73+
# value. The file system path with ref #
74+
# data (viewable by docker daemon) must #
75+
# be mounted to this location in #
76+
# container at the docker run step #
77+
# #
78+
#############################################
79+
env EXOMISER_DATA_DIR=/Exomiser/matchbox/data
80+
env EXOMISER_PHENOTYPE_DATA_VERSION=1711
81+
82+
83+
#############################################
84+
# #
85+
# This defines if matches that have no #
86+
# genotypes in common, BUT have a high #
87+
# phenotype score should be returned as #
88+
# results #
89+
# #
90+
#############################################
91+
env ALLOW_NO_GENE_IN_COMMON_MATCHES=false
92+
93+
#############################################
94+
# #
95+
# Environment variables for Mongo #
96+
# connection. Please populate before #
97+
# doing docker build command #
98+
# #
99+
#############################################
100+
env MONGODB_HOSTNAME=
101+
env MONGODB_PORT=27017
102+
env MONGODB_USERNAME=
103+
env MONGODB_PASSWORD=
104+
env MONGODB_DATABASE=
105+
106+
107+
#############################################
108+
# #
109+
# Default server port is 9020, this will #
110+
# be overwritten if you chose HTTPS below #
111+
# #
112+
#############################################
113+
env USE_HTTPS=false
114+
env SERVER_PORT=9020
115+
116+
117+
#########################################################################
118+
# #
119+
# MME REQUIRES HTTPS IF YOUR SERVER IS NOT PROXIED BEHIND HTTPS. #
120+
# You can activate HTTPS by, #
121+
# #
122+
# 1. UNCOMMENT ALL the following #
123+
# 2. SET variable USE_HTTPS to be true #
124+
# #
125+
# You can override sever port here #
126+
# #
127+
#########################################################################
128+
#env USE_HTTPS=true
129+
#env SERVER_PORT=8443
130+
#env HTTPS_SSL_KEY_STORE=matchbox_keystore
131+
#env HTTPS_SSL_KEY_STORE_PASSWORD=changeit
132+
#env HTTPS_SSL_KEY_PASSWORD=temp_ks_pwd__change_me!
133+
134+
#RUN keytool -genkey -noprompt \
135+
# -alias matchbox \
136+
# -dname "CN=, OU=, O=, L=, S=, C=" \
137+
# -keystore $HTTPS_SSL_KEY_STORE \
138+
# -storepass $HTTPS_SSL_KEY_STORE_PASSWORD \
139+
# -keypass $HTTPS_SSL_KEY_PASSWORD
140+
141+
142+
#############################################
143+
# #
144+
# This port is exposed by container #
145+
# #
146+
#############################################
147+
EXPOSE $SERVER_PORT
148+
149+
150+
###########################################################################
151+
# IN PRODUCTION, PLEASE MANAGE THESE FILES EXTREMELY CAREFULLY AS THEY #
152+
# WILL CONTAIN SENSITIVE ACCESS TO YOUR, AND OTHER NODES! #
153+
# #
154+
# These files govern/contain, #
155+
# 1. Tokens that gives OTHER NODES, access to matchbox (config.xml) #
156+
# 2. Tokens that gives MATCHBOX, access to other nodes (nodes.json) #
157+
# #
158+
###########################################################################
159+
ADD config.xml $MATCHBOX_DEPLOYMENT_CONFIG_DIR
160+
ADD nodes.json $MATCHBOX_DEPLOYMENT_CONFIG_DIR
161+
162+
163+
CMD ["/root/bin/entrypoint.sh"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# <i>matchbox Docker build process (beta)</i>
2+
3+
We are still in the process of designing a best practices build and deployment process using Docker and Kubernetes, so please consider this a work in progress.
4+
5+
Please be careful to not check in Docker files with private secure
6+
usernames, passwords, and tokens etc.
7+
8+
Please also remember to change any default passwords built into system before production!
9+
10+
## To use this docker build, you will need:
11+
12+
1. Docker (https://www.docker.com/)
13+
14+
15+
## Build process:
16+
17+
1. First update the Dockerfile empty fields at the bottom,
18+
19+
For example:
20+
21+
```
22+
env MONGODB_HOSTNAME=192.168.1.4
23+
env MONGODB_PORT=27017
24+
env MONGODB_USERNAME=username
25+
env MONGODB_PASSWORD=pwd
26+
env MONGODB_DATABASE=mme_primary
27+
```
28+
29+
If you want to serve as HTTPS, please uncomment following by removing "#" and populate as needed. You can ignore otherwise
30+
31+
```
32+
env USE_HTTPS=true
33+
env SERVER_PORT=8443
34+
env HTTPS_SSL_KEY_STORE=matchbox_keystore
35+
env HTTPS_SSL_KEY_STORE_PASSWORD=changeit
36+
env HTTPS_SSL_KEY_PASSWORD=<temp_ks_pwd__change_me!>
37+
38+
RUN keytool -genkey -noprompt \
39+
-alias matchbox \
40+
-dname "CN=, OU=, O=, L=, S=, C=" \
41+
-keystore $HTTPS_SSL_KEY_STORE \
42+
-storepass $HTTPS_SSL_KEY_STORE_PASSWORD \
43+
-keypass $HTTPS_SSL_KEY_PASSWORD
44+
```
45+
46+
47+
2. In the deploy/docker directory there are two files that should be handled extra carefully in production given that they will contain tokens and access information for your instance and other nodes.
48+
```
49+
config.xml : this XML file is used to configure the token to give access to your matchbox instance.
50+
nodes,json : this JSON file contains tokens that give your matchbox instance access to other MME nodes
51+
```
52+
53+
Using guidance from the example data inside them, populate as needed.
54+
55+
Please remember to remove default values before production!
56+
57+
Possibly use a secrets-file management system to keep fully populate files that can inserted in at deployment.
58+
59+
60+
3. Then, from the matchbox docker directory, do a build (should take 6-10mins max)
61+
```
62+
docker build -t matchbox-docimg .
63+
```
64+
65+
4. Assuming,
66+
67+
* And you have a MongoDB instance running and you have added its credentials and details to the Dockerfile before the build step,
68+
69+
70+
For example, if you are using the default HTTP settings and didn't change any port numbers:
71+
```
72+
docker run -ti -p 9020:9020 matchbox-docimg
73+
```
74+
75+
OR
76+
77+
For example, if you uncommented the HTTPS settings and didn't change any HTTPS port numbers:
78+
```
79+
docker run -ti -p 8443:8443 matchbox-docimg
80+
```
81+
82+
83+
6. You can test your instance with (make sure to adjust the URL "http://localhost:9020/patient/view" with the port you used),
84+
85+
```
86+
curl -X GET -H "X-Auth-Token: abcd" -H "Accept: application/vnd.ga4gh.matchmaker.v1.0+json" -H "Content-Type: application/x-www-form-urlencoded" http://localhost:9020/patient/view
87+
```
88+
89+
90+
91+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# shell
2+
export PS1="\h:\w]$ "
3+
4+
export SHELL=/bin/bash
5+
6+
export LS_OPTIONS='--color=auto'
7+
alias ll="ls -al"
8+
alias less='less -m -g -i--underline-special --SILENT'
9+
alias more='less'
10+
11+
export TERM=xterm
12+
13+
resize
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<beans xmlns="http://www.springframework.org/schema/beans"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
5+
6+
7+
<bean id="defaultAccessToken"
8+
class="org.broadinstitute.macarthurlab.matchbox.entities.AuthorizedToken">
9+
<constructor-arg type="java.lang.String" value="Default Access Token" />
10+
<constructor-arg type="java.lang.String" value="abcd" />
11+
<constructor-arg type="java.lang.String" value="Local Center name" />
12+
<constructor-arg type="java.lang.String" value="[email protected]" />
13+
</bean>
14+
15+
<bean id="accessAuthorizedNode"
16+
class="org.broadinstitute.macarthurlab.matchbox.authentication.AccessAuthorizedNode">
17+
<property name="accessAuthorizedNodes">
18+
<list>
19+
<ref bean="defaultAccessToken"/>
20+
</list>
21+
</property>
22+
</bean>
23+
24+
25+
</beans>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env bash
2+
3+
set -x
4+
5+
env
6+
7+
cd /matchbox_deployment
8+
9+
if $USE_HTTPS
10+
then
11+
java -jar -Dallow.no-gene-in-common.matches=$ALLOW_NO_GENE_IN_COMMON_MATCHES \
12+
-Dexomiser.data-directory=$EXOMISER_DATA_DIR \
13+
-Dspring.data.mongodb.host=$MONGODB_HOSTNAME \
14+
-Dspring.data.mongodb.port=$MONGODB_PORT \
15+
-Dspring.data.mongodb.username=$MONGODB_USERNAME \
16+
-Dspring.data.mongodb.password=$MONGODB_PASSWORD \
17+
-Dspring.data.mongodb.database=$MONGODB_DATABASE \
18+
-Dserver.port=$SERVER_PORT \
19+
-Dserver.ssl.key-store=$HTTPS_SSL_KEY_STORE \
20+
-Dserver.ssl.key-store-password=$HTTPS_SSL_KEY_STORE_PASSWORD \
21+
-Dserver.ssl.key-password=$HTTPS_SSL_KEY_PASSWORD \
22+
-Dexomiser.phenotype.data-version=$EXOMISER_PHENOTYPE_DATA_VERSION \
23+
matchbox-0.1.0.jar &
24+
else
25+
java -jar -Dallow.no-gene-in-common.matches=$ALLOW_NO_GENE_IN_COMMON_MATCHES \
26+
-Dexomiser.data-directory=$EXOMISER_DATA_DIR \
27+
-Dspring.data.mongodb.host=$MONGODB_HOSTNAME \
28+
-Dspring.data.mongodb.port=$MONGODB_PORT \
29+
-Dspring.data.mongodb.username=$MONGODB_USERNAME \
30+
-Dspring.data.mongodb.password=$MONGODB_PASSWORD \
31+
-Dspring.data.mongodb.database=$MONGODB_DATABASE \
32+
-Dserver.port=$SERVER_PORT \
33+
-Dexomiser.phenotype.data-version=$EXOMISER_PHENOTYPE_DATA_VERSION \
34+
matchbox-0.1.0.jar &
35+
fi
36+
37+
38+
39+
sleep 10000000000
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"nodes":[{
3+
"name": "test-ref-server",
4+
"token" : "abcd",
5+
"url" : "https://localhost:8443/match",
6+
"contentTypeHeader" : "application/vnd.ga4gh.matchmaker.v1.0+json",
7+
"contentLanguage" : "en-US",
8+
"acceptHeader" : "application/vnd.ga4gh.matchmaker.v1.0+json",
9+
"selfSignedCertificate": true
10+
}]
11+
}
12+
13+
14+
15+
16+
17+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<settings>
2+
<localRepository>${user.home}/.m3/repository</localRepository>
3+
</settings>

0 commit comments

Comments
 (0)