1.1 KiB
Directus on Mariadb running with Docker for local development
Run
Create the .env file following .env.example.
To generate the SECRET and KEY
head -c 16 /dev/urandom | od -An -tx1 | tr -d ' \n'
docker-compose up -d
On first launch, create the DB
A few troubles to run Directus with Docker on MariaDB instead of Postgresql, so we have to create the DB manually on the first launch.
docker exec -it PROJECTNAME_Directus_DB /bin/bash
mariadb -u root
CREATE DATABASE directus;
GRANT ALL PRIVILEGES ON directus.* TO 'directus'@'%';
FLUSH PRIVILEGES;
exit;
exit
Import an exported DB
docker cp db_export.sql PROJECTNAME_Directus_DB:/root/
docker exec -it PROJECTNAME_Directus_DB /bin/bash
mariadb -u root
drop database directus;
create database directus;
exit;
mariadb -uroot directus < /root/db_export.sql
exit
docker exec -it PROJECTNAME_Directus_DB /bin/sh
npx directus database migrate:latest
Export data model
docker exec -it PROJECTNAME_Directus /bin/sh
npx directus schema snapshot ./snapshot.yaml
exit
docker cp PROJECTNAME_Directus:/directus/snapshot.yaml .