Skip to content

Commit 7462399

Browse files
committed
fix: Docker-compose improvemements
1 parent 6f68534 commit 7462399

File tree

2 files changed

+166
-73
lines changed

2 files changed

+166
-73
lines changed

docker/docker-compose-local.yml

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,12 @@ services:
6565
dockerfile: ./services/DevStore.Identity.API/Dockerfile
6666
restart: always
6767
environment:
68-
- ASPNETCORE_ENVIRONMENT=Docker
69-
- ASPNETCORE_URLS=https://+:5101;http://+5102
70-
- ASPNETCORE_Kestrel__Certificates__Default__Password=9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe
71-
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/devstore.academy-localhost.pfx
68+
ASPNETCORE_ENVIRONMENT: Docker
69+
ASPNETCORE_URLS: https://+:5101;http://+5102
70+
ASPNETCORE_Kestrel__Certificates__Default__Password: 9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe
71+
ASPNETCORE_Kestrel__Certificates__Default__Path: /https/devstore.academy-localhost.pfx
72+
CUSTOMCONNSTR_DefaultConnection: "Server=database-identity;Database=DSUsers;MultipleActiveResultSets=true;User Id=sa;Password=MyDB@123"
73+
AppSettings__DatabaseType: SqlServer
7274
volumes:
7375
- ./certs:/https:ro
7476
depends_on:
@@ -93,10 +95,12 @@ services:
9395
dockerfile: ./services/DevStore.ShoppingCart.API/Dockerfile
9496
restart: always
9597
environment:
96-
- ASPNETCORE_ENVIRONMENT=Docker
97-
- ASPNETCORE_URLS=https://+:5201;http://+5202
98-
- ASPNETCORE_Kestrel__Certificates__Default__Password=9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe
99-
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/devstore.academy-localhost.pfx
98+
ASPNETCORE_ENVIRONMENT: Docker
99+
ASPNETCORE_URLS: https://+:5201;http://+5202
100+
ASPNETCORE_Kestrel__Certificates__Default__Password: 9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe
101+
ASPNETCORE_Kestrel__Certificates__Default__Path: /https/devstore.academy-localhost.pfx
102+
CUSTOMCONNSTR_DefaultConnection: "Server=database-cart;Database=DSShoppingCart;MultipleActiveResultSets=true;User Id=sa;Password=MyDB@123"
103+
AppSettings__DatabaseType: SqlServer
100104
volumes:
101105
- ./certs:/https:ro
102106
depends_on:
@@ -122,10 +126,12 @@ services:
122126
dockerfile: ./services/DevStore.Catalog.API/Dockerfile
123127
restart: always
124128
environment:
125-
- ASPNETCORE_ENVIRONMENT=Docker
126-
- ASPNETCORE_URLS=https://+:5301;http://+5302
127-
- ASPNETCORE_Kestrel__Certificates__Default__Password=9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe
128-
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/devstore.academy-localhost.pfx
129+
ASPNETCORE_ENVIRONMENT: Docker
130+
ASPNETCORE_URLS: https://+:5301;http://+5302
131+
ASPNETCORE_Kestrel__Certificates__Default__Password: 9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe
132+
ASPNETCORE_Kestrel__Certificates__Default__Path: /https/devstore.academy-localhost.pfx
133+
CUSTOMCONNSTR_DefaultConnection: "Server=database-catalog;Database=DSCatalog;MultipleActiveResultSets=true;User Id=sa;Password=MyDB@123"
134+
AppSettings__DatabaseType: SqlServer
129135
volumes:
130136
- ./certs:/https:ro
131137
depends_on:
@@ -150,10 +156,12 @@ services:
150156
dockerfile: ./services/DevStore.Customers.API/Dockerfile
151157
restart: always
152158
environment:
153-
- ASPNETCORE_ENVIRONMENT=Docker
154-
- ASPNETCORE_URLS=https://+:5401;http://+5402
155-
- ASPNETCORE_Kestrel__Certificates__Default__Password=9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe
156-
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/devstore.academy-localhost.pfx
159+
ASPNETCORE_ENVIRONMENT: Docker
160+
ASPNETCORE_URLS: https://+:5401;http://+5402
161+
ASPNETCORE_Kestrel__Certificates__Default__Password: 9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe
162+
ASPNETCORE_Kestrel__Certificates__Default__Path: /https/devstore.academy-localhost.pfx
163+
CUSTOMCONNSTR_DefaultConnection: "Server=database-customers;Database=DSCustomers;MultipleActiveResultSets=true;User Id=sa;Password=MyDB@123"
164+
AppSettings__DatabaseType: SqlServer
157165
volumes:
158166
- ./certs:/https:ro
159167
depends_on:
@@ -170,10 +178,10 @@ services:
170178
dockerfile: ./api-gateways/DevStore.Bff.Checkout/Dockerfile
171179
restart: always
172180
environment:
173-
- ASPNETCORE_ENVIRONMENT=Docker
174-
- ASPNETCORE_URLS=https://+:5501;http://+5502
175-
- ASPNETCORE_Kestrel__Certificates__Default__Password=9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe
176-
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/devstore.academy-localhost.pfx
181+
ASPNETCORE_ENVIRONMENT: Docker
182+
ASPNETCORE_URLS: https://+:5501;http://+5502
183+
ASPNETCORE_Kestrel__Certificates__Default__Password: 9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe
184+
ASPNETCORE_Kestrel__Certificates__Default__Path: /https/devstore.academy-localhost.pfx
177185
volumes:
178186
- ./certs:/https:ro
179187
depends_on:
@@ -202,10 +210,12 @@ services:
202210
dockerfile: ./services/DevStore.Billing.API/Dockerfile
203211
restart: always
204212
environment:
205-
- ASPNETCORE_ENVIRONMENT=Docker
206-
- ASPNETCORE_URLS=https://+:5601;http://+5602
207-
- ASPNETCORE_Kestrel__Certificates__Default__Password=9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe
208-
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/devstore.academy-localhost.pfx
213+
ASPNETCORE_ENVIRONMENT: Docker
214+
ASPNETCORE_URLS: https://+:5601;http://+5602
215+
ASPNETCORE_Kestrel__Certificates__Default__Password: 9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe
216+
ASPNETCORE_Kestrel__Certificates__Default__Path: /https/devstore.academy-localhost.pfx
217+
CUSTOMCONNSTR_DefaultConnection: "Server=database-billing;Database=DSBilling;MultipleActiveResultSets=true;User Id=sa;Password=MyDB@123"
218+
AppSettings__DatabaseType: SqlServer
209219
volumes:
210220
- ./certs:/https:ro
211221
depends_on:
@@ -232,10 +242,12 @@ services:
232242
dockerfile: ./services/DevStore.Orders.API/Dockerfile
233243
restart: always
234244
environment:
235-
- ASPNETCORE_ENVIRONMENT=Docker
236-
- ASPNETCORE_URLS=https://+:5701;http://+5702
237-
- ASPNETCORE_Kestrel__Certificates__Default__Password=9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe
238-
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/devstore.academy-localhost.pfx
245+
ASPNETCORE_ENVIRONMENT: Docker
246+
ASPNETCORE_URLS: https://+:5701;http://+5702
247+
ASPNETCORE_Kestrel__Certificates__Default__Password: 9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe
248+
ASPNETCORE_Kestrel__Certificates__Default__Path: /https/devstore.academy-localhost.pfx
249+
CUSTOMCONNSTR_DefaultConnection: "Server=database-order;Database=DSOrders;MultipleActiveResultSets=true;User Id=sa;Password=MyDB@123"
250+
AppSettings__DatabaseType: SqlServer
239251
volumes:
240252
- ./certs:/https:ro
241253
depends_on:

