# Asseter On-Prem Installation guide

## System requirements

* Linux Ubuntu 18.04 or newer
* 8 cores CPU
* 16 GB RAM
* 16 GB SSD to install and init Asseter
* Free space according to the size of your expected assets
* Internet connection and allowed access to `asseter.ai` and it's subdomains
* Root permissions

> Your assets media content can be stored directly on the host machine or you can mount an external volume. This will be described below.

## Before we start

Let's say we have a satisfying all requirements host machine running on IP address `10.1.4.1`.

First of all we need to decide where our media content will be stored and where PostgreSQL database will be running.

> &#x20;If all Asseter services should run and media content should be stored on `10.1.4.1`host machine, you can proceed to [installation](#installation) right now.

> If you need your media content to be stored on external volume, please proceed to \[Storing media content on external volume instructions] **before installing Asseter**

> If you need PostgreSQL to be run on external machine, please proceed to [Running PostgreSQL on another machine instructions](#running-postgresql-on-another-machine) **before installing Asseter**

## Storing media content on an external volume

To do so, you need to mount your external volume to `/mnt/asseter_media-content` folder on host machine **before** you install the Asseter:

`sudo nano /etc/fstab`

**Add your volume like this:**

`//10.1.4.2/my_media_content_folder_path /mnt/asseter_media-content cifs user,uid=1000,rw,suid,username=mysmbusername,password=mysmbpassword,domain=mydomain.local`

Then press CTRL+x, y, Enter to save the changes and close the file.

**Reboot your machine:**

`sudo reboot`

**Install Asseter** [as described here](#installation)

## Running PostgreSQL on another machine

To do so we need to configure PostgreSQL server. Let's say it is running on host `10.1.4.3`

`ssh 10.1.4.3`

`sudo apt update`

`sudo apt install curl gpg gnupg2 software-properties-common apt-transport-https lsb-release ca-certificates`

`curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc|sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg`

``echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |sudo tee  /etc/apt/sources.list.d/pgdg.list``

`sudo apt update`

`sudo apt install postgresql-13 postgresql-client-13`

`sudo su - postgres`

`psql -c "create user assetusr with password 'MySecretAsseterPassword';"`

`psql -c "ALTER USER assetusr WITH SUPERUSER;"`

`psql -c "ALTER USER assetusr CREATEDB LOGIN;"`

`psql -c "GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO assetusr;"`

`psql -c "GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO assetusr;"`

`sudo su`

`nano /etc/postgresql/13/main/pg_hba.conf`

**Add these lines:**

`local all assetusr md5`

`host all assetusr 10.1.4.1/32 md5`

**And save the file with CTRL+x, y, Enter**

`sudo su`

`sudo nano /etc/postgresql/13/main/postgresql.conf`

**Change listen\_addresses variable value to this:**

`listen_addresses='*'`

**And save the file with ctrl+x, y, enter**

`sudo service postgresql restart`

`psql -U assetusr -d postgres -c "create database asset_lib_db;"`

`psql -c "GRANT ALL PRIVILEGES ON DATABASE asset_lib_db to assetusr;"`

`wget -O db.dump https://fs.asseter.ai/releases/latest/db.dump`

`psql -U assetusr -v ON_ERROR_STOP=1 asset_lib_db < db.dump`

**Install Asseter** [as described here](#installation)

<br>

## Installation

> **Find your distributive download URL.** \
> **If you don't have any, please, contact Asseter Support**

**Connect to host machine**

`ssh 10.1.4.1`

**Download the last Asseter release archive**

`wget -O asseter.tar.gz`` `**`Your distributive link.`** <br>

**Extract the archive**

`tar -xzvf asseter.tar.gz`

**Edit the environment variables file**

`nano .env`

`>> ACCESS_TOKEN_SECRET_KEY=MySuperSafeStringThatNoOneElseKnows1`

character set that you come up with yourself

`>> ACCESS_TOKEN_SALT=MySuperSafeStringThatNoOneElseKnows2`

Another character set that you come up with yourself

`>> SECRET_KEY=MySuperSafeStringThatNoOneElseKnows3`

Another character set that you come up with yourself

`>> EMAIL_SECRET_KEY=MySuperSafeStringThatNoOneElseKnows4`

Another character set that you come up with yourself

`>> EMAIL_SALT=MySuperSafeStringThatNoOneElseKnows5`

Another character set that you come up with yourself

`>> MYSQL_ROOT_PASSWORD=MySecretAsseterPassword1`

Another character set that you come up with yourself

`>> MYSQL_PASSWORD=MySecretAsseterPassword1`&#x20;

> Must be equal to MYSQL\_ROOT\_PASSWORD

Another character set that you come up with yourself

`>> DB_MYSQL_PASSWORD=MySecretAsseterPassword1`&#x20;

> Must be equal to MYSQL\_ROOT\_PASSWORD

Another character set that you come up with yourself<br>

`>> POSTGRES_PASSWORD=MySecretAsseterPassword2`

Another character set that you come up with yourself

<br>

After setting this config up press CTRL+x, y, Enter to save the changes and close the file.

<br>

### Run the installer

`sudo bash build.sh`<br>

**First run**

Open `http://10.1.4.1:8945/` in your browser and setup the nginX Proxy Manager.&#x20;

**Default email:** <admin@example.com>

**Default password:** changeme<br>

Fill the profile form and change admin's email and password.

Now go to **hosts** -> **proxy hosts** and click **Add proxy host** button.

Fill the form with:

#### Details:

`Domain names: 10.1.4.1`

`Scheme: http`

`Forward Hostname / IP: http://10.1.4.1`

`Forward Port: 8080`

`Cache Assets: true`

`Block Common Exploits: true`

`Websockets support: true`

#### Advanced:

**Insert this into the text field**

`proxy_set_header Host $host;`

`proxy_set_header X-Real-IP $remote_addr;`

`proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;`

`proxy_set_header X-Forwarded-Proto $scheme;`

`proxy_set_header X-Forwarded-Scheme $scheme;`

`proxy_buffering off;`

`proxy_request_buffering off;`

`client_max_body_size 1024000M;`

`proxy_connect_timeout 6000;`

`proxy_send_timeout 6000;`

`proxy_read_timeout 6000;`

`send_timeout 6000;`

Click **Save** button.

<br>

In just a few minutes after the installation process finished you can open Asseter website on `http://10.1.4.1/` and log in with default admin user credentials:

**Email**: <admin@mail.com>

**Password**: 11111111

> ### WARNING:
>
> ### It is strongly recommended to change these credentials in Settings section!
