mirror of
https://github.com/tiennm99/coolify.git
synced 2026-09-03 00:17:50 +00:00
feat(v5): use bridged Lima hosts for coold dev
Add v5 architecture docs and update dev bootstrap, seeding, and tests to use bridged Lima .local hosts with a container-accessible SSH key.
This commit is contained in:
+17
-13
@@ -49,20 +49,24 @@ scripts/dev.sh coolify bootstrap-command
|
||||
scripts/dev.sh coolify run <args>
|
||||
```
|
||||
|
||||
On macOS, the helper builds `coolify` from the local coold repo because the
|
||||
nightly release currently publishes Linux binaries. On Linux, it downloads the
|
||||
nightly release artifact.
|
||||
The helper runs the `coolify` CLI from the Coolify development container. Lima
|
||||
VMs are addressed by their bridged mDNS names (`<vm>.local`), so the same
|
||||
addresses are used by bootstrap and by the v5 dev server seeder.
|
||||
|
||||
The generated bootstrap command uses Lima's forwarded SSH ports and dev
|
||||
WireGuard endpoint overrides, for example:
|
||||
Because Docker Desktop does not reliably pass mDNS multicast into containers,
|
||||
`scripts/dev.sh up` resolves each `<vm>.local` name on the host and writes the
|
||||
resolved records into the Coolify container `/etc/hosts` before bootstrapping.
|
||||
|
||||
The generated bootstrap command uses the container CLI, the repo-local copy of
|
||||
the Lima SSH key, and dev WireGuard endpoint overrides, for example:
|
||||
|
||||
```bash
|
||||
.dev/bin/coolify init bootstrap \
|
||||
--nodes "127.0.0.1:<ssh1>,127.0.0.1:<ssh2>" \
|
||||
--ssh-key "$HOME/.lima/_config/user" \
|
||||
--ssh-user "$USER" \
|
||||
--wg-listen-port-overrides "127.0.0.1:<ssh1>=51821,127.0.0.1:<ssh2>=51822" \
|
||||
--wg-endpoint-overrides "127.0.0.1:<ssh1>=host.lima.internal:51821,127.0.0.1:<ssh2>=host.lima.internal:51822" \
|
||||
spin exec -T coolify /usr/local/bin/coolify init bootstrap \
|
||||
--nodes "coold-dev.local,coold-dev-2.local" \
|
||||
--ssh-key "/var/www/html/.dev/lima/ssh_key" \
|
||||
--ssh-user "coolify" \
|
||||
--wg-listen-port-overrides "coold-dev.local=51821,coold-dev-2.local=51822" \
|
||||
--wg-endpoint-overrides "coold-dev.local=coold-dev.local:51821,coold-dev-2.local=coold-dev-2.local:51822" \
|
||||
--coold-version "nightly" \
|
||||
--corrosion-version "v1.0.0" \
|
||||
--yes
|
||||
@@ -78,8 +82,8 @@ After `coolify init bootstrap`, defaults are:
|
||||
|
||||
| VM | WireGuard IP | WireGuard endpoint | Podman subnet | Gateway |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| `coold-dev` | `100.64.0.1` | `host.lima.internal:51821` | `10.210.0.0/24` | `10.210.0.1` |
|
||||
| `coold-dev-2` | `100.64.0.2` | `host.lima.internal:51822` | `10.210.1.0/24` | `10.210.1.1` |
|
||||
| `coold-dev` | `100.64.0.1` | `coold-dev.local:51821` | `10.210.0.0/24` | `10.210.0.1` |
|
||||
| `coold-dev-2` | `100.64.0.2` | `coold-dev-2.local:51822` | `10.210.1.0/24` | `10.210.1.1` |
|
||||
|
||||
## Checking state
|
||||
|
||||
|
||||
+36
-62
@@ -1,79 +1,53 @@
|
||||
# Lima VM for testing Coolify v5 against coolify-provisioned hosts.
|
||||
# Start with: scripts/coold-vm.sh up
|
||||
#
|
||||
# This file is copied into .dev/lima/coold.generated.yaml by the wrapper script,
|
||||
# with {{COOLIFY_REPO}}, {{COOLIFY_COOLD_VERSION}}, and {{COOLIFY_CORROSION_VERSION}} replaced before Lima sees it.
|
||||
|
||||
vmType: "vz"
|
||||
arch: "default"
|
||||
user:
|
||||
name: coolify
|
||||
cpus: 4
|
||||
memory: "8GiB"
|
||||
disk: "100GiB"
|
||||
memory: "2GiB"
|
||||
disk: "20GiB"
|
||||
containerd:
|
||||
system: false
|
||||
user: false
|
||||
|
||||
ssh:
|
||||
localPort: {{COOLIFY_COOLD_VM_SSH_PORT}}
|
||||
|
||||
images:
|
||||
- location: "https://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-amd64.img"
|
||||
- location: "https://cloud-images.ubuntu.com/releases/26.04/release/ubuntu-26.04-server-cloudimg-amd64.img"
|
||||
arch: "x86_64"
|
||||
- location: "https://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-arm64.img"
|
||||
- location: "https://cloud-images.ubuntu.com/releases/26.04/release/ubuntu-26.04-server-cloudimg-arm64.img"
|
||||
arch: "aarch64"
|
||||
|
||||
mountType: "virtiofs"
|
||||
mounts:
|
||||
- location: "{{COOLIFY_REPO}}"
|
||||
mountPoint: "/workspace/coolify"
|
||||
writable: true
|
||||
|
||||
portForwards:
|
||||
- guestPort: 5173
|
||||
hostPort: 5173
|
||||
hostIP: "127.0.0.1"
|
||||
- guestPort: 3000
|
||||
hostPort: 3000
|
||||
hostIP: "127.0.0.1"
|
||||
networks:
|
||||
- lima: bridged
|
||||
|
||||
provision:
|
||||
- mode: system
|
||||
script: |
|
||||
#!/usr/bin/env bash
|
||||
set -euxo pipefail
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
echo "[coold-vm] Updating Ubuntu package index..."
|
||||
apt-get update
|
||||
echo "[coold-vm] Installing minimal VM dependencies..."
|
||||
apt-get install -y --no-install-recommends \
|
||||
bash \
|
||||
ca-certificates \
|
||||
curl \
|
||||
iproute2 \
|
||||
jq \
|
||||
openssl \
|
||||
sqlite3 \
|
||||
sudo
|
||||
cat >/usr/local/bin/rtk <<'SH'
|
||||
#!/usr/bin/env bash
|
||||
exec "$@"
|
||||
SH
|
||||
chmod +x /usr/local/bin/rtk
|
||||
mkdir -p /etc/coolify /var/lib/coolify-dev
|
||||
chmod 755 /etc/coolify
|
||||
|
||||
coolify_test_public_key="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFuGmoeGq/pojrsyP1pszcNVuZx9iFkCELtxrh31QJ68 sail@76ff66d2e2dd"
|
||||
install -d -m 700 /root/.ssh
|
||||
touch /root/.ssh/authorized_keys
|
||||
grep -qxF "$coolify_test_public_key" /root/.ssh/authorized_keys || echo "$coolify_test_public_key" >>/root/.ssh/authorized_keys
|
||||
chmod 600 /root/.ssh/authorized_keys
|
||||
target_home="$(getent passwd 501 | cut -d: -f6 || true)"
|
||||
if [ -n "$target_home" ] && [ -d "$target_home" ]; then
|
||||
owner="$(stat -c '%u:%g' "$target_home")"
|
||||
install -d -m 700 -o "${owner%:*}" -g "${owner#*:}" "$target_home/.ssh"
|
||||
touch "$target_home/.ssh/authorized_keys"
|
||||
grep -qxF "$coolify_test_public_key" "$target_home/.ssh/authorized_keys" || echo "$coolify_test_public_key" >>"$target_home/.ssh/authorized_keys"
|
||||
chown "$owner" "$target_home/.ssh/authorized_keys"
|
||||
chmod 600 "$target_home/.ssh/authorized_keys"
|
||||
fi
|
||||
|
||||
echo "[coold-vm] Minimal provisioning complete. coolify bootstrap will install WireGuard, Podman, Corrosion, coold, and builder."
|
||||
|
||||
echo "[coold-vm] Installing and configuring mDNS."
|
||||
apt-get update
|
||||
apt-get install -y avahi-daemon
|
||||
hostnamectl set-hostname "{{.Name}}"
|
||||
systemctl enable --now avahi-daemon
|
||||
echo "[coold-vm] Installing SSH keys."
|
||||
|
||||
install_public_key() {
|
||||
user="$1"
|
||||
home="$(getent passwd "$user" | cut -d: -f6 || true)"
|
||||
if [ -z "$home" ] || [ ! -d "$home" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
owner="$(stat -c '%u:%g' "$home")"
|
||||
authorized_keys="$home/.ssh/authorized_keys"
|
||||
install -d -m 700 -o "${owner%:*}" -g "${owner#*:}" "$home/.ssh"
|
||||
touch "$authorized_keys"
|
||||
chown "$owner" "$authorized_keys"
|
||||
chmod 600 "$authorized_keys"
|
||||
grep -qxF "$coolify_test_public_key" "$authorized_keys" || echo "$coolify_test_public_key" >>"$authorized_keys"
|
||||
chown "$owner" "$authorized_keys"
|
||||
}
|
||||
|
||||
install_public_key root
|
||||
install_public_key coolify
|
||||
|
||||
Reference in New Issue
Block a user