Skip to content

Commit 705cc9f

Browse files
committed
Added docker compose file for using local images.
1 parent 6bd3efc commit 705cc9f

File tree

8 files changed

+185
-22
lines changed

8 files changed

+185
-22
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM anapsix/alpine-java:8
22
MAINTAINER Justin Phillips "[email protected]"
33
VOLUME /tmp
4-
ADD build/libs/microservices--backing-service--edge-service-0.0.1.jar app.jar
4+
ADD build/libs/edge-service-0.0.1.jar app.jar
55
RUN bash -c 'touch /app.jar'
66
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ dependencies {
4545
compile('org.springframework.security:spring-security-test')
4646
compile('org.springframework.cloud:spring-cloud-starter-eureka')
4747
compile('org.springframework.cloud:spring-cloud-starter-hystrix')
48-
compile('org.springframework.cloud:spring-cloud-starter-oauth2')
48+
//compile('org.springframework.cloud:spring-cloud-starter-oauth2')
4949
compile('org.springframework.cloud:spring-cloud-starter-zuul')
5050
compile('org.springframework.boot:spring-boot-starter-web')
5151
providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')

docker-compose-local.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
version: '3'
2+
3+
services:
4+
5+
edgeservice:
6+
build: ./
7+
ports:
8+
- "80:8080"
9+
depends_on:
10+
- discovery-service
11+
12+
discovery-service:
13+
image: springcloud/eureka
14+
ports:
15+
- "8761:8761"
16+
17+
# hystrix-dashboard:
18+
# image: kbastani/hystrix-dashboard
19+
# container_name: hystrix-dashboard
20+
# environment:
21+
# - SPRING_PROFILES_ACTIVE=docker
22+
# ports:
23+
# - 6161:6161
24+
25+
# config-service:
26+
# build: config-service
27+
# container_name: config-service
28+
# environment:
29+
# - SPRING_PROFILES_ACTIVE=docker
30+
# ports:
31+
# - 8888:8888
32+
33+
mysqlserver:
34+
image: mysql:5.7
35+
volumes:
36+
- mysql-data:/var/lib/mysql:rw
37+
restart: always
38+
ports:
39+
- '3306:3306'
40+
environment:
41+
MYSQL_USER:
42+
MYSQL_PASSWORD:
43+
MYSQL_ROOT_PASSWORD: 'root'
44+
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
45+
MYSQL_DATABASE: 'user_service'
46+
47+
userservice:
48+
image: aista/user-service
49+
depends_on:
50+
- discovery-service
51+
- mysqlserver
52+
ports:
53+
- '8091:8091'
54+
55+
mongo:
56+
image: 'mongo:3.4.1'
57+
container_name: 'mongo'
58+
ports:
59+
- '27017:27017'
60+
volumes:
61+
- 'mongo:/data/db'
62+
63+
rabbitmq:
64+
image: rabbitmq:management
65+
container_name: 'rabbitmq'
66+
ports:
67+
- "5672:5672"
68+
- "15672:15672"
69+
70+
tripmanagementcmd:
71+
image: aista/trip-management-cmd:local
72+
environment:
73+
- RABBIT_HOST=rabbitmq
74+
- MONGO_HOST=mongo
75+
ports:
76+
- '8080'
77+
depends_on:
78+
- discovery-service
79+
- rabbitmq
80+
- mongo
81+
82+
tripmanagementquery:
83+
image: aista/trip-management-query:local
84+
environment:
85+
- RABBIT_HOST=rabbitmq
86+
- MONGO_HOST=mongo
87+
ports:
88+
- '8080'
89+
depends_on:
90+
- rabbitmq
91+
- mongo
92+
- discovery-service
93+
94+
gmapsadapter:
95+
image: aista/gmaps-adapter:local
96+
environment:
97+
- EUREKA_SERVER=discovery-service
98+
ports:
99+
- '8080'
100+
depends_on:
101+
- discovery-service
102+
103+
calculationservice:
104+
image: aista/calculation-service:local
105+
environment:
106+
- EUREKA_SERVER=discovery-service
107+
ports:
108+
- '8080'
109+
depends_on:
110+
- discovery-service
111+
112+
volumes:
113+
mongo:
114+
mysql-data:

docker-compose.yml

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@ version: '3'
22

33
services:
44

5-
edge-service:
5+
edgeservice:
66
build: ./
77
ports:
8-
- "8080:8080"
8+
- "80:8080"
99
depends_on:
1010
- discovery-service
1111

1212
discovery-service:
1313
image: springcloud/eureka
1414
ports:
1515
- "8761:8761"
16-
container_name: eureka-server
1716

1817
# hystrix-dashboard:
1918
# image: kbastani/hystrix-dashboard
@@ -31,9 +30,8 @@ services:
3130
# ports:
3231
# - 8888:8888
3332

34-
mysql-server:
33+
mysqlserver:
3534
image: mysql:5.7
36-
container_name: mysql-server
3735
volumes:
3836
- mysql-data:/var/lib/mysql:rw
3937
restart: always
@@ -46,12 +44,11 @@ services:
4644
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
4745
MYSQL_DATABASE: 'user_service'
4846

49-
microservice--user-service:
47+
userservice:
5048
image: aista/user-service
5149
depends_on:
5250
- discovery-service
53-
- mysql-server
54-
container_name: microservice--user-service
51+
- mysqlserver
5552
ports:
5653
- '8091:8091'
5754

@@ -70,9 +67,8 @@ services:
7067
- "5672:5672"
7168
- "15672:15672"
7269

73-
trip-management-cmd:
70+
tripmanagementcmd:
7471
image: aista/trip-management-cmd
75-
container_name: trip-management-cmd
7672
environment:
7773
- RABBIT_HOST=rabbitmq
7874
- MONGO_HOST=mongo
@@ -83,9 +79,8 @@ services:
8379
- rabbitmq
8480
- mongo
8581

86-
trip-management-query:
82+
tripmanagementquery:
8783
image: aista/trip-management-query
88-
container_name: trip-management-query
8984
environment:
9085
- RABBIT_HOST=rabbitmq
9186
- MONGO_HOST=mongo
@@ -94,7 +89,25 @@ services:
9489
depends_on:
9590
- rabbitmq
9691
- mongo
97-
- discovery-service
92+
- discovery-service
93+
94+
gmapsadapter:
95+
image: aista/gmaps-adapter
96+
environment:
97+
- EUREKA_SERVER=discovery-service
98+
ports:
99+
- '8080'
100+
depends_on:
101+
- discovery-service
102+
103+
calculationservice:
104+
image: aista/calculation-service
105+
environment:
106+
- EUREKA_SERVER=discovery-service
107+
ports:
108+
- '8080'
109+
depends_on:
110+
- discovery-service
98111

99112
volumes:
100113
mongo:

readme.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,14 @@
11
# Edge Service
2-
The edge service is one of the backing services that serves as the front door for the API. The services utilizes Zuul.
2+
The edge service is one of the backing services that serves as the front door for the API. The services utilizes Zuul.
3+
4+
# Running the service:
5+
6+
After making sure the project assembled properly run: ```docker-compose up --build```
7+
8+
## Running with locally build images.
9+
10+
Build the images locally but tag them with version ```:local``` instead of default, for example instead of just building gmaps-adapter as aista/gmaps-adapter tag it aista/gmaps-adapter:local
11+
12+
Run ```docker-compose -f docker-compose-local.yml up```
13+
14+
remove the :local from the docker-compose-local.yml file for images that wont be changed locally.

src/main/java/aist/edge/edgeservice/EdgeServiceApplication.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
66
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
77
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
8-
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
8+
//import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
99

1010
@SpringBootApplication
1111
@EnableEurekaClient
1212
@EnableZuulProxy
13-
@EnableResourceServer
13+
//@EnableResourceServer
1414
@EnableHystrix
1515
public class EdgeServiceApplication {
1616
public static void main(String[] args) {

src/main/resources/application.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
spring:
22
profiles:
3-
active: development
3+
active: docker
44
---
55
spring:
66
profiles: development
@@ -31,10 +31,16 @@ spring:
3131
application:
3232
name: edge-service
3333
zuul:
34-
ignored-services: '*'
35-
ignoredPatterns: /**/api/**
34+
prefix: /api
3635
routes:
37-
example-service: /example/**
36+
trip-cmd:
37+
path: /trip/cmd/**
38+
serviceId: tripmanagementcmd
39+
prefix: /api
40+
trip-query:
41+
path: /trip/query/**
42+
serviceId: tripmanagementquery
43+
prefix: /api
3844
security:
3945
oauth2:
4046
resource:

src/test/resources/docker-compose.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,24 @@ services:
8989
- mongo
9090
- discovery-service
9191

92+
gmaps-adapter:
93+
image: aista/gmaps-adapter
94+
environment:
95+
- EUREKA_SERVER=discovery-service
96+
ports:
97+
- '8080'
98+
depends_on:
99+
- discovery-service
100+
101+
calculation-service:
102+
image: aista/calculation-service
103+
environment:
104+
- EUREKA_SERVER=discovery-service
105+
ports:
106+
- '8080'
107+
depends_on:
108+
- discovery-service
109+
92110
volumes:
93111
mongo:
94112
mysql-data:

0 commit comments

Comments
 (0)