mirror of
https://github.com/tiennm99/coolify.git
synced 2026-08-21 00:24:36 +00:00
feat(v5): add WireGuard and coold/corrosion config to clusters/servers
Add WireGuard networking fields (interface, management pool, listen port), container network pool, coold/corrosion versioning, and builder CPU quota to clusters and servers via new migrations and model fillables. Expose full cluster and server CRUD on the Clusters page with private key selection, pending state tracking, and new form primitives (Field, Input, Textarea). Add server status check fields and a lima test VM config for development.
This commit is contained in:
@@ -29,6 +29,7 @@ VERSION="$(read_coolify_env COOLIFY_COOLD_VERSION nightly)"
|
||||
CORROSION_VERSION="$(read_coolify_env COOLIFY_CORROSION_VERSION v1.0.0)"
|
||||
FLUX_URL="$(read_coolify_env COOLIFY_COOLD_VM_FLUX_URL http://host.lima.internal:6443)"
|
||||
BUILDER_CAPACITY="$(read_coolify_env COOLIFY_COOLD_VM_BUILDER_CAPACITY 2)"
|
||||
SSH_PORT="$(read_coolify_env COOLIFY_COOLD_VM_SSH_PORT 60002)"
|
||||
WG_IP="$(read_coolify_env COOLIFY_COOLD_VM_WG_IP "")"
|
||||
WG_PEER_IP="$(read_coolify_env COOLIFY_COOLD_VM_WG_PEER_IP "")"
|
||||
WG_PEER_ENDPOINT="$(read_coolify_env COOLIFY_COOLD_VM_WG_PEER_ENDPOINT "")"
|
||||
@@ -69,6 +70,7 @@ Environment:
|
||||
COOLIFY_CORROSION_VERSION corrosion release tag to install (default: v1.0.0)
|
||||
COOLIFY_COOLD_VM_FLUX_URL Flux gRPC URL visible from the VM (default: http://host.lima.internal:6443)
|
||||
COOLIFY_COOLD_VM_BUILDER_CAPACITY VM builder capacity to advertise (default: 2; set 0 to disable)
|
||||
COOLIFY_COOLD_VM_SSH_PORT Host SSH port forwarded to this VM (default: 60002)
|
||||
COOLIFY_COOLD_VM_WG_IP Optional WireGuard mgmt IP for this host
|
||||
COOLIFY_COOLD_VM_CONTAINER_SUBNET Podman mesh subnet for this host
|
||||
COOLIFY_COOLD_VM_CONTAINER_GATEWAY Podman mesh gateway for this host
|
||||
@@ -395,6 +397,7 @@ generate_yaml() {
|
||||
-e "s#{{COOLIFY_REPO}}#$ROOT#g" \
|
||||
-e "s#{{COOLIFY_COOLD_VERSION}}#$VERSION#g" \
|
||||
-e "s#{{COOLIFY_CORROSION_VERSION}}#$CORROSION_VERSION#g" \
|
||||
-e "s#{{COOLIFY_COOLD_VM_SSH_PORT}}#$SSH_PORT#g" \
|
||||
"$TEMPLATE" > "$GENERATED"
|
||||
}
|
||||
|
||||
|
||||
+45
-3
@@ -60,6 +60,11 @@ coold_vm_wg_port() {
|
||||
read_coolify_env "COOLIFY_COOLD_VM_WG_PORT_${index}" "$((51820 + index))"
|
||||
}
|
||||
|
||||
coold_vm_ssh_port() {
|
||||
local index="$1"
|
||||
read_coolify_env "COOLIFY_COOLD_VM_SSH_PORT_${index}" "6000${index}"
|
||||
}
|
||||
|
||||
coold_vm_container_subnet() {
|
||||
local index="$1"
|
||||
read_coolify_env "COOLIFY_COOLD_VM_CONTAINER_SUBNET_${index}" "10.210.$((index - 1)).0/24"
|
||||
@@ -172,6 +177,28 @@ lima_ssh_config() {
|
||||
printf '%s\n' "$config"
|
||||
}
|
||||
|
||||
lima_ssh_port() {
|
||||
local index="$1"
|
||||
local instance
|
||||
local port
|
||||
|
||||
instance="$(coold_vm_instance "$index")"
|
||||
|
||||
if [ ! -f "$HOME/.lima/${instance}/ssh.config" ]; then
|
||||
echo "ERROR: Lima SSH config for ${instance} was not found. Start it first with scripts/dev.sh up." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
port="$(awk 'tolower($1) == "port" { print $2; exit }' "$HOME/.lima/${instance}/ssh.config")"
|
||||
|
||||
if [ -z "$port" ]; then
|
||||
echo "ERROR: Lima SSH port for ${instance} was not found in $HOME/.lima/${instance}/ssh.config." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf '%s\n' "$port"
|
||||
}
|
||||
|
||||
coolify_nodes_arg() {
|
||||
local count
|
||||
local nodes=""
|
||||
@@ -346,6 +373,7 @@ coold_vm() {
|
||||
shift
|
||||
COOLIFY_COOLD_LIMA_INSTANCE="$(coold_vm_instance "$index")" \
|
||||
COOLIFY_COOLD_VM_WG_IP="$(coold_vm_wg_ip "$index")" \
|
||||
COOLIFY_COOLD_VM_SSH_PORT="$(coold_vm_ssh_port "$index")" \
|
||||
COOLIFY_COOLD_VM_CONTAINER_SUBNET="$(coold_vm_container_subnet "$index")" \
|
||||
COOLIFY_COOLD_VM_CONTAINER_GATEWAY="$(coold_vm_container_gateway "$index")" \
|
||||
scripts/coold-vm.sh "$@"
|
||||
@@ -417,17 +445,31 @@ follow_logs() {
|
||||
}
|
||||
|
||||
sync_v5_dev_lima_servers() {
|
||||
local count
|
||||
local index
|
||||
local instance
|
||||
local server_args=()
|
||||
local ssh_port
|
||||
local ssh_user
|
||||
|
||||
count="$(coold_vm_count)"
|
||||
ssh_user="$(coolify_ssh_user)"
|
||||
|
||||
for index in $(seq 1 "$count"); do
|
||||
instance="$(coold_vm_instance "$index")"
|
||||
ssh_port="$(lima_ssh_port "$index")"
|
||||
server_args+=(--server="${instance}|host.docker.internal|${ssh_user}|${ssh_port}")
|
||||
done
|
||||
|
||||
echo "==> Running pending migrations before syncing v5 dev Lima state..."
|
||||
spin exec -T coolify php artisan migrate --force
|
||||
|
||||
echo "==> Seeding dev Lima VM(s) into v5 clusters/servers..."
|
||||
spin exec -T \
|
||||
-e COOLIFY_CLI_SSH_USER="$ssh_user" \
|
||||
coolify php artisan db:seed --class=V5DevLimaSeeder --force
|
||||
coolify php artisan v5:sync-dev-lima-servers \
|
||||
--builder-capacity="$(read_coolify_env COOLIFY_COOLD_VM_BUILDER_CAPACITY 2)" \
|
||||
"${server_args[@]}"
|
||||
}
|
||||
|
||||
configure_flux_dev_for_vm() {
|
||||
@@ -491,9 +533,9 @@ up() {
|
||||
|
||||
echo "==> Starting Coolify Docker stack with Spin..."
|
||||
if [ "${#spin_args[@]}" -gt 0 ]; then
|
||||
spin up -d "${spin_args[@]}"
|
||||
COOLIFY_CLI_SSH_USER="$(coolify_ssh_user)" spin up -d "${spin_args[@]}"
|
||||
else
|
||||
spin up -d
|
||||
COOLIFY_CLI_SSH_USER="$(coolify_ssh_user)" spin up -d
|
||||
fi
|
||||
|
||||
if [ "$naked" = "true" ]; then
|
||||
|
||||
Reference in New Issue
Block a user