Skip to content

Commit

Permalink
Merge branch 'main' into alp/windows_workers
Browse files Browse the repository at this point in the history
  • Loading branch information
alpetric authored Oct 10, 2024
2 parents 8b89219 + 0b115c4 commit acd9377
Show file tree
Hide file tree
Showing 15 changed files with 1,187 additions and 1,904 deletions.
2 changes: 2 additions & 0 deletions docs/advanced/18_instance_settings/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ This is from the Instance settings that you can see on which Windmill [version](

The Admins workspace is for [superadmins](../../core_concepts/16_roles_and_permissions/index.mdx#superadmin) only and contains scripts whose purpose is to manage your Windmill instance, such as [keeping resource types up to date](../../core_concepts/3_resources_and_types/index.mdx#sync-resource-types-with-windmillhub) or the New User Setup App.

The [resources types](../../core_concepts/3_resources_and_types/index.mdx) created from the Admins workspace are shared across all workspaces.

You can access it from the list of workspaces or from Instance settings.

![Admins workspace](./admins_workspace.png "Admins workspace")
Expand Down
9 changes: 8 additions & 1 deletion docs/advanced/6_imports/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ import (
)
```

You can pin dependencies in Go using those annotations in the body of the script:

```go
// Pin dependencies partially in go.mod with a comment starting with "//require":
//require rsc.io/quote v1.5.1
```

## Imports in PowerShell

For PowerShell, imports are parsed when the script is run and modules are automatically installed if they are not found in the cache.
Expand Down Expand Up @@ -183,4 +190,4 @@ To import from a custom codebase, see [Codebases & bundles](../../core_concepts/
description="Deploy scripts with any local relative imports as bundles."
href="/docs/core_concepts/codebases_and_bundles"
/>
</div>
</div>
32 changes: 20 additions & 12 deletions docs/core_concepts/3_resources_and_types/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Check our [list of integrations](../../integrations/0_integrations_on_windmill.m
/>
</div>

## Create a Resource
## Create a resource

To create a resource using an existing type, go to the <a href="https://app.windmill.dev/resources" rel="nofollow">Resources </a> page and click "Add a resource/API".

Expand Down Expand Up @@ -73,7 +73,7 @@ a link, for example:

:::

## Create a Resource Type
## Create a resource type

Windmill comes preloaded with some common Resource Types, such as databases, apps, SMTP, etc. You can see the full list on [Windmill Hub](https://hub.windmill.dev/resources).
You can also add custom Resource Types by clicking "Add a resource type" on the <a href="https://app.windmill.dev/resources" rel="nofollow">Resources</a> page.
Expand All @@ -86,7 +86,9 @@ default, etc). You can also view the schema by toggling the "As JSON" option:

![Resource type schema view](./resource_type_json.png.webp)

### Share Resource Type on Hub
The resources types created from the [Admins workspace](../../advanced/18_instance_settings/index.mdx#admins-workspace) are shared across all workspaces.

### Share resource type on Hub

You can contribute to the [Windmill Hub](https://hub.windmill.dev/) by sharing your Resource Type. To do so, add a Resource Type on the [Resources section](https://hub.windmill.dev/resources) of the Hub.

Expand All @@ -96,20 +98,26 @@ Verified Resource Types on the Hub are directly added to the list of available R

![Share resource type](./new_resource_type_hub.png)

### Sync Resource Types with WindmillHub
### Sync resource types with WindmillHub

When creating a [self-hosted](../../advanced/1_self_host/index.mdx) instance, you are offered to set a [schedule](../1_scheduling/index.mdx) to regularly sync all resource types from [WindmillHub](https://hub.windmill.dev/). This will ensure that all the approved resource types are available in your instance. On Windmill cloud, it is done regularly by the Windmill team. Ask us if you need a specific [resource type from Hub](https://hub.windmill.dev/resources) to be added.

The bun script executed from the admin workspace is:
The [Bun](../../getting_started/0_scripts_quickstart/1_typescript_quickstart/index.mdx) script executed from the admin workspace is:

```ts
import { hubPull } from "[email protected]"
import * as wmill from "[email protected]"

export async function main() {
await hubPull({ workspace: "admins", token: process.env["WM_TOKEN"], baseUrl: process.env.WM_BASE_URL })
await wmill.hubPull({ workspace: "admins", token: process.env["WM_TOKEN"], baseUrl: globalThis.process.env["BASE_URL"] });
}
```

You can find this script on [WindmillHub](https://hub.windmill.dev/scripts/windmillhub/9069/synchronize-hub-resource-types-with-instance-windmillhub#approved).

This script is probably already on your [Admins workspace](../../advanced/18_instance_settings/index.mdx#admins-workspace), as it was suggested during Windmill [self-hosting setup](../../advanced/1_self_host/index.mdx). Having this script run on your Admins workspace will sync resources accross all workspaces of your instance.

To avoid running it manually, we recommend [scheduling](../1_scheduling/index.mdx) this script regularly.

## States

States are used by scripts to keep data persistent between runs of the same script by the same trigger (schedule or user).
Expand Down Expand Up @@ -192,7 +200,7 @@ _Python_
/>
</div>

### States Path
### States path

States are stored in a [path](../16_roles_and_permissions/index.mdx#path) that is unique to the [script](../../script_editor/index.mdx), script within a [flow](../../flows/1_flow_editor.mdx) or [schedule](../1_scheduling/index.mdx). The state path [is defined](https://github.com/windmill-labs/windmill/blob/19547e90c681db1566559c31a508eb093eb05968/backend/windmill-common/src/variables.rs#L150) as:

Expand Down Expand Up @@ -224,7 +232,7 @@ States are stored in a [path](../16_roles_and_permissions/index.mdx#path) that i

For example, if a script using states is used within a flow that is scheduled, the state will take a new path as: `folder/flow_path/script_path/schedule_path`, or more concretely: `u/username/u/username/flow_name/u/username/script_name/u/username/schedule_name`.

### Custom Flow States
### Custom flow states

Custom flow states are a way to store data across steps in a [flow](../../flows/1_flow_editor.mdx). You can set and retrieve a value given a key from any step of flow and it will be available from within the flow globally. That state will be stored in the flow state itself and thus has the same lifetime as the flow [job](../20_jobs/index.mdx) itself.

Expand Down Expand Up @@ -264,7 +272,7 @@ def main(x: str):
src="/videos/flow_state.mp4"
/>

## Using Resources
## Using resources

Resources can be used [passed as script parameters](#passing-resources-as-parameters-to-scripts-preferred) or [directly fetched](#fetching-them-from-within-a-script-by-using-the-wmill-client-in-the-respective-language) within code.

Expand Down Expand Up @@ -411,7 +419,7 @@ The toggle "Static resource select only / Resources from users allowed" can be f
/>
</div>

## Plain Text File Resources
## Plain text file resources

In certain scenarios it is useful to store data as a a text file, with a format such as `.json`, `.cfg`, etc. Windmill can store plain text files as a resource, which can then be used as arguments for scripts, or have special support in certain languages (e.g. Ansible).

Expand All @@ -432,4 +440,4 @@ As you will notice, the format specified will be used for syntax highlighting wh

### Using the resource

This resource only has a `content` field, so any language can use it and access the `content` like for any other resource/object. In certain languages (currenttly only Ansible), it can be preferable to have the file available on the file system instead of inlining its contents. You can ask windmill to [create these files before the execution of the script](../getting_started/scripts_quickstart/ansible#other-non-inventory-file-resources)
This resource only has a `content` field, so any language can use it and access the `content` like for any other resource/object. In certain languages (currenttly only Ansible), it can be preferable to have the file available on the file system instead of inlining its contents. You can ask windmill to [create these files before the execution of the script](../getting_started/scripts_quickstart/ansible#other-non-inventory-file-resources)
6 changes: 1 addition & 5 deletions docs/misc/15_react_sdk/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,4 @@ function MyApp() {
}
```

Replace YOUR_WORKSPACE and YOUR_APP_PATH with the corresponding values.

### Example

We have a private repository with a Next.js example. [Contact us](../6_getting_help/index.mdx) for access.
Replace YOUR_WORKSPACE and YOUR_APP_PATH with the corresponding values.
2 changes: 1 addition & 1 deletion docs/misc/7_plans_details/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ All details on the [Pricing page](/pricing).
/>
</div>

## Self-hosted pagelans
## Self-hosted plans

Windmill is free and open source. If self-hosted, the number of executions will be unlimited. The Enterprise plan allows access to some useful features for the use of Windmill in a corporate use case, with technical and security specifics ([Audit logs](../../core_concepts/14_audit_logs/index.mdx), [Workspace & instance object storage](../../core_concepts/38_object_storage_in_windmill/index.mdx), [Git sync](../../advanced/11_git_sync/index.mdx), [Worker groups management UI](../../core_concepts/9_worker_groups/index.mdx)).

Expand Down
Loading

0 comments on commit acd9377

Please sign in to comment.