# Build Settings

## Introduction

From the **Build Settings** screen you can edit various aspects related to the image builder, such as the **infrastructure** on which the builder should run, its **cluster**, allocated **resources** and **registries** where application images should be stored.

**Build Settings** can be accessed in two ways:

* From the **Project Settings** screen. In this case, Build Settings will be automatically copied into all new environments within the project.
* From the **Environment Settings** screen. In this case, Build Settings will be available only for the current environment.

{% tabs %}
{% tab title="ACCESS THE PROJECT BUILD SETTINGS" %}
1\. Click on the project name in the upper-right corner of the Bunnyshell interface.

2\. Select **View all projects**.

3\. Click the <img src="https://1816776994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlP4CN7wxbqd_3NdM99%2Fuploads%2FzJhu9ZnwAEIrHzs149FM%2Fsettings.png?alt=media&#x26;token=92c48c2e-2474-46da-b7a7-8d2ff81a88a3" alt="" data-size="line"> **Settings** button of the project where you want to edit the settings.

4\. From the left side menu, select **Build Settings**.

![](https://1816776994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlP4CN7wxbqd_3NdM99%2Fuploads%2FLcw7gyx4pkwTkgK943ze%2FBuild%20Settings%20screen.png?alt=media\&token=5830d35a-f765-423a-b221-40f56befeb1b)
{% endtab %}

{% tab title="ACCESS THE ENVIRONMENT BUILD SETTINGS" %}
1\. Click on the project name in the upper-right corner of the Bunnyshell interface.

2\. Select **View all projects**.

3\. Select the environment where you want to make the modifications.

4\. Click the <img src="https://1816776994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlP4CN7wxbqd_3NdM99%2Fuploads%2FzJhu9ZnwAEIrHzs149FM%2Fsettings.png?alt=media&#x26;token=92c48c2e-2474-46da-b7a7-8d2ff81a88a3" alt="" data-size="line"> **Settings** button.

5\. From the left side menu, select **Build Settings**.

![](https://1816776994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlP4CN7wxbqd_3NdM99%2Fuploads%2FASop7ycGAOU1vR8X872h%2Fenvironment%20build%20settings.png?alt=media\&token=e745d626-d031-414f-b352-486b4b704d05)
{% endtab %}
{% endtabs %}

## Build Settings

### Builder Infrastructure

Choose where the Image Builder will run.

* **Managed Builder**: Run the Image Builder in a cluster managed by Bunnyshell. This involves less configuration, but it comes with less resources.

{% hint style="info" %}
The default resources are 2 CPUs and 6GB of RAM.
{% endhint %}

* **Self-Hosted Builder**: Run the Image Builder on one of clusters. This allows you to allocate as many resources as you want. However, you will have to configure your Builder Cluster.
* **Project Build Settings** (*only available at the environment level*): Use the Build Settings available at the project level.

### Select Builder Cluster

{% hint style="info" %}
*Only available if you opted for a Self-Hosted Builder.*&#x20;
{% endhint %}

To connect a Builder Cluster to Bunnyshell, you need to **create a StorageClass in Kubernetes** with the name **bns-builder-sc**. We use this policy to make sure of the following:

* The `reclaimPolicy` property is set to `delete`;
* **Auto-provisioning of volumes** is **enabled** - Private Volume (**PV**) from Private Volume Claim (**PVC**).

{% hint style="info" %}
By default, the build commands are executed in the current working directory. Bunnyshell considers the working directory to be the one where the docker-compose file is located.
{% endhint %}

#### Creating a Storage Class

To create a class you can use **kubectl** and follow the instructions below:

1\. Create a `spec.yaml` file with the following contents

```
apiVersion: storage.k8s.io/v1
metadata:
  name: bns-builder-sc
provisioner: <<varies according to provider>>
reclaimPolicy: Delete
allowVolumeExpansion: true
volumeBindingMode: Immediate
```

2\. Establish a connection with your cluster.

3\. Perform the operation below:

`kubectl apply -f spec.yaml`

{% hint style="info" %}
To make sure the operation was successful, perform the following operation:

`kubectl describe storageclass bns-builder-sc`
{% endhint %}

Alternatively, you can follow these instructions to create the storage class:

<details>

<summary>Private Kubernetes Cluster</summary>

Define the StorageClass using the content below:

```
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: bns-builder-sc
provisioner: <<varies according to provider>>
reclaimPolicy: Delete
allowVolumeExpansion: true
volumeBindingMode: Immediate
```

You can find additional information regarding Storage Classes on the [official Kubernetes documentation platform](https://kubernetes.io/docs/concepts/storage/storage-classes/).

</details>

<details>

<summary>Microsoft Azure</summary>

Define the StorageClass using the content below:

```
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: bns-builder-sc
provisioner: disk.csi.azure.com
reclaimPolicy: Delete
allowVolumeExpansion: true
volumeBindingMode: Immediate
```

Additional information regarding StorageClasses is available on the [Azure docs website](https://docs.microsoft.com/en-us/azure/aks/concepts-storage#storage-classes).

</details>

<details>

<summary>Amazon Web Services</summary>

Define the StorageClass using the content below:

```
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: bns-builder-sc
provisioner: kubernetes.io/aws-ebs
reclaimPolicy: Delete
allowVolumeExpansion: true
```

Read more about StorageClasses on the AWS documentation website[ here](https://docs.aws.amazon.com/eks/latest/userguide/storage-classes.html).

</details>

<details>

<summary>Google Cloud Platform</summary>

Define the StorageClass using the content below:

```
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: bns-builder-sc
provisioner: kubernetes.io/gce-pd
reclaimPolicy: Delete
allowVolumeExpansion: true
```

You can find out more about Storage Classes on the [Google Cloud documentation website](https://cloud.google.com/kubernetes-engine/docs/concepts/persistent-volumes#storageclasses).

</details>

<details>

<summary>DigitalOcean</summary>

To add a Storage Class in DigitalOcean, follow the steps detailed below:

1\. Log in to your DigitalOcean account and select a cluster.

2\. Click **Kubernetes Dashboard**.

3\. On the left side menu, scroll to the **Config and Storage** category and click **Storage Classes**.

4\. Click the **Create new resource** <img src="https://1816776994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MlP4CN7wxbqd_3NdM99%2Fuploads%2F3GanWzuc8qrfmTEnjPrA%2FDigitalOcean%20Add%20Cluster.png?alt=media&#x26;token=6dcee957-78dd-4bda-be4a-c24a33a077e4" alt="" data-size="line"> button in the upper-right corner of the main interface.

5\. Input the content below, then click **Upload**.

```
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: bns-builder-sc
provisioner: dobs.csi.digitalocean.com
reclaimPolicy: Delete
allowVolumeExpansion: true
volumeBindingMode: Immediate
```

</details>

### Builder Resources

{% hint style="info" %}
*Only available if you opted for a Self-Hosted Builder.*
{% endhint %}

Choose what resources will be allocated to your Builder Cluster. You can edit **the number of CPUs** and **the amount of RAM**.

{% embed url="<https://documentation.bunnyshell.com/using-bunnyshell/build-settings/resource-allocation-recommendations>" %}

### Container Registry

Select the container registry where your application images will be stored. Choose between one of your personal registries or the standard Bunnyshell registry.