docker/docker-compose.yml

Lines changed: 126 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,28 @@ services:
77
container_name: devstore-rabbit
88
environment:
99
RABBITMQ_DEFAULT_USER: "devstore"
10-
RABBITMQ_DEFAULT_PASS: "devstore"
10+
RABBITMQ_DEFAULT_PASS: "devstore"
1111

12-
sql-server:
13-
image: desenvolvedorio/devstore-sql-server:latest
14-
container_name: devstore-sql-server
15-
environment:
16-
SA_PASSWORD: "MyDB@123"
17-
ACCEPT_EULA: "Y"
12+
generate-pfx:
13+
image: emberstack/openssl
14+
container_name: generate-pfx
15+
volumes:
16+
- ./certs:/https:rw
17+
command: >
18+
sh -c "[ -e "./https/devstore.academy-localhost.pfx" ] && echo File Already exist || (
19+
rm /https/devstore.academy-localhost.pfx &&
20+
openssl genrsa -out devstore.rsa 2048 &&
21+
openssl req -sha256 -new -key devstore.rsa -out devstore.csr -subj '/CN=localhost' &&
22+
openssl x509 -req -sha256 -days 365 -in devstore.csr -signkey devstore.rsa -out devstore.crt &&
23+
openssl pkcs12 -export -out /https/devstore.academy-localhost.pfx -inkey devstore.rsa -in devstore.crt -password pass:9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe &&
24+
rm devstore.rsa devstore.csr devstore.crt)"
1825
1926
web-mvc:
2027
image: desenvolvedorio/devstore-web-mvc-ecommerce:latest
2128
container_name: devstore-web-mvc-ecommerce
2229
restart: always
2330
environment:
24-
- ASPNETCORE_ENVIRONMENT=Production
31+
- ASPNETCORE_ENVIRONMENT=Docker
2532
- ASPNETCORE_URLS=http://*:5001
2633
- LC_ALL=en_US.UTF-8
2734
- LANG=en_US.UTF-8
@@ -33,78 +40,127 @@ services:
3340
- api-identity
3441
- api-customers
3542
- api-bff-checkout
43+
- generate-pfx
44+
45+
database-identity:
46+
image: mcr.microsoft.com/mssql/server:2017-latest
47+
container_name: devstore-database-identity
48+
expose:
49+
- 1433
50+
environment:
51+
SA_PASSWORD: "MyDB@123"
52+
ACCEPT_EULA: "Y"
3653

