/directus-docker-compose

This is a boilerplate for self hosting Directus on Docker Compose. It uses Nginx as a reverse proxy and Let's Encrypt to provide SSL certificates.

Primary LanguageShellMIT LicenseMIT

Self Host Directus on Docker Compose with SSL certificates provided by Let's Encrypt

Use this boilerplate at your own risk, not intended for production use.


This is a boilerplate for self hosting Directus on Docker Compose. It uses Nginx as a reverse proxy and Let's Encrypt to provide SSL certificates.

It is based on the official Directus Docker image and the Nginx Docker image.

The certbot configuration is taken from the nginx-certbot repository and the original article it's worth a read if you want to dive deeper: Nginx and Let’s Encrypt with Docker in Less Than 5 Minutes.

The script to validate the nginx configuration is taken from this article.


Prerequisites

You need to have Docker and Docker Compose installed on your machine.


Getting Started

clone this repo and edit the docker-compose.yml and the nginx/default.conf files to your needs.

# provision certificates
./init-letsencrypt.sh

# test nginx configuration
./test-nginx.sh

# start the containers
docker-compose up -d

Contributing

Feel free to open an issue or submit a pull request.

Things I would like to add:

  • Make Certbot optional, to work in development and simplify testing the setup
  • Add a script to automate the initial configuration
  • Add a script to select the directus extensions to install
  • Support other services like Laradock
  • Add Rsync scripts to easily move configuration and data between different hosts

Author

License

This project is open source and available under the MIT License.

Useful Commands

# start the containers
docker-compose up -d

# stop the containers
docker-compose down

# rebuild the containers
docker-compose up -d --build

# list containers
docker ps

# list all containers
docker ps -a

# list images
docker images

# list volumes
docker volume ls

# remove all containers
docker rm $(docker ps -a -q)

# remove all images
docker rmi $(docker images -q)

# remove all volumes
docker volume rm $(docker volume ls -q)

# remove all unused containers, volumes, networks and images
docker system prune