Skip to content

Commit

Permalink
working
Browse files Browse the repository at this point in the history
  • Loading branch information
deal-machine committed Mar 16, 2024
1 parent ac6b334 commit d15d550
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 65 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/apply.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Apply

on: [push, workflow_dispatch]

jobs:
apply:
runs-on: ubuntu-latest
env:
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CRED }}

steps:
- name: Checkout Repo
uses: actions/checkout@v2

- name: Auth GCloud
uses: 'google-github-actions/[email protected]'
with:
credentials_json: ${{ secrets.GOOGLE_CRED }}
export_environment_variables: true
create_credentials_file: true

- name: Set up Cloud SDK
uses: 'google-github-actions/setup-gcloud@v2'

- name: Use gcloud CLI
run: gcloud container clusters list

- name: Setup Cluster Kubernetes
uses: 'google-github-actions/get-gke-credentials@v2'
with:
cluster_name: ${{ vars.CLUSTER }}
location: ${{ vars.ZONE }}

- name: Setup Namespace
run: kubectl config set-context --current --namespace=orderly

- name: apply api
run: kubectl apply -f k8s/
53 changes: 0 additions & 53 deletions .github/workflows/deploy-app.yml

This file was deleted.

38 changes: 38 additions & 0 deletions .github/workflows/destroy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Destroy

on: [workflow_dispatch]

jobs:
destroy:
runs-on: ubuntu-latest
env:
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CRED }}

steps:
- name: Checkout Repo
uses: actions/checkout@v2

- name: Auth GCloud
uses: 'google-github-actions/[email protected]'
with:
credentials_json: ${{ secrets.GOOGLE_CRED }}
export_environment_variables: true
create_credentials_file: true

- name: Setup Cloud SDK
uses: 'google-github-actions/setup-gcloud@v2'

- name: Setup Cluster Kubernetes
uses: 'google-github-actions/get-gke-credentials@v2'
with:
cluster_name: ${{ vars.CLUSTER }}
location: ${{ vars.ZONE }}

- name: Setup Namespace
run: kubectl config set-context --current --namespace=orderly

- name: delete api
run: kubectl delete -f k8s/



8 changes: 4 additions & 4 deletions k8s/api-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ metadata:
data:
PORT: "3000"
NODE_ENV: "production"
DB_HOST: "${{ env.DB_HOST }}" # db-service
DB_USERNAME: "${{ env.DB_USERNAME }}" # postgres
DB_HOST: db-service
DB_USERNAME: "postgres"
DB_PORT: "5432"
DB_PASSWORD: "${{ env.DB_PASSWORD }}" # postgres
DB_NAME: "${{ env.DB_NAME }}" # postgres
DB_PASSWORD: "postgres"
DB_NAME: postgres
DB_DIALECT: postgres
CACHE_HOST: cache-service
CACHE_PORT: "6379"
Expand Down
7 changes: 0 additions & 7 deletions k8s/api-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ spec:
- name: api-container
image: dealmachine/orderly:5
workingDir: /usr/api
resources:
requests:
memory: "500Mi"
cpu: 1
limits:
memory: "500Mi"
cpu: 1
ports:
- containerPort: 3000
envFrom:
Expand Down
2 changes: 1 addition & 1 deletion k8s/api-hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ spec:
name: cpu
target:
type: Utilization
averageUtilization: 70
averageUtilization: 90

0 comments on commit d15d550

Please sign in to comment.