> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kontratar.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Self-Hosting User Guide

> How to deploy, configure, and maintain a private instance of Kontratar on your own infrastructure.

This guide covers the installation, configuration, and maintenance of a self-hosted Kontratar instance. Self-hosting is intended for organizations that require a private deployment on their own infrastructure rather than using the Kontratar SaaS platform.

## System requirements

| Requirement          | Minimum specification                              |
| -------------------- | -------------------------------------------------- |
| **Operating system** | Linux, macOS, or Windows with WSL                  |
| **RAM**              | 8 GB                                               |
| **Disk space**       | 10 GB free                                         |
| **Docker**           | Docker and Docker Compose installed                |
| **Python**           | 3.8 or later                                       |
| **Git**              | Installed                                          |
| **Liquibase**        | Installed (used for database schema configuration) |
| **Network**          | Internet access required for installation          |

## Prerequisites

Before starting the installation, prepare the following:

### 1. Database

A running PostgreSQL database (self-hosted or cloud-based, for example AWS RDS). You will need:

* Database host, username, and password
* An SSL certificate (`.crt` file) for verifying the database connection

### 2. SMTP (optional)

SMTP credentials for sending notification emails. While optional, SMTP is recommended for full platform functionality.

### 3. Redis

A Redis instance (cloud-based or self-hosted). You will need the host address, port, and password.

### 4. Domain name

A registered domain name for your self-hosted instance. You will need a TLS/SSL certificate to verify the domain connection.

## Installation

### Step 1: Download the installer

```bash theme={"system"}
git clone https://github.com/your-org/kontratar-installer.git
cd kontratar-installer
```

<Note>
  The repository URL above is a placeholder. The actual URL will be provided during your onboarding process.
</Note>

### Step 2: Make the installer executable (Linux/macOS)

```bash theme={"system"}
chmod +x install.py
```

### Step 3: Run the installer

```bash theme={"system"}
python3 install.py
```

The installer prompts you for the following information:

| Prompt                     | Description                                                                                                                   |
| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| **Base port**              | The starting port for the application (for example, 3000). All services are offset from this port.                            |
| **Domain name**            | The domain for your self-hosted instance (for example, `example.yourdomain.com`). Optionally provide an SSL certificate path. |
| **PostgreSQL credentials** | Host, username, password, and SSL certificate path.                                                                           |
| **Redis credentials**      | Host, port, and password.                                                                                                     |
| **SMTP credentials**       | Host, username, password, and port.                                                                                           |

### What the installer does

The installer performs the following actions:

1. Authenticates and accesses the Docker registry.
2. Downloads and runs the Liquibase database schema setup.
3. Generates an `.env` file with your environment variables.
4. Creates a `docker-compose.yml` file with port mappings based on your base port.
5. Pulls and runs all required containers.

## Port mapping

All services are offset from your base port. For example, if your base port is 3000:

| Service             | Port offset | Final port |
| ------------------- | ----------- | ---------- |
| Frontend            | +0          | 3000       |
| Auth Service        | +1          | 3001       |
| Opps Controller     | +2          | 3002       |
| SAM Data Feed       | +3          | 3003       |
| SAM to Repository   | +4          | 3004       |
| Opportunity Service | +5          | 3005       |
| Award Repository    | +6          | 3006       |
| Information Service | +7          | 3007       |
| API Gateway         | +8          | 3008       |

Record these ports for reference when verifying service health or troubleshooting.

## Accessing your instance

After the containers are running, access Kontratar at:

```text theme={"system"}
https://<your-domain>:<base-port>
```

### Verifying service health

```bash theme={"system"}
curl https://<your-domain>:3001/api/checkalive        # Auth service
curl https://<your-domain>:3008/api/gateway/checkalive # API Gateway
```

### Verifying running containers

```bash theme={"system"}
docker ps                  # List running containers
docker logs <container>    # View logs for a specific container
```

## Maintenance

### Restarting all services

```bash theme={"system"}
docker-compose down && docker-compose up -d
```

### Viewing service logs

```bash theme={"system"}
docker-compose logs -f <service_name>
```

### Updating environment configuration

Edit the `.env` file, then restart:

```bash theme={"system"}
docker-compose up -d --build
```

### Reinstalling with new configuration

To reconfigure from scratch:

```bash theme={"system"}
docker-compose down
rm .env docker-compose.yml
python3 install.py
```

## Related topics

* [Quick Start](/quickstart) — Account creation and workspace configuration (applies to both SaaS and self-hosted instances).
* [Administrator Workspace](/AdministrationWorkspace) — Organizational management after installation.
* [FAQ](/FAQs) — Common questions about Kontratar.

**Parent topic:** [Kontratar v1.2 Documentation](/)
