Self-Hosting Keila: Configuration

When self-hosting Keila, you can configure most aspects of the application with environment variables.

Database

Configure the PostgreSQL database used by Keila:

VariableRequiredDefaultDescription
DB_URLyes-URL following the schema postgres://user:password@host/database
DB_ENABLE_SSLnofalseUse SSL/TLS for the database connection
DB_VERIFY_SSL_HOSTnotrueEnable SSL hostname verification (disable if connecting to an IP directly)
DB_CA_CERTno-SSL certificate (PEM) for connecting to the database

Root User

When you start Keila for the first time, a root user is created. If you don’t specify otherwise, a user with a random password is created printed to stdout.

VariableRequiredDefaultDescription
KEILA_USERroot@localhostEmail address for the root user
KEILA_PASSWORDrandomPassword for the root user

URL

Configure publicly-visible URLs generated by Keila with the following variables:

VariableRequiredDefaultDescription
URL_HOSTyes-Domain of your Keila instance
URL_PATH/Path of your Keila instance
URL_SCHEMAhttphttp or https. URL scheme of your Keila instance
URL_PORT443 if URL_SCHEMA is https
value of PORT otherwise
Port of your Keila instance

Deployment

VariableRequiredDefaultDescription
PORT4000Port on which Keila will listen
SECRET_KEY_BASEyes-Strong secret with at least 64 characters. Can be generated with head -c 48 /dev/urandom | base64
HASHID_SALTderived from SECRET_KEY_BASESalt for creating Hashids. More information
DISABLE_REGISTRATIONfalseDisable user registration by setting this variable to true
DISABLE_PRECEDENCE_HEADERfalseDisable the Precedence: Bulk header by settings this variable to true
USER_CONTENT_DIR./uploadsPath to a directory where user uploads will be stored. When deploying using containers, this should point to the path of a volume to make sure uploads are persisted.
USER_CONTENT_BASE_URL-Base URL at which files in USER_CONTENT_DIR are available on the web. It’s recommended to set up a separate server (such as Nginx or Apache) to serve user content. If not set, Keila wil serve user content files directly.

System mailer

Keila needs to be able to send system emails, e.g. for registration and password reset emails. Configure an SMTP sender for this purpose with the following variables:

VariableRequiredDefaultDescription
MAILER_TYPEsmtpCurrently only smtp is supported
MAILER_SMTP_HOSTyes-Hostname of the SMTP server
MAILER_SMTP_PORT587Port of the SMTP server
MAILER_SMTP_USERyes-Username for the SMTP server
MAILER_SMTP_PASSWORDyes-Password for the SMTP server
MAILER_SMTP_FROM_EMAILMAILER_SMTP_USERFROM email address
MAILER_ENABLE_SSLfalseEnable SSL/TLS by setting to true
MAILER_ENABLE_STARTTLSfalseEnable STARTTLS by setting to true

Captcha

Keila can use hCaptcha or Friendly Captcha to protect your sign-up forms. Configure the captcha provider with the following variables:

VariableRequiredDefaultDescription
CAPTCHA_PROVIDERhcaptchaCaptcha provider, one of hcaptcha or friendly_captcha
CAPTCHA_SITE_KEY-Captcha provider site key
CAPTCHA_SECRET_KEY-Captcha provider secret key
CAPTCHA_URLvariableCaptcha provider verification URL, defaults to https://hcaptcha.com/siteverify for hcaptcha and https://api.friendlycaptcha.com/api/v1/siteverify for friendly_captcha