content/cloud/5.migration/1.starter.md
While Directus offers both cloud-hosted and self-hosted options, we’ve spent a lot of time looking at how people are using the platform and where we can make the biggest long-term impact. After a lot of consideration, we’ve decided to retire the Starter Cloud tier.
Starter Cloud users have two options: upgrade to our managed Pro Cloud service, or transition to a self-hosted environment. We have created this guide to make transitioning from Starter Cloud to a self-hosted setup as smooth as possible.
When migrating from Directus Cloud to self-hosting, you'll need to:
Before starting the migration, ensure you have:
This section covers self-hosting on any infrastructure provider (AWS, DigitalOcean, Azure, etc.).
PostgreSQL Database (v13.8 or higher)
A managed service (AWS RDS, DigitalOcean Managed Database) or self-managed PostgreSQL instance.
Object Storage
S3, MinIO, DigitalOcean Spaces, or local filesystem
Compute Instance
Docker host, Kubernetes cluster, or Node.js server (Minimum: 1 vCPU, 2GB RAM for small projects)
Create a docker-compose.yml file:
version: '3'
services:
directus:
image: directus/directus:latest
ports:
- 8055:8055
volumes:
- ./uploads:/directus/uploads
- ./extensions:/directus/extensions
environment:
KEY: 'replace-with-random-value'
SECRET: 'replace-with-random-value'
ADMIN_EMAIL: '[email protected]'
ADMIN_PASSWORD: 'your-secure-password'
DB_CLIENT: 'pg'
DB_HOST: 'your-db-host'
DB_PORT: '5432'
DB_DATABASE: 'directus'
DB_USER: 'directus'
DB_PASSWORD: 'your-db-password'
# If using S3-compatible storage
STORAGE_LOCATIONS: 's3'
STORAGE_S3_DRIVER: 's3'
STORAGE_S3_KEY: 'your-s3-key'
STORAGE_S3_SECRET: 'your-s3-secret'
STORAGE_S3_BUCKET: 'your-bucket'
STORAGE_S3_REGION: 'us-east-1'
# Optional: Redis for caching
CACHE_ENABLED: 'true'
CACHE_STORE: 'redis'
REDIS: 'redis://redis:6379'
# Security
PUBLIC_URL: 'https://your-domain.com'
CORS_ENABLED: 'true'
CORS_ORIGIN: 'true'
redis:
image: redis:7-alpine
volumes:
uploads:
Generate secure keys:
# Generate KEY
openssl rand -base64 32
# Generate SECRET
openssl rand -base64 32
Start Directus:
docker-compose up -d
# Install Directus
npm init directus-project my-project
# Navigate to project
cd my-project
# Configure your .env file with database credentials
nano .env
# Start Directus
npx directus start
# Stop Directus temporarily
docker-compose down
# Create the directus database
psql -h your-db-host \
-p 5432 \
-U directus \
-d directus \
-c "CREATE DATABASE \"directus\""
# (Optional) Install postgis if you need to use maps
psql -h your-db-host \
-p 5432 \
-U directus \
-d directus \
-c "CREATE EXTENSION \"postgis\""
# Restore the project database
psql -h your-db-host \
-p 5432 \
-U directus \
directus < example.sql
# Configure file storage provider to local storage
psql -h your-db-host \
-p 5432 \
-U directus
-c "UPDATE \"directus_files\" SET \"storage\" = 'local'"
# Start Directus again
docker-compose up -d
# Copy files to the uploads directory
cp -r assets/* ./uploads/
# Upload files to your S3 bucket
aws s3 cp assets/ s3://your-bucket/ --recursive
Example Nginx configuration:
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://localhost:8055;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Railway offers a streamlined deployment experience with automatic SSL, environment management, and built-in PostgreSQL.
To help you get started quickly, our official Directus CMS template is now live on Railway. With one click, you can spin up a full Directus project on a lightweight, cost-efficient platform.
Railway will automatically:
After deployment, add/update these variables in the Railway dashboard:
KEY=<generate-with-openssl-rand-base64-32>
SECRET=<generate-with-openssl-rand-base64-32>
[email protected]
ADMIN_PASSWORD=your-secure-password
PUBLIC_URL=https://your-project.up.railway.app
STORAGE_LOCATIONS=s3
STORAGE_S3_DRIVER=s3
STORAGE_S3_KEY=your-aws-key
STORAGE_S3_SECRET=your-aws-secret
STORAGE_S3_BUCKET=your-bucket-name
STORAGE_S3_REGION=us-east-1
STORAGE_S3_ENDPOINT=https://s3.amazonaws.com
Railway provides direct database access:
# Using the Railway connection string
pg_restore -d postgresql://railway-user:password@host:port/database \
-v your_database_dump.sql
Alternatively, use Railway CLI:
# Install Railway CLI
npm i -g @railway/cli
# Login
railway login
# Link to your project
railway link
# Connect to database
railway connect postgres
# Then run your import commands
/directus/uploadsrailway shell
# Then use scp or other methods to transfer files
Configure S3 storage as shown in Step 3 and upload files directly to S3.
After completing your migration, verify the following:
# Test database connectivity
psql -h your-db-host -U your-user -d your-database
# Check Directus logs
docker-compose logs -f directus