Skip to content

Commit

Permalink
Release changes (#196)
Browse files Browse the repository at this point in the history
* 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 <nikhil@traceable.ai>
Co-authored-by: Mathew Jose Mammoottil <60283272+mathew-jose@users.noreply.github.com>
  • Loading branch information
3 people authored Apr 28, 2023
1 parent 01bae75 commit f8dedff
Show file tree
Hide file tree
Showing 47 changed files with 4,579 additions and 2,876 deletions.
62 changes: 42 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ jobs:
push: false
load: true
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
cache-from: type=gha,scope=identity-service
cache-to: type=gha,mode=max,scope=identity-service

- name: Build crapi-workshop image
uses: docker/build-push-action@v2
Expand All @@ -110,8 +110,8 @@ jobs:
push: false
load: true
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
cache-from: type=gha,scope=workshop-service
cache-to: type=gha,mode=max,scope=workshop-service

- name: Build crapi-community image
uses: docker/build-push-action@v2
Expand All @@ -121,8 +121,8 @@ jobs:
push: false
load: true
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
cache-from: type=gha,scope=community-service
cache-to: type=gha,mode=max,scope=community-service

- name: Build crapi-web image
uses: docker/build-push-action@v2
Expand All @@ -132,8 +132,20 @@ jobs:
push: false
load: true
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
cache-from: type=gha,scope=web-service
cache-to: type=gha,mode=max,scope=web-service

- name: Build gateway-service image
uses: docker/build-push-action@v2
with:
context: ./services/gateway-service
tags: crapi/gateway-service:${{ env.TAG_LATEST }},crapi/gateway-service:${{ env.TAG_NAME }}
push: false
load: true
platforms: linux/amd64
cache-from: type=gha,scope=gateway-service
cache-to: type=gha,mode=max,scope=gateway-service


- name: Check Mailhog existence
id: check_mailhog_exists
Expand All @@ -150,8 +162,8 @@ jobs:
push: false
load: true
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
cache-from: type=gha,scope=mailhog-service
cache-to: type=gha,mode=max,scope=mailhog-service

- name: Show all images built
run: docker images
Expand Down Expand Up @@ -180,8 +192,8 @@ jobs:
tags: crapi/crapi-identity:${{ env.TAG_LATEST }},crapi/crapi-identity:${{ env.TAG_NAME }}
push: ${{ needs.build-context.outputs.push_image }}
platforms: ${{ env.PLATFORMS }}
cache-from: type=gha
cache-to: type=gha,mode=max
cache-from: type=gha,scope=identity-service
cache-to: type=gha,mode=max,scope=identity-service

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

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

- name: Build crapi-web all platforms and conditionally push to Docker Hub
uses: docker/build-push-action@v2
Expand All @@ -210,8 +222,18 @@ jobs:
tags: crapi/crapi-web:${{ env.TAG_LATEST }},crapi/crapi-web:${{ env.TAG_NAME }}
push: ${{ needs.build-context.outputs.push_image }}
platforms: ${{ env.PLATFORMS }}
cache-from: type=gha
cache-to: type=gha,mode=max
cache-from: type=gha,scope=web-service
cache-to: type=gha,mode=max,scope=web-service

- name: Build gateway-service all platforms and conditionally push to Docker Hub
uses: docker/build-push-action@v2
with:
context: ./services/gateway-service
tags: crapi/gateway-service:${{ env.TAG_LATEST }},crapi/gateway-service:${{ env.TAG_NAME }}
push: ${{ needs.build-context.outputs.push_image }}
platforms: ${{ env.PLATFORMS }}
cache-from: type=gha,scope=gateway-service
cache-to: type=gha,mode=max,scope=gateway-service

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

32 changes: 25 additions & 7 deletions deploy/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
container_name: crapi-identity
image: crapi/crapi-identity:${VERSION:-latest}
#ports:
# - "127.0.0.1:8080:8080"
# - "${LISTEN_IP:-127.0.0.1}:8080:8080"
volumes:
- ./keys:/keys
environment:
Expand All @@ -40,6 +40,7 @@ services:
- SMTP_AUTH=true
- SMTP_STARTTLS=true
- ENABLE_LOG4J=${ENABLE_LOG4J:-false}
- API_GATEWAY_URL=https://api.crapi.io
depends_on:
postgresdb:
condition: service_healthy
Expand All @@ -60,7 +61,7 @@ services:
container_name: crapi-community
image: crapi/crapi-community:${VERSION:-latest}
#ports:
# - "127.0.0.1:8087:8087"
# - "${LISTEN_IP:-127.0.0.1}:8087:8087"
environment:
- IDENTITY_SERVICE=crapi-identity:${IDENTITY_SERVER_PORT:-8080}
- DB_NAME=crapi
Expand Down Expand Up @@ -96,7 +97,7 @@ services:
container_name: crapi-workshop
image: crapi/crapi-workshop:${VERSION:-latest}
#ports:
# - "127.0.0.1:8000:8000"
# - "${LISTEN_IP:-127.0.0.1}:8000:8000"
environment:
- IDENTITY_SERVICE=crapi-identity:${IDENTITY_SERVER_PORT:-8080}
- DB_NAME=crapi
Expand All @@ -111,6 +112,7 @@ services:
- MONGO_DB_PASSWORD=crapisecretpassword
- MONGO_DB_NAME=crapi
- SECRET_KEY=crapi
- API_GATEWAY_URL=https://api.crapi.io
depends_on:
postgresdb:
condition: service_healthy
Expand All @@ -135,7 +137,7 @@ services:
container_name: crapi-web
image: crapi/crapi-web:${VERSION:-latest}
ports:
- "127.0.0.1:8888:80"
- "${LISTEN_IP:-127.0.0.1}:8888:80"
environment:
- COMMUNITY_SERVICE=crapi-community:${COMMUNITY_SERVER_PORT:-8087}
- IDENTITY_SERVICE=crapi-identity:${IDENTITY_SERVER_PORT:-8080}
Expand Down Expand Up @@ -166,7 +168,7 @@ services:
POSTGRES_PASSWORD: crapisecretpassword
POSTGRES_DB: crapi
#ports:
# - "127.0.0.1:5432:5432"
# - "${LISTEN_IP:-127.0.0.1}:5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 15s
Expand All @@ -187,7 +189,7 @@ services:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: crapisecretpassword
#ports:
# - "127.0.0.1:27017:27017"
# - "${LISTEN_IP:-127.0.0.1}:27017:27017"
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongo mongodb:27017/test --quiet
interval: 15s
Expand All @@ -211,7 +213,7 @@ services:
MH_STORAGE: mongodb
ports:
# - "127.0.0.1:1025:1025" # smtp server
- "127.0.0.1:8025:8025" # Mail ui
- "${LISTEN_IP:-127.0.0.1}:8025:8025" # Mail ui
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "8025"]
interval: 15s
Expand All @@ -223,6 +225,22 @@ services:
cpus: '0.3'
memory: 128M

