Skip to content

Commit c69f15e

Browse files
authored
Deployments and V Control (windmill-labs#457)
1 parent 5749b44 commit c69f15e

File tree

24 files changed

+347
-132
lines changed

24 files changed

+347
-132
lines changed

blog/2023-09-04-kahoot-testimonial/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ I began working with Windmill at the start of the year. It currently supports in
3434

3535
## Choosing Windmill for Flexibility
3636

37-
Our team faced some challenges such as constrains on the tech stack. Some tools, such as [Stripe Billing](https://stripe.com/en-fr/billing), prove most effective when your business rules align precisely with their predefined criteria. However, we encountered challenges, including a maximum billing period of one year and the absence of a straightforward method for implementing Consumer Price Index increases. While it's possible to find workarounds, this essentially involves accommodating the limitations and not truly enjoying a comfortable solution. On the other hand, tools like <a href="https://zapier.com/" rel="nofollow">Zapier</a> offer simplicity in their initial use, yet they are more tailored for marketing teams and can become frustrating to iterate upon and build large scale workflows. Easy things are hard (line items - I'm looking at you), and you do not have the code in [git / version control](/docs/advanced/deploy_gh_gl) systems.
37+
Our team faced some challenges such as constraints on the tech stack. Some tools, such as [Stripe Billing](https://stripe.com/en-fr/billing), prove most effective when your business rules align precisely with their predefined criteria. However, we encountered challenges, including a maximum billing period of one year and the absence of a straightforward method for implementing Consumer Price Index increases. While it's possible to find workarounds, this essentially involves accommodating the limitations and not truly enjoying a comfortable solution. On the other hand, tools like <a href="https://zapier.com/" rel="nofollow">Zapier</a> offer simplicity in their initial use, yet they are more tailored for marketing teams and can become frustrating to iterate upon and build large scale workflows. Easy things are hard (line items - I'm looking at you), and you do not have the code in [git / version control](/docs/advanced/version_control) systems.
3838

3939
Since we had our own use cases, we needed a flexible solution to create our internal tools.
4040

blog/2023-11-23-3-global-css/Index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Choose a class and apply CSS to it. Then, from the "Theme" menu, save your confi
7474

7575
You can also transfer the configuration defined on a component to the global level, affecting all components of that type.
7676

77-
The Global CSS Editor is a feature exclusive to [Cloud & Enterprise Self-Hosted](/pricing).
77+
The Global CSS Editor is a feature exclusive to [Cloud and Self-Hosted Enterprise Edition](/pricing).
7878

7979
## Learn more
8080

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
canonical_url: /docs/advanced/cli/sync
3+
---
4+
5+
import DocCard from '@site/src/components/DocCard';
6+
7+
# CLI Sync
8+
9+
You can use Windmill CLI to sync workspace to a git repository. Either with raw syncing using `wmill sync pull --raw` & `wmill sync push --raw` or with stateful syncing using `wmill sync pull` & `wmill sync push`.
10+
11+
For more details, see:
12+
13+
<div class="grid grid-cols-2 gap-6 mb-4">
14+
<DocCard
15+
title="Command-Line Interface - Sync"
16+
description="Synchronize folders & git repositories to a Windmill instance"
17+
href="/docs/advanced/cli/sync"
18+
/>
19+
</div>
20+
21+
For options to do Version Control on Windmill, see:
22+
23+
<div class="grid grid-cols-2 gap-6 mb-4">
24+
<DocCard
25+
title="Version Control in Windmill"
26+
description="Sync your workspace to a git repository."
27+
href="/docs/advanced/version_control"
28+
/>
29+
</div>
30+
31+
For options to do Deploy to Prod on Windmill, see:
32+
33+
<div class="grid grid-cols-2 gap-6 mb-4">
34+
<DocCard
35+
title="Deploy to prod"
36+
description="Deploy to prod using a staging workspace"
37+
href="/docs/advanced/deploy_to_prod"
38+
/>
39+
</div>

docs/advanced/10_git_sync/index.mdx renamed to docs/advanced/11_git_sync/index.mdx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ import DocCard from '@site/src/components/DocCard';
22

33
# Sync Workspace to Remote Git Repository
44

5-
From the workspace settings, you can set a [git_repository](../../integrations/git_repository.mdx) resource on which the workspace will automatically commit and push scripts, flows and apps to the repository on each deploy.
5+
From the workspace settings, you can set a [git_repository](../../integrations/git_repository.mdx) resource on which the workspace will automatically commit and push scripts, flows and apps to the repository on each [deploy](../../core_concepts/0_draft_and_deploy/index.mdx).
6+
7+
:::tip Version Control
8+
9+
For all details on Version Control in Windmill, see [Version Control](../../advanced/13_version_control/index.mdx).
10+
11+
:::
612

713
<iframe
814
style={{ aspectRatio: '16/9' }}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import DocCard from '@site/src/components/DocCard';
2+
3+
# Deploy to Prod
4+
5+
Deployments in Windmill are commonly done from the same workspace using the [Draft and Deploy](../../core_concepts/0_draft_and_deploy/index.mdx) buttons.
6+
7+
For finer control, you might want to deploy to a prod workspace from a staging area. Here are the options.
8+
9+
## Deploy to Staging/Prod Web UI
10+
11+
From a workspace in Windmill, you can deploy a script/flow/resource/variable and all its dependencies to another workspace. This feature implies having at least 2 workspaces.
12+
13+
<video
14+
className="border-2 rounded-xl object-cover w-full h-full dark:border-gray-800"
15+
controls
16+
id="main-video"
17+
src="/videos/staging_prod.mp4"
18+
/>
19+
20+
<br/>
21+
22+
Deploy to Staging/Prod Web UI is [Cloud and Self-Hosted Enterprise Edition](/pricing) only.
23+
24+
More details at:
25+
26+
<div class="grid grid-cols-2 gap-6 mb-4">
27+
<DocCard
28+
title="Draft and Deploy"
29+
description="Develop and cooperate in a structured way."
30+
href="/docs/core_concepts/draft_and_deploy"
31+
/>
32+
</div>
33+
34+
## Deploy to Prod using a Git Workflow
35+
36+
Windmill integration with Git repositories makes it possible to adopt a robust development process for your Windmill scripts, flows and apps.
37+
38+
The process is as follows:
39+
- Users iterate and make their changes in a "staging" Windmill workspace.
40+
- Every time a Windmill App, Flow or Script is deployed to that workspace (via Windmill's UI), Windmill automatically commits it to this repo and creates one branch per app/flow/script.
41+
- On every commit from Windmill, PRs are automatically created via a GitHub action. Approved GitHub users can review and merge those PRs.
42+
- Every time a PR is merged, another GitHub action automatically deploys the change to a "production" Windmill workspace.
43+
44+
This gives the flexibility to fully test new Windmill scripts, flows and apps, while having them version-controlled and deployed in an automated way to the production environment.
45+
46+
Deploy to Prod using a Git Workflow is [Cloud and Self-Hosted Enterprise Edition](/pricing) only.
47+
48+
More details at:
49+
50+
<div class="grid grid-cols-2 gap-6 mb-4">
51+
<DocCard
52+
title="Deploy to Prod using a Git Workflow"
53+
description="Windmill integration with Git repositories makes it possible to adopt a robust development process for your Windmill scripts, flows and apps."
54+
href="/docs/advanced/deploy_gh_gl"
55+
/>
56+
</div>
57+
58+
## Using Windmill CLI in GitHub actions
59+
60+
Finally, you can define your own GitHub actions to pull Windmill workspace regularly from GitHub using [Windmill CLI](../3_cli/index.mdx). To automatically deploy a PR to the Windmill workspace, the [push-on-merge.yaml](https://github.com/windmill-labs/windmill-sync-example/blob/main/.github/workflows/push-on-merge.yaml) can be used.
61+
62+
And another GitHub action can be created to regularly pull Windmill workspace to the GitHub repo using Windmill CLI. This action can be run on a schedule to keep the repo and the workspace in sync.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import DocCard from '@site/src/components/DocCard';
2+
3+
# Version Control
4+
5+
Manage changes to scripts workflows, apps and resources using commits & push on remote repositories.
6+
7+
## Sync Workspace to Remote Git Repository
8+
9+
From the workspace settings, you can set a [git_repository](../../integrations/git_repository.mdx) resource on which the workspace will automatically commit and push scripts, flows and apps to the repository on each [deploy](../../core_concepts/0_draft_and_deploy/index.mdx).
10+
11+
<iframe
12+
style={{ aspectRatio: '16/9' }}
13+
src="https://www.youtube.com/embed/JqG0KNYWLx0?vq=hd1080"
14+
title="Sync Workspace to Remote Git Repository"
15+
frameBorder="0"
16+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
17+
allowFullScreen
18+
className="border-2 rounded-xl object-cover w-full dark:border-gray-800"
19+
></iframe>
20+
21+
<br/>
22+
23+
Sync Workspace to Remote Git Repository is [Cloud and Self-Hosted Enterprise Edition](/pricing) only.
24+
25+
More details at:
26+
27+
<div class="grid grid-cols-2 gap-6 mb-4">
28+
<DocCard
29+
title="Sync Workspace to Remote Git Repository"
30+
description="Connect the Windmill workspace to a Git repository to automatically commit and push scripts, flows and apps to the repository on each deploy."
31+
href="/docs/advanced/git_sync"
32+
/>
33+
</div>
34+
35+
## CLI Sync
36+
37+
You can use Windmill CLI to sync workspace to a git repository.
38+
39+
More details at:
40+
41+
<div class="grid grid-cols-2 gap-6 mb-4">
42+
<DocCard
43+
title="Command-Line Interface - Sync"
44+
description="Synchronize folders & git repositories to a Windmill instance"
45+
href="/docs/advanced/cli/sync"
46+
/>
47+
</div>

docs/advanced/9_deploy_gh_gl/index.md

Lines changed: 26 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
1-
# GitHub / GitLab for Version Control
1+
# Deploy to Prod using a Git Workflow
22

3-
Windmill integration with Git repositories makes it possible to adopt a robust development process for you Windmill scripts, flows and apps.
3+
Windmill integration with Git repositories makes it possible to adopt a robust development process for your Windmill scripts, flows and apps.
44

5-
The process is as follow:
6-
- Users iterates and make their changes in a "staging" Windmill workspace
5+
:::tip Deploy to prod
6+
7+
For all details on Deployments to Prods, see [Deploy to Prod](../../advanced/12_deploy_to_prod/index.mdx).
8+
9+
:::
10+
11+
The process is as follows:
12+
- Users iterate and make their changes in a "staging" Windmill workspace.
713
- Every time a Windmill App, Flow or Script is deployed to that workspace (via Windmill's UI), Windmill automatically commits it to this repo and creates one branch per app/flow/script.
8-
- On every commit from Windmill, PRs are automatically created via a Github action. Approved Github users can review and merge those PRs.
9-
- Every time a PR is merged, another Github action automatically deploys the change to a "production" Windmill workspace
14+
- On every commit from Windmill, PRs are automatically created via a GitHub action. Approved GitHub users can review and merge those PRs.
15+
- Every time a PR is merged, another GitHub action automatically deploys the change to a "production" Windmill workspace.
1016

11-
This gives the flexibility to fully test new Windmill scripts, flows and apps, while having them version controlled and deployed in an automated way to the production environment.
17+
This gives the flexibility to fully test new Windmill scripts, flows and apps, while having them version-controlled and deployed in an automated way to the production environment.
1218

1319
:::info
1420

15-
Windmill workspace sync to a Git repository is an Enterprise Edition only feature.
21+
Windmill workspace sync to a Git repository is a [Cloud and Self-Hosted Enterprise Edition](/pricing)-only feature.
1622

1723
:::
1824

@@ -24,39 +30,25 @@ Check out the [windmill-sync-example repository](https://github.com/windmill-lab
2430

2531
## Setup
2632

27-
Note: this is the detailed setup steps for a Github repository. It will need to ba adapted for GitLab.
33+
Note: this is the detailed setup steps for a GitHub repository. It will need to be adapted for GitLab.
2834

29-
#### Github repository setup
35+
### GitHub repository setup
3036

31-
First the Github repo needs to be setup and Windmill needs to be able to commit to it.
37+
First the GitHub repo needs to be set up and Windmill needs to be able to commit to it.
3238

33-
1. Create a Github repository
34-
1. Generate a [Github token with write permission](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token) to this repository. This is necessary for Windmill to push commits to the repo every time a change is made to the staging workspace.
35-
1. In the repository settings > Actions > General, tick the [Allow GitHub Actions to create and approve pull requests](https://docs.github.com/en/enterprise-server@3.10/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#preventing-github-actions-from-creating-or-approving-pull-requests). This is necessary for the Github action automatically creating PRs when Windmill commits a change
36-
1. From Windmill, create a token under User settings > Token and [save it as a secret](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository) named `WMILL_TOKEN` in the repo settings > "Secret and Variable" > "Actions". This is necessary for Windmill to push to the production workspace
39+
1. Create a GitHub repository.
40+
1. Generate a [GitHub token with write permission](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token) to this repository. This is n@ecessary for Windmill to push commits to the repo every time a change is made to the staging workspace.
41+
1. In the repository settings > Actions > General, tick the [Allow GitHub Actions to create and approve pull requests](https://docs.github.com/en/enterprise-server@3.10/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#preventing-github-actions-from-creating-or-approving-pull-requests). This is necessary for the GitHub action automatically creating PRs when Windmill commits a change.
42+
1. From Windmill, create a token under User settings > Token and [save it as a secret](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository) named `WMILL_TOKEN` in the repo settings > "Secret and Variable" > "Actions". This is necessary for Windmill to push to the production workspace.
3743

38-
#### Windmill setup
44+
### Windmill setup
3945

40-
1. In Windmill, create a `git_repository` resource pointing to the Github repository and containing the token generated previously. You URL should be `https://[USERNAME]:[TOKEN]@github.com/[ORG|USER]/[REPO_NAME].git`. Note that you have the possibility to input a custom branch name and a subfolder in this resource. Given that we are going to request Windmill to create one branch per script/flow/app, setting a custom branch will have no effect. However, if you wish to persist the windmill workspace in a subfolder of your repository, you can set it here.
41-
1. In Windmill workspace settings > Git sync tab, pick the `git_repository` resource and toggle ON "Create one branch per per deployed script/flow/app"
46+
1. In Windmill, create a [git_repository](https://hub.windmill.dev/resource_types/135/git_repository) [resource](../../core_concepts/3_resources_and_types/index.mdx) pointing to the GitHub repository and containing the token generated previously. You URL should be `https://[USERNAME]:[TOKEN]@github.com/[ORG|USER]/[REPO_NAME].git`. Note that you have the possibility to input a custom branch name and a subfolder in this resource. Given that we are going to request Windmill to create one branch per script/flow/app, setting a custom branch will have no effect. However, if you wish to persist the windmill workspace in a subfolder of your repository, you can set it here.
47+
2. In Windmill workspace settings > Git sync tab, pick the `git_repository` resource and toggle On "Create one branch per deployed script/flow/app"
4248

43-
#### Github actions setup
49+
### GitHub actions setup
4450

4551
Two actions are needed.
4652

4753
1. The first one to automatically create a PR when Windmill commits a change after a user deployed a script/flow/app in the staging workspace. The workflow file is available in [the example repo](https://github.com/windmill-labs/windmill-sync-example/blob/main/.github/workflows/open-pr-on-commit.yaml). All branches created by Windmill will have a `wm_deploy/` prefix, which is handy to trigger this action only when a branch matching this pattern is created.
48-
1. The second one to automatically push the content of the repo to the Windmill production workspace when a PR is merged. The workflow file is available in [the example repo](https://github.com/windmill-labs/windmill-sync-example/blob/main/.github/workflows/push-on-merge.yaml). This action uses the [Github CLI](https://cli.github.com/) which is available by default on Github action workers.
49-
50-
## Alternatives
51-
52-
If you don't have and Enterprise Edition license, alternatives exists to achieve similar workflows.
53-
54-
#### Using Windmill's embedded promotion feature
55-
56-
Windmill provides an easy way to "promote" scripts, flow and apps from one workspace to another. From the workspace settings, you can defined a workspace to be the "production" version of your current workspace. When this is set, any script flow or app can be promoted to the production workspace by clicking the ... button at the right of the script / flow / app in the home menu, and then "Deploy to Staging/Prod".
57-
58-
#### Using Windmill CLI in Github actions
59-
60-
Finally, you can define your own github actions to pull Windmill workspace regularly from Github using Windmill CLI. To automatically deploy a PR to the Windmill workspace, the (push-on-merge.yaml)[https://github.com/windmill-labs/windmill-sync-example/blob/main/.github/workflows/push-on-merge.yaml] mentioned above can be used.
61-
62-
And another Github action can be created to regularly pull Windmill workspace to the Github repo using Windmill CLI. This action can be run on a schedule to keep the repo and the workspace in sync.
54+
1. The second one to automatically push the content of the repo to the Windmill production workspace when a PR is merged. The workflow file is available in [the example repo](https://github.com/windmill-labs/windmill-sync-example/blob/main/.github/workflows/push-on-merge.yaml). This action uses the [GitHub CLI](https://cli.github.com/) which is available by default on GitHub action workers.

docs/compared_to/retool.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ Additionally, you can bypass the app builder in a no-code manner by directly [im
139139
href="/docs/advanced/local_development"
140140
/>
141141
<DocCard
142-
title="Version control from GitHub/GitLab"
143-
description="Use a GH/GL repo as the source of truth for part or all of your Windmill workspace."
144-
href="/docs/advanced/deploy_gh_gl"
142+
title="Version Control in Windmill"
143+
description="Sync your workspace to a git repository."
144+
href="/docs/advanced/version_control"
145145
/>
146146
</div>
147147

docs/core_concepts/0_draft_and_deploy/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ Once deployed, scripts, flows and apps will be visible, editable and/or runnable
1818

1919
<br />
2020

21-
:::tip Deploy to Staging or Prod
21+
:::tip Deploy to prod
2222

23-
For achieving complete isolation between staging and production environments, consider using [Deploy to Staging or Prod](../12_staging_prod/index.md) feature, which facilitates the deployment of scripts, flows, variables, and resources to separate workspaces such as staging or production.
23+
For all details on Deployments to Prods, see [Deploy to Prod](../../advanced/12_deploy_to_prod/index.mdx).
2424

2525
:::
2626

docs/core_concepts/12_staging_prod/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
From a workspace in Windmill, you can deploy a script/flow/resource/variable and all its dependencies to another workspace. This is a natural way of implementing staging/prod. This feature is available for [Enterprise Edition](../../misc/7_plans_details/index.mdx) only.
44

5+
:::tip Deploy to prod
6+
7+
For all details on Deployments to Prods, see [Deploy to Prod](../../advanced/12_deploy_to_prod/index.mdx).
8+
9+
:::
10+
511
<video
612
className="border-2 rounded-xl object-cover w-full h-full dark:border-gray-800"
713
controls

0 commit comments

Comments
 (0)