3754
api-identity:
3855
image: desenvolvedorio/devstore-api-identity:latest
3956
container_name: devstore-api-identity
4057
restart: always
4158
environment:
42-
- ASPNETCORE_ENVIRONMENT=Production
43-
- ASPNETCORE_URLS=https://+:5101;http://+5102
44-
- ASPNETCORE_Kestrel__Certificates__Default__Password=nerdstore
45-
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/nerdstore-certificate.pfx
59+
ASPNETCORE_ENVIRONMENT: Docker
60+
ASPNETCORE_URLS: https://+:5101;http://+5102
61+
ASPNETCORE_Kestrel__Certificates__Default__Password: 9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe
62+
ASPNETCORE_Kestrel__Certificates__Default__Path: /https/devstore.academy-localhost.pfx
63+
CUSTOMCONNSTR_DefaultConnection: "Server=database-identity;Database=DSUsers;MultipleActiveResultSets=true;User Id=sa;Password=MyDB@123"
64+
AppSettings__DatabaseType: SqlServer
4665
volumes:
4766
- ./certs:/https:ro
4867
depends_on:
4968
- rabbitmq
50-
- sql-server
69+
- database-identity
70+
- generate-pfx
71+
72+
database-cart:
73+
image: mcr.microsoft.com/mssql/server:2017-latest
74+
container_name: devstore-database-cart
75+
expose:
76+
- 1433
77+
environment:
78+
SA_PASSWORD: "MyDB@123"
79+
ACCEPT_EULA: "Y"
5180

