# VM Supabase Deployment

Deploying Your Supabase Instance on a Virtual Machine

***

### What You’ll Get

Once deployed, your VM will run a full Supabase stack locally via Docker.

| Service            | Purpose              | Default Port |
| ------------------ | -------------------- | ------------ |
| Postgres           | Database             | 5432         |
| Kong Gateway (API) | REST + Auth endpoint | 8000         |
| Studio             | Web UI dashboard     | 3000         |
| Storage            | File uploads         | 5000         |

***

### Step 1 — Prepare Your VM Environment

Recommended Specs

* Ubuntu 22.04 LTS (or Debian 12)
* 2 vCPUs, 2 GB RAM minimum
* 10 GB+ disk
* Docker + Docker Compose installed

Install dependencies:

```
sudo apt update
sudo apt install -y docker.io docker-compose git
sudo systemctl enable --now docker
```

***

### Step 2 — Clone the Supabase Docker Setup

```
git clone https://github.com/supabase/supabase
cd supabase/docker
```

This directory contains Docker Compose files for all Supabase services.

***

### Step 3 — Configure Your Environment

Copy and edit the example environment file:

```
cp .env.example .env
```

Open .env and minimally edit:

```
SUPABASE_URL=http://<YOUR_VM_IP>
SUPABASE_PUBLIC_URL=http://<YOUR_VM_IP>
POSTGRES_PASSWORD=postgres
JWT_SECRET=$(openssl rand -base64 48)
ANON_KEY=$(openssl rand -base64 32)
SERVICE_ROLE_KEY=$(openssl rand -base64 32)
```

> Replace \<YOUR\_VM\_IP> with your VM’s public IP or domain name (e.g. <http://203.0.113.10> or <https://supabase.yourdomain.com>).

***

### Step 4 — Start the Stack

Launch Supabase services:

```
docker compose up -d
```

Check that all services are healthy:

```
docker compose ps
```

If successful, you’ll see containers like:

```
supabase-kong (API) → 0.0.0.0:8000
supabase-studio (Dashboard) → 3000/tcp
supabase-db (Postgres) → 5432/tcp
```

***

### Step 5 — Import Your Existing Data

If you previously exported your Supabase Cloud project to a dump file (supabase\_backup.sql):

```
# copy the dump to your VM
scp supabase_backup.sql user@<YOUR_VM_IP>:~

# restore inside the VM
ssh user@<YOUR_VM_IP>
docker exec -i supabase-db psql -U postgres -d postgres < supabase_backup.sql
```

Your local database now contains all tables and data from your old cloud project.

***

### Step 6 — Connect Your Frontend

In your web project (HTML/JS):

```
const supabase = window.supabase.createClient(
  'http://<YOUR_VM_IP>:8000',   // your VM’s Supabase API URL
  'YOUR_ANON_KEY'               // from the VM’s .env file
)
```

✅ Your frontend now communicates directly with your VM’s Supabase instance

***

### Step 7 — Verify via Supabase Studio

Access the dashboard at:

```
http://<YOUR_VM_IP>:3000
```

Log in using your local keys from .env.

You’ll see your tables, users, and storage buckets — just like in Supabase Cloud.

***

### Enterprise Deployment Support

If you’d like to deploy your Supabase environment to a virtual machine (VM) or your own production server, we can help you set that up securely.

For enterprise deployment assistance, please contact our team **here**:

Our enterprise support can guide you through:

* Deploying Supabase on your own infrastructure (AWS, Azure, GCP, etc.)
* Setting up backups, SSL, and domain routing
* Scaling from local to production-grade environments

***

### References

* [Supabase Self-Hosting Guide](https://supabase.com/docs/guides/self-hosting)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.emobiq.com/emobiq-ai/readme/supabase/vm-supabase-deployment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
