dstack project¶
Before the CLI can be used, it must be configured with a project, including a project name, server address, and user token. You can configure multiple projects using the dstack project
CLI command. The configuration is stored in ~/.dstack/config.yml
.
The
dstack server
command automatically creates the defaultmain
project and adds its configuration in~/.dstack/config.yml
.
The dstack project set-default
command can be used to switch between multiple projects.
Environment variable
Alternatively to dstack project set-default
, you can set the DSTACK_PROJECT
environment variable. It overrides the default project set in ~/.dstack/config.yml
.
$ DSTACK_PROJECT=main
$ dstack apply -f examples/.dstack.yml
Also, you can install direnv
to automatically apply environment variables from the .envrc
file in your project directory.
export DSTACK_PROJECT=main
Now, dstack
will always use this project within this directory.
Remember to add .envrc
to .gitignore
to avoid committing it to the repo.
dstack project add¶
This command adds a new project configuration.
$ dstack project add --help
usage: dstack project add [-h] --name NAME --url URL --token TOKEN [-y] [-n]
options:
-h, --help show this help message and exit
--name NAME The name of the project to configure
--url URL Server url
--token TOKEN User token
-y, --yes Don't ask for confirmation (e.g. update the config)
-n, --no Don't ask for confirmation (e.g. do not update the config)
You can find the command on the project’s settings page:
dstack project list¶
This command lists the projects configured on the client.
$ dstack project list --help
usage: dstack project list [-h]
options:
-h, --help show this help message and exit
dstack project set-default¶
This command sets the given project as default.
$ dstack project set-default --help
usage: dstack project set-default [-h] name
positional arguments:
name The name of the project to set as default
options:
-h, --help show this help message and exit
dstack project delete¶
This command deletes the given project configuration.
$ dstack project delete --help
usage: dstack project delete [-h] --name NAME [-y]
options:
-h, --help show this help message and exit
--name NAME The name of the project to delete
-y, --yes Don't ask for confirmation