Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
The `dstack` plugin system allows extending `dstack` server functionality using external Python packages.

!!! info "Experimental"
Plugins are currently an _experimental_ feature.
Backward compatibility is not guaranteed across releases.
Plugins are currently an experimental feature. Backward compatibility is not guaranteed across releases.

## Enable plugins

To enable a plugin, list it under `plugins` in [`server/config.yml`](../reference/server/config.yml.md):
To enable a plugin, list it under `plugins` in [`server/config.yml`](../../server/config.yml.md):

<div editor-title="server/config.yml">

Expand All @@ -24,7 +23,7 @@ projects:

On the next server restart, you should see a log message indicating that the plugin is loaded.

## Create plugins
## Create a plugin

To create a plugin, create a Python package that implements a subclass of
`dstack.plugins.Plugin` and exports this subclass as a "dstack.plugins" entry point.
Expand Down Expand Up @@ -61,7 +60,7 @@ To create a plugin, create a Python package that implements a subclass of

</div>

3. Specify a "dstack.plugins" entry point in `pyproject.toml`:
3. Specify a `"dstack.plugins"` entry point in `pyproject.toml`:

<div editor-title="pyproject.toml">

Expand All @@ -74,10 +73,9 @@ To create a plugin, create a Python package that implements a subclass of

Then you can install the plugin package into your Python environment and enable it via `server/config.yml`.

??? info "Plugins in Docker"
??? info "Docker"
If you deploy `dstack` using a Docker image you can add plugins either
by including them in your custom image built upon the `dstack` server image,
or by mounting installed plugins as volumes.
by including them in your custom image built upon the `dstack` [server image :material-arrow-top-right-thin:{ .external }](https://github.com/dstackai/dstack/tree/master/docker/server){:target="_blank"}, or by mounting installed plugins as volumes.

## Apply policies

Expand Down Expand Up @@ -113,9 +111,9 @@ class ExamplePolicy(ApplyPolicy):

</div>

## Built-in Plugins
## Built-in plugins

### REST Plugin
### REST plugin

`rest_plugin` is a builtin `dstack` plugin that allows writing your custom plugins as API servers, so you don't need to install plugins as Python packages.

Expand All @@ -125,4 +123,4 @@ Plugins implemented as API servers have advantages over plugins implemented as P
* You can use any programming language.
* If you run the `dstack` server via Docker, you don't need to extend the `dstack` server image with plugins or map them via volumes.

To get started, check out the [plugin server example](https://github.com/dstackai/dstack/tree/master/examples/plugins/example_plugin_server). The `rest_plugin` server API is documented [here](../reference/plugins/rest_plugin/index.md).
To get started, check out the [plugin server example :material-arrow-top-right-thin:{ .external }](https://github.com/dstackai/dstack/tree/master/examples/plugins/example_plugin_server){:target="_blank"}. The `rest_plugin` server API is documented [here](../../plugins/rest/index.md).
6 changes: 3 additions & 3 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ nav:
- Troubleshooting: docs/guides/troubleshooting.md
- Metrics: docs/guides/metrics.md
- Protips: docs/guides/protips.md
- Plugins: docs/guides/plugins.md
- Reference:
- .dstack.yml:
- dev-environment: docs/reference/dstack.yml/dev-environment.md
Expand All @@ -245,7 +244,6 @@ nav:
- gateway: docs/reference/dstack.yml/gateway.md
- volume: docs/reference/dstack.yml/volume.md
- server/config.yml: docs/reference/server/config.yml.md
- .dstack/profiles.yml: docs/reference/profiles.yml.md
- CLI:
- dstack server: docs/reference/cli/dstack/server.md
- dstack init: docs/reference/cli/dstack/init.md
Expand All @@ -266,8 +264,10 @@ nav:
- Python API: docs/reference/api/python/index.md
- REST API: docs/reference/api/rest/index.md
- Environment variables: docs/reference/environment-variables.md
- .dstack/profiles.yml: docs/reference/profiles.yml.md
- Plugins:
- REST Plugin API: docs/reference/plugins/rest_plugin/index.md
- Python API: docs/reference/plugins/python/index.md
- REST API: docs/reference/plugins/rest/index.md
- Examples:
- examples.md
- Single-node training:
Expand Down