Skip to content

Commit d2d370a

Browse files
committed
Changes:
- docker-compose version to 2.3 to allow mem_limit per container due to excesive use of memory when launching docker-compose.yml services. - added in IntegrationTests userId for CalculationService new required field - added local profile in application.yml to allow debug edge-service locally
1 parent dd92e3d commit d2d370a

File tree

6 files changed

+190
-113
lines changed

6 files changed

+190
-113
lines changed

docker-compose.yml

Lines changed: 59 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
version: '3'
1+
version: '2.3'
22

33
services:
44

55
edgeservice:
66
image: aista/edge-service
7+
mem_limit: 512M
78
ports:
89
- "8080:8080"
910
depends_on:
@@ -14,6 +15,7 @@ services:
1415
- discoveryservice
1516
- rabbitmq
1617
image: aista/notification-service
18+
mem_limit: 512M
1719
command: notification-service
1820
ports:
1921
- "32700:32700"
@@ -23,6 +25,7 @@ services:
2325

2426
discoveryservice:
2527
image: aista/eureka
28+
mem_limit: 512M
2629
ports:
2730
- "8761:8761"
2831

@@ -44,6 +47,7 @@ services:
4447

4548
mysqlserver:
4649
image: mysql:5.7
50+
mem_limit: 512M
4751
volumes:
4852
- mysql-data:/var/lib/mysql:rw
4953
restart: always
@@ -58,6 +62,7 @@ services:
5862

5963
userservice:
6064
image: aista/user-service
65+
mem_limit: 512M
6166
depends_on:
6267
- discoveryservice
6368
- mysqlserver
@@ -66,34 +71,38 @@ services:
6671

6772
mongo:
6873
image: 'mongo:3.4.1'
74+
mem_limit: 512M
6975
container_name: 'mongo'
7076
ports:
7177
- '27017:27017'
7278
volumes:
7379
- 'mongo:/data/db'
7480

75-
postgres:
76-
image: postgres
77-
restart: always
78-
environment:
79-
POSTGRES_DB: 'passenger_db'
80-
POSTGRES_PASSWORD: "admin"
81-
POSTGRES_USER: "admin"
82-
PGDATA: ./postgres-data
83-
ports:
84-
- '5432:5432'
85-
volumes:
86-
- ./db_volume:/var/lib/postgresql
81+
# postgres:
82+
# image: postgres
83+
# mem_limit: 512M
84+
# restart: always
85+
# environment:
86+
# POSTGRES_DB: 'passenger_db'
87+
# POSTGRES_PASSWORD: "admin"
88+
# POSTGRES_USER: "admin"
89+
# PGDATA: ./postgres-data
90+
# ports:
91+
# - '5432:5432'
92+
# volumes:
93+
# - ./db_volume:/var/lib/postgresql
8794

8895
rabbitmq:
8996
image: rabbitmq:management
97+
mem_limit: 512M
9098
container_name: 'rabbitmq'
9199
ports:
92100
- "5672:5672"
93101
- "15672:15672"
94102

95103
tripmanagementcmd:
96104
image: aista/trip-management-cmd
105+
mem_limit: 512M
97106
environment:
98107
- RABBIT_HOST=rabbitmq
99108
- MONGO_HOST=mongo
@@ -106,6 +115,7 @@ services:
106115

107116
tripmanagementquery:
108117
image: aista/trip-management-query
118+
mem_limit: 512M
109119
environment:
110120
- RABBIT_HOST=rabbitmq
111121
- MONGO_HOST=mongo
@@ -118,6 +128,7 @@ services:
118128

119129
gmaps-adapter:
120130
image: aista/gmaps-adapter
131+
mem_limit: 512M
121132
environment:
122133
- EUREKA_SERVER=discoveryservice
123134
- RABBIT_HOST=rabbitmq
@@ -128,6 +139,7 @@ services:
128139

129140
calculation-service:
130141
image: aista/calculation-service
142+
mem_limit: 512M
131143
environment:
132144
- EUREKA_SERVER=discoveryservice
133145
- RABBIT_HOST=rabbitmq
@@ -137,37 +149,40 @@ services:
137149
depends_on:
138150
- discoveryservice
139151

