Deploy the mautrix-syncproxy helm chart on Rancher
TypeScriptTo deploy the
mautrix-syncproxy
Helm chart on Rancher, you would typically need to perform a few steps. First, Rancher needs to be up and running, and you need to havekubectl
access to the underlying Kubernetes cluster where you are deploying the Helm chart. It's also important to have Helm installed and configured properly.However, for the purpose of this Pulumi program, we'll focus on deploying a Helm chart to a Kubernetes cluster managed by Rancher using Pulumi's
rancher2
provider.Here's what you need to do:
- Set up Pulumi with Rancher2 by installing the package and configuring it to connect to your Rancher instance.
- Create a new
CatalogV2
resource that points to the location of themautrix-syncproxy
Helm chart. This will ensure that the Helm chart is available for deployment within Rancher. - Use a
HelmChart
resource to deploy the chart from the catalog.
Here's a basic TypeScript program that you can use as a starting point:
import * as pulumi from '@pulumi/pulumi'; import * as rancher2 from '@pulumi/rancher2'; // Create a new catalog in Rancher that points to the Helm chart repository const catalog = new rancher2.CatalogV2('mautrix-syncproxy-catalog', { clusterId: '<RANCHER_CLUSTER_ID>', // Replace with your actual Rancher Cluster ID url: 'https://mau.dev/mautrix/syncproxy', // Replace with the actual Helm chart repository URL gitBranch: 'main', }); // Deploy the mautrix-syncproxy Helm chart using the catalog const mautrixSyncproxyChart = new rancher2.HelmChart('mautrix-syncproxy-chart', { // The chart's name and version, acquired from the chart repository chartName: 'mautrix-syncproxy', chartVersion: '<CHART_VERSION>', // Specify the chart version you want to deploy projectName: '<RANCHER_PROJECT_ID>', // Replace with your Rancher Project ID values: { // The values to pass to the Helm chart key: 'value', // Replace with actual key-value pairs required by the mautrix-syncproxy Helm chart }, }, { dependsOn: [catalog] }); // Ensure the Helm chart is deployed after the catalog is created // Export the name of the cluster export const clusterName = pulumi.output('<RANCHER_CLUSTER_NAME>'); // Replace with your Rancher Cluster Name
Please ensure you replace the placeholders (e.g.,
<RANCHER_CLUSTER_ID>
,<RANCHER_PROJECT_ID>
,<CHART_VERSION>
,<RANCHER_CLUSTER_NAME>
, and any values required by the Helm chart) with actual values appropriate for your Rancher setup and the mautrix-syncproxy Helm chart.This code does the following:
- It imports the Pulumi SDK and the Rancher2 package.
- A new catalog resource named
mautrix-syncproxy-catalog
is created, which points to the Helm chart repository for mautrix-syncproxy. - A HelmChart resource named
mautrix-syncproxy-chart
is then deployed, which makes sure to pull the chart from the catalog we just added. - The
values
hash should be filled with any custom values that the mautrix-syncproxy chart needs to function correctly. - There is a dependency specified, ensuring that Pulumi only attempts to deploy the Helm chart after it has finished setting up the catalog.
The
dependsOn
option is passed to theHelmChart
resource to ensure the catalog is created before deploying the Helm chart. TheprojectName
parameter should correspond to the ID of a Rancher project under which you want to deploy the mautrix-syncproxy.Finally, an output is exported to provide the name of the cluster. This output can be seen in the Pulumi CLI after deployment and might be useful if you are composing your infrastructure across multiple Pulumi programs.