Skip to content

Commit

Permalink
Adding support for Prod Deployment (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shwetabhk authored Nov 14, 2022
1 parent 843a6fb commit cba9346
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/production_deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy to Production

on:
release:
types: [created]

jobs:
production_deploy:
runs-on: ubuntu-latest
environment: Production
steps:
- uses: actions/checkout@v2
- uses: satackey/[email protected]
continue-on-error: true
- name: push to dockerhub
uses: fylein/docker-release-action@master
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
IMAGE_NAME: fyle_xero-api
- name: Deploy to Production
uses: fylein/aws-eks-deploy-action@master
env:
EKS_CLUSTER_NAME: ${{ secrets.EKS_CLUSTER_NAME }}
AWS_REGION: ${{ secrets.AWS_REGION }}
LOCAL_HOST: ${{ secrets.LOCAL_HOST }}
LOCAL_PORT: ${{ secrets.LOCAL_PORT }}
REMOTE_PORT: ${{ secrets.REMOTE_PORT }}
EKS_KUBECTL_ROLE: ${{ secrets.EKS_KUBECTL_ROLE }}
ROLE_SESSION_NAME: ${{ secrets.ROLE_SESSION_NAME }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
KUBERNETES_MANIFEST_FILE_PATH: deployment/production/controller.yml
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: ${{ job.status }}
SLACK_MESSAGE: Production Deploy Status - ${{ job.status }}
SLACK_TITLE: Deploy Xero API to Production
SLACK_ICON_EMOJI: ":pepeok:"
SLACK_USERNAME: QBO_API
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_FOOTER: ''
File renamed without changes.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ __pycache__/

# Test files
test.py
debugger

# Cache
demo_cache.sqlite
Expand Down
94 changes: 94 additions & 0 deletions deployment/production/controller.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
apiVersion: v1
kind: Service
metadata:
name: xero-api
namespace: integrations
labels:
app: xero-api
spec:
ports:
- port: 8000
selector:
app: xero-api
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: xero-api
namespace: integrations
labels:
app: xero-api
spec:
replicas: 1
selector:
matchLabels:
app: xero-api
strategy:
type: RollingUpdate
template:
metadata:
labels:
app: xero-api
spec:
containers:
- name: xero-api
image: docker.io/{{DOCKERHUB_USERNAME}}/fyle_xero-api:{{RELEASE_VERSION}}
resources:
limits:
memory: 300Mi
requests:
memory: 300Mi
env:
- name: GET_HOSTS_FROM
value: dns
ports:
- containerPort: 8000
readinessProbe:
httpGet:
path: /api/workspaces/ready/
port: 8000
initialDelaySeconds: 10
timeoutSeconds: 1
envFrom:
- secretRef:
name: xero-api-secrets
imagePullSecrets:
- name: myregistrykey2
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: xero-api-qcluster
namespace: integrations
labels:
app: xero-api-qcluster
spec:
replicas: 1
selector:
matchLabels:
app: xero-api-qcluster
strategy:
type: RollingUpdate
template:
metadata:
labels:
app: xero-api-qcluster
spec:
containers:
- name: xero-api
image: docker.io/{{DOCKERHUB_USERNAME}}/fyle_xero-api:{{RELEASE_VERSION}}
command: ['/bin/bash', 'start_qcluster.sh']
resources:
limits:
memory: 650Mi
requests:
memory: 650Mi
env:
- name: GET_HOSTS_FROM
value: dns
envFrom:
- secretRef:
name: xero-api-secrets
imagePullSecrets:
- name: myregistrykey2

0 comments on commit cba9346

Please sign in to comment.