fix: share the default HTTP port so the indexer advertises the right one

Moves DEFAULT_PORT into windmill-common: the indexer derives the address it
advertises from it, and a copy in the binary would have drifted the next time
either side changed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V2vNYVA1Jc9rrfqCPN6eKg
This commit is contained in:
Ruben Fiszel
2026-08-27 06:41:20 +00:00
co-authored by Claude Opus 5
parent a787496c21
commit 3542e4ce8b
7 changed files with 16 additions and 56 deletions
@@ -1,15 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "UPDATE concurrency_locks SET\n last_locked_at = now()\n WHERE id = $1 AND owner = $2",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Text",
"Text"
]
},
"nullable": []
},
"hash": "57e270e032e8c04dda7b5c1ca949861756b3ad367a4a500728332a7cb91560a4"
}
@@ -1,15 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "INSERT INTO concurrency_locks (id, last_locked_at, owner)\n VALUES ($1, now(), $2)\n ON CONFLICT (id)\n DO UPDATE SET\n last_locked_at = now(),\n owner = EXCLUDED.owner",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Varchar",
"Varchar"
]
},
"nullable": []
},
"hash": "6d7a4185063dbcca0dbea1b002330d622c9d2d844a2ab3938e6ec23c6150fb40"
}
@@ -1,22 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "SELECT last_locked_at FROM concurrency_locks WHERE id = $1",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "last_locked_at",
"type_info": "Timestamp"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
false
]
},
"hash": "9b88e522ecbe9fa67ef83e79ec5eb5c9c87999a877fcb7f23be75d991bba6e49"
}
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
"query": "SELECT last_locked_at, owner_addr FROM concurrency_locks WHERE id = $1",
"query": "SELECT last_locked_at, owner, owner_addr FROM concurrency_locks WHERE id = $1",
"describe": {
"columns": [
{
@@ -10,6 +10,11 @@
},
{
"ordinal": 1,
"name": "owner",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "owner_addr",
"type_info": "Varchar"
}
@@ -21,8 +26,9 @@
},
"nullable": [
false,
true,
true
]
},
"hash": "1ff3d43899a63d5f56450d8edfc741e2a4823ac287cb94b17c42277c67513b53"
"hash": "bf22c7378a3db96a205d69b01f94f1dc85de86517abfd7298f4026f6d4d71aa0"
}
+2 -1
View File
@@ -153,7 +153,7 @@ use crate::monitor::{
use windmill_object_store::reload_object_store_setting;
const DEFAULT_NUM_WORKERS: usize = 1;
const DEFAULT_PORT: u16 = 8000;
use windmill_common::utils::DEFAULT_PORT;
const DEFAULT_SERVER_BIND_ADDR: Ipv4Addr = Ipv4Addr::new(0, 0, 0, 0);
const DEFAULT_WORKER_BIND_ADDR: Ipv4Addr = Ipv4Addr::new(127, 0, 0, 1);
const BIND_ADDR_ENV: &str = "SERVER_BIND_ADDR";
@@ -577,6 +577,7 @@ fn print_help() {
" PORT = {} HTTP port (server/indexer/MCP modes)",
DEFAULT_PORT
);
println!(" INDEXER_ADVERTISED_URL = <hostname> Base URL other instances forward search requests to (indexer mode); defaults to http://$HOSTNAME:$PORT");
println!(
" SERVER_BIND_ADDR = <mode dependent> IP to bind to (server: {}, worker: {})",
DEFAULT_SERVER_BIND_ADDR, DEFAULT_WORKER_BIND_ADDR
+1 -1
View File
@@ -62,7 +62,7 @@ cloud_workspace_settings: workspace_id(char), threshold_alert_amount(int), last_
FK: (workspace_id) -> workspace(id)
concurrency_counter: concurrency_id(char), job_uuids(jsonb)
concurrency_key: key(char), ended_at(ts), job_id(uuid)
concurrency_locks: id(char), last_locked_at(ts), owner(char)
concurrency_locks: id(char), last_locked_at(ts), owner(char), owner_addr(char)
ci_test_reference: workspace_id(char), test_script_path(char), test_script_hash(bigint), tested_item_path(char), tested_item_kind(char)
FK: (workspace_id) -> workspace(id)
concurrency_settings: hash(bigint), concurrency_key(char), concurrent_limit(int), concurrency_time_window_s(int)
+5
View File
@@ -43,6 +43,11 @@ pub const AGENT_JWT_PREFIX: &str = "jwt_agent_";
pub const WORKER_NAME_PREFIX: &str = "wk";
pub const AGENT_WORKER_NAME_PREFIX: &str = "ag";
/// Port the server binds in server, indexer and MCP mode when neither PORT nor BACKEND_PORT is
/// set. Anything deriving an address it expects to reach that server on must use this same
/// fallback, or it will advertise a port nothing is listening on.
pub const DEFAULT_PORT: u16 = 8000;
use crate::CRITICAL_ALERT_MUTE_UI_ENABLED;
use std::panic::{self, AssertUnwindSafe, Location};
use std::sync::atomic::{AtomicBool, Ordering};