140-
passenger:
141-
image: aista/passenger
142-
ports:
143-
- '8080'
144-
depends_on:
145-
- postgres
146-
- discoveryservice
147-
148-
driver-cmd:
149-
image: aista/driver-cmd
150-
environment:
151-
- EUREKA_SERVER=discoveryservice
152-
ports:
153-
- '8080'
154-
depends_on:
155-
- rabbitmq
156-
- mongo
157-
- discoveryservice
158-
159-
driver-query:
160-
image: aista/driver-query
161-
container_name: 'driver-query'
162-
environment:
163-
- RABBIT_HOST=rabbitmq
164-
- MONGO_HOST=mongo
165-
ports:
166-
- "8080"
167-
depends_on:
168-
- rabbitmq
169-
- mongo
170-
- discoveryservice
152+
# passenger:
153+
# image: aista/passenger
154+
# mem_limit: 512M
155+
# ports:
156+
# - '8080'
157+
# depends_on:
158+
# - postgres
159+
# - discoveryservice
160+
#
161+
# driver-cmd:
162+
# image: aista/driver-cmd
163+
# mem_limit: 512M
164+
# environment:
165+
# - EUREKA_SERVER=discoveryservice
166+
# ports:
167+
# - '8080'
168+
# depends_on:
169+
# - rabbitmq
170+
# - mongo
171+
# - discoveryservice
172+
#
173+
# driver-query:
174+
# image: aista/driver-query
175+
# mem_limit: 512M
176+
# container_name: 'driver-query'
177+
# environment:
178+
# - RABBIT_HOST=rabbitmq
179+
# - MONGO_HOST=mongo
180+
# ports:
181+
# - "8080"
182+
# depends_on:
183+
# - rabbitmq
184+
# - mongo
185+
# - discoveryservice
171186

172187
volumes:
173188
mongo:

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package aist.edge.edgeservice;
22

3-
3+
import java.util.Arrays;
44

55
import org.springframework.context.annotation.Bean;
66
import org.springframework.context.annotation.Configuration;
@@ -10,8 +10,6 @@
1010
import org.springframework.web.cors.CorsConfigurationSource;
1111
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
1212

13-
import java.util.Arrays;
14-
1513
@Configuration
1614
public class ConfigurationCORS extends WebSecurityConfigurerAdapter {
1715

@@ -21,7 +19,7 @@ protected void configure(HttpSecurity http) throws Exception {
2119
}
2220

2321
@Bean
24-
public CorsConfigurationSource corsConfigurationSource() {
22+
public CorsConfigurationSource corsConfigurationSource() {
2523
CorsConfiguration configuration = new CorsConfiguration();
2624
configuration.setAllowedOrigins(Arrays.asList("*"));
2725
configuration.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"));

src/main/resources/application.yml

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
spring:
2-
profiles:
3-
active: development
41
---
52
spring:
63
profiles: development
@@ -36,6 +33,7 @@ management:
3633
security:
3734
enabled: false
3835
context-path: /actuator
36+
3937
---
4038
spring:
4139
profiles: docker
@@ -68,6 +66,42 @@ eureka:
6866
serviceUrl:
6967
defaultZone: http://discoveryservice:8761/eureka/
7068
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds: 60000
69+
ribbon:
70+
ConnectTimeout: 3000
71+
ReadTimeout: 60000
72+
73+
---
74+
spring:
75+
profiles: local
76+
application:
77+
name: edgeservice
78+
zuul:
79+
prefix: /api
80+
routes:
81+
trip-cmd:
82+
path: /trip/cmd/**
83+
url: http://${DOCKER_MACHINE_IP:localhost}:8080/api
84+
trip-query:
85+
path: /trip/query/**
86+
url: http://${DOCKER_MACHINE_IP:localhost}:8080/api
87+
userservice:
88+
path: /userservice/**
89+
url: http://${DOCKER_MACHINE_IP:localhost}:8080/
90+
sensitiveHeaders: Cookie,Set-Cookie
91+
security:
92+
oauth2:
93+
resource:
94+
userInfoUri: http://${DOCKER_MACHINE_IP:localhost}:8080/auth/user
95+
ignored: /catalog/**
96+
eureka:
97+
instance:
98+
prefer-ip-address: true
99+
client:
100+
registerWithEureka: true
101+
fetchRegistry: true
102+
serviceUrl:
103+
defaultZone: http://${DOCKER_MACHINE_IP:localhost}:8761/eureka/
104+
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds: 60000
71105
ribbon:
72106
ConnectTimeout: 3000
73107
ReadTimeout: 60000

src/main/resources/bootstrap.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
spring:
2+
application:
3+
name: edgeservice
4+
profiles:
5+
active: development
6+
cloud:
7+
config:
8+
uri: http://${CONFIGURATION_HOST:localhost}:8888
9+
enabled: true

0 commit comments

Comments
 (0)