This is a boilerplate project for your directus installations. Just fork it!
Expect to update windows, WSL2 and Docker!
- Docker 3.3.3 (Engine 20.x) in WSL2 mode
- WSL2 (Ubuntu or Debian)
- Windows 10 1909
- WSL2 (Ubuntu or Debian)
- sh (msys/gitbash, or actual)
- Clone the repo
- Set environment variables
- Copy the default
<project-path>/sample.envto<project-path>/.env - Make changes to
<project-path>/.envto suit your needs (in particular your personal secrets)
- Copy the default
With sh from inside <project-path>:
git clone git@repos.m-box.de:cms/directs-cms-boilerplate.git
cd directus-container
cp sample.env .envOr use other tools of your choice for the same effect.
With sh/cmd/ps inside <project-path>/directus-container:
Start the container-stack
docker compose up -dSoft Stop/Restart the container stack (without loosing state)
docker compose stopdocker compose restartHard Stop of the container stack (will loose all non-persistent state). This is required if the database should be re-initialized via /db-init/init.sql
docker compose down -vRevert the container to the last database export. CAUTION: Only works when used together with Sharing Database Changes described below.
- Remove the container stack
- Start the container stack
When committing/pushing a change to db-init/init.sql or cli-data/** or directus-data/**, everyone else on the branch will also have to use that state! Make sure this is intended and consistent!
With sh inside <project-path> while the container stack is up (shows green in Docker Desktop):
docker compose exec db pg_dump --user=directus --column-inserts --clean --if-exists --format=plain --dbname=directus > db-dump/dump_$(date +%d-%m-%y_%H%M%S).sqlOn Windows just double-click on
./dump_db.batThis dumps the database into a SQL-file at <project-path>/db-dump/dump_<TIMESTAMP>.sql to initialize the container (i.e. start the container) with that state, copy it to <project-path>/db-init/init.sql, overwriting any existing file.
cp ./db-dump/dump_<TIMESTAMP>.sql ./db-init/init.sqlThen just commit your changes. Dumps left in <project-path>/db-dump will not affect the container state.
Access admin UI at http://:8055 or form a different machine http://<hostname>:8055
Login: admin@user.com
Most known problems are solved by updating the required software (listed above) and restarting windows.
PROBLEM docker crashes on startup on windows with some sort of "logon" failure
FIX run gpupdate /force in with cmd, then use the container as normal.
PROBLEM docker will not start because of some sort of "virtualization" failure PROBLEM WSL2 won't work FIX ensure virtualization is enabled in BIOS and as a system feature in Windows (google how to do that)
PROBLEM docker compose up -d doesn't work because of "Duplicate mount point" or some such.
FIX run docker compose down and/or docker compose rm -fsv, then use container as normal again.