Skip to content

Commit 3bed07a

Browse files
Document repos (#3026)
1 parent 8505528 commit 3bed07a

File tree

9 files changed

+264
-188
lines changed

9 files changed

+264
-188
lines changed

docs/docs/concepts/dev-environments.md

Lines changed: 63 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,7 @@ If you don't assign a value to an environment variable (see `HF_TOKEN` above),
296296

297297
### Files
298298

299-
If you configured a [repo](repos.md), `dstack` automatically mounts its content (incl. your local changes) inside the container.
300-
301-
In some cases, you don’t need to mount an entire repo and can mount only specific directories. This can be done using
302-
[`files`](../reference/dstack.yml/task.md#_files) instead of repos.
299+
Sometimes, when you run a dev environment, you may want to mount local files. This is possible via the [`files`](../reference/dstack.yml/task.md#_files) property. Each entry maps a local directory or file to a path inside the container.
303300

304301
<div editor-title="examples/.dstack.yml">
305302

@@ -316,12 +313,10 @@ ide: vscode
316313
317314
</div>
318315
319-
Each entry maps a local directory or file to a path inside the container. Both local and container paths can be relative or absolute.
320-
321-
- If the local path is relative, it’s resolved relative to the configuration file.
322-
- If the container path is relative, it’s resolved relative to `/workflow`.
316+
If the local path is relative, it’s resolved relative to the configuration file.
317+
If the container path is relative, it’s resolved relative to `/workflow`.
323318

324-
The container path is optional. If not specified, it will be automatically calculated.
319+
The container path is optional. If not specified, it will be automatically calculated:
325320

326321
<div editor-title="examples/.dstack.yml">
327322

@@ -338,25 +333,71 @@ ide: vscode
338333
339334
</div>
340335
341-
Note: If you want to use `files` without mounting the entire repo directory,
342-
make sure to pass `--no-repo` when running `dstack apply`:
336+
??? info "Upload limit and excludes"
337+
Whether its a file or folder, each entry is limited to 2MB. To avoid exceeding this limit, make sure to exclude unnecessary files
338+
by listing it via `.gitignore` or `.dstackignore`.
339+
The 2MB upload limit can be increased by setting the `DSTACK_SERVER_CODE_UPLOAD_LIMIT` environment variable.
343340

344-
<div class="termy">
341+
### Repos
345342

346-
```shell
347-
$ dstack apply -f examples/.dstack.yml --no-repo
343+
Sometimes, you may want to mount an entire Git repo inside the container.
344+
345+
Imagine you have a cloned Git repo containing an `examples` subdirectory with a `.dstack.yml` file:
346+
347+
<div editor-title="examples/.dstack.yml">
348+
349+
```yaml
350+
type: dev-environment
351+
name: vscode
352+
353+
repos:
354+
# Mounts the parent directory of `examples` (must be a Git repo)
355+
# to `/workflow` (the default working directory)
356+
- ..
357+
358+
ide: vscode
348359
```
349360
350361
</div>
351362
352-
??? info ".gitignore and .dstackignore"
353-
If you configured a [repo](repos.md) or [files](#files), `dstack` excludes files and folders listed in `.gitignore` and `.dstackignore`.
354-
355-
Uploads are limited to 2MB. To avoid exceeding this limit, make sure to exclude unnecessary files.
356-
You can increase the default server limit by setting the `DSTACK_SERVER_CODE_UPLOAD_LIMIT` environment variable.
363+
When you run it, `dstack` fetches the repo on the instance, applies your local changes, and mounts it—so the container matches your local repo.
364+
365+
The local path can be either relative to the configuration file or absolute.
366+
367+
??? info "Path"
368+
Currently, `dstack` always mounts the repo to `/workflow` inside the container. It's the default working directory.
369+
Starting with the next release, it will be possible to specify a custom container path.
370+
371+
??? info "Local diff limit and excludes"
372+
The local diff size is limited to 2MB. To avoid exceeding this limit, exclude unnecessary files
373+
via `.gitignore` or `.dstackignore`.
374+
The 2MB local diff limit can be increased by setting the `DSTACK_SERVER_CODE_UPLOAD_LIMIT` environment variable.
375+
376+
??? info "Repo URL"
377+
Sometimes you may want to mount a Git repo without cloning it locally. In this case, simply provide a URL in `repos`:
378+
379+
<div editor-title="examples/.dstack.yml">
380+
381+
```yaml
382+
type: dev-environment
383+
name: vscode
384+
385+
repos:
386+
# Clone the specified repo to `/workflow` (the default working directory)
387+
- https://github.com/dstackai/dstack
388+
389+
ide: vscode
390+
```
391+
392+
</div>
393+
394+
??? info "Private repos"
395+
If a Git repo is private, `dstack` will automatically try to use your default Git credentials (from
396+
`~/.ssh/config` or `~/.config/gh/hosts.yml`).
397+
398+
If you want to use custom credentials, you can provide them with [`dstack init`](../reference/cli/dstack/init.md).
357399

358-
!!! warning "Experimental"
359-
The `files` feature is experimental. Feedback is highly appreciated.
400+
> Currently, you can configure up to one repo per run configuration.
360401

361402
### Retry policy
362403

@@ -534,5 +575,5 @@ via the [`spot_policy`](../reference/dstack.yml/dev-environment.md#spot_policy)
534575
--8<-- "docs/concepts/snippets/manage-runs.ext"
535576

536577
!!! info "What's next?"
537-
1. Read about [tasks](tasks.md), [services](services.md), and [repos](repos.md)
578+
1. Read about [tasks](tasks.md) and [services](services.md)
538579
2. Learn how to manage [fleets](fleets.md)

docs/docs/concepts/repos.md

Lines changed: 0 additions & 94 deletions
This file was deleted.

docs/docs/concepts/services.md

Lines changed: 89 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -588,12 +588,7 @@ resources:
588588

589589
### Files
590590

591-
By default, `dstack` automatically mounts the [repo](repos.md) directory where you ran `dstack init` to any run configuration.
592-
593-
If you configured a [repo](repos.md), `dstack` automatically mounts its content (incl. your local changes) inside the container.
594-
595-
In some cases, you don’t need to mount an entire repo and can mount only specific directories. This can be done using
596-
[`files`](../reference/dstack.yml/task.md#_files) instead of repos.
591+
Sometimes, when you run a service, you may want to mount local files. This is possible via the [`files`](../reference/dstack.yml/task.md#_files) property. Each entry maps a local directory or file to a path inside the container.
597592

598593
<!-- TODO: Add a more relevant example -->
599594

@@ -625,14 +620,12 @@ resources:
625620
626621
Each entry maps a local directory or file to a path inside the container. Both local and container paths can be relative or absolute.
627622
628-
- If the local path is relative, it’s resolved relative to the configuration file.
629-
- If the container path is relative, it’s resolved relative to `/workflow`.
623+
If the local path is relative, it’s resolved relative to the configuration file. If the container path is relative, it’s resolved relative to `/workflow`.
630624

631625
The container path is optional. If not specified, it will be automatically calculated.
632626

633627
<!-- TODO: Add a more relevant example -->
634628

635-
636629
<div editor-title="examples/.dstack.yml">
637630

638631
```yaml
@@ -659,27 +652,99 @@ resources:
659652
660653
</div>
661654
662-
Note: If you want to use `files` without mounting the entire repo directory,
663-
make sure to pass `--no-repo` when running `dstack apply`:
655+
??? info "Upload limit and excludes"
656+
Whether its a file or folder, each entry is limited to 2MB. To avoid exceeding this limit, make sure to exclude unnecessary files
657+
by listing it via `.gitignore` or `.dstackignore`.
658+
The 2MB upload limit can be increased by setting the `DSTACK_SERVER_CODE_UPLOAD_LIMIT` environment variable.
664659

665-
<div class="termy">
660+
### Repos
666661

667-
```shell
668-
$ dstack apply -f examples/.dstack.yml --no-repo
662+
Sometimes, you may want to mount an entire Git repo inside the container.
663+
664+
Imagine you have a cloned Git repo containing an `examples` subdirectory with a `.dstack.yml` file:
665+
666+
<!-- TODO: Add a more relevant example -->
667+
668+
<div editor-title="examples/.dstack.yml">
669+
670+
```yaml
671+
type: service
672+
name: llama-2-7b-service
673+
674+
repos:
675+
# Mounts the parent directory of `examples` (must be a Git repo)
676+
# to `/workflow` (the default working directory)
677+
- ..
678+
679+
python: 3.12
680+
681+
env:
682+
- HF_TOKEN
683+
- MODEL=NousResearch/Llama-2-7b-chat-hf
684+
commands:
685+
- uv pip install vllm
686+
- python -m vllm.entrypoints.openai.api_server --model $MODEL --port 8000
687+
port: 8000
688+
689+
resources:
690+
gpu: 24GB
669691
```
670692
671693
</div>
672694
673-
??? info ".gitignore and .dstackignore"
674-
If you configured a [repo](repos.md) or [files](#files), `dstack` excludes files and folders listed in `.gitignore` and `.dstackignore`.
675-
676-
Uploads are limited to 2MB. To avoid exceeding this limit, make sure to exclude unnecessary files.
677-
You can increase the default server limit by setting the `DSTACK_SERVER_CODE_UPLOAD_LIMIT` environment variable.
695+
When you run it, `dstack` fetches the repo on the instance, applies your local changes, and mounts it—so the container matches your local repo.
678696

697+
The local path can be either relative to the configuration file or absolute.
698+
699+
??? info "Path"
700+
Currently, `dstack` always mounts the repo to `/workflow` inside the container. It's the default working directory.
701+
Starting with the next release, it will be possible to specify a custom container path.
702+
703+
??? info "Local diff limit and excludes"
704+
The local diff size is limited to 2MB. To avoid exceeding this limit, exclude unnecessary files
705+
via `.gitignore` or `.dstackignore`.
706+
The 2MB local diff limit can be increased by setting the `DSTACK_SERVER_CODE_UPLOAD_LIMIT` environment variable.
707+
708+
??? info "Repo URL"
709+
710+
Sometimes you may want to mount a Git repo without cloning it locally. In this case, simply provide a URL in `repos`:
711+
712+
<!-- TODO: Add a more relevant example -->
713+
714+
<div editor-title="examples/.dstack.yml">
715+
716+
```yaml
717+
type: service
718+
name: llama-2-7b-service
719+
720+
repos:
721+
# Clone the specified repo to `/workflow` (the default working directory)
722+
- https://github.com/dstackai/dstack
723+
724+
python: 3.12
725+
726+
env:
727+
- HF_TOKEN
728+
- MODEL=NousResearch/Llama-2-7b-chat-hf
729+
commands:
730+
- uv pip install vllm
731+
- python -m vllm.entrypoints.openai.api_server --model $MODEL --port 8000
732+
port: 8000
733+
734+
resources:
735+
gpu: 24GB
736+
```
737+
738+
</div>
739+
740+
??? info "Private repos"
741+
If a Git repo is private, `dstack` will automatically try to use your default Git credentials (from
742+
`~/.ssh/config` or `~/.config/gh/hosts.yml`).
743+
744+
If you want to use custom credentials, you can provide them with [`dstack init`](../reference/cli/dstack/init.md).
745+
746+
> Currently, you can configure up to one repo per run configuration.
679747

680-
!!! warning "Experimental"
681-
The `files` feature is experimental. Feedback is highly appreciated.
682-
683748
### Retry policy
684749

685750
By default, if `dstack` can't find capacity, or the service exits with an error, or the instance is interrupted, the run will fail.
@@ -858,7 +923,7 @@ The rolling deployment stops when all replicas are updated or when a new deploym
858923
??? info "Supported properties"
859924
<!-- NOTE: should be in sync with constants in server/services/runs.py -->
860925

861-
Rolling deployment supports changes to the following properties: `port`, `probes`, `resources`, `volumes`, `docker`, `files`, `image`, `user`, `privileged`, `entrypoint`, `working_dir`, `python`, `nvcc`, `single_branch`, `env`, `shell`, `commands`, as well as changes to [repo](repos.md) or [file](#files) contents.
926+
Rolling deployment supports changes to the following properties: `port`, `probes`, `resources`, `volumes`, `docker`, `files`, `image`, `user`, `privileged`, `entrypoint`, `working_dir`, `python`, `nvcc`, `single_branch`, `env`, `shell`, `commands`, as well as changes to [repo](#repos) or [file](#files) contents.
862927

863928
Changes to `replicas` and `scaling` can be applied without redeploying replicas.
864929

@@ -870,7 +935,7 @@ The rolling deployment stops when all replicas are updated or when a new deploym
870935
--8<-- "docs/concepts/snippets/manage-runs.ext"
871936

872937
!!! info "What's next?"
873-
1. Read about [dev environments](dev-environments.md), [tasks](tasks.md), and [repos](repos.md)
938+
1. Read about [dev environments](dev-environments.md) and [tasks](tasks.md)
874939
2. Learn how to manage [fleets](fleets.md)
875940
3. See how to set up [gateways](gateways.md)
876941
4. Check the [TGI :material-arrow-top-right-thin:{ .external }](../../examples/inference/tgi/index.md){:target="_blank"},

0 commit comments

Comments
 (0)