revert: wip

This commit is contained in:
Andras Bacsai 2023-12-04 21:37:30 +01:00
parent ac13ba0957
commit 810b55163c
12 changed files with 73 additions and 133 deletions

View File

@ -1,38 +0,0 @@
<?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 ApplicationDeploymentFinished implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public ?int $teamId = null;
/**
* Create a new event instance.
*/
public function __construct(public ?string $applicationUuid = null, public ?string $status = null)
{
$this->teamId = auth()->user()->currentTeam()->id;
}
/**
* Get the channels the event should broadcast on.
*
* @return array<int, \Illuminate\Broadcasting\Channel>
*/
public function broadcastOn(): array
{
return [
new PrivateChannel("custom.{$this->teamId}"),
];
}
}

View File

@ -11,24 +11,11 @@
class Heading extends Component class Heading extends Component
{ {
protected string $deploymentUuid;
public Application $application; public Application $application;
public array $parameters; public array $parameters;
public function getListeners()
{
$teamId = auth()->user()->currentTeam()->id;
return [
"echo-private:custom.{$teamId},ApplicationDeploymentFinished" => 'updateStatus',
];
}
public function updateStatus($message) protected string $deploymentUuid;
{
$applicationUuid = data_get($message, 'applicationUuid');
if ($this->application->uuid === $applicationUuid) {
$this->application->status = data_get($message, 'status');
}
}
public function mount() public function mount()
{ {
$this->parameters = get_route_parameters(); $this->parameters = get_route_parameters();

View File

@ -3,33 +3,18 @@
namespace App\Jobs; namespace App\Jobs;
use App\Enums\ApplicationDeploymentStatus; use App\Enums\ApplicationDeploymentStatus;
use App\Enums\ProxyTypes;
use App\Events\ApplicationDeploymentFinished;
use App\Models\Application; use App\Models\Application;
use App\Models\ApplicationDeploymentQueue; use App\Models\ApplicationDeploymentQueue;
use App\Models\ApplicationPreview;
use App\Models\GithubApp;
use App\Models\GitlabApp;
use App\Models\Server; use App\Models\Server;
use App\Models\StandaloneDocker;
use App\Models\SwarmDocker;
use App\Notifications\Application\DeploymentFailed;
use App\Notifications\Application\DeploymentSuccess;
use App\Traits\ExecuteRemoteCommand; use App\Traits\ExecuteRemoteCommand;
use Exception;
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeEncrypted; use Illuminate\Contracts\Queue\ShouldBeEncrypted;
use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use RuntimeException; use RuntimeException;
use Spatie\Url\Url;
use Symfony\Component\Yaml\Yaml;
use Throwable; use Throwable;
use Visus\Cuid2\Cuid2;
class ApplicationDeploymentNewJob implements ShouldQueue, ShouldBeEncrypted class ApplicationDeploymentNewJob implements ShouldQueue, ShouldBeEncrypted
{ {
@ -102,7 +87,6 @@ public function handle()
}); });
} }
$this->next(ApplicationDeploymentStatus::FINISHED->value); $this->next(ApplicationDeploymentStatus::FINISHED->value);
ApplicationDeploymentFinished::dispatch($this->application->uuid, ApplicationDeploymentStatus::FINISHED->value);
} catch (Throwable $exception) { } catch (Throwable $exception) {
$this->fail($exception); $this->fail($exception);
} finally { } finally {

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

@ -21,7 +21,7 @@ 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: "${PUSHER_HOST:-127.0.0.1}" 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}"
@ -48,23 +48,21 @@ 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: "true"
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
environment: environment:
VITE_PUSHER_HOST: "${PUSHER_HOST:-127.0.0.1}"
VITE_PUSHER_APP_KEY: "${PUSHER_APP_KEY:-coolify}" VITE_PUSHER_APP_KEY: "${PUSHER_APP_KEY:-coolify}"
VITE_PUSHER_PORT: "${FORWARD_SOKETI_PORT:-6001}"
ports: ports:
- "${VITE_PORT:-5173}:${VITE_PORT:-5173}" - "${VITE_PORT:-5173}:${VITE_PORT:-5173}"
volumes: volumes:

View File

@ -35,13 +35,6 @@ 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_HOST
- PUSHER_APP_ID
- PUSHER_APP_KEY
- PUSHER_APP_SECRET
- VITE_PUSHER_HOST
- VITE_PUSHER_APP_KEY
- VITE_PUSHER_PORT
- SELF_HOSTED - SELF_HOSTED
- WAITLIST - WAITLIST
- SUBSCRIPTION_PROVIDER - SUBSCRIPTION_PROVIDER

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 ?? 'coolify',
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

@ -45,7 +45,7 @@ class="flex items-center gap-2 cursor-pointer hover:text-white text-neutral-400"
</svg> </svg>
Restart Restart
</button> </button>
@if(isDev()) @if (isDev())
<button title="Restart without rebuilding" wire:click='restartNew' <button title="Restart without rebuilding" wire:click='restartNew'
class="flex items-center gap-2 cursor-pointer hover:text-white text-neutral-400"> class="flex items-center gap-2 cursor-pointer hover:text-white text-neutral-400">
<svg class="w-5 h-5 text-warning" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> <svg class="w-5 h-5 text-warning" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">

View File

@ -1,4 +1,4 @@
<nav x-init="$wire.check_status"> <nav x-init="$wire.check_status" wire:poll.10000ms="check_status">
<x-resources.breadcrumbs :resource="$application" :parameters="$parameters" /> <x-resources.breadcrumbs :resource="$application" :parameters="$parameters" />
<x-applications.navbar :application="$application" :parameters="$parameters" /> <x-applications.navbar :application="$application" :parameters="$parameters" />
</nav> </nav>

View File

@ -1,6 +1,5 @@
<?php <?php
use App\Events\ApplicationDeploymentFinished;
use App\Http\Controllers\ApplicationController; use App\Http\Controllers\ApplicationController;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Controllers\DatabaseController; use App\Http\Controllers\DatabaseController;
@ -40,11 +39,6 @@
use Laravel\Fortify\Contracts\SuccessfulPasswordResetLinkRequestResponse; use Laravel\Fortify\Contracts\SuccessfulPasswordResetLinkRequestResponse;
use Laravel\Fortify\Fortify; use Laravel\Fortify\Fortify;
Route::get('/fire', function () {
ApplicationDeploymentFinished::dispatch('kk0gg0s', 'stopped');
return 'Event has been sent!';
});
if (isDev()) { if (isDev()) {
Route::get('/dev/compose', Compose::class)->name('dev.compose'); Route::get('/dev/compose', Compose::class)->name('dev.compose');
} }

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
## Do not modify this file. You will lost the ability to autoupdate! ## Do not modify this file. You will lost the ability to autoupdate!
VERSION="1.0.3" VERSION="1.0.4"
CDN="https://cdn.coollabs.io/coolify" CDN="https://cdn.coollabs.io/coolify"
curl -fsSL $CDN/docker-compose.yml -o /data/coolify/source/docker-compose.yml curl -fsSL $CDN/docker-compose.yml -o /data/coolify/source/docker-compose.yml
@ -9,7 +9,29 @@ curl -fsSL $CDN/docker-compose.prod.yml -o /data/coolify/source/docker-compose.p
curl -fsSL $CDN/.env.production -o /data/coolify/source/.env.production curl -fsSL $CDN/.env.production -o /data/coolify/source/.env.production
# Merge .env and .env.production. New values will be added to .env # Merge .env and .env.production. New values will be added to .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 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_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_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
# 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