first commit
This commit is contained in:
commit
24a99557d7
|
|
@ -0,0 +1,6 @@
|
|||
PROJECT_NAME=
|
||||
KEY=
|
||||
SECRET=
|
||||
ADMIN_EMAIL=
|
||||
ADMIN_PASSWORD=
|
||||
PORT=
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
data/
|
||||
uploads/
|
||||
*.sql
|
||||
.env
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
# 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 .`
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
version: "3"
|
||||
services:
|
||||
database:
|
||||
container_name: ${PROJECT_NAME}_Directus_DB
|
||||
image: mariadb:10
|
||||
volumes:
|
||||
- ./data:/var/lib/mysql
|
||||
environment:
|
||||
- MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1
|
||||
- MARIADB_USER=directus
|
||||
- MARIADB_PASSWORD=directus
|
||||
- MARIADB_DB=directus
|
||||
|
||||
cache:
|
||||
container_name: ${PROJECT_NAME}_Directus_Cache
|
||||
image: redis:6
|
||||
|
||||
directus:
|
||||
container_name: ${PROJECT_NAME}_Directus
|
||||
image: directus/directus:latest
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- ${PORT}:8055
|
||||
volumes:
|
||||
- ./uploads:/directus/uploads
|
||||
depends_on:
|
||||
- cache
|
||||
- database
|
||||
environment:
|
||||
KEY: ${SECRET}
|
||||
SECRET: ${KEY}
|
||||
|
||||
LOG_LEVEL: 'debug'
|
||||
|
||||
DB_CLIENT: "mysql"
|
||||
DB_HOST: "database"
|
||||
DB_PORT: "3306"
|
||||
DB_DATABASE: "directus"
|
||||
DB_USER: "directus"
|
||||
DB_PASSWORD: "directus"
|
||||
|
||||
CACHE_ENABLED: "true"
|
||||
CACHE_STORE: "redis"
|
||||
REDIS: "redis://cache:6379"
|
||||
|
||||
ADMIN_EMAIL: ${ADMIN_EMAIL}
|
||||
ADMIN_PASSWORD: ${ADMIN_PASSWORD}
|
||||
|
||||
PUBLIC_URL: http://localhost:${PORT}
|
||||
|
||||
CORS_ENABLED: true
|
||||
CORS_ORIGIN: true
|
||||
|
||||
CACHE_AUTO_PURGE: true
|
||||
Loading…
Reference in New Issue