Skip to content

Commit

Permalink
chore(release): implements a workflow to deploy to k8s
Browse files Browse the repository at this point in the history
  • Loading branch information
ygrishajev committed Feb 25, 2025
1 parent a19e242 commit db0fbf7
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 0 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/deploy-k8s.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Deploy Kubernetes

on:
workflow_dispatch:
inputs:
environment:
description: "The environment to deploy to"
required: true
type: choice
options:
- staging
- production
app:
description: "The app to deploy"
required: true
type: choice
options:
- console-web
- console-api
- provider-proxy
appVersion:
description: "The version of the app to deploy"
required: true
type: string
chain:
description: "The chain to deploy to"
required: false
type: choice
options:
- mainnet
- sandbox
workflow_call:
inputs:
environment:
description: "The environment to deploy to"
required: true
type: string
app:
description: "The app to deploy"
required: true
type: string
appVersion:
description: "The version of the app to deploy"
required: true
type: string
chain:
description: "The chain to deploy to"
required: false
type: string

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Load kubeconfig
id: op-load-secret
uses: 1password/load-secrets-action@v2
with:
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
KUBECONFIG: op://console/console.akash.network/kubeconfig

- name: Set up Helm
uses: azure/setup-helm@v4.3.0
with:
version: "latest"

- name: Deploy with Helm
run: |
echo "$KUBECONFIG" > kubeconfig
if [ -n "${{ inputs.chain }}" ]; then
valuesFileArg="--values .helm/${{ inputs.app }}-values-${{ inputs.chain }}.yaml"
fi
chart_name=akash/${{ inputs.app }}
release_name=${{ inputs.app }}
if [ -n "${{ inputs.chain }}" ]; then
release_name="${release_name}-${{ inputs.chain }}"
fi
helm repo add akash https://akash-network.github.io/helm-charts
echo "executing: helm upgrade $release_name $chart_name --install --atomic -n ${{ inputs.environment }} --set appVersion=${{ inputs.appVersion }} --debug --kubeconfig kubeconfig $valuesFileArg"
helm upgrade $release_name $chart_name --install --atomic -n ${{ inputs.environment }} --set appVersion=${{ inputs.appVersion }} --debug --kubeconfig kubeconfig $valuesFileArg
27 changes: 27 additions & 0 deletions .helm/console-api-values-mainnet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
chain: mainnet
hostName: console-api-mainnet-staging.akash.network
jobs:
- name: top-up-deployments
schedule: "0 * * * *" # 0 minutes past the hour
command:
- node
- dist/console.js
- top-up-deployments
- name: refill-wallets
schedule: "45 * * * *" # 45 minutes past the hour
command:
- node
- dist/console.js
- refill-wallets
- name: cleanup-stale-deployments
schedule: "30 10 * * 2" # 10:30 AM every Tuesday
command:
- node
- dist/console.js
- cleanup-stale-deployments
- name: cleanup-stale-anonymous-users
schedule: "0 9 * * 1" # 9:00 AM every Monday
command:
- node
- dist/console.js
- cleanup-stale-anonymous-users
2 changes: 2 additions & 0 deletions .helm/console-api-values-sandbox.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
chain: sandbox
hostName: console-api-sandbox-staging.akash.network

0 comments on commit db0fbf7

Please sign in to comment.