Directus
Deploy Directus to act as a headless CMS and backend for your apps and services.
Overview
Directus is an open data platform that serves as a headless CMS and powerful Backend-as-a-Service (BaaS). It is designed to make it easy for anyone to manage content, access, and APIs for apps and sites.
This Starter deploys Directus on Koyeb in one click. It is configured to use a PostgreSQL database for data persistence and an S3-compatible object storage provider for storing files and uploads. Additionally, it uses Redis to cache content and allow scaling to multiple instances easily.
Requirements
- A web-accessible PostgreSQL database. You can start up a PostgreSQL database on Koyeb using Koyeb Database Services.
- An S3-compatible object storage bucket and connection credentials. These are used to store uploads and other files externally so that Directus can scale and redeploy without issues.
- (Optional) A web-accessible Redis store. This is used to cache data and coordinate between multiple Directus instances. You can disable this and use in-memory caching if you plan on using only a single Directus instance.
Configuration
Directus requires a Koyeb Instance of size eco-micro or larger. An instance size of small or larger is recommended.
When deploying Directus on Koyeb, the following environment variables are used for configuration. Take care to set the required variables with the appropriate values if not set.
KEY
: A unique string that serves as an identifier for the current project. Set to a random number (for example, generated byopenssl rand -base64 24
).SECRET
: A unique string used to sign JSON web tokens for authentication. Set to a random number (for example, generated byopenssl rand -base64 24
).DB_CLIENT
: Set topg
to indicate a PostgreSQL database.DB_CONNECTION_STRING
: Set to your PostgreSQL connection string, ensuring that?sslmode=require
is appended to the end.STORAGE_LOCATIONS
: A name for the storage location to be configured. This will be used as part of the other variables used to configure it. Uses3
here.STORAGE_S3_DRIVER
: The driver to use for the storage location. Set this tos3
.STORAGE_S3_KEY
: The API key ID for authenticating to your S3 provider.STORAGE_S3_SECRET
: The API key secret for authenticating to your S3 provider.STORAGE_S3_BUCKET
: The name of the S3 bucket.STORAGE_S3_REGION
: The name of the region where your S3 bucket can be accessed. For non-AWS providers, this is typically part of the endpoint URL.STORAGE_S3_ENDPOINT
: The S3 provider endpoint URL.REDIS
: The connection string for the Redis store. If you do not plan on running multiple Directus containers, you can optionally remove this requirement.CACHE_ENABLED
: Set totrue
to enable caching.CACHE_STORE
: Set toredis
if using a Redis store. Set tomemory
if you are not using Redis.CACHE_AUTO_PURGE
: Set totrue
to automatically purge cache when data is manipulated.SYNCRHONIZATION_STORE
: Set toredis
if using a Redis store. Set tomemory
if you are not using Redis.PUBLIC_URL
: Set to the public URL where the Directus service will run. Set tohttps://{{ KOYEB_PUBLIC_DOMAIN }}
and your application's public URL will be substituted on deployment.ADMIN_EMAIL
: Set to the email you wish to use to authenticate to the Directus admin account.ADMIN_PASSWORD
: Set to the password you wish to use to authenticate to the Directus admin account.