Skip to content

Commit 0a0474d

Browse files
committed
updated docker-compose.yml for use v2 syntax. use network to replace links.
1 parent c84fb2c commit 0a0474d

File tree

4 files changed

+122
-114
lines changed

4 files changed

+122
-114
lines changed

infra_support/compose/docker-compose.yml

+72-76
Original file line numberDiff line numberDiff line change
@@ -3,85 +3,81 @@
33
# docker-compose up
44
#
55

6-
# redis is used to store session data
7-
redis:
8-
image: redis:3.0.5
9-
expose:
10-
- "6379"
6+
version: '2'
117

12-
authsvr:
13-
image: ${DOCKER_REGISTRY_PREFIX}/infra-auth-server
14-
# environment:
15-
# SPRING_PROFILES_ACTIVE: ${DB_TYPE}
16-
expose:
17-
- "19999"
18-
extra_hosts:
19-
- "dbhost:${MYSQL_HOST}"
8+
services:
9+
# redis is used to store session data
10+
redis:
11+
image: redis:3.0.5
12+
networks:
13+
- default
2014

21-
cloudsvr:
22-
image: ${DOCKER_REGISTRY_PREFIX}/infra-cloud-server
23-
environment:
24-
EUREKA_HOST: cloudsvr
25-
expose:
26-
- "8761"
15+
authsvr:
16+
image: ${DOCKER_REGISTRY_PREFIX}/infra-auth-server
17+
networks:
18+
- default
2719

28-
profilesvc:
29-
image: ${DOCKER_REGISTRY_PREFIX}/ibank-profile-service
30-
environment:
31-
SPRING_PROFILES_ACTIVE: ${DB_TYPE}
32-
CONFIG_SERVER_URL: http://cloudsvr:8761
33-
EUREKA_HOST: cloudsvr
34-
JDBC_URL: jdbc:mysql://dbhost/profdb
35-
expose:
36-
- "8110"
37-
links:
38-
- cloudsvr
39-
- authsvr
40-
extra_hosts:
41-
- "dbhost:${MYSQL_HOST}"
20+
cloudsvr:
21+
image: ${DOCKER_REGISTRY_PREFIX}/infra-cloud-server
22+
environment:
23+
EUREKA_HOST: cloudsvr
24+
networks:
25+
- default
4226

43-
cardsvc:
44-
image: ${DOCKER_REGISTRY_PREFIX}/ibank-card-service
45-
environment:
46-
SPRING_PROFILES_ACTIVE: ${DB_TYPE}
47-
CONFIG_SERVER_URL: http://cloudsvr:8761
48-
EUREKA_HOST: cloudsvr
49-
JDBC_URL: jdbc:mysql://dbhost/carddb
50-
expose:
51-
- "8120"
52-
links:
53-
- cloudsvr
54-
- authsvr
55-
extra_hosts:
56-
- "dbhost:${MYSQL_HOST}"
27+
profilesvc:
28+
image: ${DOCKER_REGISTRY_PREFIX}/ibank-profile-service
29+
environment:
30+
SPRING_PROFILES_ACTIVE: mysql
31+
CONFIG_SERVER_URL: http://cloudsvr:8761
32+
EUREKA_HOST: cloudsvr
33+
JDBC_URL: jdbc:mysql://${MYSQL_HOST}/profdb
34+
networks:
35+
- default
36+
depends_on:
37+
- cloudsvr
38+
- authsvr
5739

