Skip to content

Latest commit

 

History

History
182 lines (126 loc) · 4.23 KB

README_DEV.md

File metadata and controls

182 lines (126 loc) · 4.23 KB

Developing

Using Nix, otherwise:

In the frontend/ directory:

  • install the dependencies with npm install (or pnpm install or yarn)
  • generate the windmill client:
npm run generate-backend-client
## on mac use
npm run generate-backend-client-mac

Once the dependencies are installed, just start the dev server:

npm run dev

The default proxy is setup to use the remote backend: https://app.windmill.dev.

You can configure another proxy to use like so:

REMOTE=http://127.0.0.1:8000 REMOTE_LSP=http://127.0.0.1:3001 npm run dev

Use a Local backend

1. Backend is run by docker

docker build . -t windmill
docker compose up db windmill_server windmill_worker
REMOTE=http://localhost REMOTE_LSP=http://localhost npm run dev

2. Backend is run by cargo

Prerequisites

  • Install Rust as explained on the website.

  • Install llvm

    On OSX:

    brew install llvm gsed
    
    # make LLVM tools available on PATH
    echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.zshrc
    
    # now, restart your shell. You should now have the `lld` binary on your PATH.
  • To test that you have Rust and Cargo installed run cargo --version

Known issue on M1 Mac while running cargorun

  • You may encounter linking with cc failed build time error.
  • To solve this run:
    echo 'export RUSTFLAGS="-L/opt/homebrew/opt/libomp/lib"' >> ~/.zshrc
    source ~/.zshrc

In the root folder:

docker-compose up db

In the backend folder:

DATABASE_URL=postgres://postgres:changeme@127.0.0.1:5433/windmill?sslmode=disable cargo run

In the frontend folder:

REMOTE=http://127.0.0.1:8000 REMOTE_LSP=http://127.0.0.1:3001 npm run dev

Building

NODE_OPTIONS=--max_old_space_size=8096 npm run build

Formatting

This project uses prettier and prettier-plugin-svelte, be sure to install them and set up your editor to run prettier automatically before you commit.

Recommended config for VS Code:

  • Prettier for formatting
  • Svelte for VS Code for highlighting and Intellisense
  • make sure that your VS Code settings.json has the following lines:
"[svelte]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
  • turn format on save on

Building

The project is built with SvelteKit and uses as output static files. There are others adapters for sveltekit, but we use the static adapter.

To build the frontend as static assets, use:

npm run build

The output is in the build folder.

The default build assume you serve every non static files as the 200.html file which is catchall. If you prefer a normal layout, you can use:

NOTCATCHALL=true npm run build

which will generate an index.html and allow you to serve the frontend with any static server.

Env variables used for build are set in .env file. See https://vitejs.dev/guide/env-and-mode.html#env-files for more details.

Nix

Windmill use nix flakes:

nix run github:windmill-labs/windmill

Development

nix develop # enter a dev shell containing all necessary packages.

wm-setup # build the frontend and setup the database.
wm # run the frontend.

# In an other shell:
nix develop
cd backend
cargo run

Updating flake.nix

nix flake update # update the lock file.

Some cargo dependencies use fixed git revisions, which are also fixed in flake.nix:

outputHashes = {
  "php-parser-rs-0.1.3" = "sha256-ZeI3KgUPmtjlRfq6eAYveqt8Ay35gwj6B9iOQRjQa9A=";
  # ...
};

When updating a revision, replace the incorrect sha256 with pkgs.lib.fakeHash:

-            "php-parser-rs-0.1.3" = "sha256-ZeI3KgUPmtjlRfq6eAYveqt8Ay35gwj6B9iOQRjQa9A=";
+            "php-parser-rs-0.1.3" = pkgs.lib.fakeHash;

Then run nix build .#windmill and update with the correct sha.