Deploy the supabase helm chart on Azure Managed Openshift Service
TypeScriptTo deploy the Supabase Helm chart on Azure Managed Openshift Service using Pulumi, you will go through several steps, including setting up an Azure Managed OpenShift Cluster and then deploying the Helm chart to it. Here’s a breakdown of the process:
-
Set up an Azure Managed OpenShift Cluster: You'll use the
azure-native.containerservice.OpenShiftManagedCluster
Pulumi resource to create an Azure Managed OpenShift cluster. This will create the necessary infrastructure on the cloud to run your applications. -
Deploy Supabase Helm Chart on the Cluster: Once the cluster is set up and configured, you can deploy applications onto it. You will use the
kubernetes.helm.sh/v3.Chart
resource to deploy the Supabase Helm chart to your OpenShift cluster.
Below is a Pulumi program written in TypeScript that illustrates how to set up the Azure Managed OpenShift Service and deploy the Supabase Helm chart.
Firstly, ensure you have the Pulumi CLI installed and are logged in. Next, create a new directory, initialize a Pulumi project with
pulumi new azure-typescript
, and then replace the contents ofindex.ts
with the following code:import * as azureNative from "@pulumi/azure-native"; import * as k8s from "@pulumi/kubernetes"; // TypeScript program to deploy Supabase on Azure Managed OpenShift Service const projectName = "azure-openshift-supabase"; // Set up an Azure Managed OpenShift Cluster const resourceGroupName = new azureNative.resources.ResourceGroup(`${projectName}-rg`); const openShiftCluster = new azureNative.containerservice.OpenShiftManagedCluster(`${projectName}-cluster`, { resourceGroupName: resourceGroupName.name, location: resourceGroupName.location, openShiftVersion: "3.11", // Specify your desired OpenShift version networkProfile: { vnetCidr: "10.0.0.0/8", }, masterPoolProfile: { name: "master", count: 3, vmSize: "Standard_D4s_v3", }, agentPoolProfiles: [{ name: "agentpool", count: 3, vmSize: "Standard_D4s_v3", role: "compute", }], // Set appropriate authentication details }); // Deploy Supabase Helm chart to the cluster // First, we need to set up a provider to communicate with the OpenShift cluster const creds = azureNative.containerservice.listOpenShiftManagedClusterUserCredentialsOutput({ resourceName: openShiftCluster.name, resourceGroupName: resourceGroupName.name, }); const kubeconfig = creds.kubeconfigs[0].value.apply(c => Buffer.from(c, 'base64').toString()); const openshiftProvider = new k8s.Provider("openshiftK8s", { kubeconfig: kubeconfig, }); // Now we use the provider to deploy the Supabase Helm chart const supabaseChart = new k8s.helm.v3.Chart("supabase", { chart: "supabase", version: "latest", // Replace with the specific version you need fetchOpts: { repo: "https://charts.supabase.io", // Supabase Helm chart repository }, }, { provider: openshiftProvider }); export const supabaseEndpoint = supabaseChart.getResourceProperty( "v1/Service", "supabase", "status");
Note:
- Update the
openShiftVersion
to the OpenShift version you wish to deploy. - You should specify authentication details (
servicePrincipalProfile
,networkProfile
, etc.) as per your organizational policy and for secure access to the cluster. - The
kubeconfig
is obtained programmatically from the OpenShift cluster's credentials. This config is then used to create a Kubernetes Provider in Pulumi which allows deployments to the cluster. - The
fetchOpts
should contain the repository URL where the Supabase Helm chart is located. - The endpoint for accessing Supabase once deployed is exported for your convenience.
Ensure to walk through the code, understand the resources being created, and make sure they align with your cloud resources and policies. After you have customized the code to your needs, you can run
pulumi up
to initiate the deployment process.You will be prompted to review the plan by Pulumi and on approval, Pulumi will proceed to provision the resources as defined. This process may take several minutes, depending on the cloud provider’s response times and the complexity of your infrastructure.
Once the deployment is successful, Pulumi will output the endpoint for Supabase as defined in the export statement. You can use this endpoint to start interacting with your Supabase instance.
-