api.crapi.io:
container_name: api.crapi.io
image: crapi/gateway-service:${VERSION:-latest}
#ports:
# - "${LISTEN_IP:-127.0.0.1}:8443:443" # https
healthcheck:
test: curl -vk 0.0.0.0:443
interval: 15s
timeout: 15s
retries: 15
deploy:
resources:
limits:
cpus: '0.1'
memory: 50M

volumes:
mongodb-data:
postgresql-data:
11 changes: 11 additions & 0 deletions deploy/helm/templates/api-gateway-service/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{ if .Values.apiGatewayServiceInstall }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.apiGatewayService.config.name }}
labels:
release: {{ .Release.Name }}
{{- toYaml .Values.apiGatewayService.config.labels | nindent 4 }}
data:
SERVER_PORT: {{ .Values.apiGatewayService.port | quote }}
{{ end }}
39 changes: 39 additions & 0 deletions deploy/helm/templates/api-gateway-service/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{{ if .Values.apiGatewayServiceInstall }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.apiGatewayService.name }}
labels:
release: {{ .Release.Name }}
{{- with .Values.apiGatewayService.deploymentLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.apiGatewayService.replicaCount }}
selector:
matchLabels:
{{- toYaml .Values.apiGatewayService.deploymentSelectorMatchLabels | nindent 6 }}
template:
metadata:
labels:
release: {{ .Release.Name }}
{{- with .Values.apiGatewayService.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
containers:
- name: {{ .Values.apiGatewayService.name }}
image: {{ .Values.apiGatewayService.image }}:{{ .Chart.AppVersion }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
ports:
- containerPort: {{ .Values.apiGatewayService.port }}
{{- if .Values.apiGatewayService.resources }}
resources:
{{- toYaml .Values.apiGatewayService.resources | nindent 12 }}
{{- end }}
readinessProbe:
tcpSocket:
port: {{ .Values.apiGatewayService.port }}
initialDelaySeconds: 15
periodSeconds: 10
{{ end }}
17 changes: 17 additions & 0 deletions deploy/helm/templates/api-gateway-service/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{ if .Values.apiGatewayServiceInstall }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.apiGatewayService.service.name }}
labels:
release: {{ .Release.Name }}
{{- with .Values.apiGatewayService.service.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
ports:
- port: {{ .Values.apiGatewayService.port }}
name: https
selector:
{{- toYaml .Values.apiGatewayService.serviceSelectorLabels | nindent 4 }}
{{ end }}
1 change: 1 addition & 0 deletions deploy/helm/templates/identity/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ data:
SMTP_AUTH: {{ .Values.identity.config.smtpAuth | quote }}
SMTP_STARTTLS: {{ .Values.identity.config.smtpStartTLS | quote }}
SERVER_PORT: {{ .Values.identity.port | quote }}
API_GATEWAY_URL: {{ if .Values.apiGatewayServiceInstall }}"https://{{ .Values.apiGatewayService.service.name }}"{{ else }}{{ .Values.apiGatewayServiceUrl }}{{ end }}
1 change: 1 addition & 0 deletions deploy/helm/templates/workshop/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ data:
MONGO_DB_PASSWORD: {{ .Values.mongodb.config.mongoPassword }}
MONGO_DB_NAME: {{ .Values.mongodb.config.mongoDbName }}
SERVER_PORT: {{ .Values.workshop.port | quote }}
API_GATEWAY_URL: {{ if .Values.apiGatewayServiceInstall }}"https://{{ .Values.apiGatewayService.service.name }}"{{ else }}{{ .Values.apiGatewayServiceUrl }}{{ end }}
30 changes: 30 additions & 0 deletions deploy/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ jwtSecret: crapi
enableLog4j: false
enableShellInjection: true
imagePullPolicy: Always
apiGatewayServiceUrl: https://api.crapi.io
apiGatewayServiceInstall: true
apiGatewayPassword:

waitForK8sResources:
image: groundnuty/k8s-wait-for:v1.3
Expand Down Expand Up @@ -249,3 +252,30 @@ postgresdb:
app: postgresdb
statefulsetSelectorMatchLabels:
app: postgresdb

apiGatewayService:
name: gateway-service
image: crapi/gateway-service
port: 443
replicaCount: 1
service:
name: "gateway-service"
labels:
app: gateway-service
config:
name: gateway-service
labels:
app: gateway-service
resources:
limits:
cpu: "100m"
requests:
cpu: 50m
deploymentLabels:
app: gateway-service
podLabels:
app: gateway-service
deploymentSelectorMatchLabels:
app: gateway-service
serviceSelectorLabels:
app: gateway-service
8 changes: 8 additions & 0 deletions deploy/k8s/base/gateway-service/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: gateway-service-configmap
labels:
app: gateway-service
data:
SERVER_PORT: "443"
25 changes: 25 additions & 0 deletions deploy/k8s/base/gateway-service/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: gateway-service
spec:
replicas: 1
selector:
matchLabels:
app: gateway-service
template:
metadata:
labels:
app: gateway-service
spec:
containers:
- name: gateway-service
image: crapi/gateway-service:latest
imagePullPolicy: Always
ports:
- containerPort: 8087
resources:
limits:
cpu: "100m"
requests:
cpu: 50m
Loading

0 comments on commit f8dedff

Please sign in to comment.