You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Drop Configurator.get_default_configs()
* Replace get_config_values with validate_config
Breaking change: drop /api/backends/config_values endpoint
* Test validate_config
* Make Configurator not to depend on server models
* Pass default_creds_enabled to Configurator.validate_config()
* Move configurators to core
* Test OCIConfigurator.validate_config()
* Move backend models to backend dir
* Unify API and YAML backend config models
* Move _CONFIGURATOR_CLASSES to core
* Include project_id and backend_id in StoredBackendRecord to support external configurators working with db models
* Reflect configurator/models refactoring in the backends guide
* Handle no Kubernetes networking config
* docs: update backend types in config.yml documentation
* feat: add Nebius, RunPod and DataCrunch backend configurations
* Fix server/config.yml schema references
* Clean up old Azure config
* Update src/dstack/_internal/core/backends/base/configurator.py
Co-authored-by: jvstme <36324149+jvstme@users.noreply.github.com>
* Document that Configurator.create_backend() can do extra validation
---------
Co-authored-by: jvstme <36324149+jvstme@users.noreply.github.com>
Add any dependencies required by your cloud provider to `setup.py`. Create a separate section with the provider's name for
92
-
these dependencies, and ensure that you update the `all` section to include them as well.
91
+
Add any dependencies required by your cloud provider to `setup.py`. Create a separate section with the provider's name for these dependencies, and ensure that you update the `all` section to include them as well.
93
92
94
93
#### 2.4. Implement the provider backend
95
94
@@ -100,20 +99,20 @@ Use the name of the provider.
100
99
101
100
Then create a database [migration](MIGRATIONS.md) to reflect the new enum member.
102
101
103
-
##### 2.4.2. Create the provider directory
102
+
##### 2.4.2. Create the backend directory
104
103
105
104
Create a new directory under `src/dstack/_internal/core/backends` with the name of the backend type.
106
105
107
106
##### 2.4.3. Create the backend class
108
107
109
-
Under the backend directory you've created, create the `__init__.py` file and define the
108
+
Under the backend directory you've created, create the `backend.py` file and define the
110
109
backend class there (should extend `dstack._internal.core.backends.base.Backend`).
[azure](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/core/backends/azure/config.py), etc.
163
-
164
-
##### 2.4.7. Import config model classes
165
-
166
-
Ensure the config model classes are imported
167
-
into [`src/dstack/_internal/core/models/backends/__init__.py`](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/core/models/backends/__init__.py).
144
+
The models should be added to `AnyBackendConfig*` unions in [`src/dstack/_internal/core/backends/models.py`](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/core/backends/models.py).
168
145
169
-
##### 2.4.8. Create the configurator class
146
+
It's not required but recommended to define `*BackendStoredConfig` that extends `*BackendConfig` to be able to store extra parameters in the DB. By the same logic, it's recommended to define `*Config` that extends `*BackendStoredConfig` with creds and use it as the main `Backend` and `Compute` config instead of using `*BackendConfigWithCreds` directly.
170
147
171
-
Create the file with the backend name under `src/dstack/_internal/server/services/backends/configurators`(https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/server/services/backends/configurators)
172
-
and define the backend configurator class (must extend `dstack._internal.server.services.backends.configurators.base.Configurator`).
173
-
174
-
Refer to examples: [datacrunch](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/server/services/backends/configurators/datacrunch.py),
[azure](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/core/backends/models.py), etc.
178
153
179
-
##### 2.4.9. Create the server config class
154
+
##### 2.4.6. Create and register the configurator class
180
155
181
-
In [`src/dstack/_internal/server/services/config.py`](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/server/services/config.py),
182
-
define the corresponding server config class (that represents the `~/.dstack/server/config.yml` file),
183
-
and add it to `AnyBackendConfig` (in the same file).
156
+
Under the backend directory, create the `configurator.py` file and and define the backend configurator class (must extend `dstack._internal.core.backends.base.configurator.Configurator`).
184
157
185
-
##### 2.4.10. Add safe imports
158
+
Refer to examples: [datacrunch](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/core/backends/datacrunch/configurator.py),
[azure](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/core/backends/azure/configurator.py), etc.
186
162
187
-
In [`src/dstack/_internal/server/services/backends/__init__.py`](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/server/services/backends/__init__.py),
188
-
add the `try`/`except` block that imports the backend configurator and appends it to `_CONFIGURATOR_CLASSES`.
163
+
Register configurator by appending it to `_CONFIGURATOR_CLASSES` in [`src/dstack/_internal/core/backends/configurators.py`](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/core/backends/configurators.py).
0 commit comments