Deploy a Database Server
Run PostgreSQL or MySQL on a dedicated Octos Cloud VM with private networking, NVMe storage, and automated snapshots for production-grade reliability.
Recommended configuration
| Component | Recommendation |
|---|---|
| Plan | mo.medium (2 vCPU, 16 GB RAM) or higher |
| Storage | 100+ GB NVMe SSD volume |
| Network | Private network only (no public IP) |
| Backup | Daily automated snapshots |
Step 1: Provision a VM
- Create a VM with a memory-optimized plan
- Attach to a private network only
- Do not assign a public IP — access via a bastion host or VPN
Step 2: Install PostgreSQL
sudo apt update
sudo apt install postgresql postgresql-contrib -y
# Start and enable the service
sudo systemctl start postgresql
sudo systemctl enable postgresql
Configure for remote access
# Edit PostgreSQL config
sudo nano /etc/postgresql/16/main/postgresql.conf
# Set: listen_addresses = '10.0.0.5' (your private IP)
# Edit client authentication
sudo nano /etc/postgresql/16/main/pg_hba.conf
# Add: host all all 10.0.0.0/24 scram-sha-256
sudo systemctl restart postgresql
Step 3: Attach dedicated storage
For production databases, attach a separate block storage volume:
# Format and mount
sudo mkfs.ext4 /dev/vdb
sudo mkdir /var/lib/postgresql/data-vol
sudo mount /dev/vdb /var/lib/postgresql/data-vol
# Move data directory (optional, advanced)
# Refer to PostgreSQL docs for relocating the data directory
Step 4: Security hardening
- Security group: Allow port
5432only from your application VM's private IP - Authentication: Use
scram-sha-256(default in PostgreSQL 16+) - Encryption: Enable SSL for client connections
- Backups: Configure daily automated snapshots via the Octos portal
Security group rules
| Direction | Protocol | Port | Remote |
|---|---|---|---|
| Inbound | TCP | 5432 | 10.0.0.0/24 (private subnet) |
| Inbound | TCP | 22 | Bastion host IP |
Step 5: Automated backups
- Navigate to Backups in your project
- Create a scheduled backup for the database VM
- Set interval to Daily with 7-day retention
- Monitor backup status in the portal