58-
webapp:
59-
image: ${DOCKER_REGISTRY_PREFIX}/ibank-webapp
60-
environment:
61-
CONFIG_SERVER_URL: http://cloudsvr:8761
62-
AUTH_SERVER_URL: http://authsvr:19999/uaa
63-
EUREKA_HOST: cloudsvr
64-
REDIS_HOST: redis
65-
# below are for use in browser
66-
# so need external domain name or public IP
67-
PUBLIC_APP_URL: ${PUBLIC_BASE_URL}/app
68-
PUBLIC_AUTH_URL: ${PUBLIC_BASE_URL}/uaa
69-
expose:
70-
- "8000"
71-
links:
72-
- redis
73-
- cloudsvr
74-
- authsvr
75-
- profilesvc
76-
- cardsvc
77-
extra_hosts:
78-
- "dbhost:${MYSQL_HOST}"
40+
cardsvc:
41+
image: ${DOCKER_REGISTRY_PREFIX}/ibank-card-service
42+
environment:
43+
SPRING_PROFILES_ACTIVE: mysql
44+
CONFIG_SERVER_URL: http://cloudsvr:8761
45+
EUREKA_HOST: cloudsvr
46+
JDBC_URL: jdbc:mysql://${MYSQL_HOST}/carddb
47+
networks:
48+
- default
49+
depends_on:
50+
- cloudsvr
51+
- authsvr
52+
53+
webapp:
54+
image: ${DOCKER_REGISTRY_PREFIX}/ibank-webapp
55+
environment:
56+
CONFIG_SERVER_URL: http://cloudsvr:8761
57+
AUTH_SERVER_URL: http://authsvr:19999/uaa
58+
EUREKA_HOST: cloudsvr
59+
REDIS_HOST: redis
60+
# below are for use in browser
61+
# so need external domain name or public IP
62+
PUBLIC_APP_URL: ${PUBLIC_BASE_URL}/app
63+
PUBLIC_AUTH_URL: ${PUBLIC_BASE_URL}/uaa
64+
networks:
65+
- default
66+
depends_on:
67+
- redis
68+
- cloudsvr
69+
- authsvr
70+
- profilesvc
71+
- cardsvc
72+
73+
httpd:
74+
image: ${DOCKER_REGISTRY_PREFIX}/ibank-httpd
75+
networks:
76+
- default
77+
ports:
78+
- "8080:8080"
79+
depends_on:
80+
- cloudsvr
81+
- authsvr
82+
- webapp
7983

80-
httpd:
81-
image: ${DOCKER_REGISTRY_PREFIX}/ibank-httpd
82-
ports:
83-
- "8080:8080"
84-
links:
85-
- cloudsvr
86-
- authsvr
87-
- webapp

infra_support/compose/restart

-38
This file was deleted.

infra_support/compose/start

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#! /bin/bash
2+
3+
# steps to start the application
4+
#
5+
# 1. prepare a mysql server somewhere. if none is available you can start one with docker
6+
#
7+
# docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password -d mysql:5.5
8+
#
9+
# 2. execute the mysql_dbinit.script
10+
#
11+
# 3. set MYSQL_HOST variable below to your MYSQL server address
12+
#
13+
14+
# change to the actual MYSQL server IP
15+
export MYSQL_HOST=192.168.20.20
16+
17+
if [ "$DOCKER_REGISTRY_PREFIX" = "" ]; then
18+
export DOCKER_REGISTRY_PREFIX="sloppycoder"
19+
fi
20+
21+
if [ "$DOCKER_MACHINE_NAME" = "" ]; then
22+
DOCKER_HOST_IP="127.0.0.1"
23+
else
24+
DOCKER_HOST_IP=$(docker-machine inspect --format='{{.Driver.IPAddress}}' $DOCKER_MACHINE_NAME)
25+
fi
26+
27+
if [ "$DOCKER_HOST_IP" = "" ]; then
28+
echo unable to determine IP address of docker host. abort...
29+
exit 1
30+
fi
31+
32+
33+
export PUBLIC_BASE_URL=http://$DOCKER_HOST_IP:8080
34+
35+
echo Starting application $PUBLIC_BASE_URL using docker-compose
36+
docker-compose up -d
37+
38+
echo Waiting for application to boot ...
39+
for i in {1..10}; do
40+
echo " checking..."
41+
curl -sL $PUBLIC_BASE_URL/app | grep csrf_token > /dev/null && break
42+
sleep 30
43+
done
44+
45+
sleep 3
46+
curl -sL $PUBLIC_BASE_URL/app | grep csrf_token > /dev/null
47+
48+
$RET && echo Your application should be available at $PUBLIC_BASE_URL/app
49+
$RET || echo Cannot start application
50+

0 commit comments

Comments
 (0)