Skip to content

Commit

Permalink
Merge pull request #686 from deriv-smarttrader/f-replace-docker-with-…
Browse files Browse the repository at this point in the history
…vercel

Akmal / feat: replace docker with vercel for disaster recovery
  • Loading branch information
balakrishna-deriv authored Jul 22, 2024
2 parents c3f0ad9 + 6090de0 commit e9f088d
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 105 deletions.
2 changes: 0 additions & 2 deletions .dockerignore

This file was deleted.

77 changes: 0 additions & 77 deletions .github/actions/build_and_push_docker_image/action.yml

This file was deleted.

24 changes: 11 additions & 13 deletions .github/workflows/release_production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,22 @@ jobs:
with:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- name: Build Docker image and push to Docker hub and K8S
id: build_and_push_docker_image
uses: "./.github/actions/build_and_push_docker_image"
- name: Upload to vercel
id: deploy_vercel
uses: 'deriv-com/shared-actions/.github/actions/vercel_DR_publish@master'
with:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
DOCKERHUB_ORGANISATION: ${{ secrets.DOCKERHUB_ORGANISATION }}
K8S_NAMESPACE: smarttrader-deriv-app-production
KUBE_SERVER: ${{ secrets.KUBE_SERVER }}
SERVICEACCOUNT_TOKEN: ${{ secrets.SERVICEACCOUNT_TOKEN }}
CA_CRT: ${{ secrets.CA_CRT }}
APP_VERSION: latest
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_API_TOKEN }}
ENVIRONMENT: Production
VERCEL_SCOPE: deriv
ALIAS_DOMAIN_URL: 'smarttrader-dr.binary.sx'
- name: Send Slack Notification on Docker Publish and Kubernetes Deployment Failure
if: ${{ steps.build_and_push_docker_image.outcome != 'success' }}
if: ${{ steps.deploy_vercel.outcome != 'success' }}
uses: "deriv-com/shared-actions/.github/actions/send_slack_notification@master"
with:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MESSAGE: "$RELEASE_TYPE Docker Publish and Kubernetes Deployment for smarttrader.deriv.com with version ${{ needs.build_and_test.outputs.RELEASE_VERSION }} has Failed"
MESSAGE: "$RELEASE_TYPE Vercel Deployment for smarttrader.deriv.com with version ${{ needs.build_and_test.outputs.RELEASE_VERSION }} has Failed"
notify_on_slack:
name: Notify on Slack
if: always()
Expand Down
18 changes: 8 additions & 10 deletions .github/workflows/release_staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,12 @@ jobs:
with:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- name: Build Docker image and push to Docker hub and K8S
uses: "./.github/actions/build_and_push_docker_image"
- name: Upload to vercel
uses: 'deriv-com/shared-actions/.github/actions/vercel_DR_publish@master'
with:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
DOCKERHUB_ORGANISATION: ${{ secrets.DOCKERHUB_ORGANISATION }}
K8S_NAMESPACE: smarttrader-deriv-app-staging
KUBE_SERVER: ${{ secrets.KUBE_SERVER }}
SERVICEACCOUNT_TOKEN: ${{ secrets.SERVICEACCOUNT_TOKEN }}
CA_CRT: ${{ secrets.CA_CRT }}
APP_VERSION: latest-staging
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_API_TOKEN }}
ENVIRONMENT: Preview
VERCEL_SCOPE: deriv
ALIAS_DOMAIN_URL: 'staging-smarttrader-dr.binary.sx'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ scripts/CNAME
.DS_Store
*.swp
npm-debug.log
.vercel
3 changes: 0 additions & 3 deletions Dockerfile

This file was deleted.

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,9 @@ git push origin staging_v20191010_0
## Manage translations

To add translation manually use [manual translation doc](scripts/README.md#Updating-the-translations)

## Disaster Recovery

Each release, whether to staging or production is backed up and deployed to Vercel

You may see the current production and staging deployed into: https://staging-smarttrader-dr.binary.sx and https://smarttrader-dr.binary.sx
5 changes: 5 additions & 0 deletions vercel.dr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cleanUrls": true,
"outputDirectory": "dist",
"buildCommand": "echo ✅ Skipping build to use existing built files"
}
3 changes: 3 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cleanUrls": true
}

0 comments on commit e9f088d

Please sign in to comment.