Skip to content

Commit

Permalink
Merge pull request #161 from hypersign-protocol/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Pratap2018 authored Jan 10, 2024
2 parents 2796e98 + a8f7090 commit 6fdaead
Show file tree
Hide file tree
Showing 16 changed files with 21,045 additions and 34 deletions.
93 changes: 93 additions & 0 deletions .deploy/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: studio-playground
namespace: hypermine-development
spec:
replicas: 1
selector:
matchLabels:
app: studio-playground
template:
metadata:
labels:
app: studio-playground
spec:
containers:
- name: studio-playground
image: __GOOGLE_ARTIFACT_URL__/__GOOGLE_PROJECT_ID__/__GOOGLE_ARTIFACT_REPO__/playground-server:__LATEST_RELEASE_TAG__
resources:
limits:
memory: "128Mi"
cpu: "500m"
ports:
- containerPort: __PORT__
env:
- name: WHITELISTED_CORS
values: '["http://localhost:9000","http://localhost:9001","http://192.168.29.12:9001", "https://localhost:9001", "http://192.168.29.209:9001", "http://entity.hypersign.id","https://entity.hypersign.id","http://localhost:9001", "https://wallet-stage.hypersign.id", "http://localhost:4999","192.168.29.13","http://localhost:1234","http://localhost:4000","https://wallet-prajna.hypersign.id" "*"]'
- name: NODE_ENV
values: "__NODE_ENV__"
- name: HOST
values: "__HOST__"
- name: PORT
values: __PORT__
- name: LOG_FILEPATH
values: "__LOG_FILEPATH__"
- name: LOG_DIR
values: "__LOG_DIR__"
- name: LOG_TIMESTAMP_FORMAT
values: "__LOG_TIMESTAMP_FORMAT__"
- name: LOG_LEVEL
values: "__LOG_LEVEL__"
- name: DATABASE_FILEPATH
values: "__DATABASE_FILEPATH__"
- name: DID_METHOD_NAME
values: "__DID_METHOD_NAME__"
- name: DID_PREFIX
values: "__DID_PREFIX__"
- name: JWT_SECRET
values: "__JWT_SECRET__"
- name: STUDIO_SERVER_BASE_URL
values: "__STUDIO_SERVER_BASE_URL__"
- name: SSE_CLIENT_URL
values: "__SSE_CLIENT_URL__"
- name: NODE_SERVER_DID_CREATE_EP
values: "__NODE_SERVER_DID_CREATE_EP__"
- name: NODE_SERVER_SCHEMA_CREATE_EP
values: "__NODE_SERVER_SCHEMA_CREATE_EP__"
- name: MAIL_HOST
values: "__MAIL_HOST__"
- name: MAIL_PORT
values: "__MAIL_PORT__"
- name: MAIL_USERNAME
values: "__MAIL_USERNAME__"
- name: MAIL_PASSWORD
values: "__MAIL_PASSWORD__"
- name: MAIL_NAME
values: "__MAIL_NAME__"
- name: HID_NETWORK_RPC
values: "__HID_NETWORK_RPC__"
- name: HID_NETWORK_API
values: "__HID_NETWORK_API__"
- name: PATH_TO_ISSUE_CRED
values: "__PATH_TO_ISSUE_CRED__"
- name: EMAIL_CREDENTITAL_SCHEMA_ID
values: "__EMAIL_CREDENTITAL_SCHEMA_ID__"
- name: DB_URL
values: "__DB_URL__"
---
apiVersion: v1
kind: Service
metadata:
name: studio-playground-service
namespace: hypermine-development
annotations:
cloud.google.com/neg: '{"ingress": true}'
spec:
type: NodePort
selector:
app: studio-playground
ports:
- port: __PORT__
targetPort: __PORT__
protocol: TCP
127 changes: 127 additions & 0 deletions .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Playground Build and deploy Pipeline

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]-rc.[0-9]+"

jobs:
Build-Pipeline:
runs-on: ubuntu-latest
environment: production

steps:
- name: code checkout
uses: actions/checkout@v3
# - name: Set Latest Tag
# run: echo "LATEST_RELEASE_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV

- id: "auth"
uses: "google-github-actions/auth@v1"
with:
credentials_json: "${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}"

- name: install gcloud cli tools
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{secrets.GOOGLE_PROJECT_ID}}
service_account_key: ${{secrets.GOOGLE_APPLICATION_CREDENTIALS}}
install_components: "gke-gcloud-auth-plugin"
export_default_credentials: true
- name: "Use gcloud CLI"
run: "gcloud info"
- name: "Docker Auth"
run: gcloud auth configure-docker ${{secrets.GOOGLE_ARTIFACT_URL}}
- name: "Docker Build and Push"
working-directory: server
env:
GOOGLE_PROJECT_ID: ${{secrets.GOOGLE_PROJECT_ID}}
GOOGLE_ARTIFACT_URL: ${{secrets.GOOGLE_ARTIFACT_URL}}
GOOGLE_ARTIFACT_REPO: ${{secrets.GOOGLE_ARTIFACT_REPO}}
run:
docker build -t $GOOGLE_ARTIFACT_URL/$GOOGLE_PROJECT_ID/$GOOGLE_ARTIFACT_REPO/playground-server:${{ env.LATEST_RELEASE_TAG }} .

