Merge pull request #1434 from coollabsio/next

v4.0.0-beta.123
This commit is contained in:
Andras Bacsai 2023-11-12 19:11:31 +01:00 committed by GitHub
commit 285666e181
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 132 additions and 29 deletions

View File

@ -7,6 +7,7 @@
class StackForm extends Component
{
public $service;
public $isConfigurationRequired = false;
protected $listeners = ["saveCompose"];
protected $rules = [
'service.docker_compose_raw' => 'required',
@ -14,8 +15,14 @@ class StackForm extends Component
'service.name' => 'required',
'service.description' => 'nullable',
];
public function mount () {
if ($this->service->applications->filter(fn($app) => str($app->image)->contains('minio/minio'))->count() > 0) {
$this->isConfigurationRequired = true;
}
}
public function saveCompose($raw)
{
$this->service->docker_compose_raw = $raw;
$this->submit();
}

View File

@ -453,15 +453,31 @@ public function parse(bool $isNew = false): Collection
'service_id' => $this->id,
])->first();
if ($value->startsWith('SERVICE_')) {
$command = $value->after('SERVICE_')->beforeLast('_');
$forService = $value->afterLast('_');
$generatedValue = null;
// Count _ in $value
$count = substr_count($value->value(), '_');
if ($count === 2) {
// SERVICE_FQDN_UMAMI
$command = $value->after('SERVICE_')->beforeLast('_');
$forService = $value->afterLast('_');
$generatedValue = null;
$port = null;
}
if ($count === 3) {
// SERVICE_FQDN_UMAMI_1000
$command = $value->after('SERVICE_')->before('_');
$forService = $value->after('SERVICE_')->after('_')->before('_');
$generatedValue = null;
$port = $value->afterLast('_');
}
if ($command->value() === 'FQDN' || $command->value() === 'URL') {
if (Str::lower($forService) === $serviceName) {
$fqdn = generateFqdn($this->server, $containerName);
} else {
$fqdn = generateFqdn($this->server, Str::lower($forService) . '-' . $this->uuid);
}
if ($port) {
$fqdn = "$fqdn:$port";
}
if ($foundEnv) {
$fqdn = data_get($foundEnv, 'value');
} else {
@ -477,7 +493,7 @@ public function parse(bool $isNew = false): Collection
]);
}
if (!$isDatabase) {
if ($command->value() === 'FQDN') {
if ($command->value() === 'FQDN' && is_null($savedService->fqdn)) {
$savedService->fqdn = $fqdn;
$savedService->save();
}

View File

@ -85,7 +85,6 @@ function getFilesystemVolumesFromServer(ServiceApplication|ServiceDatabase $oneS
} else {
$fileLocation = $path;
}
ray($path,$fileLocation);
// Exists and is a file
$isFile = instant_remote_process(["test -f $fileLocation && echo OK || echo NOK"], $server);
// Exists and is a directory
@ -127,6 +126,7 @@ function getFilesystemVolumesFromServer(ServiceApplication|ServiceDatabase $oneS
function updateCompose($resource)
{
try {
ray($resource);
$name = data_get($resource, 'name');
$dockerComposeRaw = data_get($resource, 'service.docker_compose_raw');
$dockerCompose = Yaml::parse($dockerComposeRaw);
@ -135,19 +135,21 @@ function updateCompose($resource)
$image = data_get($resource, 'image');
data_set($dockerCompose, "services.{$name}.image", $image);
// Update FQDN
$variableName = "SERVICE_FQDN_" . Str::of($resource->name)->upper();
$generatedEnv = EnvironmentVariable::where('service_id', $resource->service_id)->where('key', $variableName)->first();
if ($generatedEnv) {
$generatedEnv->value = $resource->fqdn;
$generatedEnv->save();
}
$variableName = "SERVICE_URL_" . Str::of($resource->name)->upper();
$generatedEnv = EnvironmentVariable::where('service_id', $resource->service_id)->where('key', $variableName)->first();
if ($generatedEnv) {
$url = Str::of($resource->fqdn)->after('://');
$generatedEnv->value = $url;
$generatedEnv->save();
if (!str($resource->fqdn)->contains(',')) {
// Update FQDN
$variableName = "SERVICE_FQDN_" . Str::of($resource->name)->upper();
$generatedEnv = EnvironmentVariable::where('service_id', $resource->service_id)->where('key', $variableName)->first();
if ($generatedEnv) {
$generatedEnv->value = $resource->fqdn;
$generatedEnv->save();
}
$variableName = "SERVICE_URL_" . Str::of($resource->name)->upper();
$generatedEnv = EnvironmentVariable::where('service_id', $resource->service_id)->where('key', $variableName)->first();
if ($generatedEnv) {
$url = Str::of($resource->fqdn)->after('://');
$generatedEnv->value = $url;
$generatedEnv->save();
}
}
$dockerComposeRaw = Yaml::dump($dockerCompose, 10, 2);

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.122',
'release' => '4.0.0-beta.123',
// 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.122';
return '4.0.0-beta.123';

View File

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('applications', function (Blueprint $table) {
$table->longText('fqdn')->nullable()->change();
});
Schema::table('application_previews', function (Blueprint $table) {
$table->longText('fqdn')->nullable()->change();
});
Schema::table('service_applications', function (Blueprint $table) {
$table->longText('fqdn')->nullable()->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('applications', function (Blueprint $table) {
$table->string('fqdn')->nullable()->change();
});
Schema::table('application_previews', function (Blueprint $table) {
$table->string('fqdn')->nullable()->change();
});
Schema::table('service_applications', function (Blueprint $table) {
$table->string('fqdn')->nullable()->change();
});
}
};

View File

@ -9,8 +9,12 @@
File</x-forms.button>
</div>
<div class="flex gap-2">
<x-forms.input id="service.name" required label="Service Name"
placeholder="My super wordpress site" />
<x-forms.input id="service.name" required label="Service Name" placeholder="My super wordpress site" />
<x-forms.input id="service.description" label="Description" />
</div>
{{-- @if ($isConfigurationRequired)
<div class="text-warning">This service requires additional confiugration. Please check our <a
href="https://coolify.io/docs" class="text-white underline">documentation</a> for further information.
</div>
@endif --}}
</form>

View File

@ -1,4 +1,3 @@
# ignore: true
# documentation: https://docs.min.io/docs/minio-docker-quickstart-guide.html
# slogan: MinIO is a high performance object storage server compatible with Amazon S3 APIs.
# tags: object, storage, server, s3, api
@ -8,12 +7,35 @@ services:
image: quay.io/minio/minio:latest
command: server /data --console-address ":9001"
environment:
- SERVICE_FQDN_MINIO_9000
- SERVICE_FQDN_CONSOLE_9001
- MINIO_DOMAIN=$SERVICE_URL_MINIO_9000
- MINIO_SERVER_URL=$SERVICE_FQDN_MINIO_9000
- MINIO_BROWSER_REDIRECT_URL=$SERVICE_FQDN_CONSOLE_9001
- MINIO_SERVER_URL=$MINIO_SERVER_URL
- MINIO_BROWSER_REDIRECT_URL=$MINIO_BROWSER_REDIRECT_URL
- MINIO_ROOT_USER=$SERVICE_USER_MINIO
- MINIO_ROOT_PASSWORD=$SERVICE_PASSWORD_MINIO
volumes:
- minio-data:/data
# services:
# minio:
# image: minio/minio
# command: server /data --address ":9000" --console-address ":9001"
# networks:
# - coolify
# environment:
# - MINIO_SERVER_URL=http://minio.65.21.189.27.sslip.io
# - MINIO_BROWSER_REDIRECT_URL=http://console.65.21.189.27.sslip.io
# - MINIO_BROWSER=on
# - MINIO_ROOT_USER=asd
# - MINIO_ROOT_PASSWORD=asdasdasd
# labels:
# - "traefik.enable=true"
# - "traefik.http.routers.minio-console.rule=Host(`console.65.21.189.27.sslip.io`)"
# - "traefik.http.routers.minio-console.entrypoints=http"
# - "traefik.http.routers.minio-console.service=minio-console"
# - "traefik.http.services.minio-console.loadbalancer.server.port=9001"
# - "traefik.http.routers.minio.rule=Host(`minio.65.21.189.27.sslip.io`)"
# - "traefik.http.routers.minio.entrypoints=http"
# - "traefik.http.routers.minio.service=minio"
# - "traefik.http.services.minio.loadbalancer.server.port=9000"
# networks:
# coolify:
# external: true

View File

@ -300,6 +300,18 @@
"playlist"
]
},
"minio": {
"documentation": "https:\/\/docs.min.io\/docs\/minio-docker-quickstart-guide.html",
"slogan": "MinIO is a high performance object storage server compatible with Amazon S3 APIs.",
"compose": "c2VydmljZXM6CiAgbWluaW86CiAgICBpbWFnZTogJ3F1YXkuaW8vbWluaW8vbWluaW86bGF0ZXN0JwogICAgY29tbWFuZDogJ3NlcnZlciAvZGF0YSAtLWNvbnNvbGUtYWRkcmVzcyAiOjkwMDEiJwogICAgZW52aXJvbm1lbnQ6CiAgICAgIC0gTUlOSU9fU0VSVkVSX1VSTD0kTUlOSU9fU0VSVkVSX1VSTAogICAgICAtIE1JTklPX0JST1dTRVJfUkVESVJFQ1RfVVJMPSRNSU5JT19CUk9XU0VSX1JFRElSRUNUX1VSTAogICAgICAtIE1JTklPX1JPT1RfVVNFUj0kU0VSVklDRV9VU0VSX01JTklPCiAgICAgIC0gTUlOSU9fUk9PVF9QQVNTV09SRD0kU0VSVklDRV9QQVNTV09SRF9NSU5JTwogICAgdm9sdW1lczoKICAgICAgLSAnbWluaW8tZGF0YTovZGF0YScK",
"tags": [
"object",
"storage",
"server",
"s3",
"api"
]
},
"moodle": {
"documentation": "https:\/\/moodle.org",
"slogan": "Moodle is the world\u2019s most customisable and trusted eLearning solution that empowers educators to improve our world.",

View File

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