Deployment

DigitalOcean

DigitalOcean is a straightforward and cost-effective choice for self-hosting Open Astra. Two options are available: a Droplet (VM) for full control, or App Platform for managed container deployment.

A Droplet gives you full control over the stack. The minimum recommended size is s-2vcpu-4gb at $24/month, which comfortably runs the gateway, Postgres, and Typesense with room for moderate traffic.

One-command provisioning with cloud-init

The repository includes a deploy/cloud-init.yml script that installs Docker, configures the environment, and starts the stack automatically when the Droplet first boots:

bash
# Create a Droplet with the cloud-init script
doctl compute droplet create astra \
  --size s-2vcpu-4gb \
  --image ubuntu-24-04-x64 \
  --region nyc3 \
  --user-data-file deploy/cloud-init.yml \
  --ssh-keys $(doctl compute ssh-key list --format ID --no-header)

Manual Droplet setup

bash
# SSH into the Droplet
ssh root@your-droplet-ip

# Install Docker
curl -fsSL https://get.docker.com | sh

# Clone the repo
npx astra@latest init --dir /opt/astra
cd /opt/astra

# Configure environment
cp .env.example .env
nano .env   # Fill in your API keys and secrets

# Start the full stack
docker compose up -d

# Check logs
docker compose logs -f gateway

Using DigitalOcean Managed Postgres

For production, replace the Postgres container with a DigitalOcean Managed Database for automated backups, failover, and no maintenance overhead:

bash
# Create a Managed Postgres cluster (smallest size)
doctl databases create astra-db \
  --engine pg \
  --version 17 \
  --size db-s-1vcpu-1gb \
  --region nyc3 \
  --num-nodes 1

# Get the connection string
doctl databases connection astra-db --format DSN

Set PG_HOST, PG_PORT, PG_DATABASE, PG_USER, and PG_PASSWORD from the connection details. Remove the postgres service from docker-compose.yml since you are now using managed Postgres.

App Platform

DigitalOcean App Platform can host the gateway container without managing a VM. It is best for teams that want managed scaling and zero-downtime deploys but do not need the flexibility of a bare Droplet.

bash
# Deploy using the App Spec file
doctl apps create --spec deploy/digitalocean-app-spec.yml

The App Spec file is included in the repository at deploy/digitalocean-app-spec.yml. Edit it to set your environment variables before deploying.

Firewall configuration

bash
# Allow HTTP/HTTPS and SSH, block everything else
doctl compute firewall create \\
  --name astra-fw \\
  --inbound-rules "protocol:tcp,ports:22,address:0.0.0.0/0 protocol:tcp,ports:80,address:0.0.0.0/0 protocol:tcp,ports:443,address:0.0.0.0/0" \\
  --droplet-ids $(doctl compute droplet get astra --format ID --no-header)