docker push $GOOGLE_ARTIFACT_URL/$GOOGLE_PROJECT_ID/$GOOGLE_ARTIFACT_REPO/playground-server:${{ env.LATEST_RELEASE_TAG }}
Deploy-Pipeline:
needs: [Build-Pipeline]
runs-on: ubuntu-latest
environment: production
steps:
- name: code checkout
uses: actions/checkout@v3

- name: Set Latest Tag
run: echo "LATEST_RELEASE_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV

- id: "auth"
uses: "google-github-actions/auth@v1"
with:
credentials_json: "${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}"
- name: install gcloud cli tools
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{secrets.GOOGLE_PROJECT_ID}}
service_account_key: ${{secrets.GOOGLE_APPLICATION_CREDENTIALS}}
install_components: "gke-gcloud-auth-plugin"
export_default_credentials: true
- name: "Configure kubectl"
run: gcloud container clusters get-credentials hypermine-gke --region=asia-south1
- name: Replace tags
run: find .deploy/deployment.yaml -type f -exec sed -i -e "s#__LATEST_RELEASE_TAG__#${{ env.LATEST_RELEASE_TAG }}#" {} \;
- name: "Replace secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i ''s/__GOOGLE_ARTIFACT_URL__/${{ secrets.GOOGLE_ARTIFACT_URL }}/g'' {} \;
- name: "Replace secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i ''s/__GOOGLE_ARTIFACT_REPO__/${{ secrets.GOOGLE_ARTIFACT_REPO }}/g'' {} \;
- name: "Replace secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i ''s/__GOOGLE_PROJECT_ID__/${{ secrets.GOOGLE_PROJECT_ID }}/g'' {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__NODE_ENV__#${{ vars.NODE_ENV }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__HOST__#${{ vars.HOST }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__PORT__#${{ vars.PORT }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__LOG_FILEPATH__#${{ vars.LOG_FILEPATH }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__LOG_DIR__#${{ vars.LOG_DIR }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__LOG_TIMESTAMP_FORMAT__#${{ vars.LOG_TIMESTAMP_FORMAT }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__DATABASE_FILEPATH__#${{ vars.DATABASE_FILEPATH }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__DID_METHOD_NAME__#${{ vars.DID_METHOD_NAME }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__DID_PREFIX__#${{ vars.DID_PREFIX }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__JWT_SECRET__#${{ vars.JWT_SECRET }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__STUDIO_SERVER_BASE_URL__#${{ vars.STUDIO_SERVER_BASE_URL }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__SSE_CLIENT_URL__#${{ vars.SSE_CLIENT_URL }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__NODE_SERVER_DID_CREATE_EP__#${{ vars.NODE_SERVER_DID_CREATE_EP }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__NODE_SERVER_SCHEMA_CREATE_EP__#${{ vars.NODE_SERVER_SCHEMA_CREATE_EP }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__MAIL_HOST__#${{ vars.MAIL_HOST }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__MAIL_PORT__#${{ vars.MAIL_PORT }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__MAIL_USERNAME__#${{ vars.MAIL_USERNAME }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__MAIL_PASSWORD__#${{ vars.MAIL_PASSWORD }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__MAIL_NAME__#${{ vars.MAIL_NAME }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__HID_NETWORK_RPC__#${{ vars.HID_NETWORK_RPC }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__HID_NETWORK_API__#${{ vars.HID_NETWORK_API }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__PATH_TO_ISSUE_CRED__#${{ vars.PATH_TO_ISSUE_CRED }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__EMAIL_CREDENTITAL_SCHEMA_ID__#${{ vars.EMAIL_CREDENTITAL_SCHEMA_ID }}#" {} \;
- name: "Replace Secrets"
run: find .deploy/deployment.yaml -type f -exec sed -i "s#__DB_URL__#${{ vars.DB_URL }}#" {} \;
- name: "Deploy to GKE"
run: kubectl apply -f .deploy/deployment.yaml
File renamed without changes.
12 changes: 9 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
FROM node:16
WORKDIR /usr/src/app
ADD ./server/ /usr/src/app/
RUN npm cache clean --force
COPY ./package.json .
COPY ./tsconfig.json .
COPY . .
RUN npm install
CMD ["npm","run", "dev"]
RUN npm run build
CMD ["npm","run", "start"]




1 change: 0 additions & 1 deletion server/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ DATABASE_FILEPATH=../db/studio-server.db
DID_METHOD_NAME=hs
JWT_SECRET= 00c2c433-a077-4e68-b19c-1234f014a510
STUDIO_SERVER_BASE_URL=http://localhost:9000/
NODE_SERVER_BASE_URL=http://localhost:5000/
NODE_SERVER_DID_CREATE_EP=api/did/create_tmp
NODE_SERVER_SCHEMA_CREATE_EP=api/schema/create
DB_URL=
Expand Down
21 changes: 0 additions & 21 deletions server/.env.staging

This file was deleted.

1 change: 0 additions & 1 deletion server/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ services:
DID_METHOD_NAME: "hs"
JWT_SECRET: "00c2c433-a077-4e68-b19c-1234f014a510"
STUDIO_SERVER_BASE_URL: "http://localhost:9000/"
NODE_SERVER_BASE_URL: "http://localhost:5000/"
NODE_SERVER_DID_CREATE_EP: "api/did/create_tmp"
NODE_SERVER_SCHEMA_CREATE_EP: "api/schema/create"
DB_URL: "mongodb://mongo:27017/studio-dashboard-service"
Expand Down
Loading

0 comments on commit 6fdaead

Please sign in to comment.