Fix sandbox Docker root issue and replace make dev with systemd services
Fixes docker permissions by enabling Docker daemon during provisioning. Replaces make dev with three managed systemd services: probo-stack (auto-starting Docker Compose infra), probod (API server with gow for hot-reload), and probo-console (frontend dev server). The stack now starts automatically on VM boot; probod and console are started manually after build. Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -19,15 +19,15 @@ brew install lima jq
|
||||
# Check status and get the VM IP
|
||||
./contrib/lima/sandbox.sh status
|
||||
|
||||
# Start the Docker stack inside the VM
|
||||
./contrib/lima/sandbox.sh exec -- make stack-up
|
||||
|
||||
# Build and run the dev server
|
||||
# Build the backend binary (probo-stack starts automatically on boot)
|
||||
./contrib/lima/sandbox.sh exec -- make build
|
||||
./contrib/lima/sandbox.sh exec -- make dev
|
||||
|
||||
# Start probod and the console dev server
|
||||
./contrib/lima/sandbox.sh exec -- sudo systemctl start probod probo-console
|
||||
|
||||
# Access services from your host browser using the VM IP
|
||||
# e.g. http://192.168.105.2:5173
|
||||
# e.g. http://192.168.105.2:5173 (console)
|
||||
# e.g. http://192.168.105.2:8080 (API)
|
||||
```
|
||||
|
||||
## Commands
|
||||
|
||||
@@ -45,6 +45,8 @@ if ! command -v docker &>/dev/null; then
|
||||
containerd.io \
|
||||
docker-buildx-plugin \
|
||||
docker-compose-plugin
|
||||
|
||||
systemctl enable --now docker
|
||||
fi
|
||||
|
||||
usermod -aG docker "${LIMA_CIDATA_USER:-lima}" 2>/dev/null || true
|
||||
@@ -107,3 +109,63 @@ AWS_USE_PATH_STYLE=true \
|
||||
|
||||
echo "VITE_API_URL=http://${VM_IP}:8080" > /workspace/apps/console/.env
|
||||
echo "VITE_API_URL=http://${VM_IP}:8080" > /workspace/apps/trust/.env
|
||||
|
||||
# Install systemd services for the sandbox
|
||||
cat > /etc/systemd/system/probo-stack.service << 'EOF'
|
||||
[Unit]
|
||||
Description=Probo Docker Compose Stack
|
||||
Requires=docker.service
|
||||
After=docker.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/workspace
|
||||
ExecStart=/usr/bin/docker compose -f compose.yaml up
|
||||
ExecStop=/usr/bin/docker compose -f compose.yaml down
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
cat > /etc/systemd/system/probod.service << EOF
|
||||
[Unit]
|
||||
Description=Probo API Server
|
||||
Requires=probo-stack.service
|
||||
After=probo-stack.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=${LIMA_USER}
|
||||
WorkingDirectory=/workspace
|
||||
ExecStart=/usr/local/bin/gow -r=false run ./cmd/probod -cfg-file /etc/probod/config.yml
|
||||
Restart=on-failure
|
||||
RestartSec=3s
|
||||
Environment=PATH=/usr/local/go/bin:/usr/local/bin:/usr/bin:/bin
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
cat > /etc/systemd/system/probo-console.service << EOF
|
||||
[Unit]
|
||||
Description=Probo Console Dev Server
|
||||
After=probod.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=${LIMA_USER}
|
||||
WorkingDirectory=/workspace
|
||||
ExecStart=/usr/bin/npm --workspace @probo/console run dev -- --host 0.0.0.0
|
||||
Restart=on-failure
|
||||
RestartSec=3s
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl enable --now probo-stack.service
|
||||
systemctl enable probod.service probo-console.service
|
||||
|
||||
Reference in New Issue
Block a user