-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update to latest directus; replace rbac sync with schema-sync ++
- Loading branch information
Showing
65 changed files
with
21,045 additions
and
24,583 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,12 +15,12 @@ | |
# IP or host the API listens on ["0.0.0.0"] | ||
HOST="0.0.0.0" | ||
|
||
# The port Directus will run on [8080] | ||
PORT=8080 | ||
# The port Directus will run on [8055] | ||
PORT=8055 | ||
|
||
# The URL where your API can be reached on the web. It is also used for things like OAuth redirects, | ||
# forgot-password emails, and logos that needs to be publicly available on the internet. ["/"] | ||
PUBLIC_URL="http://localhost:8080" | ||
PUBLIC_URL="http://localhost:8055" | ||
|
||
# What level of detail to log. [info] | ||
# "fatal", "error", "warn", "info", "debug", "trace", "silent" | ||
|
@@ -46,8 +46,10 @@ LOG_LEVEL="debug" | |
ADMIN_EMAIL="[email protected]" | ||
ADMIN_PASSWORD="admin" | ||
|
||
# RBAC Sync setting can either be "FULL | EXPORT | IMPORT | NONE" | ||
RBAC_SYNC_MODE=FULL | ||
# SCHEMA Sync setting can either be "BOTH | EXPORT | IMPORT | NONE" | ||
SCHEMA_SYNC=BOTH | ||
# Additional config file for SCHEMA Sync | ||
#SCHEMA_SYNC_CONFIG=custom_config.js | ||
|
||
#################################################################################################### | ||
### Database | ||
|
@@ -57,11 +59,11 @@ RBAC_SYNC_MODE=FULL | |
# you need to pass to the database instance. | ||
|
||
DB_CLIENT="pg" | ||
DB_HOST="postgres-db" | ||
DB_HOST="localhost" | ||
DB_PORT="5432" | ||
DB_DATABASE="directus-app" | ||
DB_USER="postgres-admin" | ||
DB_PASSWORD="password" | ||
DB_DATABASE="directus" | ||
DB_USER="postgres" | ||
DB_PASSWORD="postgrespw" | ||
DB_SSL="false" | ||
|
||
# These match the databases defined in the docker-compose file in the root of this repo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ node_modules/ | |
.idea/ | ||
|
||
#PostgreSQL local files | ||
data/ | ||
/data/ | ||
|
||
# SQLite local files | ||
*.db | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,16 +2,18 @@ | |
|
||
A boilerplate for using Directus with best practices inside BCC. | ||
|
||
## Setup locally (useing docker) | ||
## Setup locally (using docker) | ||
|
||
1. Clone the repo | ||
2. Create `.env` file. You can copy example by `cp env.example .env` | ||
3. Install dependencies by `npm install` | ||
4. Need to prepare shared to be used by docker `cd shared && npm run build` | ||
5. Run services by `docker compose up -d` | ||
6. When you run application for the first time, run `npm run dk-init`. | ||
2. (optional) Create a 1Password Vault or get access to one that contains the secrets you need to run this app locally. | ||
3. Adjust `local.env` file if needed. You can get inspiration from `.env.example`. Add secrets in form of 1Password references. | ||
4. Install dependencies by `npm install` | ||
5. Need to prepare `shared` to be used by Directus `cd shared && npm install && npm run build` | ||
6. Start database with `docker compose up -d` | ||
7. When you run application for the first time, run `npm run init`. | ||
8. Run `npm run local` to run locally | ||
|
||
Initial admin user is: `[email protected] | admin` | ||
Initial admin user is: `[email protected] | 12345678`. | ||
|
||
## Documentation | ||
|
||
|
@@ -36,16 +38,21 @@ There is a problem with `@Query` annotation when query is an object. In that cas | |
|
||
### Seeding data to database | ||
|
||
Command: `npm run seed` | ||
The command `npm run init` will import test data prefixed with `testdata__` from `schema-sync/data` folder. | ||
|
||
Look at example under `database/seeds/src/index.ts`. | ||
Look at configuration file in `schema-sync/local_config.js`. | ||
|
||
Using knex to seed database. | ||
It syncs `directus_users` table, but only the admin user. This is needed in order to get a Directus instance with an admin user available. | ||
It syncs `todo_lists` and `todo_items` test tables. These can be removed and replaced with whatever tables are needed. | ||
|
||
### RBAC sync | ||
Documentation for schema-sync extension can be found here <https://github.com/bcc-code/directus-schema-sync> | ||
|
||
In the `.env` file, set the RBAC synchronization mode before database initialization to: `RBAC_SYNC_MODE=EXPORT` | ||
### Testing the Docker container locally | ||
|
||
If the database is already initialized, you can set it to: `RBAC_SYNC_MODE=FULL` | ||
Run `docker build -t test-directus -f Dockerfile.prod .` to build the test image. | ||
|
||
Otherwise, you may run into problems initializing the app. | ||
Copy `.env.example` to `dockertest.env` and change `DB_HOST` to `host.docker.internal`. | ||
|
||
Run `docker run -v "%cd%/dockertest.env:/home/node/app/.env" --name directustest -dp 127.0.0.1:8055:8055 test-directus` to run the image. | ||
|
||
To cleanup run `docker stop directustest && docker rm directustest && docker image rm test-directus` |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.