Skip to content

Commit 8cfb74f

Browse files
committed
Fixing SPA for using aggregators
1 parent 1b87e2a commit 8cfb74f

11 files changed

Lines changed: 1026 additions & 66 deletions

File tree

docker-compose.override.yml

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ services:
115115
- IdentityUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
116116
- MarketingUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5110
117117
- LocationsUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5109
118-
- PurchaseUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5200
118+
- PurchaseUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5202
119119
- CatalogUrlHC=http://catalog.api/hc
120120
- OrderingUrlHC=http://ordering.api/hc
121121
- IdentityUrlHC=http://identity.api/hc #Local: Use ${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}, if using external IP or DNS name from browser.
@@ -132,7 +132,7 @@ services:
132132
environment:
133133
- ASPNETCORE_ENVIRONMENT=Development
134134
- ASPNETCORE_URLS=http://0.0.0.0:80
135-
- PurchaseUrl=http://apigw/shopping
135+
- PurchaseUrl=http://webshoppingapigw
136136
- LocationsUrl=http://locations.api
137137
- IdentityUrl=http://10.0.75.1:5105 # Local Mac: Use http://docker.for.mac.localhost:5105 || Local Windows: Use 10.0.75.1 in a "Docker for Windows" environment, if using "localhost" from browser. || #Remote access: Use ${ESHOP_EXTERNAL_DNS_NAME_OR_IP} if using external IP or DNS name from browser.
138138
- MarketingUrl=http://marketing.api
@@ -218,23 +218,23 @@ services:
218218
- "15672:15672"
219219
- "5672:5672"
220220

221-
mobileshoppingapigw:
222-
environment:
223-
- ASPNETCORE_ENVIRONMENT=Development
224-
- IdentityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
225-
ports:
226-
- "5200:80"
227-
volumes:
228-
- ./src/Apigw/configs/mobileshoppingapigw:/app/configuration
229-
230-
mobilemarketingapigw:
231-
environment:
232-
- ASPNETCORE_ENVIRONMENT=Development
233-
- IdentityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
234-
ports:
235-
- "5201:80"
236-
volumes:
237-
- ./src/Apigw/configs/mobilemarketingapigw:/app/configuration
221+
# mobileshoppingapigw:
222+
# environment:
223+
# - ASPNETCORE_ENVIRONMENT=Development
224+
# - IdentityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
225+
# ports:
226+
# - "5200:80"
227+
# volumes:
228+
# - ./src/Apigw/configs/mobileshoppingapigw:/app/configuration
229+
#
230+
# mobilemarketingapigw:
231+
# environment:
232+
# - ASPNETCORE_ENVIRONMENT=Development
233+
# - IdentityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
234+
# ports:
235+
# - "5201:80"
236+
# volumes:
237+
# - ./src/Apigw/configs/mobilemarketingapigw:/app/configuration
238238

239239
webshoppingapigw:
240240
environment:
@@ -245,14 +245,14 @@ services:
245245
volumes:
246246
- ./src/Apigw/configs/webshoppingapigw:/app/configuration
247247

248-
webmarketingapigw:
249-
environment:
250-
- ASPNETCORE_ENVIRONMENT=Development
251-
- IdentityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
252-
ports:
253-
- "5203:80"
254-
volumes:
255-
- ./src/Apigw/configs/webmarketingapigw:/app/configuration
248+
# webmarketingapigw:
249+
# environment:
250+
# - ASPNETCORE_ENVIRONMENT=Development
251+
# - IdentityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
252+
# ports:
253+
# - "5203:80"
254+
# volumes:
255+
# - ./src/Apigw/configs/webmarketingapigw:/app/configuration
256256

257257
mobileshoppingagg:
258258
environment:
@@ -262,5 +262,4 @@ services:
262262
- urls__orders=http://ordering.api
263263
- urls__identity=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
264264
ports:
265-
- "5120:80"
266-
265+
- "5120:80"

docker-compose.prod.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,16 @@ services:
139139

140140
webmvc:
141141
environment:
142+
142143
- ASPNETCORE_ENVIRONMENT=Development
143144
- ASPNETCORE_URLS=http://0.0.0.0:80
144-
- CatalogUrl=http://catalog.api
145-
- OrderingUrl=http://ordering.api
146-
- BasketUrl=http://basket.api
145+
- PurchaseUrl=http://webshoppingapigw/shopping
147146
- LocationsUrl=http://locations.api
148-
- IdentityUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: Use 10.0.75.1 in a "Docker for Windows" environment, if using "localhost" from browser. #Remote: Use ${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP} if using external IP or DNS name from browser.
149-
- MarketingUrl=http://marketing.api
147+
- IdentityUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 # Local Mac: Use http://docker.for.mac.localhost:5105 || Local Windows: Use 10.0.75.1 in a "Docker for Windows" environment, if using "localhost" from browser. || #Remote access: Use ${ESHOP_EXTERNAL_DNS_NAME_OR_IP} if using external IP or DNS name from browser.
148+
- MarketingUrl=http://marketing.api
150149
- CatalogUrlHC=http://catalog.api/hc
151150
- OrderingUrlHC=http://ordering.api/hc
152-
- IdentityUrlHC=http://identity.api/hc
151+
- IdentityUrlHC=http://identity.api/hc #Local: Use ${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}, if using external IP or DNS name from browser.
153152
- BasketUrlHC=http://basket.api/hc
154153
- MarketingUrlHC=http://marketing.api/hc
155154
- PaymentUrlHC=http://payment.api/hc

