mirror of
https://github.com/directus/directus.git
synced 2026-01-24 08:58:11 -05:00
* Add Quickstart Guide * Update installation * Remove unused files * Update support/backing * Tweaks in concepts * Setup file structure for API reference 2.0 * Setup page layout for reference * Add clean-urls plugin * getting started updates * Finish authentication rest * getting started updates * Render stylus in 2 spaces * Various * Various * Finish activity docs * Add collections reference * Add extension reference * concepts updates * Fields/tweaks * Add files doc * Add revisions * concepts docs * More api reference * Finish rest api reference (finally) * initial concepts * More things * Add assets api ref * Move sections from file to assets * Add environment variables * contributing docs * Add field transforms page * Left align table headers * concept links * Add API config * Fix mobile nav * Add migrating a project * doc link fixes Co-authored-by: Ben Haynes <ben@rngr.org>
56 lines
1.7 KiB
Markdown
56 lines
1.7 KiB
Markdown
# Command Line Interface
|
|
|
|
Directus ships with a (small) command line interface (CLI) that you can use for various actions. All functionality can
|
|
be accessed by running `npx directus <command>` in your project folder.
|
|
|
|
[[toc]]
|
|
|
|
## Initialize a New Project
|
|
|
|
```
|
|
npx directus init
|
|
```
|
|
|
|
Will install the required database driver, and create a new `.env` file based on your inputted values.
|
|
|
|
## Bootstrap a Project
|
|
|
|
```
|
|
npx directus bootstrap
|
|
```
|
|
|
|
Will use an existing `.env` file (or existing environment variables) to either install the database (if it's empty) or
|
|
migrate it to the latest version (if it already exists and has missing migrations).
|
|
|
|
This is very useful to use in environments where you're doing standalone automatic deployments, like a multi-container
|
|
Kubernetes configuration, or a similar approach on
|
|
[DigitalOcean App Platform](/guides/installation/digitalocean-app-platform/) or
|
|
[AWS Elastic Beanstalk](/guides/installation/aws/)
|
|
|
|
::: tip First User
|
|
|
|
You can use the `ADMIN_EMAIL` and `ADMIN_PASSWORD` environment variables to automatically provision the first user on
|
|
first creation using the `bootstrap` command. See [Environment Variables](/reference/environment-variables/) for more
|
|
information.
|
|
|
|
:::
|
|
|
|
## Install the Database
|
|
|
|
```
|
|
npx directus database install
|
|
```
|
|
|
|
Installs the Directus system tables on an empty database. Used internally by `bootstrap`
|
|
|
|
## Upgrade the Database
|
|
|
|
```
|
|
npx directus database migrate:latest
|
|
npx directus database migrate:up
|
|
npx directus database migrate:down
|
|
```
|
|
|
|
Migrate the database up/down to match the versions of Directus. Once you update Directus itself, make sure to run
|
|
`npx directus database migrate:latest` (or `npx directus bootstrap`) to update your database.
|