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

# Deploy Open Source

## AWS

### Create a New Instance

1. Launch a new instance
2. Select instance AMI
   * Everything has been tested on `Amazon Linux 2 AMI (HVM)` and `Ubuntu 20.04`
3. Set Instance Type
   * Select at least a `t2.large`
4. Network Settings
   * Allow SSH traffic
   * Allow traffic to port `8081`
   * **For security purposes do not allow HTTP/HTTPS traffic from the internet**
5. Configure Storage
   * Add at least 128 GB for the Root Volume
6. Connect to your instance

```bash Bash theme={null}
SSH_KEY=~/Downloads/metlo-api-security-key.pem
INSTANCE_IP=<YOUR_INSTANCE_IP>
chmod 400 $SSH_KEY
ssh -i $SSH_KEY ubuntu@$INSTANCE_IP
```

### Install Metlo

```bash Bash theme={null}
sudo wget https://raw.githubusercontent.com/metlo-labs/metlo/master/manage-deployment.py -O manage-deployment.py
sudo chmod +x manage-deployment.py
sudo -E python manage-deployment.py init -q
sudo python manage-deployment.py start
```

### Connect to Metlo

```bash Bash theme={null}
ssh -i $SSH_KEY -L 8000:localhost:8000 -N -f ubuntu@$INSTANCE_IP
```

## GCP

### Create a New Instance

1. Create a new instance
2. Select an OS
   * Everything has been tested on `Debian`
3. Set Instance Type
   * Select at least a `e2.medium`
4. Configure Storage
   * Add at least 128 GB for the Boot Disk

### Install Metlo

1. Connect to your instance

```bash Bash theme={null}
PROJECT_ID=<YOUR_PROJECT_ID>
INSTANCE_NAME=<YOUR_INSTANCE_NAME>
gcloud --project=$PROJECT_ID beta compute ssh $INSTANCE_NAME
```

1. Install Metlo (In the instance)

```bash Bash theme={null}
sudo wget https://raw.githubusercontent.com/metlo-labs/metlo/master/manage-deployment.py -O manage-deployment.py
sudo chmod +x manage-deployment.py
sudo -E python manage-deployment.py init -q
sudo python manage-deployment.py start
```

1. Connect to your instance

```bash Bash theme={null}
PROJECT_ID=<YOUR_PROJECT_ID>
INSTANCE_NAME=<YOUR_INSTANCE_NAME>
gcloud --project=$PROJECT_ID beta compute ssh $INSTANCE_NAME
```

1. Install Metlo

```bash Bash theme={null}
mkdir metlo && cd metlo
wget https://raw.githubusercontent.com/metlo-labs/metlo/master/{docker-compose.yaml,init.sql,metlo-config.yaml}
ENCRYPTION_KEY="<A_RANDOM_STRING>"
EXPRESS_SECRET="<A_RANDOM_STRING>"
BACKEND_URL="https://<YOUR_INSTANCE_IP>:8081"
docker-compose up -d
```

### Connect to Metlo

```bash Bash theme={null}
gcloud --project=$PROJECT_ID beta compute ssh $INSTANCE_NAME -- -L 8000:localhost:8000 -N -f
```

## Azure

### One click deployment to Azure

[![azure](https://aka.ms/deploytoazurebutton "Deploy To Azure")](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fmetlo-labs%2Fmetlo%2Fmaster%2Fdeploy%2Fazure%2Fdeployment.json)

### Then you can tunnel locally to access the UI

```bash Bash theme={null}
ssh -i $SSH_KEY -L 8000:localhost:8000 -N -f azureuser@$INSTANCE_IP
```
