# CacheR installation

## Prerequisites

* Working Stifler Setup with version 3.0 or newer
* Windows Server (2Pint used Windows Server Standard 2022)
* MS SQL (Express works for lab but not recommended for production)
* SQL Management Studio
* Webserver certificate

## Installation

<details>

<summary>Install SQL</summary>

{% hint style="warning" %}
If you already have an SQL Server instance in place, you can use it for CacheR, you don't need a new one.
{% endhint %}

Select custom and choose download folder.

<figure><img src="https://2767179248-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSdKKJqJhW8GvhMBmgTTJ%2Fuploads%2F2qR3GoNwn09eWJPTUIis%2FCacheR_SQL_setup_custom.png?alt=media&#x26;token=5dc4564e-93b4-4d03-89d2-9cc390d3adc8" alt=""><figcaption></figcaption></figure>

Select "New SQL server standalone installation"

<figure><img src="https://2767179248-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSdKKJqJhW8GvhMBmgTTJ%2Fuploads%2FOZjJP3OI8uRjLVzszUSB%2FCacheR_SQL_setup_new_SQL.png?alt=media&#x26;token=2d808edc-9dcb-4788-b844-b16fe7e16798" alt=""><figcaption></figcaption></figure>

Untick "Azure Extension for SQL Server"

<figure><img src="https://2767179248-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSdKKJqJhW8GvhMBmgTTJ%2Fuploads%2F86RfkHKT8JdZawgjwPyS%2FCacheR_SQL_setup_azure_extension.png?alt=media&#x26;token=437b5f8b-9fa5-4896-87da-8d5ba5ca4c78" alt=""><figcaption></figcaption></figure>

Unselect everything except “Database Engine Services” and select root directory

<figure><img src="https://2767179248-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSdKKJqJhW8GvhMBmgTTJ%2Fuploads%2F7glGWFoh497fCQdYuXET%2FCacheR_SQL_setup_database_engine_services.png?alt=media&#x26;token=4b742e7b-6f84-4f8b-94c9-34f78ea379f1" alt=""><figcaption></figcaption></figure>

Enable SQL Server Browser

<figure><img src="https://2767179248-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSdKKJqJhW8GvhMBmgTTJ%2Fuploads%2FmU67jbGsSCWHMuLi5kGn%2FCacheR_SQL_setup_sql_server_browser.png?alt=media&#x26;token=87de4bad-5cd7-4795-bd64-957b81320b95" alt=""><figcaption></figcaption></figure>

Verify collation

<figure><img src="https://2767179248-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSdKKJqJhW8GvhMBmgTTJ%2Fuploads%2FmImsozc1OjzVxVhHjVAJ%2FCacheR_SQL_setup_sql_verify_collation.png?alt=media&#x26;token=497ad942-7186-4cbb-825a-555e2803e31b" alt=""><figcaption></figcaption></figure>

Add Builtin\Administrators to SQL Admins

<figure><img src="https://2767179248-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSdKKJqJhW8GvhMBmgTTJ%2Fuploads%2FlMWkjNJ6Ob4lO1f75Ze1%2FCacheR_SQL_setup_SQL_Admins.png?alt=media&#x26;token=1f5df9d1-9d19-4dc6-ab3f-3c74fd07bba6" alt=""><figcaption></figcaption></figure>

Configure Data Directories

<figure><img src="https://2767179248-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSdKKJqJhW8GvhMBmgTTJ%2Fuploads%2Fp657cVGhPCXAx6gnYoKO%2FCacheR_SQL_setup_Data_directories.png?alt=media&#x26;token=9cef97c0-6b1f-4f7d-be4d-9873fd1dd824" alt=""><figcaption></figcaption></figure>

</details>

### Create SQL database and tables manually (optional)

As long as the account running the service has access to SQL and is allowed to create databases and tables it will be automatically created and this can be skipped. If not it needs to be created using the following process.

{% hint style="warning" %}
If you let the service create the database make sure that the account connecting with SQL Mgmt Studio is sysadm on the SQL service so the database can be accessed.
{% endhint %}

On the server, open SQL Management Studio (install if needed) and create a new Database called CacheR.\
If on a remote server, make sure to apply the correct security rights for the services. (Computer account if running as local system, or the service account used for the services)

### Install WebApi service

From an Elevated Command prompt launch **TwoPint.CacheR.WebApi.Installer64.msi**. You also can launch installation as it is – the installer will ask for elevation when needed.

At the "Welcome" screen, feel welcomed, and then click **Next**.

<figure><img src="https://2767179248-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSdKKJqJhW8GvhMBmgTTJ%2Fuploads%2F63QxUTQ8PBVNTSo0YBwK%2Fcacher_install_webapi_start.png?alt=media&#x26;token=b4791e18-3695-4ba8-b816-6de6d1540a75" alt=""><figcaption></figcaption></figure>

