mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
Merge scripts/dev-instances into scripts/dev. Each branch gets its own Compose project, container, volumes, port block, libvirt network, and KVM VMs, so stop and start reuse the same data and worktrees do not collide. - Name instances after the branch; keep slots and APP_KEYs in the main checkout's .dev-instances/ so they survive worktree removal - Reuse existing QEMU VMs instead of recreating them; add dev:qemu --fresh - Give each instance an isolated libvirt network (10.221.<slot>.0/24) and VM names coolify-dev-<branch>--<profile> - Publish per-instance browser ports and publish them with tailscale serve when APP_URL is a tailnet host - Add urls, exec, logs, container, destroy, and teardown commands; run teardown from jean.json before Jean deletes a worktree - Fix Reverb/terminal browser ports and the testing-host alias in the instance compose file - Keep fresh worktree instances working: pre-create laravel.log, log the host dev:qemu call to stderr, and stop Vite from watching vendor/ Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
45 lines
1.4 KiB
Bash
Executable File
45 lines
1.4 KiB
Bash
Executable File
#!/command/with-contenv sh
|
|
set -eu
|
|
|
|
cd /var/www/html
|
|
|
|
# When the project is bind-mounted, host ownership may be root:root while the
|
|
# app runs as www-data (UID 1000). Fix the minimum needed so composer/laravel
|
|
# can write, without a recursive chown of the whole tree.
|
|
prepare_bind_mount() {
|
|
mkdir -p \
|
|
storage/framework/cache \
|
|
storage/framework/sessions \
|
|
storage/framework/views \
|
|
storage/logs \
|
|
bootstrap/cache
|
|
# Create the shared log before root processes (migrate, scheduler) can create it root-owned.
|
|
touch storage/logs/laravel.log
|
|
|
|
if [ "$(id -u)" = "0" ]; then
|
|
# Top-level only: allows creating vendor/ when the mount is root-owned
|
|
chown www-data:www-data /var/www/html 2>/dev/null || true
|
|
chown -R www-data:www-data storage bootstrap/cache 2>/dev/null || true
|
|
git config --global --add safe.directory /var/www/html 2>/dev/null || true
|
|
fi
|
|
}
|
|
|
|
prepare_bind_mount
|
|
|
|
echo "👉 init-setup: composer install..."
|
|
# Run as root when needed so a root-owned bind mount cannot block vendor/
|
|
# creation, then hand writable paths to www-data for PHP-FPM.
|
|
composer install --no-interaction
|
|
|
|
echo "👉 init-setup: migrate..."
|
|
php artisan migrate --step --force
|
|
|
|
echo "👉 init-setup: artisan dev --init..."
|
|
php artisan dev --init
|
|
|
|
if [ "$(id -u)" = "0" ]; then
|
|
chown -R www-data:www-data vendor storage bootstrap/cache 2>/dev/null || true
|
|
fi
|
|
|
|
echo "👉 init-setup: done"
|