From 41280aa780f5dd712c8e711d33a75cc778f77137 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 5 Dec 2023 12:13:57 +0100 Subject: [PATCH] wip --- .env.production | 5 -- config/app.php | 2 +- config/broadcasting.php | 2 +- docker-compose.dev.yml | 32 ++++++------- docker-compose.prod.yml | 19 ++++---- docker-compose.yml | 12 ++--- package-lock.json | 100 ++++++++++++++++++++++++++++++++++++++++ package.json | 1 + resources/js/app.js | 32 ++++++------- scripts/install.sh | 6 +-- scripts/upgrade.sh | 34 ++++++-------- 11 files changed, 168 insertions(+), 77 deletions(-) diff --git a/.env.production b/.env.production index b8aaa9c0d..32652711e 100644 --- a/.env.production +++ b/.env.production @@ -4,8 +4,3 @@ APP_KEY= DB_PASSWORD= REDIS_PASSWORD= - -PUSHER_APP_ID= -PUSHER_APP_KEY= -PUSHER_APP_SECRET= -VITE_PUSHER_APP_KEY=$PUSHER_APP_KEY diff --git a/config/app.php b/config/app.php index 5851640be..246ad1f99 100644 --- a/config/app.php +++ b/config/app.php @@ -194,7 +194,7 @@ App\Providers\AppServiceProvider::class, App\Providers\FortifyServiceProvider::class, App\Providers\AuthServiceProvider::class, - App\Providers\BroadcastServiceProvider::class, + // App\Providers\BroadcastServiceProvider::class, App\Providers\EventServiceProvider::class, App\Providers\HorizonServiceProvider::class, App\Providers\RouteServiceProvider::class, diff --git a/config/broadcasting.php b/config/broadcasting.php index f61cb05f2..f1f005241 100644 --- a/config/broadcasting.php +++ b/config/broadcasting.php @@ -15,7 +15,7 @@ | */ - 'default' => env('BROADCAST_DRIVER', 'pusher'), + 'default' => env('BROADCAST_DRIVER', 'null'), /* |-------------------------------------------------------------------------- diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index e0240f286..59bb6284b 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -21,10 +21,10 @@ services: SSL_MODE: "off" AUTORUN_LARAVEL_STORAGE_LINK: "false" AUTORUN_LARAVEL_MIGRATION: "false" - PUSHER_HOST: "coolify-soketi" - PUSHER_APP_ID: "${PUSHER_APP_ID:-coolify}" - PUSHER_APP_KEY: "${PUSHER_APP_KEY:-coolify}" - PUSHER_APP_SECRET: "${PUSHER_APP_SECRET:-coolify}" + # PUSHER_HOST: "coolify-soketi" + # PUSHER_APP_ID: "${PUSHER_APP_ID:-coolify}" + # PUSHER_APP_KEY: "${PUSHER_APP_KEY:-coolify}" + # PUSHER_APP_SECRET: "${PUSHER_APP_SECRET:-coolify}" volumes: - .:/var/www/html/:cached postgres: @@ -48,21 +48,21 @@ services: volumes: - /data/coolify/_volumes/redis/:/data # - coolify-redis-data-dev:/data - soketi: - env_file: - - .env - ports: - - "${FORWARD_SOKETI_PORT:-6001}:6001" - environment: - SOKETI_DEBUG: "false" - SOKETI_DEFAULT_APP_ID: "${PUSHER_APP_ID:-coolify}" - SOKETI_DEFAULT_APP_KEY: "${PUSHER_APP_KEY:-coolify}" - SOKETI_DEFAULT_APP_SECRET: "${PUSHER_APP_SECRET:-coolify}" + # soketi: + # env_file: + # - .env + # ports: + # - "${FORWARD_SOKETI_PORT:-6001}:6001" + # environment: + # SOKETI_DEBUG: "false" + # SOKETI_DEFAULT_APP_ID: "${PUSHER_APP_ID:-coolify}" + # SOKETI_DEFAULT_APP_KEY: "${PUSHER_APP_KEY:-coolify}" + # SOKETI_DEFAULT_APP_SECRET: "${PUSHER_APP_SECRET:-coolify}" vite: image: node:20 working_dir: /var/www/html - environment: - VITE_PUSHER_APP_KEY: "${PUSHER_APP_KEY:-coolify}" + # environment: + # VITE_PUSHER_APP_KEY: "${PUSHER_APP_KEY:-coolify}" ports: - "${VITE_PORT:-5173}:${VITE_PORT:-5173}" volumes: diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index abf5dda6c..721174fa7 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -35,10 +35,9 @@ services: - PHP_PM_START_SERVERS=1 - PHP_PM_MIN_SPARE_SERVERS=1 - PHP_PM_MAX_SPARE_SERVERS=10 - - VITE_PUSHER_APP_KEY - - PUSHER_APP_ID - - PUSHER_APP_KEY - - PUSHER_APP_SECRET + # - PUSHER_APP_ID + # - PUSHER_APP_KEY + # - PUSHER_APP_SECRET - SELF_HOSTED - WAITLIST - SUBSCRIPTION_PROVIDER @@ -115,12 +114,12 @@ services: interval: 2s retries: 5 timeout: 2s - soketi: - environment: - SOKETI_DEBUG: "${SOKETI_DEBUG:-false}" - SOKETI_DEFAULT_APP_ID: "${PUSHER_APP_ID}" - SOKETI_DEFAULT_APP_KEY: "${PUSHER_APP_KEY}" - SOKETI_DEFAULT_APP_SECRET: "${PUSHER_APP_SECRET}" + # soketi: + # environment: + # SOKETI_DEBUG: "${SOKETI_DEBUG:-false}" + # SOKETI_DEFAULT_APP_ID: "${PUSHER_APP_ID}" + # SOKETI_DEFAULT_APP_KEY: "${PUSHER_APP_KEY}" + # SOKETI_DEFAULT_APP_SECRET: "${PUSHER_APP_SECRET}" volumes: coolify-db: name: coolify-db diff --git a/docker-compose.yml b/docker-compose.yml index 2509f6fc8..ab900f5f9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,12 +24,12 @@ services: restart: always networks: - coolify - soketi: - image: 'quay.io/soketi/soketi:latest-16-alpine' - container_name: coolify-soketi - restart: always - networks: - - coolify + # soketi: + # image: 'quay.io/soketi/soketi:latest-16-alpine' + # container_name: coolify-soketi + # restart: always + # networks: + # - coolify networks: coolify: name: coolify diff --git a/package-lock.json b/package-lock.json index 05d25a5d1..0a0e67f83 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,7 @@ "@tailwindcss/typography": "0.5.10", "alpinejs": "3.13.2", "daisyui": "4.3.1", + "ioredis": "^5.3.2", "tailwindcss-scrollbar": "0.1.0" }, "devDependencies": { @@ -398,6 +399,11 @@ "node": ">=12" } }, + "node_modules/@ioredis/commands": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ioredis/commands/-/commands-1.2.0.tgz", + "integrity": "sha512-Sx1pU8EM64o2BrqNpEO1CNLtKQwyhuXuqyfH7oGKCk+1a33d2r5saW8zNwm3j6BTExtjrv2BxTgzzkMwts6vGg==" + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", @@ -898,6 +904,14 @@ "node": ">= 6" } }, + "node_modules/cluster-key-slot": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/cluster-key-slot/-/cluster-key-slot-1.1.2.tgz", + "integrity": "sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -975,6 +989,22 @@ "url": "https://opencollective.com/daisyui" } }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -984,6 +1014,14 @@ "node": ">=0.4.0" } }, + "node_modules/denque": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz", + "integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==", + "engines": { + "node": ">=0.10" + } + }, "node_modules/didyoumean": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", @@ -1235,6 +1273,29 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, + "node_modules/ioredis": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ioredis/-/ioredis-5.3.2.tgz", + "integrity": "sha512-1DKMMzlIHM02eBBVOFQ1+AolGjs6+xEcM4PDL7NqOS6szq7H9jSaEkIUH6/a5Hl241LzW6JLSiAbNvTQjUupUA==", + "dependencies": { + "@ioredis/commands": "^1.1.1", + "cluster-key-slot": "^1.1.0", + "debug": "^4.3.4", + "denque": "^2.1.0", + "lodash.defaults": "^4.2.0", + "lodash.isarguments": "^3.1.0", + "redis-errors": "^1.2.0", + "redis-parser": "^3.0.0", + "standard-as-callback": "^2.1.0" + }, + "engines": { + "node": ">=12.22.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/ioredis" + } + }, "node_modules/is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -1335,6 +1396,16 @@ "resolved": "https://registry.npmjs.org/lodash.castarray/-/lodash.castarray-4.4.0.tgz", "integrity": "sha512-aVx8ztPv7/2ULbArGJ2Y42bG1mEQ5mGjpdvrbJcJFU3TbYybe+QlLS4pst9zV52ymy2in1KpFPiZnAOATxD4+Q==" }, + "node_modules/lodash.defaults": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", + "integrity": "sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ==" + }, + "node_modules/lodash.isarguments": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", + "integrity": "sha512-chi4NHZlZqZD18a0imDHnZPrDeBbTtVN7GXMwuGdRH9qotxAjYs3aVLKc7zNOG9eddR5Ksd8rvFEBc9SsggPpg==" + }, "node_modules/lodash.isplainobject": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", @@ -1409,6 +1480,11 @@ "node": "*" } }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, "node_modules/mz": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", @@ -1705,6 +1781,25 @@ "node": ">=8.10.0" } }, + "node_modules/redis-errors": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/redis-errors/-/redis-errors-1.2.0.tgz", + "integrity": "sha512-1qny3OExCf0UvUV/5wpYKf2YwPcOqXzkwKKSmKHiE6ZMQs5heeE/c8eXK+PNllPvmjgAbfnsbpkGZWy8cBpn9w==", + "engines": { + "node": ">=4" + } + }, + "node_modules/redis-parser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/redis-parser/-/redis-parser-3.0.0.tgz", + "integrity": "sha512-DJnGAeenTdpMEH6uAJRK/uiyEIH9WVsUmoLwzudwGJUwZPp80PDBWPHXSAGNPwNvIXAbe7MSUB1zQFugFml66A==", + "dependencies": { + "redis-errors": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/resolve": { "version": "1.22.2", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", @@ -1795,6 +1890,11 @@ "node": ">=0.10.0" } }, + "node_modules/standard-as-callback": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/standard-as-callback/-/standard-as-callback-2.1.0.tgz", + "integrity": "sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A==" + }, "node_modules/sucrase": { "version": "3.32.0", "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.32.0.tgz", diff --git a/package.json b/package.json index f06d6e28e..3112214cb 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "@tailwindcss/typography": "0.5.10", "alpinejs": "3.13.2", "daisyui": "4.3.1", + "ioredis": "^5.3.2", "tailwindcss-scrollbar": "0.1.0" } } diff --git a/resources/js/app.js b/resources/js/app.js index 0895df63d..3370f1857 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1,25 +1,25 @@ import Alpine from "alpinejs"; -import Echo from 'laravel-echo'; -import Pusher from 'pusher-js'; +// import Echo from 'laravel-echo'; +// import Pusher from 'pusher-js'; import { createApp } from "vue"; import MagicBar from "./components/MagicBar.vue"; import Toaster from "../../vendor/masmerise/livewire-toaster/resources/js"; -window.Pusher = Pusher; +// window.Pusher = Pusher; -window.Echo = new Echo({ - broadcaster: 'pusher', - cluster: import.meta.env.VITE_PUSHER_HOST || window.location.hostname, - key: import.meta.env.VITE_PUSHER_APP_KEY, - wsHost: import.meta.env.VITE_PUSHER_HOST || window.location.hostname, - wsPort: import.meta.env.VITE_PUSHER_PORT || 6001, - wssPort: import.meta.env.VITE_PUSHER_PORT || 6001, - forceTLS: false, - encrypted: true, - disableStats: false, - enableLogging: true, - enabledTransports: ['ws', 'wss'], -}); +// window.Echo = new Echo({ +// broadcaster: 'pusher', +// cluster: window.location.hostname, +// key: 'coolify', +// wsHost: window.location.hostname, +// wsPort: 6001, +// wssPort: 6001, +// forceTLS: false, +// encrypted: true, +// disableStats: false, +// enableLogging: true, +// enabledTransports: ['ws', 'wss'], +// }); Alpine.plugin(Toaster); diff --git a/scripts/install.sh b/scripts/install.sh index b7afeaefb..bfbc65cf1 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -137,9 +137,9 @@ if [ ! -f /data/coolify/source/.env ]; then sed -i "s|APP_KEY=.*|APP_KEY=base64:$(openssl rand -base64 32)|g" /data/coolify/source/.env sed -i "s|DB_PASSWORD=.*|DB_PASSWORD=$(openssl rand -base64 32)|g" /data/coolify/source/.env sed -i "s|REDIS_PASSWORD=.*|REDIS_PASSWORD=$(openssl rand -base64 32)|g" /data/coolify/source/.env - sed -i "s|PUSHER_APP_ID=.*|PUSHER_APP_ID=$(openssl rand -hex 32)|g" /data/coolify/source/.env - sed -i "s|PUSHER_APP_KEY=.*|PUSHER_APP_KEY=$(openssl rand -hex 32)|g" /data/coolify/source/.env - sed -i "s|PUSHER_APP_SECRET=.*|PUSHER_APP_SECRET=$(openssl rand -hex 32)|g" /data/coolify/source/.env + # sed -i "s|PUSHER_APP_ID=.*|PUSHER_APP_ID=$(openssl rand -hex 32)|g" /data/coolify/source/.env + # sed -i "s|PUSHER_APP_KEY=.*|PUSHER_APP_KEY=$(openssl rand -hex 32)|g" /data/coolify/source/.env + # sed -i "s|PUSHER_APP_SECRET=.*|PUSHER_APP_SECRET=$(openssl rand -hex 32)|g" /data/coolify/source/.env fi # Merge .env and .env.production. New values will be added to .env diff --git a/scripts/upgrade.sh b/scripts/upgrade.sh index 8b361c4be..8b7015739 100644 --- a/scripts/upgrade.sh +++ b/scripts/upgrade.sh @@ -12,29 +12,25 @@ curl -fsSL $CDN/.env.production -o /data/coolify/source/.env.production sort -u -t '=' -k 1,1 /data/coolify/source/.env /data/coolify/source/.env.production | sed '/^$/d' >/data/coolify/source/.env.temp && mv /data/coolify/source/.env.temp /data/coolify/source/.env # Check if PUSHER_APP_ID or PUSHER_APP_KEY or PUSHER_APP_SECRET is empty in /data/coolify/source/.env -if grep -q "PUSHER_APP_ID=$" /data/coolify/source/.env; then - echo "PUSHER_APP_ID is not set in .env" - sed -i "s|PUSHER_APP_ID=.*|PUSHER_APP_ID=$(openssl rand -hex 32)|g" /data/coolify/source/.env -else - echo "PUSHER_APP_ID is set in .env" -fi +# if grep -q "PUSHER_APP_ID=$" /data/coolify/source/.env; then +# sed -i "s|PUSHER_APP_ID=.*|PUSHER_APP_ID=$(openssl rand -hex 32)|g" /data/coolify/source/.env +# fi -if grep -q "PUSHER_APP_KEY=$" /data/coolify/source/.env; then - echo "PUSHER_APP_KEY is not set in .env" - sed -i "s|PUSHER_APP_KEY=.*|PUSHER_APP_KEY=$(openssl rand -hex 32)|g" /data/coolify/source/.env -else - echo "PUSHER_APP_KEY is set in .env" -fi +# if grep -q "PUSHER_APP_KEY=$" /data/coolify/source/.env; then +# sed -i "s|PUSHER_APP_KEY=.*|PUSHER_APP_KEY=$(openssl rand -hex 32)|g" /data/coolify/source/.env +# fi -if grep -q "PUSHER_APP_SECRET=$" /data/coolify/source/.env; then - echo "PUSHER_APP_SECRET is not set in .env" - sed -i "s|PUSHER_APP_SECRET=.*|PUSHER_APP_SECRET=$(openssl rand -hex 32)|g" /data/coolify/source/.env -else - echo "PUSHER_APP_SECRET is set in .env" -fi +# if grep -q "PUSHER_APP_SECRET=$" /data/coolify/source/.env; then +# sed -i "s|PUSHER_APP_SECRET=.*|PUSHER_APP_SECRET=$(openssl rand -hex 32)|g" /data/coolify/source/.env +# fi # Make sure coolify network exists docker network create --attachable coolify 2>/dev/null # docker network create --attachable --driver=overlay coolify-overlay 2>/dev/null -docker run --pull always -v /data/coolify/source:/data/coolify/source -v /var/run/docker.sock:/var/run/docker.sock --rm ghcr.io/coollabsio/coolify-helper bash -c "LATEST_IMAGE=${1:-} docker compose --env-file /data/coolify/source/.env -f /data/coolify/source/docker-compose.yml -f /data/coolify/source/docker-compose.prod.yml up -d --pull always --remove-orphans --force-recreate" +if [ -f /data/coolify/source/docker-compose.custom.yml ]; then + echo "Custom docker-compose.yml detected, using it instead of default one." + docker run --pull always -v /data/coolify/source:/data/coolify/source -v /var/run/docker.sock:/var/run/docker.sock --rm ghcr.io/coollabsio/coolify-helper bash -c "LATEST_IMAGE=${1:-} docker compose --env-file /data/coolify/source/.env -f /data/coolify/source/docker-compose.yml -f /data/coolify/source/docker-compose.prod.yml -f /data/coolify/source/docker-compose.custom.yml up -d --pull always --remove-orphans --force-recreate" +else + docker run --pull always -v /data/coolify/source:/data/coolify/source -v /var/run/docker.sock:/var/run/docker.sock --rm ghcr.io/coollabsio/coolify-helper bash -c "LATEST_IMAGE=${1:-} docker compose --env-file /data/coolify/source/.env -f /data/coolify/source/docker-compose.yml -f /data/coolify/source/docker-compose.prod.yml up -d --pull always --remove-orphans --force-recreate" +fi