At the "End-User License Agreement" screen, once you have reviewed the EULA, check the box: \
**I accept the terms in the License Agreement**, and then click **Next**.

<figure><img src="https://2767179248-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSdKKJqJhW8GvhMBmgTTJ%2Fuploads%2FIX8G8B2c0LKEnHJnevGY%2Fcacher_install_webapi_EULA.png?alt=media&#x26;token=f0ec4d4c-2d0f-492b-9828-1a9091e7dc26" alt=""><figcaption></figcaption></figure>

At the "Destination Folder" screen, enter the path to the directory where the CacheR WebApi program files should be installed and then click **Next**.

<figure><img src="https://2767179248-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSdKKJqJhW8GvhMBmgTTJ%2Fuploads%2FSoDmVEWwRFbluMm7SnY6%2Fcacher_install_webapi_path.png?alt=media&#x26;token=5ba7b8cc-d7ea-4952-b839-69d33c571fc4" alt=""><figcaption></figcaption></figure>

At the "Ready to install..." screen, click **Install** to begin the installation.

<figure><img src="https://2767179248-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSdKKJqJhW8GvhMBmgTTJ%2Fuploads%2FGZzm4AMp4w18xVwobC9H%2Fcacher_install_webapi_install.png?alt=media&#x26;token=7854636a-f7ea-45b6-9dae-ed5f7edd6f80" alt=""><figcaption></figcaption></figure>

At the "Completed" screen, the installation wizard is complete. Make sure that checkbox on the bottom left is set to Launch Configuration Editor. Click **Finish** and enjoy a nice cup of tea, you’ve earned it.&#x20;

<figure><img src="https://2767179248-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSdKKJqJhW8GvhMBmgTTJ%2Fuploads%2F7GzUpSbpyxUIWIH3gPPk%2Fcacher_install_webapi_finish.png?alt=media&#x26;token=c3fbf52f-6d3c-4814-9104-8b8b5e2de6ae" alt=""><figcaption></figcaption></figure>

### Configure CacheR WebAPI Service

Use the **Configuration Editor** to complete the initial CacheR setup. All required fields must be populated before the service can be verified and started.

* **Enable HTTPS** (recommended) to secure communication between CacheR, clients, and upstream services. HTTPS is strongly recommended for production environments.
* In **HostCertificateThumbPrint**, enter the thumbprint of the SSL certificate bound to the CacheR service.The certificate must be present in the local computer certificate store and include the appropriate DNS name.
* **Provide the SQL connection string** used by CacheR WebAPI to store operational data.

  Example:

```
Server=.\SQLEXPRESS;Database=CacheR;Trusted_Connection=True;MultipleActiveResultSets=true;TrustServerCertificate=True
```

* **Define the StifleR Server URL** that CacheR will register with and report to.\
  Example:

```
https://dp01.corp.mblab.org:9000/
```

* Click **Verify** to validate all settings. Once verification completes successfully, click **Save** to apply the configuration.
* After saving, a confirmation dialog will appear indicating that the configuration was saved successfully. You will be prompted to set the **CacheRWebAPI** service startup type to **Automatic** and start the service. Select **Yes** to apply the startup configuration and start the service immediately.

<figure><img src="https://2767179248-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSdKKJqJhW8GvhMBmgTTJ%2Fuploads%2FGy21ZL6yzzTlOjwflUgg%2Fcacher_install_webapi_service_start.png?alt=media&#x26;token=e4642f58-8743-4ac1-b70f-89ceff30b43a" alt=""><figcaption></figcaption></figure>

### Install Worker Service

From an Elevated Command prompt launch **TwoPint.CacheR.Worker.Installer64.msi**. You also can launch installation as it is – the installer will ask for elevation when needed.

At the "Welcome" screen, feel welcomed, and then click **Next**.

<figure><img src="https://2767179248-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSdKKJqJhW8GvhMBmgTTJ%2Fuploads%2FSBjGsQKaZolgi1OMhqvo%2FCacheR_worker_welcome.png?alt=media&#x26;token=e761804b-31ce-442e-b8a2-bb3795c8a971" alt=""><figcaption></figcaption></figure>

At the "End-User License Agreement" screen, once you have reviewed the EULA, check the box: \
**I accept the terms in the License Agreement**, and then click **Next**.

<figure><img src="https://2767179248-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSdKKJqJhW8GvhMBmgTTJ%2Fuploads%2FsNi3myNpzAoK9yYdkJQv%2FCacheR_worker_eula.png?alt=media&#x26;token=cf02c930-91eb-4344-8313-dbf03d39560f" alt=""><figcaption></figcaption></figure>

At the "Destination Folder" screen, enter the path to the directory where the CacheR Worker service program files should be installed and then click **Next**.

