# Installing the PullRequest Proxy

## Server Provisioning

These instructions assume the PullRequest Proxy will run in a cloud environment on its own virtual instance.

### Recommended minimum

* 4 vCPUs
* 16 GB of memory
* 200 GB of disk space

If the "Server Install" instructions are followed, PullRequest Proxy stores all of its files in the `/home/pullrequest/pullrequest_proxy/` directory. This includes service executables, installed versions, and runtime data.

The proxy clones a copy of each repository locally, which accounts for the majority of disk usage. CPU and memory usage is dominated by `git` operations (clone, fetch, diff) and API calls to your source code provider.

### Scaling for larger deployments

**Disk** is the most important dimension to scale. The proxy stores up to `NUM_REPO_WORKERS + REPO_CACHE_LIMIT` repos on disk simultaneously (default: 15). Automatic eviction kicks in at 80% disk usage.

Use this formula to estimate disk needs:

```
(NUM_REPO_WORKERS + REPO_CACHE_LIMIT) × avg_repo_clone_size × 2
```

The ×2 factor accounts for git working tree overhead. For example:

* Default settings, avg repo 2 GB: 15 × 2 GB × 2 = **60 GB** — 200 GB is comfortable.
* Cache limit raised to 20, avg repo 10 GB: 25 × 10 GB × 2 = **500 GB**.

**CPU** scales roughly with `NUM_REPO_WORKERS`. Git clone and diff operations are CPU-intensive. As a guideline, allocate \~1 vCPU per worker. The default of 5 workers runs well on 4 vCPUs. If increasing to 10+ workers, consider 8+ vCPUs.

**Memory** is the least concern — git operations are not memory-heavy for most repos. 16 GB handles most workloads. Only consider 32 GB if running 10+ workers on very large repos.

### Sizing reference

| Workload                          | vCPUs | Memory | Disk   |
| --------------------------------- | ----- | ------ | ------ |
| Small (< 50 repos, avg < 500 MB)  | 4     | 16 GB  | 200 GB |
| Medium (50–200 repos, avg 1–5 GB) | 8     | 16 GB  | 500 GB |
| Large (200+ repos or avg > 5 GB)  | 8–16  | 32 GB  | 1 TB+  |

## Configuring the firewall

The PullRequest Proxy will only contact the following FQDNs:

```
https://app.pullrequest.com
https://content.pullrequest.com
```

The only one that's required for the proxy to minimally operate is `https://app.pullrequest.com`.&#x20;

The `https://content.pullrequest.com` domain is only required if enabling auto-upgrade. Read more in the next section.

[Upgrading PullRequest Proxy](/on-premise-server/upgrading-the-pullrequest-proxy.md#auto-upgrade)

In order for the PullRequest Proxy to be able to access source code provider APIs, the proxy instance itself needs to have access to your source code provider instances either via `http` (port 80), `https` (port 443), or both.

If you are configuring webhooks from your source code provider to the proxy, then the provider instances need to be able to access the proxy instance by either port `5012` if using `http` and `8443` if using `https`. More on configuring SSL can be found here:

[Configuring SSL](/on-premise-server/configuring-ssl.md)

More on configuring webhooks can be found here:

[Configure Webhooks](/on-premise-server/configure-webhooks.md)

## Server install

The instructions below outline how to install the PullRequest Proxy on a fresh server. **The assumed flavor of Linux is Amazon Linux 2**, but you can go ahead and modify the instructions to apply to your flavor of Linux. The commands themselves assume you're running as the `root` user.

## Install necessary packages

The PullRequest Proxy doesn't have many dependencies as it is distributed as an executable binary. However, it does require that the `git` utility is installed.

```
yum install -y git
```

## Create service user

Best practices dictate that each service should have its own user running it. Let's go ahead and create a PullRequest user. Below, I'm creating the `pullrequest` user and locking the account to prevent logins as the user.

```
useradd pullrequest
usermod -L pullrequest
```

## Installing the proxy

Now, it's time to assume the role of the `pullrequest` user for this portion of the installation process.

```
su pullrequest
```

The following commands will be run as the `pullrequest` user.

```
cd $HOME
curl <proxy_url> --output - | tar zxvf -
cd pullrequest_proxy
```

We'll stay logged in as the `pullrequest` user for the next few steps so that the proxy can now be configured. Go ahead and open the `.env` file in this directory in your favorite text editor.

<pre><code><strong>vim .env
</strong></code></pre>

## Configuring an HTTP proxy

As the PullRequest Proxy uses the Golang standard library for communicating with external domains, the standard UNIX environment variables (`http_proxy`, `HTTP_PROXY`, `https_proxy`, `HTTPS_PROXY`, `no_proxy`, and `NO_PROXY`) can be configured in the `.env` file. Information about  these can be found here:

* <https://www.cyberciti.biz/faq/linux-unix-set-proxy-environment-variable/>
* <https://about.gitlab.com/blog/2021/01/27/we-need-to-talk-no-proxy/>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pullrequest.com/on-premise-server/installing-the-pullrequest-proxy.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
