> For the complete documentation index, see [llms.txt](https://doc.wearepatchworks.com/product-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.wearepatchworks.com/product-documentation/developer-hub/self-hosting.md).

# Self-hosting

Run Patchworks inside your own Kubernetes environment with an installer-led deployment that configures the platform, generates the required Helm values and deploys the supporting infrastructure for you.

***

{% file src="/files/Dck2nXQnRU0xJbN8XmZt" %}

### Self-hosting at a glance

<table data-header-hidden data-search="false"><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>Deployment model</strong></td><td>Kubernetes + Helm</td></tr><tr><td><strong>Setup experience</strong></td><td>Guided Patchworks self-hosting installer</td></tr><tr><td><strong>Ingress</strong></td><td>Use your cluster ingress, or install Contour during setup</td></tr><tr><td><strong>Core infrastructure</strong></td><td>Database, Elasticsearch , RabbitMQ and S3</td></tr><tr><td><strong>Application deployment</strong></td><td>Patchworks application components, workers, migrations and seed data</td></tr><tr><td><strong>Configuration output</strong></td><td>Generated Helm values file</td></tr><tr><td><strong>DNS</strong></td><td>Point your chosen hostname at the ingress address if external DNS is not already configured</td></tr><tr><td><strong>Demo deployment time</strong></td><td>Approximately 10 - 15 minutes in the DigitalOcean walkthrough, including ingress installation</td></tr></tbody></table>

{% hint style="info" %}
The walkthrough used a fresh DigitalOcean Kubernetes cluster. The self-hosting flow shown below starts once the Kubernetes cluster and local context are available.
{% endhint %}

***

### Before you start

Have the following available before running the installer:

* A Kubernetes cluster
* A working kubeconfig/context for the target cluster
* A hostname you want to use for Patchworks
* DNS access if your cluster does not manage DNS automatically
* Patchworks image pull credentials
* A valid Patchworks self-hosting licence
* The email address for the initial administrator

***

### What the installer does

The self-hosting installer removes most of the manual Kubernetes setup from the deployment process. Once connected to the correct cluster context, it guides you through the information Patchworks needs and then performs the Helm deployment.

During setup you can configure:

* The Kubernetes namespace for Patchworks
* The hostname used to access the platform over HTTPS
* Dashboard and path routing
* Deployment mode and worker count
* Image pull credentials
* Ingress configuration
* Cookie/session domain
* Your Patchworks self-hosting licence
* The initial company and administrator account

The installer then generates the Helm values used for the deployment.

***

### How the deployment works

#### 1. Connect to your Kubernetes cluster

Create or select the target Kubernetes cluster, download its configuration and make that context available locally. The installer inspects the active cluster before continuing.

If an ingress controller is not already present, the walkthrough shows Contour being installed directly through the self-hosting installer.

#### 2. Configure Patchworks

Run through the guided installer and provide the deployment settings for your environment, including hostname, routing, deployment mode, worker count, image pull credentials, licence and the initial administrator account.

Once configuration is complete, the installer generates the values file that will be used by the Patchworks Helm charts.

#### 3. Install the infrastructure

The first deployment phase installs the supporting components required by Patchworks, including:

* Database
* Elasticsearch
* RabbitMQ

The installer waits for the infrastructure to become ready before progressing to the application deployment.

#### 4. Deploy Patchworks

The second phase deploys the Patchworks application components and completes the required database migrations and seeders.

The walkthrough completes the full process in around five minutes, including the initial ingress controller installation. Actual deployment time will depend on the cluster and environment.

#### 5. Configure DNS and verify the deployment

When installation is complete, check the ingress address. If external DNS is not already configured in the cluster, create the required DNS record for the hostname selected during setup.

Navigate to the generated Patchworks URL and sign in using the initial administrator credentials. If the password was left blank during setup, the installer generates one automatically.

***

### What happens behind the scenes

The installation is deliberately split into two stages:

**Infrastructure**\
The installer prepares the services Patchworks depends on - including the database, Elasticsearch and RabbitMQ - and waits for them to become ready.

**Application**\
Patchworks application components are deployed through Helm, followed by database migrations and seeders required to initialise the environment.

This staged approach makes the progress of the deployment easy to follow and gives operators a clear view of which part of the installation is currently running.

***