<figure><img src="https://2767179248-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSdKKJqJhW8GvhMBmgTTJ%2Fuploads%2FgJYpQrkRsf9kZRI6QrjY%2FCacheR_worker_path.png?alt=media&#x26;token=44c7feb8-a57b-4d97-8d9a-2ecb323ad9f4" alt=""><figcaption></figcaption></figure>

At the "Ready to install..." screen, click **Install** to begin the installation.

<figure><img src="https://2767179248-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSdKKJqJhW8GvhMBmgTTJ%2Fuploads%2FtyJHHoDMoBfXvUv5QF5G%2FCacheR_worker_install.png?alt=media&#x26;token=03af94ea-808e-4c32-8dee-eb6e08535075" alt=""><figcaption></figcaption></figure>

At the "Completed" screen, the installation wizard is complete. Make sure that checkbox on the bottom left is set to Launch Configuration Editor. Click **Finish** and enjoy a nice cup of tea, you’ve earned it.&#x20;

<figure><img src="https://2767179248-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSdKKJqJhW8GvhMBmgTTJ%2Fuploads%2FmFwXX4oPOVmFYrzFDOz4%2FCacheR_worker_path.png?alt=media&#x26;token=32836079-ae9d-4145-988a-9a30bb62d935" alt=""><figcaption></figcaption></figure>

#### Configure CacheR Worker service

* Enter the **Domain** where the service account resides.
* In **UserName**, specify the service account used by the CacheR Worker service.\
  This account is used to access Distribution Point IIS shares and calculate content hashes.
* Provide the **Password** for the specified service account.
* **Provide the SQL connection string** used by CacheR WebAPI to store operational data.

  Example:

```
Server=.\SQLEXPRESS;Database=CacheR;Trusted_Connection=True;MultipleActiveResultSets=true;TrustServerCertificate=True
```

* Click **Verify** to validate all settings. Once verification completes successfully, click **Save** to apply the configuration.
* After saving, a confirmation dialog will appear indicating that the configuration was saved successfully. You will be prompted to set the **CacheRWebAPI** service startup type to **Automatic** and start the service. Select **Yes** to apply the startup configuration and start the service immediately.

<figure><img src="https://2767179248-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSdKKJqJhW8GvhMBmgTTJ%2Fuploads%2F05J02sc2cnAs3uSPkpLH%2FCacheR_worker_service.png?alt=media&#x26;token=a7ffa6b7-d2c3-4302-a9c8-b747d6b48b6a" alt=""><figcaption></figcaption></figure>

### Configure Stifler to enable CacheR

To enable CacheR functionality, start the **StifleR Service Config Editor** on the machine where it is installed. Enable **Show Advanced**, search for **CacheR**, and then enable **Show CacheR features**. **Verify and Save the configuration** and restart the StifleR service if prompted to ensure the changes take effect.

<figure><img src="https://2767179248-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSdKKJqJhW8GvhMBmgTTJ%2Fuploads%2FYNkx8j4lYMdcHyZpcNwT%2FCacheR_Stifler_config_editor.png?alt=media&#x26;token=a8fc9d69-71af-40ea-96f4-359d5f889447" alt=""><figcaption></figcaption></figure>

Once CacheR features are enabled, open the **StifleR Dashboard** and navigate to **Infrastructure Services**. The CacheR server will appear in the list and must be approved before it can be used by StifleR.

<figure><img src="https://2767179248-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSdKKJqJhW8GvhMBmgTTJ%2Fuploads%2FzPtotG8cyLFatyXlZhjY%2FCacheR_Stifler_dasboard1.png?alt=media&#x26;token=a9bca1b5-a661-4963-b02d-ca87444cbe9a" alt=""><figcaption></figcaption></figure>

After approval, select the CacheR server and set it as the **Default** CacheR instance. If multiple CacheR servers exist in the environment, only one can be configured as the default at any given time.

<figure><img src="https://2767179248-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSdKKJqJhW8GvhMBmgTTJ%2Fuploads%2F4EPdToIywicPygJ3j8ya%2FCacheR_Stifler_dasboard2.png?alt=media&#x26;token=3f3be458-f47d-4918-a737-1cfeb92e54ef" alt=""><figcaption></figcaption></figure>

When the CacheR server is approved and set as default, additional CacheR related sections will become available in the **StifleR Dashboard**, confirming that CacheR is enabled and ready for configuration and operation.

<figure><img src="https://2767179248-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSdKKJqJhW8GvhMBmgTTJ%2Fuploads%2FdYZ7poGaxtu9pWOhlgLI%2FCacheR_Stifler_dasboard3.png?alt=media&#x26;token=adead243-2778-47bf-b194-325589a7eaf7" alt=""><figcaption></figcaption></figure>

Additional guidance on  operating CacheR is available in the CacheR [documentation](https://documentation.2pintsoftware.com/stifler/operations-and-features/cacher-operations) section.
