mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-18 16:02:10 +00:00
avoid the need for caddy for dev
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
:80 {
|
||||
bind {$ADDRESS}
|
||||
reverse_proxy /api/* http://localhost:8000
|
||||
reverse_proxy /* http://localhost:3000
|
||||
reverse_proxy /ws/* http://localhost:3001
|
||||
}
|
||||
|
||||
:443 {
|
||||
bind {$ADDRESS}
|
||||
reverse_proxy /api/* http://localhost:8000
|
||||
reverse_proxy /ws/* http://localhost:3001
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
auto_https off
|
||||
}
|
||||
|
||||
:8080 {
|
||||
bind {$ADDRESS}
|
||||
reverse_proxy /api/* http://localhost:8000
|
||||
reverse_proxy /* http://localhost:3000
|
||||
reverse_proxy /ws/* http://lsp:3001 {
|
||||
lb_policy header "Authorization"
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
http://localhost {
|
||||
bind {$ADDRESS}
|
||||
reverse_proxy /api/* https://app.windmill.dev {
|
||||
header_up Host {http.reverse_proxy.upstream.hostport}
|
||||
}
|
||||
reverse_proxy /* http://localhost:3000
|
||||
}
|
||||
|
||||
|
||||
https://localhost {
|
||||
bind {$ADDRESS}
|
||||
reverse_proxy /ws/* http://localhost:3001
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
http://localhost {
|
||||
bind {$ADDRESS}
|
||||
reverse_proxy /api/* https://app.windmill.dev {
|
||||
header_up Host {http.reverse_proxy.upstream.hostport}
|
||||
header_down Set-Cookie windmill.dev localhost
|
||||
}
|
||||
reverse_proxy /* http://localhost:3000
|
||||
}
|
||||
|
||||
|
||||
https://localhost {
|
||||
bind {$ADDRESS}
|
||||
reverse_proxy /ws/* https://app.windmill.dev {
|
||||
header_up Host {http.reverse_proxy.upstream.hostport}
|
||||
}
|
||||
}
|
||||
|
||||
+25
-66
@@ -1,25 +1,41 @@
|
||||
# Developing
|
||||
|
||||
## Starting The Development Server
|
||||
- install the dependencies with `npm install` (or `pnpm install` or `yarn`)
|
||||
- generate the windmill client:
|
||||
|
||||
Once you've created a project and installed dependencies with `npm install` (or
|
||||
`pnpm install` or `yarn`), start a development server:
|
||||
```bash
|
||||
npm run generate-backend-client
|
||||
## on mac use
|
||||
npm run generate-backend-client-mac
|
||||
```
|
||||
|
||||
Once the dependencies are installed, just start the dev server:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
To have the whole stack backing your dev environment, 3 solutions:
|
||||
The default proxy is setup to use the remote backend: <https://app.windmill.dev>.
|
||||
|
||||
You can configure another proxy to use like so:
|
||||
|
||||
```bash
|
||||
REMOTE=http://localhost:8000 REMOTE_LSP=http://localhost:3000 npm run dev
|
||||
```
|
||||
|
||||
## Use a Local backend
|
||||
|
||||
### 1. Backend is run by docker
|
||||
|
||||
In the root folder:
|
||||
|
||||
```bash
|
||||
docker build . -t windmill
|
||||
docker compose up db windmill_server windmill_worker
|
||||
```
|
||||
|
||||
```bash
|
||||
REMOTE=http://localhost REMOTE_LSP=http://localhost npm run dev
|
||||
```
|
||||
|
||||
### 2. Backend is run by cargo
|
||||
|
||||
**Prerequisites**
|
||||
@@ -40,10 +56,7 @@ docker compose up db windmill_server windmill_worker
|
||||
|
||||
- To test that you have Rust and Cargo installed run `cargo --version`
|
||||
|
||||
- In your terminal, go to the backend directory and run `cargo build`
|
||||
- Run `cargo run`
|
||||
|
||||
**Known issue on M1 Mac while running `cargo build`**
|
||||
**Known issue on M1 Mac while running `cargorun`**
|
||||
|
||||
- You may encounter `linking with cc failed` build time error.
|
||||
- To solve this run:
|
||||
@@ -52,38 +65,6 @@ docker compose up db windmill_server windmill_worker
|
||||
source ~/.zshrc
|
||||
```
|
||||
|
||||
**Do a Frontend Build**
|
||||
|
||||
In order to run the backend, you need to have a frontend build inside `frontend/build/`.
|
||||
|
||||
Otherwise, `cargo run` will break.
|
||||
|
||||
So, in the frontend folder, run:
|
||||
|
||||
```bash
|
||||
# !!! on OSX, you are not allowed to use the system SED, but you need to use GNU SED.
|
||||
# !!! thus, in `frontend/package.json`, replace all `sed` occurences with `gsed`.
|
||||
|
||||
# prerequisite for build
|
||||
npm run generate-backend-client
|
||||
## on mac use
|
||||
npm run generate-backend-client-mac
|
||||
|
||||
npm run build
|
||||
# now, you'll have a `frontend/build` folder.
|
||||
```
|
||||
|
||||
**Known issue while running `npm run build`**
|
||||
|
||||
- You may encounter `FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory` error.
|
||||
- To solve this run:
|
||||
|
||||
```bash
|
||||
export NODE_OPTIONS=--max_old_space_size=8096
|
||||
```
|
||||
|
||||
- run `npm run build` again
|
||||
|
||||
In the root folder:
|
||||
|
||||
```bash
|
||||
@@ -96,38 +77,16 @@ In the backend folder:
|
||||
DATABASE_URL=postgres://postgres:changeme@127.0.0.1:5433/windmill?sslmode=disable cargo run
|
||||
```
|
||||
|
||||
You can now access [http://127.0.0.1:8000](http://127.0.0.1:8000).
|
||||
|
||||
### In both cases
|
||||
|
||||
In the frontend folder:
|
||||
|
||||
```bash
|
||||
sudo caddy run --config ./Caddyfile
|
||||
REMOTE=http://localhost:8000 REMOTE_LSP=http://localhost:3000 npm run dev
|
||||
```
|
||||
|
||||
(sudo is required to bind port 80 and 443)
|
||||
|
||||
and then go to <http://localhost>
|
||||
|
||||
### 3. Backend is run by remote!
|
||||
|
||||
```bash
|
||||
sudo caddy run --config ./CaddyfileRemote
|
||||
```
|
||||
|
||||
and then go to <http://localhost>
|
||||
|
||||
## Building
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
## Generating the backend client automatically
|
||||
|
||||
```bash
|
||||
npm run generate-backend-client
|
||||
NODE_OPTIONS=--max_old_space_size=8096 npm run build
|
||||
```
|
||||
|
||||
## Formatting
|
||||
|
||||
+14
-1
@@ -9,7 +9,20 @@ const version = JSON.parse(json)
|
||||
/** @type {import('vite').UserConfig} */
|
||||
const config = {
|
||||
server: {
|
||||
port: 3000
|
||||
port: 3000,
|
||||
proxy: {
|
||||
'^/api/.*': {
|
||||
target: process.env.REMOTE ?? 'https://app.windmill.dev/',
|
||||
changeOrigin: true,
|
||||
cookieDomainRewrite: 'localhost'
|
||||
},
|
||||
// Proxying websockets or socket.io: ws://localhost:5173/socket.io -> ws://localhost:5174/socket.io
|
||||
'^/ws/.*': {
|
||||
target: process.env.REMOTE_LSP ?? 'https://app.windmill.dev',
|
||||
changeOrigin: true,
|
||||
ws: true
|
||||
}
|
||||
}
|
||||
},
|
||||
preview: {
|
||||
port: 3000
|
||||
|
||||
Reference in New Issue
Block a user