docker-compose.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -108,29 +108,29 @@ services:
108108
rabbitmq:
109109
image: rabbitmq:3-management-alpine
110110

111-
mobileshoppingapigw:
112-
image: eshop/ocelotapigw
113-
build:
114-
context: .
115-
dockerfile: src/Apigw/OcelotApiGw/Dockerfile
116-
117-
mobilemarketingapigw:
118-
image: eshop/ocelotapigw
119-
build:
120-
context: .
121-
dockerfile: src/Apigw/OcelotApiGw/Dockerfile
122-
111+
# mobileshoppingapigw:
112+
# image: eshop/ocelotapigw-ms
113+
# build:
114+
# context: .
115+
# dockerfile: src/Apigw/OcelotApiGw/Dockerfile
116+
#
117+
# mobilemarketingapigw:
118+
# image: eshop/ocelotapigw-mm
119+
# build:
120+
# context: .
121+
# dockerfile: src/Apigw/OcelotApiGw/Dockerfile2
122+
#
123123
webshoppingapigw:
124-
image: eshop/ocelotapigw
124+
image: eshop/ocelotapigw-ws
125125
build:
126126
context: .
127-
dockerfile: src/Apigw/OcelotApiGw/Dockerfile
127+
dockerfile: src/Apigw/OcelotApiGw/Dockerfile3
128128

129-
webmarketingapigw:
130-
image: eshop/ocelotapigw
131-
build:
132-
context: .
133-
dockerfile: src/Apigw/OcelotApiGw/Dockerfile
129+
# webmarketingapigw:
130+
# image: eshop/ocelotapigw-wm
131+
# build:
132+
# context: .
133+
# dockerfile: src/Apigw/OcelotApiGw/Dockerfile4
134134

135135
mobileshoppingagg:
136136
image: eshop/mobileshoppingagg

src/Apigw/OcelotApiGw/Dockerfile2

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM microsoft/aspnetcore:2.0 AS base
2+
WORKDIR /app
3+
EXPOSE 80
4+
5+
FROM microsoft/aspnetcore-build:2.0 AS build
6+
WORKDIR /src
7+
COPY src/Apigw/OcelotApiGw/OcelotApiGw.csproj src/Apigw/OcelotApiGw/
8+
RUN dotnet restore src/Apigw/OcelotApiGw/
9+
COPY . .
10+
WORKDIR /src/src/Apigw/OcelotApiGw
11+
RUN dotnet build -c Release -o /app
12+
13+
FROM build AS publish
14+
RUN dotnet publish -c Release -o /app
15+
16+
FROM base AS final
17+
WORKDIR /app
18+
COPY --from=publish /app .
19+
ENTRYPOINT ["dotnet", "OcelotApiGw.dll"]

src/Apigw/OcelotApiGw/Dockerfile3

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM microsoft/aspnetcore:2.0 AS base
2+
WORKDIR /app
3+
EXPOSE 80
4+
5+
FROM microsoft/aspnetcore-build:2.0 AS build
6+
WORKDIR /src
7+
COPY src/Apigw/OcelotApiGw/OcelotApiGw.csproj src/Apigw/OcelotApiGw/
8+
RUN dotnet restore src/Apigw/OcelotApiGw/
9+
COPY . .
10+
WORKDIR /src/src/Apigw/OcelotApiGw
11+
RUN dotnet build -c Release -o /app
12+
13+
FROM build AS publish
14+
RUN dotnet publish -c Release -o /app
15+
16+
FROM base AS final
17+
WORKDIR /app
18+
COPY --from=publish /app .
19+
ENTRYPOINT ["dotnet", "OcelotApiGw.dll"]

src/Apigw/OcelotApiGw/Dockerfile4

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM microsoft/aspnetcore:2.0 AS base
2+
WORKDIR /app
3+
EXPOSE 80
4+
5+
FROM microsoft/aspnetcore-build:2.0 AS build
6+
WORKDIR /src
7+
COPY src/Apigw/OcelotApiGw/OcelotApiGw.csproj src/Apigw/OcelotApiGw/
8+
RUN dotnet restore src/Apigw/OcelotApiGw/
9+
COPY . .
10+
WORKDIR /src/src/Apigw/OcelotApiGw
11+
RUN dotnet build -c Release -o /app
12+
13+
FROM build AS publish
14+
RUN dotnet publish -c Release -o /app
15+
16+
FROM base AS final
17+
WORKDIR /app
18+
COPY --from=publish /app .
19+
ENTRYPOINT ["dotnet", "OcelotApiGw.dll"]