5281
api-cart:
5382
image: desenvolvedorio/devstore-api-cart:latest
5483
container_name: devstore-api-cart
5584
restart: always
5685
environment:
57-
- ASPNETCORE_ENVIRONMENT=Production
58-
- ASPNETCORE_URLS=https://+:5201;http://+5202
59-
- ASPNETCORE_Kestrel__Certificates__Default__Password=nerdstore
60-
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/nerdstore-certificate.pfx
86+
ASPNETCORE_ENVIRONMENT: Docker
87+
ASPNETCORE_URLS: https://+:5201;http://+5202
88+
ASPNETCORE_Kestrel__Certificates__Default__Password: 9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe
89+
ASPNETCORE_Kestrel__Certificates__Default__Path: /https/devstore.academy-localhost.pfx
90+
CUSTOMCONNSTR_DefaultConnection: "Server=database-cart;Database=DSShoppingCart;MultipleActiveResultSets=true;User Id=sa;Password=MyDB@123"
91+
AppSettings__DatabaseType: SqlServer
6192
volumes:
6293
- ./certs:/https:ro
6394
depends_on:
6495
- rabbitmq
6596
- api-identity
66-
- sql-server
97+
- database-cart
98+
- generate-pfx
99+
100+
database-catalog:
101+
image: mcr.microsoft.com/mssql/server:2017-latest
102+
container_name: devstore-database-catalog
103+
expose:
104+
- 1433
105+
environment:
106+
SA_PASSWORD: "MyDB@123"
107+
ACCEPT_EULA: "Y"
67108

68109
api-catalog:
69110
image: desenvolvedorio/devstore-api-catalog:latest
70111
container_name: devstore-api-catalog
71112
restart: always
72113
environment:
73-
- ASPNETCORE_ENVIRONMENT=Production
74-
- ASPNETCORE_URLS=https://+:5301;http://+5302
75-
- ASPNETCORE_Kestrel__Certificates__Default__Password=nerdstore
76-
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/nerdstore-certificate.pfx
114+
ASPNETCORE_ENVIRONMENT: Docker
115+
ASPNETCORE_URLS: https://+:5301;http://+5302
116+
ASPNETCORE_Kestrel__Certificates__Default__Password: 9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe
117+
ASPNETCORE_Kestrel__Certificates__Default__Path: /https/devstore.academy-localhost.pfx
118+
CUSTOMCONNSTR_DefaultConnection: "Server=database-catalog;Database=DSCatalog;MultipleActiveResultSets=true;User Id=sa;Password=MyDB@123"
119+
AppSettings__DatabaseType: SqlServer
77120
volumes:
78121
- ./certs:/https:ro
79122
depends_on:
80123
- rabbitmq
81-
- sql-server
124+
- database-catalog
125+
- generate-pfx
126+
127+
database-customers:
128+
image: mcr.microsoft.com/mssql/server:2017-latest
129+
container_name: devstore-database-customers
130+
expose:
131+
- 1433
132+
environment:
133+
SA_PASSWORD: "MyDB@123"
134+
ACCEPT_EULA: "Y"
82135

83136
api-customers:
84137
image: desenvolvedorio/devstore-api-customers:latest
85138
container_name: devstore-api-customers
86139
restart: always
87140
environment:
88-
- ASPNETCORE_ENVIRONMENT=Production
89-
- ASPNETCORE_URLS=https://+:5401;http://+5402
90-
- ASPNETCORE_Kestrel__Certificates__Default__Password=nerdstore
91-
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/nerdstore-certificate.pfx
141+
ASPNETCORE_ENVIRONMENT: Docker
142+
ASPNETCORE_URLS: https://+:5401;http://+5402
143+
ASPNETCORE_Kestrel__Certificates__Default__Password: 9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe
144+
ASPNETCORE_Kestrel__Certificates__Default__Path: /https/devstore.academy-localhost.pfx
145+
CUSTOMCONNSTR_DefaultConnection: "Server=database-customers;Database=DSCustomers;MultipleActiveResultSets=true;User Id=sa;Password=MyDB@123"
146+
AppSettings__DatabaseType: SqlServer
92147
volumes:
93148
- ./certs:/https:ro
94149
depends_on:
95150
- rabbitmq
96151
- api-identity
97-
- sql-server
152+
- database-customers
153+
- generate-pfx
98154

