# On-Prem Installation Guide

### **Hivel On-Prem Installation Using Docker Compose**

This guide outlines the installation and setup process for running Hivel On-Prem on a Linux-based machine using Docker Compose. The required Docker images are hosted in AWS ECR, and this document assumes you have the necessary access credentials.

#### **Prerequisites**

Before starting the installation process, ensure you have the following:

* **Docker & Docker Compose**: Installed on the target machine.
* **JAVA**: Installed on the target machine.
* **AWS CLI**: Installed on the target machine.
* **AWS ECR Access Credentials**: Provided separately.
* **Linux Server**: With sufficient resources (CPU, RAM, Disk Space).
* **Network Access**: To required dependencies such as databases or external services.

***

#### **Step 1: Set Up AWS ECR Authentication**

To authenticate and pull the Docker images from AWS ECR, follow these steps:

1. Run the following AWS CLI command to get the login credentials for your ECR:

   ```bash
   aws ecr get-login-password --region <AWS_REGION> | docker login --username AWS --password-stdin <AWS_ECR_URL>
   ```

   Replace `<AWS_REGION>` with your AWS region (e.g., `us-east-1`), and `<AWS_ECR_URL>` with the URL for your ECR repository.
2. After running the command, you should see the following message:

   ```bash
   Login Succeeded
   ```

   This confirms that authentication was successful.

***

#### **Step 2: Docker Compose Set Up Configuration Files**

Now that authentication is complete, you'll need to download and extract the configuration files.

**Download the Configuration Package**

1. Run the following AWS CLI command to download the configuration package:

   ```bash
   aws s3 cp s3://<AWS_S3_BUCKET_NAME>/hivel-on-prem.zip ./ --region ap-south-1
   ```

   Replace `<AWS_S3_BUCKET_NAME>` with the actual name of your AWS S3 bucket.

**Extract the Configuration Package**

2. Unzip the downloaded package using the following command:

   ```bash
   unzip hivel-on-prem.zip
   ```
3. Navigate to the extracted directory:

   ```bash
   cd hivel-on-prem
   ```

***

#### **Step 3: Unified Setup or Manual Configuration**

There are two methods to set up Hivel:

**Recommended Method (Unified Setup)**

For a smoother experience, you can use the **unified README file** located in the root directory of the extracted files. This file will automatically configure both the database and services.

**Alternative Method (Manual Configuration)**

If you prefer to configure the database and services separately, follow the instructions below:

1. Inside the extracted directory, navigate to the **`database`** folder:

   ```bash
   cd database
   ```
2. Refer to the README file in this folder for detailed, step-by-step instructions on setting up the database.

#### **Step 2: Services Setup**

Once the database setup is complete, proceed to set up the services.

1. Navigate to the **`hivel-service`** folder:

   ```bash
   cd ../hivel-service
   ```
2. Follow the README file in this folder to configure the services.

***

#### **Additional Notes**

* **Security**: Ensure that `.env` files and any credentials are stored securely.
* **Firewall**: Verify that firewall rules allow traffic on necessary ports.
* **Disk Usage**: Monitor disk space to prevent failures.
* **Integrations**: Details for integrating external services will be provided once the application is operational.

For further assistance or if you encounter any issues, please reach out to us at [<mark style="color:purple;">**support@hivel.ai**</mark>](mailto:support@hivel.ai).
