Menjalankan Directus dengan Docker Compose

Hi Pembaca Setia,

Kali ini Penulis hendak berbagi pengalaman instalasi Directus (https://directus.io/) di local menggunakan Docker Compose (https://docs.docker.com/compose/).

Instalasi

Untuk instalasi cukup mudah, cukup buat file docker-compose.yaml sesuai arahan dari dokumentasi resmi Directus (https://docs.directus.io/self-hosted/docker-guide.html#example-docker-compose). Ini versi Penulis:

version: "3"
services:
  database:
    image: postgis/postgis:13-master
    volumes:
      - ./data/database:/var/lib/postgresql/data
    environment:
      POSTGRES_USER: "directus"
      POSTGRES_PASSWORD: "3unYGDVsGQTegF6WgwtRJB5izofXKnMHAPPcJ"
      POSTGRES_DB: "directus"

  cache:
    image: redis:6

  directus:
    image: directus/directus:10.13.1
    ports:
      - 8055:8055
    volumes:
      - ./uploads:/directus/uploads
      # If you want to load extensions from the host
      # - ./extensions:/directus/extensions
    depends_on:
      - cache
      - database
    environment:
      KEY: "be9c1025-6704-4a50-b671-264be913dbfb"
      SECRET: "2685151d-e85c-4894-a3ac-9144b8d82c7e"

      DB_CLIENT: "pg"
      DB_HOST: "database"
      DB_PORT: "5432"
      DB_DATABASE: "directus"
      DB_USER: "directus"
      DB_PASSWORD: "3unYGDVsGQTegF6WgwtRJB5izofXKnMHAPPcJ"

      CACHE_ENABLED: "true"
      CACHE_STORE: "redis"
      REDIS: "redis://cache:6379"

      ADMIN_EMAIL: "aknutman@gmail.com"
      ADMIN_PASSWORD: "wkzjYmXqYwPbB97Aw7ZgkjveekYYm5TeeEkKP"

Gagal upload file

Bila Pembaca sekalian mengalami hal ini, kemungkinan besar hanya karena Permission. Penulis mengekseskusi perintah berikut (saat container sedang berjalan)

docker exec -u root <container-name> chown -R node:node /directus/database /directus/extensions /directus/uploads

Sumber: https://github.com/directus/directus/discussions/6480#discussioncomment-1106735

Penutup

Demikian ringkasan berbagi pengalaman kali ini. Bila ada pertanyaan silakan komen di bawah.

Salam Advance Headless CMS!