> For the complete documentation index, see [llms.txt](https://docs.poocho.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.poocho.co/environments/staging-setup/server-setup.md).

# Server Setup

We're using AWS Lightsail ➜ $5 ➜  1 GB Memory, 1 Core Processor, 40 GB SSD Disk, 2 TB Transfer

## Create Server

* Create a new VM that's at least 1GB RAM & 1vPU
* Assign a static IP
* Get updates with `sudo apt update && sudo apt dist-upgrade -y && sudo apt autoremove -y`
* Enable Digital Ocean metrics with `curl -sSL https://repos.insights.digitalocean.com/install.sh | sudo bash`
* Install Docker with `sudo apt install docker.io docker-compose -y`
* Enable Autostart for Docker with `sudo systemctl start docker && sudo systemctl enable docker`
* Create a new directory with `mkdir home` at the root.
* Enter `cd home`
* Clone git repo `git clone https://github.com/yalefox/messenger-nats-yalewtf.git`

## Setup Dev/Production Server Environment

* Navigate to the root directory.
* Run `sudo nano .env` this is for the server.

```
POSTGRES_HOST=messages-db
POSTGRES_USER=postgres
POSTGRES_PASS=postgres
POSTGRES_DB=underdog
AWS_REGION=us-east-1							
AWS_POOL_ID=us-east-1_Vv8eSQPw9
AWS_CLIENT_ID=34utdbhl5alaftk8bq9t9qvk9s
NATS_URL=nats://nats:4222
API_PORT=5050
```

* **POSTGRES\_PASS:** Make sure to set a strong password
* **AWS\_REGION:** Make sure the correct region is specified
* **AWS\_POOL\_ID:** This needs to be specified
* **AWS\_CLIENT\_ID:** AWS Cognito App Client ID in User Pool needs to be specified
