Skip to content

Deploy CTF services on Azure Kubernetes Service #18

Deploy CTF services on Azure Kubernetes Service

Deploy CTF services on Azure Kubernetes Service #18

Workflow file for this run

name: Deploy CTF services on Azure Kubernetes Service
on:
workflow_dispatch:
inputs:
ENVIRONMENT:
default: ctf
description: The name of the GitHub environment to use (https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#about-environments)
type: environment
workflow_call:
inputs:
ENVIRONMENT:
default: ctf
description: The name of the GitHub environment to use (https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#about-environments)
type: string
secrets:
AZURE_CLIENT_ID:
required: true
AZURE_TENANT_ID:
required: true
AZURE_SUBSCRIPTION_ID:
required: true
permissions:
id-token: write # Required for requesting the JWT
contents: read
jobs:
deploy:
name: Deploy CTF services
runs-on: ubuntu-latest
environment: ${{ inputs.ENVIRONMENT }}
env:
AZURE_RESOURCE_GROUP: ${{ vars.AZURE_RESOURCE_GROUP }}
AZURE_DNS_NAME: ${{ vars.AZURE_DNS_NAME }}
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
CLUSTER_NAME: ${{ vars.CLUSTER_NAME }}
NODE_COUNT: ${{ vars.NODE_COUNT }}
KEY_VAULT_NAME: ${{ vars.KEY_VAULT_NAME }}
MANAGE_RG: ${{ vars.MANAGE_RG }}
PURGE_RG: ${{ vars.PURGE_RG }}
MANAGE_CLUSTER: ${{ vars.MANAGE_CLUSTER }}
MANAGE_KEYVAULT: ${{ vars.MANAGE_KEYVAULT }}
PURGE_KEYVAULT: ${{ vars.PURGE_KEYVAULT }}
steps:
- name: Run az login
uses: azure/login@v1
with:
client-id: ${{ vars.AZURE_CLIENT_ID }}
tenant-id: ${{ vars.AZURE_TENANT_ID }}
subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
- name: Checkout
uses: actions/checkout@v4
- name: Install kubectl
uses: azure/setup-kubectl@v3
with:
version: 'v1.29.1'
- name: Install helm
uses: azure/setup-helm@v3
with:
version: 'v3.14.0'
- name: Install go
uses: actions/setup-go@v5
- name: Install envsubst
run: |
go install github.com/a8m/envsubst/cmd/[email protected]
- name: Create the Kubernetes cluster in AKS
env:
AZURE_RESOURCE_GROUP: ${{ vars.AZURE_RESOURCE_GROUP }}
AZURE_DNS_NAME: ${{ vars.AZURE_DNS_NAME }}
run: |
./manage-azure-deployment.sh new
- name: Deploy the CTF services
env:
CTF_KEY: ${{ secrets.CTF_KEY }}
COOKIE_SECRET: ${{ secrets.COOKIE_SECRET }}
CTFD_SECRET_KEY: ${{ secrets.CTFD_SECRET_KEY }}
JUICE_FQDN: ${{ vars.JUICE_FQDN }}
TLS_CERT_EMAIL: ${{ vars.TLS_CERT_EMAIL }}
BALANCER_REPLICAS: ${{ vars.BALANCER_REPLICAS }}
MAX_INSTANCES: ${{ vars.MAX_INSTANCES }}
METRICS_USER: ${{ vars.METRICS_USER }}
GRACE_PERIOD: ${{ vars.GRACE_PERIOD }}
MANAGE_MONITORING: ${{ vars.MANAGE_MONITORING }}
MANAGE_CTFD: ${{ vars.MANAGE_CTFD }}
METRICS_PASS: ${{ secrets.METRICS_PASS }}
GRAFANA_PASS: ${{ secrets.GRAFANA_PASS }}
CTFD_REDIS_PASS: ${{ secrets.CTFD_REDIS_PASS }}
CTFD_MYSQL_ROOT_PASS: ${{ secrets.CTFD_MYSQL_ROOT_PASS }}
CTFD_MYSQL_PASS: ${{ secrets.CTFD_MYSQL_PASS }}
CTFD_MYSQL_REPL_PASS: ${{ secrets.CTFD_MYSQL_REPL_PASS }}
run: |
./manage-multijuicer.sh up