1. Deploy the hoppscotch helm chart on Azure Kubernetes Service (AKS)

    TypeScript

    To deploy the Hoppscotch Helm chart on Azure Kubernetes Service (AKS), you will need to perform the following steps:

    1. Set up an AKS cluster: You'll first need a running AKS cluster. If you don't have one, you'll create it through Pulumi.
    2. Install Helm and Tiller: Helm is a package manager for Kubernetes, which simplifies deployment of applications. Tiller is the server-side component of Helm, which applies Helm package deployments onto your Kubernetes cluster.
    3. Deploy the Hoppscotch Helm chart: Once you have the cluster and Helm is set up, you'll use Helm to deploy Hoppscotch.

    I will guide you through how to create an AKS cluster and how to deploy a Helm chart using Pulumi and TypeScript. You'll also see comments within the code explaining each step. This program assumes that you already have Pulumi CLI and Azure command-line tool (Azure CLI) installed and configured with appropriate credentials.

    Let's start by installing the Pulumi packages required:

    npm install @pulumi/azure-native @pulumi/kubernetes

    Next, here's a program that creates an AKS cluster and deploys the Hoppscotch Helm chart on it:

    import * as pulumi from "@pulumi/pulumi"; import * as azure_native from "@pulumi/azure-native"; import * as k8s from "@pulumi/kubernetes"; // Define the required configuration for the AKS cluster const config = new pulumi.Config(); const nodeCount = config.getNumber("nodeCount") || 2; const nodeSize = config.get("nodeSize") || "Standard_D2_v2"; const password = config.requireSecret("password"); // Remember to set this in pulumi config const location = config.get("location") || "EastUS"; // Create a resource group for the AKS cluster const resourceGroup = new azure_native.resources.ResourceGroup("rg", { location }); // Create an AD service principal for the AKS cluster const adApp = new azure_native.graphrbac.Application("app", { displayName: "app", }); const adSp = new azure_native.graphrbac.ServicePrincipal("serviceprincipal", { appId: adApp.applicationId, }); const adSpPassword = new azure_native.graphrbac.ServicePrincipalPassword("serviceprincipalpassword", { endDate: "2025-01-01T00:00:00Z", servicePrincipalId: adSp.id, value: password, }); // Create the AKS cluster const cluster = new azure_native.containerservice.ManagedCluster("cluster", { resourceGroupName: resourceGroup.name, agentPoolProfiles: [{ count: nodeCount, vmSize: nodeSize, name: "agentpool", mode: "System", }], dnsPrefix: pulumi.interpolate`${resourceGroup.name}-kube`, linuxProfile: { adminUsername: "azureuser", ssh: { publicKeys: [{ keyData: config.require("sshPublicKey"), // Remember to set this in the pulumi config }], }, }, servicePrincipalProfile: { clientId: adApp.applicationId, secret: adSpPassword.value, }, location: resourceGroup.location, }); // Export the kubeconfig export const kubeconfig = pulumi.all([cluster.name, resourceGroup.name]).apply(([clusterName, rgName]) => azure_native.containerservice.listManagedClusterUserCredentials({ resourceGroupName: rgName, resourceName: clusterName, }).then(creds => { const encoded = creds.kubeconfigs[0].value; if (encoded === undefined) { throw new Error("Kubeconfig was undefined"); } return Buffer.from(encoded, 'base64').toString('utf8'); })); // Create a k8s provider using the kubeconfig const k8sProvider = new k8s.Provider("k8sprovider", { kubeconfig: kubeconfig, }); // Deploy the Hoppscotch Helm chart using the k8s provider const chart = new k8s.helm.v3.Chart("hoppscotch", { chart: "hoppscotch", version: "0.1.0", // Use the correct Hoppscotch chart version fetchOpts: { repo: "https://charts.hoppscotch.io/", // Official Hoppscotch Helm chart repository }, }, { provider: k8sProvider }); // Export the public IP to access Hoppscotch export const hoppscotchPublicIP = chart.getResourceProperty("v1/Service", "hoppscotch/hoppscotch", "status") .apply(status => status.loadBalancer.ingress[0].ip);

    This Pulumi program completes the following:

    • Creates a new resource group for the AKS cluster within the desired location.
    • Sets up an AD application and service principal that the AKS cluster will use for interactions with other Azure services.
    • Defines the Managed Cluster, including the number and size of VMs, the admin username, and SSH public key for secure access. Make sure to specify your SSH public key in Pulumi's configuration.
    • Exports the kubeconfig for the created AKS cluster which is required for kubectl and Pulumi to interact with the Kubernetes cluster.
    • Initializes the Kubernetes provider with the exported kubeconfig.
    • Deploys the Hoppscotch Helm chart to the AKS cluster with a specified version and the official Hoppscotch Helm repository.

    After you've written this program in a file (such as index.ts), you can simply deploy it using Pulumi CLI. Remember to set the required configuration values (password and sshPublicKey) in your Pulumi project using pulumi config.

    This will provision the infrastructure and services on Azure and return the public IP address of the deployed Hoppscotch application, which you'll then be able to use in any web browser to access Hoppscotch.