-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sh
380 lines (271 loc) · 9.91 KB
/
build.sh
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
WORKDIR=`pwd`
JBOSS_PORT=9090
JBOSS_PORT_AJP=9009
LOG_LEVEL=INFO # INFO, DEBUG, WARN, ERROR
i2b2_VERSIONS=( '1.7.07' '1.7.06' '1.7.05' '1.7.04' ) # git since 1.7.07
i2b2_VERSION=${i2b2_VERSIONS[1]}
i2b2_VERSION_SHORT="${i2b2_VERSION//.}"
# Set Ant Version [0='1.8.4', 1='1.9.6']
ANT_VERSIONS=( '1.9.7' '1.9.6' '1.8.4' ) # 1.8.4 <-- i2b2
ANT_VERSION=${ANT_VERSIONS[0]}
# Set Axis2 Version [0='1.6.2', 1='1.6.3']
AXIS_VERSIONS=( '1.7.2' '1.7.1' '1.7.0' '1.6.4' '1.6.3' '1.6.2' ) # 1.6.2 <-- i2b2
AXIS_VERSION=${AXIS_VERSIONS[0]}
# PostgreSQL Database
PGVERSIONS=( '9.3' '9.4' '9.5')
# JBoss Wildfly
WILDFLY_VERSIONS=( '8.2.1.Final' '9.0.2.Final' '10.0.0.Final' )
#######################
## CentOS: Base Images with JDK
cd "$WORKDIR/1.1a i2b2 Base CentOS"
JAVA_CENTOS=( 'java-1.7.0-openjdk-devel' 'java-1.8.0-openjdk-devel' )
docker build --pull --tag=floe/i2b2_base_centos:jdk7 \
--build-arg JAVA_INSTALL=${JAVA_CENTOS[0]} --rm=true .
docker build --pull --tag=floe/i2b2_base_centos:jdk8 \
--build-arg JAVA_INSTALL=${JAVA_CENTOS[1]} --rm=true .
### PHUSION Oracle JDK
cd "$WORKDIR/1.1b i2b2 Base Phusion"
JAVA_ORACLE=( '7' '8' )
docker build --pull --tag=floe/i2b2_base_phusion:jdk7 \
--build-arg JAVA_VERSION=${JAVA_ORACLE[0]} --rm=true .
docker build --pull --tag=floe/i2b2_base_phusion:jdk8 \
--build-arg JAVA_VERSION=${JAVA_ORACLE[1]} --rm=true .
### UBUNTU OpenJDK
cd "$WORKDIR/1.1c i2b2 Base Ubuntu"
JAVA_UBUNTU=( 'openjdk-7-jdk' 'openjdk-8-jdk' )
docker build --pull --tag=floe/i2b2_base_ubuntu:jdk7 \
--build-arg JAVA_INSTALL=${JAVA_UBUNTU[0]} --rm=true .
docker build --pull --tag=floe/i2b2_base_ubuntu:jdk8 \
--build-arg JAVA_INSTALL=${JAVA_UBUNTU[1]} --rm=true .
###############################
## JBoss AS Application Service
cd "$WORKDIR/1.2a JBoss AS"
docker build --tag=floe/jboss_as:7.1.1.Final \
--build-arg JBOSS_PORT=${JBOSS_PORT} \
--build-arg JBOSS_PORT_AJP=${JBOSS_PORT_AJP} \
--build-arg JBOSS_LOG_LEVEL=${LOG_LEVEL} \
--rm=true .
## Test
# docker run --name=jboss_as -it --rm=true -p 8080:$JBOSS_PORT -p 9999:9990 \
# floe/jboss_as:7.1.1.Final
# http://127.0.0.1:8080
# JBoss Wildfly
cd "$WORKDIR/1.2b JBoss Wildfly"
for WILDFLY_VERSION in "${WILDFLY_VERSIONS[@]}"
do
echo JBoss Wildfly: $WILDFLY_VERSION
docker build --tag=floe/jboss_wildfly:$WILDFLY_VERSION \
--build-arg JBOSS_PORT=$JBOSS_PORT \
--build-arg JBOSS_PORT_AJP=$JBOSS_PORT_AJP \
--build-arg JBOSS_LOG_LEVEL=$LOG_LEVEL \
--build-arg WILDFLY_VERSION=$WILDFLY_VERSION \
--rm=true .
done
## Test
# docker run --name=wildfly -it --rm=true -p 8080:$JBOSS_PORT -p 9990:9990 \
# floe/jboss_wildfly:${WILDFLY_VERSIONS[2]}
# http://127.0.0.1:8080
#############
## Apache Ant
cd "$WORKDIR/1.3 Apache Ant"
# JBoss AS 7.1.1
sed -i "1s#floe.*#floe/jboss_as:7.1.1.Final#g" Dockerfile
docker build --tag=floe/jboss_as_ant$ANT_VERSION:7.1.1.Final \
--build-arg ANT_VERSION=$ANT_VERSION \
--rm=true .
# JBoss Wildfly
for WILDFLY_VERSION in "${WILDFLY_VERSIONS[@]}"
do
echo JBoss Wildfly: $WILDFLY_VERSION, ANT: $ANT_VERSION
sed -i "1s#floe.*#floe/jboss_wildfly:$WILDFLY_VERSION#g" Dockerfile
docker build --tag=floe/jboss_wildfly_ant$ANT_VERSION:$WILDFLY_VERSION \
--build-arg ANT_VERSION=$ANT_VERSION \
--rm=true .
done
## Test
# docker run --name=ant -it --rm=true \
# floe/jboss_wildfly_ant$ANT_VERSION:${WILDFLY_VERSIONS[0]} ant -version
##############
## Apache Axis
cd "$WORKDIR/1.4 Apache Axis2"
# JBoss AS 7.1.1
sed -i "1s#floe.*#floe/jboss_as_ant$ANT_VERSION:7.1.1.Final#g" Dockerfile
docker build --tag=floe/jboss_as_axis$AXIS_VERSION:7.1.1.Final \
--build-arg AXIS_VERSION=$AXIS_VERSION \
--rm=true .
# JBoss Wildfly
for WILDFLY_VERSION in "${WILDFLY_VERSIONS[@]}"
do
echo JBoss Wildfly: $WILDFLY_VERSION, ANT: $ANT_VERSION, AXIS2: $AXIS_VERSION
sed -i "1s#floe.*#floe/jboss_wildfly_ant$ANT_VERSION:$WILDFLY_VERSION#g" Dockerfile
docker build --tag=floe/jboss_wildfly_axis$AXIS_VERSION:$WILDFLY_VERSION \
--build-arg AXIS_VERSION=$AXIS_VERSION \
--rm=true .
done
## Test
# docker run --name=axis2 -it --rm=true -p 8080:$JBOSS_PORT -p 9999:9990 \
# floe/jboss_wildfly_axis$AXIS_VERSION:${WILDFLY_VERSIONS[1]} /bin/bash
# floe/jboss_as_axis$AXIS_VERSION:7.1.1.Final
# http://127.0.0.1:8080/i2b2/services/listServices
############
## i2b2 core
cd "$WORKDIR/4.1 i2b2 Server Common"
# set Axis Version
sed -i "1s#floe.*#floe/jboss_as_axis$AXIS_VERSION:7.1.1.Final#g" Dockerfile
# get sources
rm resources/i2b2core-src-*
cp ../Downloads/i2b2core-src-$i2b2_VERSION_SHORT.zip ./resources/
cp ../Configuration/* ./resources/Config/
# Build Application Server AS
DOCKER_IMAGE=floe/i2b2_core-as7.1.1.Final-axis$AXIS_VERSION:$i2b2_VERSION
DOCKER_IMAGE=$(echo $DOCKER_IMAGE | awk '{print tolower($0)}')
docker build --tag=$DOCKER_IMAGE \
--build-arg i2b2_VERSION=$i2b2_VERSION \
--build-arg i2b2_VERSION_SHORT=$i2b2_VERSION_SHORT \
--build-arg DB_HOST=db \
--rm=true .
# Build Wildfly
for WILDFLY_VERSION in "${WILDFLY_VERSIONS[@]}"
do
DOCKER_IMAGE=floe/i2b2_core-wildfly$WILDFLY_VERSION-axis$AXIS_VERSION:$i2b2_VERSION
DOCKER_IMAGE=$(echo $DOCKER_IMAGE | awk '{print tolower($0)}')
echo $DOCKER_IMAGE
sed -i "1s#floe.*#floe/jboss_wildfly_axis$AXIS_VERSION:$WILDFLY_VERSION#g" Dockerfile
docker build --tag=$DOCKER_IMAGE \
--build-arg i2b2_VERSION=$i2b2_VERSION \
--build-arg i2b2_VERSION_SHORT=$i2b2_VERSION_SHORT \
--build-arg DB_HOST=db \
--rm=true .
done
#########
# publish
cd "$WORKDIR/4.1 i2b2 Server Common"
###############
## i2b2 Setting
# insert current Container IP in DB
cd "$WORKDIR/4.3 i2b2 Settings"
for PGVERSION in "${PGVERSIONS[@]}"
do
echo $PGVERSION
DOCKER_IMAGE=floe/i2b2$i2b2_VERSION_SHORT-setting_pg:$PGVERSION
echo $DOCKER_IMAGE
sed -i "1s/.*/FROM postgres:$PGVERSION/" Dockerfile
docker build --tag=$DOCKER_IMAGE \
--build-arg JBOSS_PORT=$JBOSS_PORT \
--rm=true .
done
#########################
## Apache Webserver, PHP5
cd "$WORKDIR/6 Webserver"
# i2b2_web_VERSION=$i2b2_VERSION
# i2b2_web_VERSION_SHORT=$i2b2_VERSION_SHORT
i2b2_web_VERSION=1.7.04
i2b2_web_VERSION_SHORT=1704
# get files
rm resources/i2b2webclient-*
rm resources/i2b2core-src-*
cp ../Downloads/i2b2webclient-$i2b2_web_VERSION_SHORT.zip ./resources/
cp ../Downloads/i2b2core-src-$i2b2_web_VERSION_SHORT.zip ./resources/
docker build --pull --tag=floe/i2b2_webserver:$i2b2_web_VERSION \
--build-arg i2b2_VERSION=$i2b2_web_VERSION \
--build-arg i2b2_VERSION_SHORT=$i2b2_web_VERSION_SHORT \
--build-arg HIVE_ID=dexhelpp \
--build-arg HIVE_NAME=dexhelpp \
--build-arg i2b2_HOST=i2b2 \
--build-arg JBOSS_PORT=$JBOSS_PORT \
--rm=true .
################################################################################
## Run: DB
PGVERSION=9.4
DB_CONTAINER=i2b2_db
# from persistant image
PG_STORAGE=i2b2_$i2b2_VERSION_SHORT-postgres_storage-$PGVERSION
docker run -d --name $DB_CONTAINER \
-p 127.0.0.1:5432:5432 \
-e "POSTGRES_USER=postgres" -e "POSTGRES_PASSWORD=postgres" \
--volumes-from $PG_STORAGE \
floe/postgres_citusdb_1.3:$PGVERSION
# import SQL dump
docker run --name $DB_CONTAINER -d \
-p 127.0.0.1:5432:5432 \
-e "POSTGRES_USER=postgres" -e "POSTGRES_PASSWORD=postgres" \
floe/i2b2-$i2b2_VERSION_SHORT-postgres:$PGVERSION
# --> loading takes some time!!
## Run: i2b2 'native'
# latest
docker run --name=i2b2 -d -p 9090:$JBOSS_PORT -p 9990:9990 \
--link $DB_CONTAINER:db \
floe/i2b2_core-wildfly$WILDFLY_VERSION-axis$AXIS_VERSION:$i2b2_VERSION
# floe/i2b2_core-wildfly10.0.0.final-axis1.7.2:1.7.06
# recommended
docker run --name=i2b2 -d -p 9090:$JBOSS_PORT -p 9990:9990 \
--link $DB_CONTAINER:db \
floe/i2b2_core-as7.1.1.final-axis$AXIS_VERSION:$i2b2_VERSION
# docker inspect i2b2 | grep IPAddress
# docker exec -it i2b2 /bin/bash
# http://localhost:8080/i2b2/services/listServices
## Run: i2b2 'foreign'
# load installation as offline data-volume
# --> mount volume & run server from other image
# example for AS / JDK 7
docker run --name=i2b2_vol -d \
floe/i2b2_core-as7.1.1.final-axis1.6.3:1.7.06 true
docker run --name=i2b2 -d -p 9090:$JBOSS_PORT -p 9990:9990 \
--link $DB_CONTAINER:db \
--volumes-from=i2b2_vol \
floe/i2b2_base_ubuntu:jdk7 \
/opt/jboss/as/bin/standalone.sh -b 0.0.0.0 -bmanagement 0.0.0.0
# example for Wildfly / JDK 8
docker run --name=i2b2_vol -d \
floe/i2b2_core-wildfly10.0.0.cr2-axis1.6.3:1.7.06 true
docker run --name=i2b2 -d -p 9090:$JBOSS_PORT -p 9990:9990 \
--link $DB_CONTAINER:db \
--volumes-from=i2b2_vol \
floe/i2b2_base_phusion:jdk8 \
/opt/jboss/wildfly/bin/standalone.sh -b 0.0.0.0 -bmanagement 0.0.0.0
## Run: i2b2 DB config
# get IPs from linked container or Environment Variables
IMAGE_SETTING=floe/i2b2$i2b2_VERSION_SHORT-setting_pg:$PGVERSION
docker run -it --rm=true --name i2b2_db_settings \
-e "HIVE_ID=dexhelpp" \
-e "JBOSS_PORT=$JBOSS_PORT" \
-e "PGPASSWORD=postgres" \
--link i2b2_i2b2_1:i2b2 \
--link i2b2_i2b2_db_1:db \
$IMAGE_SETTING
#-e "PG_IP=172.17.0.2" \ --> to connect to the database
#-e "i2b2_IP=172.17.0.3" \ --> to set i2b2 IP in configuration
## Run: Webserver
docker run -p 80:80 -d --name i2b2_web \
--link i2b2:i2b2 \
--volumes-from=i2b2 \
floe/i2b2_webserver:1.7.04
# Current: $i2b2_VERSION
# Everything working: 1.7.04
## STOP
docker stop i2b2_web && docker rm i2b2_web
docker stop i2b2 && docker rm i2b2
#docker rm i2b2_vol
docker stop $DB_CONTAINER && docker rm $DB_CONTAINER
#############################3
## docker-compose
PGVERSION=9.4
JBOSS_PORT=9090
i2b2_VERSION=1.7.06
i2b2_VERSION_SHORT=1706
DB_HOST=
export PGVERSION JBOSS_PORT i2b2_VERSION i2b2_VERSION_SHORT DB_HOST
docker-compose up -d
# http://127.0.0.1:9090/i2b2/services/listServices
# http://localhost:9000/
# http://localhost:8080/
# localhost/webclient
# localhost/admin
##########
## plugin - Test
cd "$WORKDIR/4.x i2b2 Server Testing"
docker build --tag=i2b2_plugin:1.7.04 --rm=true .
docker run --name=i2b2 -d -p 9090:$JBOSS_PORT -p 9990:9990 \
--link $DB_CONTAINER:db \
i2b2_plugin:1.7.04
#