This commit is contained in:
Andras Bacsai 2023-12-05 11:17:52 +01:00
parent 02989678be
commit ce49f26c53
11 changed files with 107 additions and 65 deletions

26
app/Events/TestEvent.php Normal file
View File

@ -0,0 +1,26 @@
<?php
namespace App\Events;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class TestEvent implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public function __construct()
{
}
public function broadcastOn(): array
{
return [
new Channel('public'),
];
}
}

View File

@ -10,6 +10,12 @@ class Dashboard extends Component
{ {
public $projects = []; public $projects = [];
public $servers = []; public $servers = [];
protected $listeners = ['echo:public,TestEvent' => 'notifyNewOrder'];
public function notifyNewOrder()
{
$this->emit('success', 'New order received!');
}
public function mount() public function mount()
{ {
$this->servers = Server::ownedByCurrentTeam()->get(); $this->servers = Server::ownedByCurrentTeam()->get();

View File

@ -194,7 +194,7 @@
App\Providers\AppServiceProvider::class, App\Providers\AppServiceProvider::class,
App\Providers\FortifyServiceProvider::class, App\Providers\FortifyServiceProvider::class,
App\Providers\AuthServiceProvider::class, App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class, App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class, App\Providers\EventServiceProvider::class,
App\Providers\HorizonServiceProvider::class, App\Providers\HorizonServiceProvider::class,
App\Providers\RouteServiceProvider::class, App\Providers\RouteServiceProvider::class,

View File

@ -32,14 +32,14 @@
'pusher' => [ 'pusher' => [
'driver' => 'pusher', 'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY', 'coolify'), 'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET', 'coolify'), 'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID', 'coolify'), 'app_id' => env('PUSHER_APP_ID'),
'options' => [ 'options' => [
'host' => 'coolify-soketi', 'host' => 'coolify-soketi',
'port' => env('PUSHER_PORT', 6001), 'port' => env('PUSHER_PORT', 6001),
'scheme' => env('PUSHER_SCHEME', 'http'), 'scheme' => env('PUSHER_SCHEME', 'http'),
'encrypted' => false, 'encrypted' => true,
'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
], ],
'client_options' => [ 'client_options' => [

View File

@ -21,10 +21,10 @@ services:
SSL_MODE: "off" SSL_MODE: "off"
AUTORUN_LARAVEL_STORAGE_LINK: "false" AUTORUN_LARAVEL_STORAGE_LINK: "false"
AUTORUN_LARAVEL_MIGRATION: "false" AUTORUN_LARAVEL_MIGRATION: "false"
# PUSHER_HOST: "coolify-soketi" PUSHER_HOST: "coolify-soketi"
# PUSHER_APP_ID: "${PUSHER_APP_ID:-coolify}" PUSHER_APP_ID: "${PUSHER_APP_ID:-coolify}"
# PUSHER_APP_KEY: "${PUSHER_APP_KEY:-coolify}" PUSHER_APP_KEY: "${PUSHER_APP_KEY:-coolify}"
# PUSHER_APP_SECRET: "${PUSHER_APP_SECRET:-coolify}" PUSHER_APP_SECRET: "${PUSHER_APP_SECRET:-coolify}"
volumes: volumes:
- .:/var/www/html/:cached - .:/var/www/html/:cached
postgres: postgres:
@ -48,16 +48,16 @@ services:
volumes: volumes:
- /data/coolify/_volumes/redis/:/data - /data/coolify/_volumes/redis/:/data
# - coolify-redis-data-dev:/data # - coolify-redis-data-dev:/data
# soketi: soketi:
# env_file: env_file:
# - .env - .env
# ports: ports:
# - "${FORWARD_SOKETI_PORT:-6001}:6001" - "${FORWARD_SOKETI_PORT:-6001}:6001"
# environment: environment:
# SOKETI_DEBUG: "true" SOKETI_DEBUG: "false"
# SOKETI_DEFAULT_APP_ID: "${PUSHER_APP_ID:-coolify}" SOKETI_DEFAULT_APP_ID: "${PUSHER_APP_ID:-coolify}"
# SOKETI_DEFAULT_APP_KEY: "${PUSHER_APP_KEY:-coolify}" SOKETI_DEFAULT_APP_KEY: "${PUSHER_APP_KEY:-coolify}"
# SOKETI_DEFAULT_APP_SECRET: "${PUSHER_APP_SECRET:-coolify}" SOKETI_DEFAULT_APP_SECRET: "${PUSHER_APP_SECRET:-coolify}"
vite: vite:
image: node:20 image: node:20
working_dir: /var/www/html working_dir: /var/www/html

View File

@ -35,6 +35,9 @@ services:
- PHP_PM_START_SERVERS=1 - PHP_PM_START_SERVERS=1
- PHP_PM_MIN_SPARE_SERVERS=1 - PHP_PM_MIN_SPARE_SERVERS=1
- PHP_PM_MAX_SPARE_SERVERS=10 - PHP_PM_MAX_SPARE_SERVERS=10
- PUSHER_APP_ID
- PUSHER_APP_KEY
- PUSHER_APP_SECRET
- SELF_HOSTED - SELF_HOSTED
- WAITLIST - WAITLIST
- SUBSCRIPTION_PROVIDER - SUBSCRIPTION_PROVIDER
@ -111,12 +114,12 @@ services:
interval: 2s interval: 2s
retries: 5 retries: 5
timeout: 2s timeout: 2s
# soketi: soketi:
# environment: environment:
# SOKETI_DEBUG: "${SOKETI_DEBUG:-false}" SOKETI_DEBUG: "${SOKETI_DEBUG:-false}"
# SOKETI_DEFAULT_APP_ID: "${PUSHER_APP_ID}" SOKETI_DEFAULT_APP_ID: "${PUSHER_APP_ID}"
# SOKETI_DEFAULT_APP_KEY: "${PUSHER_APP_KEY}" SOKETI_DEFAULT_APP_KEY: "${PUSHER_APP_KEY}"
# SOKETI_DEFAULT_APP_SECRET: "${PUSHER_APP_SECRET}" SOKETI_DEFAULT_APP_SECRET: "${PUSHER_APP_SECRET}"
volumes: volumes:
coolify-db: coolify-db:
name: coolify-db name: coolify-db

View File

@ -24,12 +24,12 @@ services:
restart: always restart: always
networks: networks:
- coolify - coolify
# soketi: soketi:
# image: 'quay.io/soketi/soketi:latest-16-alpine' image: 'quay.io/soketi/soketi:latest-16-alpine'
# container_name: coolify-soketi container_name: coolify-soketi
# restart: always restart: always
# networks: networks:
# - coolify - coolify
networks: networks:
coolify: coolify:
name: coolify name: coolify

View File

@ -1,25 +1,25 @@
import Alpine from "alpinejs"; import Alpine from "alpinejs";
// import Echo from 'laravel-echo'; import Echo from 'laravel-echo';
// import Pusher from 'pusher-js'; import Pusher from 'pusher-js';
import { createApp } from "vue"; import { createApp } from "vue";
import MagicBar from "./components/MagicBar.vue"; import MagicBar from "./components/MagicBar.vue";
import Toaster from "../../vendor/masmerise/livewire-toaster/resources/js"; import Toaster from "../../vendor/masmerise/livewire-toaster/resources/js";
// window.Pusher = Pusher; window.Pusher = Pusher;
// window.Echo = new Echo({ window.Echo = new Echo({
// broadcaster: 'pusher', broadcaster: 'pusher',
// cluster: window.location.hostname, cluster: window.location.hostname,
// key: import.meta.env.VITE_PUSHER_APP_KEY ?? 'coolify', key: import.meta.env.VITE_PUSHER_APP_KEY,
// wsHost: window.location.hostname, wsHost: window.location.hostname,
// wsPort: 6001, wsPort: 6001,
// wssPort: 6001, wssPort: 6001,
// forceTLS: false, forceTLS: false,
// encrypted: true, encrypted: true,
// disableStats: false, disableStats: false,
// enableLogging: true, enableLogging: true,
// enabledTransports: ['ws', 'wss'], enabledTransports: ['ws', 'wss'],
// }); });
Alpine.plugin(Toaster); Alpine.plugin(Toaster);

View File

@ -39,6 +39,10 @@
use Laravel\Fortify\Contracts\SuccessfulPasswordResetLinkRequestResponse; use Laravel\Fortify\Contracts\SuccessfulPasswordResetLinkRequestResponse;
use Laravel\Fortify\Fortify; use Laravel\Fortify\Fortify;
Route::get('/fire', function () {
event(new \App\Events\TestEvent());
return 'fired';
});
if (isDev()) { if (isDev()) {
Route::get('/dev/compose', Compose::class)->name('dev.compose'); Route::get('/dev/compose', Compose::class)->name('dev.compose');
} }

View File

@ -137,6 +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|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|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|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
fi fi
# Merge .env and .env.production. New values will be added to .env # Merge .env and .env.production. New values will be added to .env

View File

@ -12,26 +12,26 @@ 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 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 # 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 if grep -q "PUSHER_APP_ID=$" /data/coolify/source/.env; then
# echo "PUSHER_APP_ID is not set in .env" 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 sed -i "s|PUSHER_APP_ID=.*|PUSHER_APP_ID=$(openssl rand -hex 32)|g" /data/coolify/source/.env
# else else
# echo "PUSHER_APP_ID is set in .env" echo "PUSHER_APP_ID is set in .env"
# fi fi
# if grep -q "PUSHER_APP_KEY=$" /data/coolify/source/.env; then if grep -q "PUSHER_APP_KEY=$" /data/coolify/source/.env; then
# echo "PUSHER_APP_KEY is not set in .env" 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 sed -i "s|PUSHER_APP_KEY=.*|PUSHER_APP_KEY=$(openssl rand -hex 32)|g" /data/coolify/source/.env
# else else
# echo "PUSHER_APP_KEY is set in .env" echo "PUSHER_APP_KEY is set in .env"
# fi fi
# if grep -q "PUSHER_APP_SECRET=$" /data/coolify/source/.env; then if grep -q "PUSHER_APP_SECRET=$" /data/coolify/source/.env; then
# echo "PUSHER_APP_SECRET is not set in .env" 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 sed -i "s|PUSHER_APP_SECRET=.*|PUSHER_APP_SECRET=$(openssl rand -hex 32)|g" /data/coolify/source/.env
# else else
# echo "PUSHER_APP_SECRET is set in .env" echo "PUSHER_APP_SECRET is set in .env"
# fi fi
# Make sure coolify network exists # Make sure coolify network exists
docker network create --attachable coolify 2>/dev/null docker network create --attachable coolify 2>/dev/null