Merge branch 'main' into dev

This commit is contained in:
Saleel
2023-06-21 16:30:10 +05:30
committed by GitHub
13 changed files with 28 additions and 91 deletions

View File

@@ -1,6 +1,8 @@
#!/bin/bash
egrep build.*true .killswitch || exit 0
build=$1
[ $build = "enable" ] || exit 0
aws ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin 490752553772.dkr.ecr.eu-central-1.amazonaws.com

View File

@@ -1,21 +1,10 @@
#!/bin/bash
set -x
set -ex
COMMIT_HASH=$(git rev-parse HEAD)
DEPLOY_ID=$(aws deploy create-deployment --application-name bandada --deployment-group-name bandada-group --github-location repository=$GITHUB_REPOSITORY,commitId=$COMMIT_HASH --ignore-application-stop-failures --file-exists OVERWRITE --output text)
while true; do
STATUS=$(aws deploy get-deployment --deployment-id $DEPLOY_ID --query 'deploymentInfo.status' --output text)
if [ $STATUS != "InProgress" ] && [ $STATUS != "Created" ]; then
if [ $STATUS = "Succeeded" ]; then
echo "SUCCESS"
exit 0
else
echo "Failed"
exit 1
fi
else
echo "Deploying..."
fi
sleep 30
tasks="bandada-client bandada-api bandada-dashboard"
for task in $tasks; do
bandada_revision=$(aws ecs describe-task-definition --task-definition $task --query "taskDefinition.revision")
aws ecs update-service --cluster bandada --service $task --force-new-deployment --task-definition $task:$bandada_revision
done
aws ecs wait services-stable --cluster bandada --services $tasks

View File

@@ -2,7 +2,16 @@ name: Deploy
on:
push:
branches: [main]
workflow_dispatch: {}
workflow_dispatch:
inputs:
build:
description: "Build trigger"
required: true
default: "enable"
type: choice
options:
- enable
- disable
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -11,6 +20,8 @@ concurrency:
jobs:
deploy:
runs-on: ubuntu-latest
env:
DATA: ${{ github.event.inputs.build }}
permissions:
id-token: write
contents: read
@@ -24,13 +35,13 @@ jobs:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::490752553772:role/bandada-deploy-slc
role-to-assume: arn:aws:iam::490752553772:role/bandada-ecs-deploy-slc
role-duration-seconds: 1800
aws-region: eu-central-1
- name: Build and Push images to ECR
run: |
.github/scripts/build.sh
.github/scripts/build.sh ${{ env.DATA }}
- name: Create Deployment
run: |

View File

@@ -1 +0,0 @@
build=true

View File

@@ -1,3 +1,3 @@
# This file contains build time variables for prod env.
VITE_API_URL=https://bandada.appliedzkp.org/api
VITE_API_URL=https://api.bandada.appliedzkp.org

View File

@@ -4,7 +4,7 @@
"type": "module",
"scripts": {
"dev": "vite --port 3002",
"build": "tsc && vite build --mode production --base=/client",
"build": "tsc && vite build --mode production",
"preview": "vite preview"
},
"dependencies": {

View File

@@ -1,6 +1,6 @@
# This file contains build time variables for prod env.
VITE_API_URL=https://bandada.appliedzkp.org/api
VITE_CLIENT_INVITES_URL=https://bandada.appliedzkp.org/client/invites/\
VITE_API_URL=https://api.bandada.appliedzkp.org
VITE_CLIENT_URL=https://client.bandada.appliedzkp.org
VITE_ETHEREUM_NETWORK=goerli
VITE_GITHUB_CLIENT_ID=

View File

@@ -1,30 +0,0 @@
version: 0.0
os: linux
files:
- source: /
destination: /home/ubuntu/bandada
permissions:
- object: /home/ubuntu/bandada
owner: ubuntu
group: ubuntu
hooks:
BeforeInstall:
- location: scripts/before_install.sh
timeout: 300
runas: ubuntu
AfterInstall:
- location: scripts/after_install.sh
timeout: 300
runas: ubuntu
ApplicationStart:
- location: scripts/start_app.sh
timeout: 300
runas: ubuntu
ApplicationStop:
- location: scripts/stop_app.sh
timeout: 300
runas: ubuntu
ValidateService:
- location: scripts/validate_app.sh
timeout: 300
runas: ubuntu

View File

@@ -1,6 +0,0 @@
#!/bin/bash
set -e
cp ~/.env ~/bandada/apps/api/
exit 0

View File

@@ -1,6 +0,0 @@
#!/bin/bash
set -e
docker image prune --filter "until=48h" -f
exit 0

View File

@@ -1,10 +0,0 @@
#!/bin/bash
set -e
aws ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin 490752553772.dkr.ecr.eu-central-1.amazonaws.com
cd ~/bandada
docker compose -f docker-compose.prod.yml up -d --no-build
exit 0

View File

@@ -1,6 +0,0 @@
#!/bin/bash
cd ~/bandada
docker compose -f docker-compose.prod.yml down
exit 0

View File

@@ -1,6 +0,0 @@
#!/bin/bash
docker ps | grep bandada
[ $? -eq 0 ] || exit 1
exit 0