99155
api-bff-checkout:
100156
image: desenvolvedorio/devstore-api-bff-checkout:latest
101157
container_name: devstore-api-bff-checkout
102158
restart: always
103159
environment:
104-
- ASPNETCORE_ENVIRONMENT=Production
105-
- ASPNETCORE_URLS=https://+:5501;http://+5502
106-
- ASPNETCORE_Kestrel__Certificates__Default__Password=nerdstore
107-
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/nerdstore-certificate.pfx
160+
ASPNETCORE_ENVIRONMENT: Docker
161+
ASPNETCORE_URLS: https://+:5501;http://+5502
162+
ASPNETCORE_Kestrel__Certificates__Default__Password: 9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe
163+
ASPNETCORE_Kestrel__Certificates__Default__Path: /https/devstore.academy-localhost.pfx
108164
volumes:
109165
- ./certs:/https:ro
110166
depends_on:
@@ -113,47 +169,72 @@ services:
113169
- api-cart
114170
- api-billing
115171
- api-order
172+
- generate-pfx
173+
174+
database-billing:
175+
image: mcr.microsoft.com/mssql/server:2017-latest
176+
container_name: devstore-database-billing
177+
expose:
178+
- 1433
179+
environment:
180+
SA_PASSWORD: "MyDB@123"
181+
ACCEPT_EULA: "Y"
116182

117183
api-billing:
118184
image: desenvolvedorio/devstore-api-billing:latest
119185
container_name: devstore-api-billing
120186
restart: always
121187
environment:
122-
- ASPNETCORE_ENVIRONMENT=Production
123-
- ASPNETCORE_URLS=https://+:5601;http://+5602
124-
- ASPNETCORE_Kestrel__Certificates__Default__Password=nerdstore
125-
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/nerdstore-certificate.pfx
188+
ASPNETCORE_ENVIRONMENT: Docker
189+
ASPNETCORE_URLS: https://+:5601;http://+5602
190+
ASPNETCORE_Kestrel__Certificates__Default__Password: 9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe
191+
ASPNETCORE_Kestrel__Certificates__Default__Path: /https/devstore.academy-localhost.pfx
192+
CUSTOMCONNSTR_DefaultConnection: "Server=database-billing;Database=DSBilling;MultipleActiveResultSets=true;User Id=sa;Password=MyDB@123"
193+
AppSettings__DatabaseType: SqlServer
126194
volumes:
127195
- ./certs:/https:ro
128196
depends_on:
129197
- rabbitmq
130198
- api-identity
131199
- api-order
132-
- sql-server
200+
- database-billing
201+
- generate-pfx
202+
203+
database-order:
204+
image: mcr.microsoft.com/mssql/server:2017-latest
205+
container_name: devstore-database-order
206+
expose:
207+
- 1433
208+
environment:
209+
SA_PASSWORD: "MyDB@123"
210+
ACCEPT_EULA: "Y"
133211

134212
api-order:
135213
image: desenvolvedorio/devstore-api-order:latest
136214
container_name: devstore-api-order
137215
restart: always
138216
environment:
139-
- ASPNETCORE_ENVIRONMENT=Production
140-
- ASPNETCORE_URLS=https://+:5701;http://+5702
141-
- ASPNETCORE_Kestrel__Certificates__Default__Password=nerdstore
142-
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/nerdstore-certificate.pfx
217+
ASPNETCORE_ENVIRONMENT: Docker
218+
ASPNETCORE_URLS: https://+:5701;http://+5702
219+
ASPNETCORE_Kestrel__Certificates__Default__Password: 9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe
220+
ASPNETCORE_Kestrel__Certificates__Default__Path: /https/devstore.academy-localhost.pfx
221+
CUSTOMCONNSTR_DefaultConnection: "Server=database-order;Database=DSOrders;MultipleActiveResultSets=true;User Id=sa;Password=MyDB@123"
222+
AppSettings__DatabaseType: SqlServer
143223
volumes:
144224
- ./certs:/https:ro
145225
depends_on:
146226
- rabbitmq
147-
- sql-server
148-
- api-identity
227+
- database-order
228+
- api-identity
229+
- generate-pfx
149230

150231
devstore-server:
151232
image: desenvolvedorio/devstore-server:latest
152233
container_name: devstore-server
153234
restart: always
154235
ports:
155-
- "80:80"
156-
- "443:443"
236+
- "7500:80"
237+
- "7501:443"
157238
depends_on:
158239
- web-mvc
159240

0 commit comments

Comments
 (0)