Skip to content

Commit f8dedff

Browse files
piyushroshannikhil-rajeshmathew-jose
authored
Release changes (#196)
* Update openapi * Updated password validation message * Updated cache scope * Update postman collections * Tls external (#183) * Fetch paymentinfo/vehicleowners from external api gateway * Added A Reset Password for Test Users Endpoint to Identity Service (#185) * added reset endpoint to identity service * Updated Postman Collection (#188) * Updated Postman Collection * Automatically Remove test database (#189) --------- Co-authored-by: Nikhil R <[email protected]> Co-authored-by: Mathew Jose Mammoottil <[email protected]>
1 parent 01bae75 commit f8dedff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+4579
-2876
lines changed

.github/workflows/ci.yml

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ jobs:
9999
push: false
100100
load: true
101101
platforms: linux/amd64
102-
cache-from: type=gha
103-
cache-to: type=gha,mode=max
102+
cache-from: type=gha,scope=identity-service
103+
cache-to: type=gha,mode=max,scope=identity-service
104104

105105
- name: Build crapi-workshop image
106106
uses: docker/build-push-action@v2
@@ -110,8 +110,8 @@ jobs:
110110
push: false
111111
load: true
112112
platforms: linux/amd64
113-
cache-from: type=gha
114-
cache-to: type=gha,mode=max
113+
cache-from: type=gha,scope=workshop-service
114+
cache-to: type=gha,mode=max,scope=workshop-service
115115

116116
- name: Build crapi-community image
117117
uses: docker/build-push-action@v2
@@ -121,8 +121,8 @@ jobs:
121121
push: false
122122
load: true
123123
platforms: linux/amd64
124-
cache-from: type=gha
125-
cache-to: type=gha,mode=max
124+
cache-from: type=gha,scope=community-service
125+
cache-to: type=gha,mode=max,scope=community-service
126126

127127
- name: Build crapi-web image
128128
uses: docker/build-push-action@v2
@@ -132,8 +132,20 @@ jobs:
132132
push: false
133133
load: true
134134
platforms: linux/amd64
135-
cache-from: type=gha
136-
cache-to: type=gha,mode=max
135+
cache-from: type=gha,scope=web-service
136+
cache-to: type=gha,mode=max,scope=web-service
137+
138+
- name: Build gateway-service image
139+
uses: docker/build-push-action@v2
140+
with:
141+
context: ./services/gateway-service
142+
tags: crapi/gateway-service:${{ env.TAG_LATEST }},crapi/gateway-service:${{ env.TAG_NAME }}
143+
push: false
144+
load: true
145+
platforms: linux/amd64
146+
cache-from: type=gha,scope=gateway-service
147+
cache-to: type=gha,mode=max,scope=gateway-service
148+
137149

138150
- name: Check Mailhog existence
139151
id: check_mailhog_exists
@@ -150,8 +162,8 @@ jobs:
150162
push: false
151163
load: true
152164
platforms: linux/amd64
153-
cache-from: type=gha
154-
cache-to: type=gha,mode=max
165+
cache-from: type=gha,scope=mailhog-service
166+
cache-to: type=gha,mode=max,scope=mailhog-service
155167

156168
- name: Show all images built
157169
run: docker images
@@ -180,8 +192,8 @@ jobs:
180192
tags: crapi/crapi-identity:${{ env.TAG_LATEST }},crapi/crapi-identity:${{ env.TAG_NAME }}
181193
push: ${{ needs.build-context.outputs.push_image }}
182194
platforms: ${{ env.PLATFORMS }}
183-
cache-from: type=gha
184-
cache-to: type=gha,mode=max
195+
cache-from: type=gha,scope=identity-service
196+
cache-to: type=gha,mode=max,scope=identity-service
185197

186198
- name: Build crapi-workshop all platforms and conditionally push to Docker Hub
187199
uses: docker/build-push-action@v2
@@ -190,8 +202,8 @@ jobs:
190202
tags: crapi/crapi-workshop:${{ env.TAG_LATEST }},crapi/crapi-workshop:${{ env.TAG_NAME }}
191203
push: ${{ needs.build-context.outputs.push_image }}
192204
platforms: ${{ env.PLATFORMS }}
193-
cache-from: type=gha
194-
cache-to: type=gha,mode=max
205+
cache-from: type=gha,scope=workshop-service
206+
cache-to: type=gha,mode=max,scope=workshop-service
195207

196208
- name: Build crapi-community all platforms and conditionally push to Docker Hub
197209
uses: docker/build-push-action@v2
@@ -200,8 +212,8 @@ jobs:
200212
tags: crapi/crapi-community:${{ env.TAG_LATEST }},crapi/crapi-community:${{ env.TAG_NAME }}
201213
push: ${{ needs.build-context.outputs.push_image }}
202214
platforms: ${{ env.PLATFORMS }}
203-
cache-from: type=gha
204-
cache-to: type=gha,mode=max
215+
cache-from: type=gha,scope=community-service
216+
cache-to: type=gha,mode=max,scope=community-service
205217

206218
- name: Build crapi-web all platforms and conditionally push to Docker Hub
207219
uses: docker/build-push-action@v2
@@ -210,8 +222,18 @@ jobs:
210222
tags: crapi/crapi-web:${{ env.TAG_LATEST }},crapi/crapi-web:${{ env.TAG_NAME }}
211223
push: ${{ needs.build-context.outputs.push_image }}
212224
platforms: ${{ env.PLATFORMS }}
213-
cache-from: type=gha
214-
cache-to: type=gha,mode=max
225+
cache-from: type=gha,scope=web-service
226+
cache-to: type=gha,mode=max,scope=web-service
227+
228+
- name: Build gateway-service all platforms and conditionally push to Docker Hub
229+
uses: docker/build-push-action@v2
230+
with:
231+
context: ./services/gateway-service
232+
tags: crapi/gateway-service:${{ env.TAG_LATEST }},crapi/gateway-service:${{ env.TAG_NAME }}
233+
push: ${{ needs.build-context.outputs.push_image }}
234+
platforms: ${{ env.PLATFORMS }}
235+
cache-from: type=gha,scope=gateway-service
236+
cache-to: type=gha,mode=max,scope=gateway-service
215237

216238
- name: Build mailhog all platforms and conditionally push to Docker Hub
217239
if: steps.check_mailhog_exists.outputs.files_exists == 'true'
@@ -221,6 +243,6 @@ jobs:
221243
tags: crapi/mailhog:${{ env.TAG_LATEST }},crapi/mailhog:${{ env.TAG_NAME }}
222244
push: ${{ needs.build-context.outputs.push_image }}
223245
platforms: ${{ env.PLATFORMS }}
224-
cache-from: type=gha
225-
cache-to: type=gha,mode=max
246+
cache-from: type=gha,scope=mailhog-service
247+
cache-to: type=gha,mode=max,scope=mailhog-service
226248

deploy/docker/docker-compose.yml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ services:
1717
container_name: crapi-identity
1818
image: crapi/crapi-identity:${VERSION:-latest}
1919
#ports:
20-
# - "127.0.0.1:8080:8080"
20+
# - "${LISTEN_IP:-127.0.0.1}:8080:8080"
2121
volumes:
2222
- ./keys:/keys
2323
environment:
@@ -40,6 +40,7 @@ services:
4040
- SMTP_AUTH=true
4141
- SMTP_STARTTLS=true
4242
- ENABLE_LOG4J=${ENABLE_LOG4J:-false}
43+
- API_GATEWAY_URL=https://api.crapi.io
4344
depends_on:
4445
postgresdb:
4546
condition: service_healthy
@@ -60,7 +61,7 @@ services:
6061
container_name: crapi-community
6162
image: crapi/crapi-community:${VERSION:-latest}
6263
#ports:
63-
# - "127.0.0.1:8087:8087"
64+
# - "${LISTEN_IP:-127.0.0.1}:8087:8087"
6465
environment:
6566
- IDENTITY_SERVICE=crapi-identity:${IDENTITY_SERVER_PORT:-8080}
6667
- DB_NAME=crapi
@@ -96,7 +97,7 @@ services:
9697
container_name: crapi-workshop
9798
image: crapi/crapi-workshop:${VERSION:-latest}
9899
#ports:
99-
# - "127.0.0.1:8000:8000"
100+
# - "${LISTEN_IP:-127.0.0.1}:8000:8000"
100101
environment:
101102
- IDENTITY_SERVICE=crapi-identity:${IDENTITY_SERVER_PORT:-8080}
102103
- DB_NAME=crapi
@@ -111,6 +112,7 @@ services:
111112
- MONGO_DB_PASSWORD=crapisecretpassword
112113
- MONGO_DB_NAME=crapi
113114
- SECRET_KEY=crapi
115+
- API_GATEWAY_URL=https://api.crapi.io
114116
depends_on:
115117
postgresdb:
116118
condition: service_healthy
@@ -135,7 +137,7 @@ services:
135137
container_name: crapi-web
136138
image: crapi/crapi-web:${VERSION:-latest}
137139
ports:
138-
- "127.0.0.1:8888:80"
140+
- "${LISTEN_IP:-127.0.0.1}:8888:80"
139141
environment:
140142
- COMMUNITY_SERVICE=crapi-community:${COMMUNITY_SERVER_PORT:-8087}
141143
- IDENTITY_SERVICE=crapi-identity:${IDENTITY_SERVER_PORT:-8080}
@@ -166,7 +168,7 @@ services:
166168
POSTGRES_PASSWORD: crapisecretpassword
167169
POSTGRES_DB: crapi
168170
#ports:
169-
# - "127.0.0.1:5432:5432"
171+
# - "${LISTEN_IP:-127.0.0.1}:5432:5432"
170172
healthcheck:
171173
test: ["CMD-SHELL", "pg_isready"]
172174
interval: 15s
@@ -187,7 +189,7 @@ services:
187189
MONGO_INITDB_ROOT_USERNAME: admin
188190
MONGO_INITDB_ROOT_PASSWORD: crapisecretpassword
189191
#ports:
190-
# - "127.0.0.1:27017:27017"
192+
# - "${LISTEN_IP:-127.0.0.1}:27017:27017"
191193
healthcheck:
192194
test: echo 'db.runCommand("ping").ok' | mongo mongodb:27017/test --quiet
193195
interval: 15s
@@ -211,7 +213,7 @@ services:
211213
MH_STORAGE: mongodb
212214
ports:
213215
# - "127.0.0.1:1025:1025" # smtp server
214-
- "127.0.0.1:8025:8025" # Mail ui
216+
- "${LISTEN_IP:-127.0.0.1}:8025:8025" # Mail ui
215217
healthcheck:
216218
test: ["CMD", "nc", "-z", "localhost", "8025"]
217219
interval: 15s
@@ -223,6 +225,22 @@ services:
223225
cpus: '0.3'
224226
memory: 128M
225227

228+
api.crapi.io:
229+
container_name: api.crapi.io
230+
image: crapi/gateway-service:${VERSION:-latest}
231+
#ports:
232+
# - "${LISTEN_IP:-127.0.0.1}:8443:443" # https
233+
healthcheck:
234+
test: curl -vk 0.0.0.0:443
235+
interval: 15s
236+
timeout: 15s
237+
retries: 15
238+
deploy:
239+
resources:
240+
limits:
241+
cpus: '0.1'
242+
memory: 50M
243+
226244
volumes:
227245
mongodb-data:
228246
postgresql-data:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{{ if .Values.apiGatewayServiceInstall }}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: {{ .Values.apiGatewayService.config.name }}
6+
labels:
7+
release: {{ .Release.Name }}
8+
{{- toYaml .Values.apiGatewayService.config.labels | nindent 4 }}
9+
data:
10+
SERVER_PORT: {{ .Values.apiGatewayService.port | quote }}
11+
{{ end }}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{{ if .Values.apiGatewayServiceInstall }}
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: {{ .Values.apiGatewayService.name }}
6+
labels:
7+
release: {{ .Release.Name }}
8+
{{- with .Values.apiGatewayService.deploymentLabels }}
9+
{{- toYaml . | nindent 4 }}
10+
{{- end }}
11+
spec:
12+
replicas: {{ .Values.apiGatewayService.replicaCount }}
13+
selector:
14+
matchLabels:
15+
{{- toYaml .Values.apiGatewayService.deploymentSelectorMatchLabels | nindent 6 }}
16+
template:
17+
metadata:
18+
labels:
19+
release: {{ .Release.Name }}
20+
{{- with .Values.apiGatewayService.podLabels }}
21+
{{- toYaml . | nindent 8 }}
22+
{{- end }}
23+
spec:
24+
containers:
25+
- name: {{ .Values.apiGatewayService.name }}
26+
image: {{ .Values.apiGatewayService.image }}:{{ .Chart.AppVersion }}
27+
imagePullPolicy: {{ .Values.imagePullPolicy }}
28+
ports:
29+
- containerPort: {{ .Values.apiGatewayService.port }}
30+
{{- if .Values.apiGatewayService.resources }}
31+
resources:
32+
{{- toYaml .Values.apiGatewayService.resources | nindent 12 }}
33+
{{- end }}
34+
readinessProbe:
35+
tcpSocket:
36+
port: {{ .Values.apiGatewayService.port }}
37+
initialDelaySeconds: 15
38+
periodSeconds: 10
39+
{{ end }}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{{ if .Values.apiGatewayServiceInstall }}
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: {{ .Values.apiGatewayService.service.name }}
6+
labels:
7+
release: {{ .Release.Name }}
8+
{{- with .Values.apiGatewayService.service.labels }}
9+
{{- toYaml . | nindent 4 }}
10+
{{- end }}
11+
spec:
12+
ports:
13+
- port: {{ .Values.apiGatewayService.port }}
14+
name: https
15+
selector:
16+
{{- toYaml .Values.apiGatewayService.serviceSelectorLabels | nindent 4 }}
17+
{{ end }}

deploy/helm/templates/identity/config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ data:
2929
SMTP_AUTH: {{ .Values.identity.config.smtpAuth | quote }}
3030
SMTP_STARTTLS: {{ .Values.identity.config.smtpStartTLS | quote }}
3131
SERVER_PORT: {{ .Values.identity.port | quote }}
32+
API_GATEWAY_URL: {{ if .Values.apiGatewayServiceInstall }}"https://{{ .Values.apiGatewayService.service.name }}"{{ else }}{{ .Values.apiGatewayServiceUrl }}{{ end }}

deploy/helm/templates/workshop/config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ data:
2121
MONGO_DB_PASSWORD: {{ .Values.mongodb.config.mongoPassword }}
2222
MONGO_DB_NAME: {{ .Values.mongodb.config.mongoDbName }}
2323
SERVER_PORT: {{ .Values.workshop.port | quote }}
24+
API_GATEWAY_URL: {{ if .Values.apiGatewayServiceInstall }}"https://{{ .Values.apiGatewayService.service.name }}"{{ else }}{{ .Values.apiGatewayServiceUrl }}{{ end }}

deploy/helm/values.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ jwtSecret: crapi
66
enableLog4j: false
77
enableShellInjection: true
88
imagePullPolicy: Always
9+
apiGatewayServiceUrl: https://api.crapi.io
10+
apiGatewayServiceInstall: true
11+
apiGatewayPassword:
912

1013
waitForK8sResources:
1114
image: groundnuty/k8s-wait-for:v1.3
@@ -249,3 +252,30 @@ postgresdb:
249252
app: postgresdb
250253
statefulsetSelectorMatchLabels:
251254
app: postgresdb
255+
256+
apiGatewayService:
257+
name: gateway-service
258+
image: crapi/gateway-service
259+
port: 443
260+
replicaCount: 1
261+
service:
262+
name: "gateway-service"
263+
labels:
264+
app: gateway-service
265+
config:
266+
name: gateway-service
267+
labels:
268+
app: gateway-service
269+
resources:
270+
limits:
271+
cpu: "100m"
272+
requests:
273+
cpu: 50m
274+
deploymentLabels:
275+
app: gateway-service
276+
podLabels:
277+
app: gateway-service
278+
deploymentSelectorMatchLabels:
279+
app: gateway-service
280+
serviceSelectorLabels:
281+
app: gateway-service
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: gateway-service-configmap
5+
labels:
6+
app: gateway-service
7+
data:
8+
SERVER_PORT: "443"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: gateway-service
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app: gateway-service
10+
template:
11+
metadata:
12+
labels:
13+
app: gateway-service
14+
spec:
15+
containers:
16+
- name: gateway-service
17+
image: crapi/gateway-service:latest
18+
imagePullPolicy: Always
19+
ports:
20+
- containerPort: 8087
21+
resources:
22+
limits:
23+
cpu: "100m"
24+
requests:
25+
cpu: 50m

0 commit comments

Comments
 (0)