src/Apigw/configs/webshoppingapigw/configuration.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"Port": 80
1010
}
1111
],
12-
"UpstreamPathTemplate": "/shopping/api/{version}/c/{everything}",
12+
"UpstreamPathTemplate": "/api/{version}/c/{everything}",
1313
"UpstreamHttpMethod": [ "GET" ]
1414
},
1515
{
@@ -21,7 +21,7 @@
2121
"Port": 80
2222
}
2323
],
24-
"UpstreamPathTemplate": "/shopping/api/{version}/b/{everything}",
24+
"UpstreamPathTemplate": "/api/{version}/b/{everything}",
2525
"UpstreamHttpMethod": [],
2626
"AuthenticationOptions": {
2727
"AuthenticationProviderKey": "IdentityApiKey",
@@ -37,7 +37,7 @@
3737
"Port": 80
3838
}
3939
],
40-
"UpstreamPathTemplate": "/shopping/api/{version}/o/{everything}",
40+
"UpstreamPathTemplate": "/api/{version}/o/{everything}",
4141
"UpstreamHttpMethod": [],
4242
"AuthenticationOptions": {
4343
"AuthenticationProviderKey": "IdentityApiKey",
@@ -53,7 +53,7 @@
5353
"Port": 80
5454
}
5555
],
56-
"UpstreamPathTemplate": "/shopping/{everything}",
56+
"UpstreamPathTemplate": "/{everything}",
5757
"UpstreamHttpMethod": [ "POST", "PUT", "GET" ],
5858
"AuthenticationOptions": {
5959
"AuthenticationProviderKey": "IdentityApiKey",

src/Web/WebSPA/Client/modules/basket/basket.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,23 @@ export class BasketService {
6666
}
6767

6868
setBasket(basket): Observable<boolean> {
69-
let url = this.purchaseUrl + '/shopping/api/v1/basket/';
69+
let url = this.purchaseUrl + '/api/v1/basket/';
7070
this.basket = basket;
7171
return this.service.post(url, basket).map((response: Response) => {
7272
return true;
7373
});
7474
}
7575

7676
setBasketCheckout(basketCheckout): Observable<boolean> {
77-
let url = this.basketUrl + '/shopping/api/v1/b/basket/checkout';
77+
let url = this.basketUrl + '/api/v1/b/basket/checkout';
7878
return this.service.postWithId(url, basketCheckout).map((response: Response) => {
7979
this.basketEvents.orderCreated();
8080
return true;
8181
});
8282
}
8383

8484
getBasket(): Observable<IBasket> {
85-
let url = this.basketUrl + '/shopping/api/v1/b/basket/' + this.basket.buyerId;
85+
let url = this.basketUrl + '/api/v1/b/basket/' + this.basket.buyerId;
8686
return this.service.get(url).map((response: Response) => {
8787
if (response.status === 204) {
8888
return null;

src/Web/WebSPA/Client/modules/catalog/catalog.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ export class CatalogService {
2121

2222
constructor(private service: DataService, private configurationService: ConfigurationService) {
2323
this.configurationService.settingsLoaded$.subscribe(x => {
24-
this.catalogUrl = this.configurationService.serverSettings.purchaseUrl + '/shopping/api/v1/c/catalog/items';
25-
this.brandUrl = this.configurationService.serverSettings.purchaseUrl + '/shopping/api/v1/c/catalog/catalogbrands';
26-
this.typesUrl = this.configurationService.serverSettings.purchaseUrl + '/shopping/api/v1/c/catalog/catalogtypes';
24+
this.catalogUrl = this.configurationService.serverSettings.purchaseUrl + '/api/v1/c/catalog/items';
25+
this.brandUrl = this.configurationService.serverSettings.purchaseUrl + '/api/v1/c/catalog/catalogbrands';
26+
this.typesUrl = this.configurationService.serverSettings.purchaseUrl + '/api/v1/c/catalog/catalogtypes';
2727
});
2828
}
2929

src/Web/WebSPA/Client/modules/orders/orders.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ export class OrdersService {
2929
}
3030

3131
getOrders(): Observable<IOrder[]> {
32-
let url = this.ordersUrl + '/shopping/api/v1/o/orders';
32+
let url = this.ordersUrl + '/api/v1/o/orders';
3333

3434
return this.service.get(url).map((response: Response) => {
3535
return response.json();
3636
});
3737
}
3838

3939
getOrder(id: number): Observable<IOrderDetail> {
40-
let url = this.ordersUrl + '/shopping/api/v1/o/orders/' + id;
40+
let url = this.ordersUrl + '/api/v1/o/orders/' + id;
4141

4242
return this.service.get(url).map((response: Response) => {
4343
return response.json();

0 commit comments

Comments
 (0)