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
Copy file name to clipboardExpand all lines: docs/docs/concepts/services.md
+55Lines changed: 55 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -679,6 +679,61 @@ utilization_policy:
679
679
[`max_price`](../reference/dstack.yml/service.md#max_price), and
680
680
among [others](../reference/dstack.yml/service.md).
681
681
682
+
## Rolling deployment
683
+
684
+
To deploy a new version of a service that is already `running`, use `dstack apply`. `dstack` will automatically detect changes and suggest a rolling deployment update.
685
+
686
+
<div class="termy">
687
+
688
+
```shell
689
+
$ dstack apply -f my-service.dstack.yml
690
+
691
+
Active run my-service already exists. Detected changes that can be updated in-place:
692
+
- Repo state (branch, commit, or other)
693
+
- File archives
694
+
- Configuration properties:
695
+
- env
696
+
- files
697
+
698
+
Update the run? [y/n]:
699
+
```
700
+
701
+
</div>
702
+
703
+
If approved, `dstack` gradually updates the service replicas. To update a replica, `dstack` starts a new replica, waits for it to become `running`, then terminates the old replica. This process is repeated for each replica, one at a time.
704
+
705
+
You can track the progress of rolling deployment in both `dstack apply` or `dstack ps`.
706
+
Older replicas have lower `deployment` numbers; newer ones have higher.
707
+
708
+
<!--
709
+
Not using termy for this example, since the example shows an intermediate CLI state,
710
+
not a completed command.
711
+
-->
712
+
713
+
```shell
714
+
$ dstack apply -f my-service.dstack.yml
715
+
716
+
⠋ Launching my-service...
717
+
NAME BACKEND PRICE STATUS SUBMITTED
718
+
my-service deployment=1 running 11 mins ago
719
+
replica=0 job=0 deployment=0 aws (us-west-2) $0.0026 terminating 11 mins ago
720
+
replica=1 job=0 deployment=1 aws (us-west-2) $0.0026 running 1 min ago
721
+
```
722
+
723
+
The rolling deployment stops when all replicas are updated or when a new deployment is submitted.
724
+
725
+
??? info "Supported properties"
726
+
<!-- NOTE: should be in sync with constants in server/services/runs.py -->
727
+
728
+
Rolling deployment supports changes to the following properties: `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.
729
+
730
+
Changes to `replicas` and `scaling` can be applied without redeploying replicas.
731
+
732
+
Changes to other properties require a full service restart.
733
+
734
+
To trigger a rolling deployment when no properties have changed (e.g., after updating [secrets](secrets.md) or to restart all replicas),
735
+
make a minor config change, such as adding a dummy [environment variable](#environment-variables).
0 commit comments