fix: database proxy for services

version++
tiny css modifications
This commit is contained in:
Andras Bacsai 2023-11-10 09:41:42 +01:00
parent 87ab4bd71e
commit db0e3cfcc4
8 changed files with 18 additions and 13 deletions

View File

@ -21,26 +21,33 @@ public function handle(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|St
$type = $database->getMorphClass();
$network = data_get($database, 'destination.network');
$server = data_get($database, 'destination.server');
$containerName = data_get($database, 'uuid');
$proxyContainerName = "{$database->uuid}-proxy";
if ($database->getMorphClass() === 'App\Models\ServiceDatabase') {
$databaseType = $database->databaseType();
$network = data_get($database, 'service.destination.network');
$server = data_get($database, 'service.destination.server');
ray($databaseType, $network);
$proxyContainerName = "{$database->service->uuid}-proxy";
switch ($databaseType) {
case 'standalone-mariadb':
$type = 'App\Models\StandaloneMariadb';
$containerName = "mariadb-{$database->service->uuid}";
break;
case 'standalone-mongodb':
$type = 'App\Models\StandaloneMongodb';
$containerName = "mongodb-{$database->service->uuid}";
break;
case 'standalone-mysql':
$type = 'App\Models\StandaloneMysql';
$containerName = "mysql-{$database->service->uuid}";
break;
case 'standalone-postgresql':
$type = 'App\Models\StandalonePostgresql';
$containerName = "postgresql-{$database->service->uuid}";
break;
case 'standalone-redis':
$type = 'App\Models\StandaloneRedis';
$containerName = "redis-{$database->service->uuid}";
break;
}
}
@ -55,7 +62,6 @@ public function handle(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|St
} else if ($type === 'App\Models\StandaloneMariadb') {
$internalPort = 3306;
}
$containerName = "{$database->uuid}-proxy";
$configuration_dir = database_proxy_dir($database->uuid);
$nginxconf = <<<EOF
user nginx;
@ -69,7 +75,7 @@ public function handle(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|St
stream {
server {
listen $database->public_port;
proxy_pass $database->uuid:$internalPort;
proxy_pass $containerName:$internalPort;
}
}
EOF;
@ -81,13 +87,13 @@ public function handle(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|St
$docker_compose = [
'version' => '3.8',
'services' => [
$containerName => [
$proxyContainerName => [
'build' => [
'context' => $configuration_dir,
'dockerfile' => 'Dockerfile',
],
'image' => "nginx:stable-alpine",
'container_name' => $containerName,
'container_name' => $proxyContainerName,
'restart' => RESTART_MODE,
'ports' => [
"$database->public_port:$database->public_port",

View File

@ -20,7 +20,7 @@ public function __construct(
public bool $readonly = false,
public string|null $helper = null,
public bool $allowToPeak = true,
public string $defaultClass = "input input-sm bg-coolgray-200 rounded text-white w-full disabled:bg-coolgray-200/50 disabled:border-none placeholder:text-coolgray-500 read-only:text-neutral-500 read-only:bg-coolgray-200/50"
public string $defaultClass = "input input-sm bg-coolgray-100 rounded text-white w-full disabled:bg-coolgray-200/50 disabled:border-none placeholder:text-coolgray-500 read-only:text-neutral-500 read-only:bg-coolgray-200/50"
) {
}

View File

@ -7,7 +7,7 @@
// The release version of your application
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))
'release' => '4.0.0-beta.119',
'release' => '4.0.0-beta.120',
// When left empty or `null` the Laravel environment will be used
'environment' => config('app.env'),

View File

@ -1,3 +1,3 @@
<?php
return '4.0.0-beta.119';
return '4.0.0-beta.120';

View File

@ -53,7 +53,7 @@ .icon:hover {
@apply text-white;
}
.box {
@apply flex p-2 transition-colors cursor-pointer min-h-16 bg-coolgray-200 hover:bg-coollabs-100 hover:text-white hover:no-underline min-w-[24rem];
@apply flex p-2 transition-colors cursor-pointer min-h-16 bg-coolgray-100 hover:bg-coollabs-100 hover:text-white hover:no-underline min-w-[24rem];
}
.box-without-bg {
@apply flex p-2 transition-colors min-h-16 hover:text-white hover:no-underline min-w-[24rem];

View File

@ -25,7 +25,6 @@
@endif
</head>
@section('body')
<body>
@livewireScripts
<dialog id="help" class="modal">

View File

@ -39,12 +39,12 @@ module.exports = {
themes: [
{
coollabs: {
primary: "#323232",
primary: "#202020",
"primary-focus": "#242424",
secondary: "#6B16ED",
accent: "#4338ca",
neutral: "#1B1D1D",
"base-100": "#181818",
"base-100": "#101010",
info: "#2563EB",
success: "#16A34A",
warning: "#FCD34D",

View File

@ -4,7 +4,7 @@
"version": "3.12.36"
},
"v4": {
"version": "4.0.0-beta.119"
"version": "4.0.0-beta.120"
}
}
}