Skip to main content

Sync

Synchronizing folders & git repositories to a Windmill instance is made easy using the wmill CLI. Syncing operations are behind the wmill sync subcommand.

Having a Windmill instance synchronized to folders & git repositories allows for local development through the VS Code extension.

Raw Syncing

Raw syncing will soon become the default.

Raw syncing is a one-off operation with no state maintained. When using Windmill EE and Git Sync, this is what you should use since Git Sync will always keep your git repo up-to-date. When not used in with Git Sync. It's best used for making backups, cloning a complete workspace, and similar one-off operations.

Raw syncing is done using wmill sync pull & wmill sync push

Pulling

wmill sync pull will simply pull all files from the currently selected workspace and store them in the current folder. Overwrites will not prompt the user. Make sure you are in the correct folder or you may loose data.

Pushing

wmill sync push will simply push all local files to the currently selected workspace, creating or updating the remote equivalents.

Pull API

The wmill sync pull command is used to pull remote changes and apply them locally. It synchronizes the local workspace with the remote workspace by downloading any remote changes and updating the corresponding local files.

wmill sync pull [options]

Options

OptionparameterDescription
--fail-conflictsNoneError on conflicts (both remote and local have changes on the same item).
--yesNonePull without needing confirmation. The command proceeds automatically without user intervention.
--plain-secretsNonePull secrets as plain text. Secrets are downloaded without encryption or obfuscation.
--jsonNoneUse JSON instead of YAML. The downloaded files are in JSON format instead of YAML.

Push API

The wmill sync push command is used to push local changes and apply them remotely. It synchronizes the remote workspace with the local workspace by uploading any local changes and updating the corresponding remote files.

wmill sync push [options]

Options

OptionparameterDescription
--fail-conflictsNoneError on conflicts (both remote and local have changes on the same item).
--skip-pullNonePush without pulling first. Assumes that the pull operation has already been performed.
--yesNonePush without needing confirmation. The command proceeds automatically without user intervention.
--plain-secretsNonePush secrets as plain text. Secrets are uploaded without encryption or obfuscation.
--jsonNoneUse JSON instead of YAML. The uploaded files are in JSON format instead of YAML.

wmill.yaml

Note that you can set the default TypeScript language and explicitly exclude (or include) specific files or folders to be taken into account with a wmill.yaml file.

includes: ['f/**'] # uses "*" or uncomment this line to include everything. Note that wmill will only consider files with valid path (u/ or f/, with the right extension)
excludes: [] # excludes patterns here

defaultTs: 'bun' # deno is the default, set it to bun if you primarily use bun to avoid needing the .bun.ts extension

All sync options for your workspace can be found on this file:

export interface SyncOptions {
raw?: boolean;
yes?: boolean;
skipPull?: boolean;
failConflicts?: boolean;
plainSecrets?: boolean;
json?: boolean;
skipVariables?: boolean;
skipResources?: boolean;
skipSecrets?: boolean;
includeSchedules?: boolean;
includeUsers?: boolean;
includeGroups?: boolean;
includeSettings?: boolean;
message?: string;
includes?: string[];
extraIncludes?: string[];
excludes?: string[];
defaultTs?: "bun" | "deno";
codebases?: Codebase[];
}

Example Repo for Syncing with Windmill in Git

We provide an example repo for syncing with Windmill:

Cloning an instance

Instances can be cloned with Windmill CLI. This is useful for instance migration or for setting up a new (prod) instance with the same configuration as an existing one.

Pulling an instance

To pull instance users, groups, settings and configs (=worker groups+SMTP) from the instance use wmill instance pull.

You can skip any of those using --skip-XXX.

You can also pull all workspaces at the same time by adding the --include-workspaces option. It will setup for each a local workspace (including a folder in the current directory) with a prefix specific to the instance (based on the name you've given to the instance).

Pushing an instance

To push to an instance use wmill instance push. It takes the same options as pulling an instance.

When using --include-workspaces, you will also have to select the instance prefix of the local workspaces you want to push (make sure you're in its parent folder).

During the push process, you will be prompted to decide whether to re-encrypt the secrets of the workspace on the remote instance. In the case of instance migration, it is recommended to select "no" as the secrets are already encrypted with the correct key.