Files
directus/docs/self-hosted/quickstart.md
Brainslug d4e8286ebc Update quickstart (#19159)
* Added database configuration to the quickstart

* 0.0.0.0 is not a valid IP and wont work across
across operating systems

* Create short-drinks-smile.md
2023-07-14 09:54:05 -04:00

3.1 KiB

description
description
If you're looking for the fastest way to get up-and-running with Directus locally, this guide will get you there in minutes.

Self-Hosting Quickstart

Install Docker

You should have Docker installed and running on your machine.

:::info What Is Docker?

Docker is a developer tool that allows software-creators to distribute their work along with all dependencies and required environment settings. This means that applications can run reliably and consistently, making it the perfect way to use Directus both locally and in-production.

As soon as there are new releases of Directus, we publish them on Docker Hub.

:::

Create a Docker Compose File

Create a new empty directory, and open it in a text editor. Create a docker-compose.yml file and paste the following:

version: '3'
services:
  directus:
    image: directus/directus:latest
    ports:
      - 8055:8055
    volumes:
      - ./database:/directus/database
      - ./uploads:/directus/uploads
    environment:
      KEY: 'replace-with-random-value'
      SECRET: 'replace-with-random-value'
      ADMIN_EMAIL: 'admin@example.com'
      ADMIN_PASSWORD: 'd1r3ctu5'
      DB_CLIENT: 'sqlite3'
      DB_FILENAME: '/directus/database/data.db'
      WEBSOCKETS_ENABLED: true

Save the file. Let's step through it:

  • This file defines a single Docker container that will use the latest version of the directus/directus image.
  • The ports list maps internal port 8055 is made available to our machine using the same port number, meaning we can access it from our computer's browser.
  • Thevolumes section maps internal directus/database and directus/uploads to our local file system alongside the docker-compose.yml - meaning data is backed up outside of Docker containers.
  • The environment section contains any configuration variables we wish to set.
    • KEY and SECRET are required and should be long random values. KEY is used for telemetry and health tracking, and SECRET is used to sign access tokens.
    • ADMIN_EMAIL and ADMIN_PASSWORD is the initial admin user credentials on first launch.
    • DB_CLIENT and DB_FILENAME are defining the connection to your database.
    • WEBSOCKETS_ENABLED is not required, but enables Directus Realtime.

The volumes section is not required, but without this, our database and file uploads will be destroyed when the Docker container stops running. The default database is SQLite - a self-contained server-less database that stores data to a file.

Run Directus

Run the following in your terminal:

docker compose up

Directus should now be available at http://localhost:8055 or http://127.0.0.1:8055