Skip to content

recipes/directus

View source on GitHub

typescript
import '@catapultjs/deploy/recipes/directus'

This recipe runs the Directus migration and schema tasks on the server. It does not override deploy:update_code, so combine it with a transfer recipe such as git or rsync.

Tasks

TaskInsertedDescription
directus:database:migrateRuns directus database migrate:latest
directus:snapshot:createRuns directus schema snapshot <directus_snapshot_path>
directus:snapshot:applyRuns directus schema apply -y <directus_snapshot_path>

The recipe runs commands from /.

Configuration

KeyTypeDefaultDescription
writable_dirsstring[]['uploads']Directories created in shared/ during cata deploy:setup
shared_dirsstring[]['uploads']Directories symlinked from shared/ into each release
shared_filesstring[]['.env']Files symlinked from shared/ into each release
directus_pathstring''Sub-path to the Directus app within the repository
directus_snapshot_pathstring'./snapshot.yaml'Snapshot file path used by the schema tasks
typescript
import { set } from '@catapultjs/deploy'
import '@catapultjs/deploy/recipes/directus'

set('directus_path', 'apps/cms')
set('directus_snapshot_path', './database/snapshot.yaml')

Run the tasks manually from the terminal:

bash
npx cata task directus:database:migrate
npx cata task directus:snapshot:apply --host staging