+
@foreach ($applications as $application)
Str::of(
@@ -58,7 +58,7 @@
@endif
{{ $application->status }}
-
Logs
@@ -88,7 +88,7 @@
@endif
{{ $database->status }}
-
Logs
diff --git a/resources/views/livewire/project/service/stack-form.blade.php b/resources/views/livewire/project/service/stack-form.blade.php
index 7a6b7d808..1f6bd61ae 100644
--- a/resources/views/livewire/project/service/stack-form.blade.php
+++ b/resources/views/livewire/project/service/stack-form.blade.php
@@ -12,9 +12,17 @@
This service requires additional confiugration. Please check our
documentation for further information.
+ @if ($fields)
+
+
Service Specific Configuration
- @endif --}}
+
+ @foreach ($fields as $serviceName => $fields)
+
+ @endforeach
+
+ @endif
From 239459dfa8f4d402385462519d6a5375c648c39a Mon Sep 17 00:00:00 2001
From: Andras Bacsai
Date: Mon, 13 Nov 2023 11:13:16 +0100
Subject: [PATCH 07/12] Remove commented out code for minio service
---
templates/compose/minio.yaml | 26 --------------------------
1 file changed, 26 deletions(-)
diff --git a/templates/compose/minio.yaml b/templates/compose/minio.yaml
index 569172ca0..dcc68bc53 100644
--- a/templates/compose/minio.yaml
+++ b/templates/compose/minio.yaml
@@ -13,29 +13,3 @@ services:
- 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
From 9e7823795d5fcc5f0bb1e20a4c1a8bb1aa54347d Mon Sep 17 00:00:00 2001
From: Andras Bacsai
Date: Mon, 13 Nov 2023 11:17:49 +0100
Subject: [PATCH 08/12] Fix null check for MINIO_BROWSER_REDIRECT_URL and
MINIO_SERVER_URL in generateServiceSpecificFqdns function
---
bootstrap/helpers/docker.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/bootstrap/helpers/docker.php b/bootstrap/helpers/docker.php
index f932c95f3..7a92ab072 100644
--- a/bootstrap/helpers/docker.php
+++ b/bootstrap/helpers/docker.php
@@ -152,13 +152,13 @@ function generateServiceSpecificFqdns($service, $forTraefik = false)
switch ($type) {
case $type->contains('minio'):
$MINIO_BROWSER_REDIRECT_URL = $variables->where('key', 'MINIO_BROWSER_REDIRECT_URL')->first();
- if (is_null($MINIO_BROWSER_REDIRECT_URL->value)) {
+ if (is_null($MINIO_BROWSER_REDIRECT_URL?->value)) {
$MINIO_BROWSER_REDIRECT_URL->update([
"value" => generateFqdn($service->service->server, 'console-' . $service->uuid)
]);
}
$MINIO_SERVER_URL = $variables->where('key', 'MINIO_SERVER_URL')->first();
- if (is_null($MINIO_SERVER_URL->value)) {
+ if (is_null($MINIO_SERVER_URL?->value)) {
$MINIO_SERVER_URL->update([
"value" => generateFqdn($service->service->server, 'minio-' . $service->uuid)
]);
From f2980738e4e8737043502c0d203d43e3c4b60695 Mon Sep 17 00:00:00 2001
From: Andras Bacsai
Date: Mon, 13 Nov 2023 11:30:20 +0100
Subject: [PATCH 09/12] Fix documentation link in service-templates.json
---
templates/service-templates.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/templates/service-templates.json b/templates/service-templates.json
index 34bf51787..d6f73cc20 100644
--- a/templates/service-templates.json
+++ b/templates/service-templates.json
@@ -132,7 +132,7 @@
]
},
"fider": {
- "documentation": "https:\/\/fider.io\/doc",
+ "documentation": "https:\/\/fider.io\/docs",
"slogan": "Fider is an open-source feedback platform for collecting and managing user feedback, helping you prioritize improvements to your products and services.",
"compose": "c2VydmljZXM6CiAgZmlkZXI6CiAgICBpbWFnZTogJ2dldGZpZGVyL2ZpZGVyOnN0YWJsZScKICAgIGVudmlyb25tZW50OgogICAgICBCQVNFX1VSTDogJFNFUlZJQ0VfRlFETl9GSURFUgogICAgICBEQVRBQkFTRV9VUkw6ICdwb3N0Z3JlczovLyRTRVJWSUNFX1VTRVJfTVlTUUw6JFNFUlZJQ0VfUEFTU1dPUkRfTVlTUUxAZGF0YWJhc2U6NTQzMi9maWRlcj9zc2xtb2RlPWRpc2FibGUnCiAgICAgIEpXVF9TRUNSRVQ6ICRTRVJWSUNFX1BBU1NXT1JEXzY0X0ZJREVSCiAgICAgIEVNQUlMX05PUkVQTFk6ICcke0VNQUlMX05PUkVQTFk6LW5vcmVwbHlAZXhhbXBsZS5jb219JwogICAgICBFTUFJTF9NQUlMR1VOX0FQSTogJEVNQUlMX01BSUxHVU5fQVBJCiAgICAgIEVNQUlMX01BSUxHVU5fRE9NQUlOOiAkRU1BSUxfTUFJTEdVTl9ET01BSU4KICAgICAgRU1BSUxfTUFJTEdVTl9SRUdJT046ICRFTUFJTF9NQUlMR1VOX1JFR0lPTgogICAgICBFTUFJTF9TTVRQX0hPU1Q6ICcke0VNQUlMX1NNVFBfSE9TVDotc210cC5tYWlsZ3VuLmNvbX0nCiAgICAgIEVNQUlMX1NNVFBfUE9SVDogJyR7RU1BSUxfU01UUF9QT1JUOi01ODd9JwogICAgICBFTUFJTF9TTVRQX1VTRVJOQU1FOiAnJHtFTUFJTF9TTVRQX1VTRVJOQU1FOi1wb3N0bWFzdGVyQG1haWxndW4uY29tfScKICAgICAgRU1BSUxfU01UUF9QQVNTV09SRDogJEVNQUlMX1NNVFBfUEFTU1dPUkQKICAgICAgRU1BSUxfU01UUF9FTkFCTEVfU1RBUlRUTFM6ICRFTUFJTF9TTVRQX0VOQUJMRV9TVEFSVFRMUwogICAgICBFTUFJTF9BV1NTRVNfUkVHSU9OOiAkRU1BSUxfQVdTU0VTX1JFR0lPTgogICAgICBFTUFJTF9BV1NTRVNfQUNDRVNTX0tFWV9JRDogJEVNQUlMX0FXU1NFU19BQ0NFU1NfS0VZX0lECiAgICAgIEVNQUlMX0FXU1NFU19TRUNSRVRfQUNDRVNTX0tFWTogJEVNQUlMX0FXU1NFU19TRUNSRVRfQUNDRVNTX0tFWQogIGRhdGFiYXNlOgogICAgaW1hZ2U6ICdwb3N0Z3JlczoxMicKICAgIHZvbHVtZXM6CiAgICAgIC0gJ3BnX2RhdGE6L3Zhci9saWIvcG9zdGdyZXNxbC9kYXRhJwogICAgZW52aXJvbm1lbnQ6CiAgICAgIFBPU1RHUkVTX1VTRVI6ICRTRVJWSUNFX1VTRVJfTVlTUUwKICAgICAgUE9TVEdSRVNfUEFTU1dPUkQ6ICRTRVJWSUNFX1BBU1NXT1JEX01ZU1FMCiAgICAgIFBPU1RHUkVTX0RCOiAnJHtQT1NUR1JFU19EQjotZmlkZXJ9Jwo=",
"tags": [
From 6b5339c1c15427a1ca768ef2d339c8c93102d08f Mon Sep 17 00:00:00 2001
From: Andras Bacsai
Date: Mon, 13 Nov 2023 11:44:13 +0100
Subject: [PATCH 10/12] Remove ray debug statement and refactor random name
generator
---
bootstrap/helpers/services.php | 1 -
bootstrap/helpers/shared.php | 13 +++++++++----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/bootstrap/helpers/services.php b/bootstrap/helpers/services.php
index b9a305a42..43a15444c 100644
--- a/bootstrap/helpers/services.php
+++ b/bootstrap/helpers/services.php
@@ -126,7 +126,6 @@ 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);
diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php
index 013821bd7..ae0f78642 100644
--- a/bootstrap/helpers/shared.php
+++ b/bootstrap/helpers/shared.php
@@ -27,7 +27,6 @@ use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Str;
use Illuminate\Support\Stringable;
-use Nubs\RandomNameGenerator\All;
use Poliander\Cron\CronExpression;
use Visus\Cuid2\Cuid2;
use phpseclib3\Crypt\RSA;
@@ -173,7 +172,11 @@ function get_latest_version_of_coolify(): string
function generate_random_name(?string $cuid = null): string
{
- $generator = All::create();
+ $generator = new \Nubs\RandomNameGenerator\All(
+ [
+ new \Nubs\RandomNameGenerator\Alliteration(),
+ ]
+ );
if (is_null($cuid)) {
$cuid = new Cuid2(7);
}
@@ -493,7 +496,8 @@ function queryResourcesByUuid(string $uuid)
return $resource;
}
-function generateDeployWebhook($resource) {
+function generateDeployWebhook($resource)
+{
$baseUrl = base_url();
$api = Url::fromString($baseUrl) . '/api/v1';
$endpoint = '/deploy';
@@ -501,6 +505,7 @@ function generateDeployWebhook($resource) {
$url = $api . $endpoint . "?uuid=$uuid&force=false";
return $url;
}
-function removeAnsiColors($text) {
+function removeAnsiColors($text)
+{
return preg_replace('/\e[[][A-Za-z0-9];?[0-9]*m?/', '', $text);
}
From 7763594e6e3538d8a578d0fc40fd1058e644f844 Mon Sep 17 00:00:00 2001
From: Andras Bacsai
Date: Mon, 13 Nov 2023 12:30:25 +0100
Subject: [PATCH 11/12] Add pull_latest_image function and update build_image
function to use it. Also add check for dockerfile existence in
start_by_compose_file function.
---
app/Jobs/ApplicationDeploymentJob.php | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php
index 71cf9026d..de32ad1fb 100644
--- a/app/Jobs/ApplicationDeploymentJob.php
+++ b/app/Jobs/ApplicationDeploymentJob.php
@@ -934,7 +934,16 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
}
return implode(' ', $generated_healthchecks_commands);
}
+ private function pull_latest_image($image)
+ {
+ $this->execute_remote_command(
+ ["echo -n 'Pulling latest image ($image) from the registry.'"],
+ [
+ executeInDocker($this->deployment_uuid, "docker pull {$image}"), "hidden" => true
+ ]
+ );
+ }
private function build_image()
{
if ($this->application->build_pack === 'static') {
@@ -948,6 +957,9 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
}
if ($this->application->settings->is_static || $this->application->build_pack === 'static') {
+ if ($this->application->static_image) {
+ $this->pull_latest_image($this->application->static_image);
+ }
if ($this->application->build_pack === 'static') {
$dockerfile = base64_encode("FROM {$this->application->static_image}
WORKDIR /usr/share/nginx/html/
@@ -1012,8 +1024,9 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
]
);
} else {
+ // Pure Dockerfile based deployment
$this->execute_remote_command([
- executeInDocker($this->deployment_uuid, "docker build $this->buildTarget $this->addHosts --network host -f {$this->workdir}{$this->dockerfile_location} {$this->build_args} --progress plain -t $this->production_image_name {$this->workdir}"), "hidden" => true
+ executeInDocker($this->deployment_uuid, "docker build --pull $this->buildTarget $this->addHosts --network host -f {$this->workdir}{$this->dockerfile_location} {$this->build_args} --progress plain -t $this->production_image_name {$this->workdir}"), "hidden" => true
]);
}
}
@@ -1049,6 +1062,17 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
private function start_by_compose_file()
{
+ if (
+ !$this->application->dockerfile &&
+ (
+ $this->application->build_pack === 'dockerimage' ||
+ $this->application->build_pack === 'dockerfile')
+ ) {
+ $this->execute_remote_command(
+ ["echo -n 'Pulling latest images from the registry.'"],
+ [executeInDocker($this->deployment_uuid, "docker compose --project-directory {$this->workdir} pull"), "hidden" => true],
+ );
+ }
$this->execute_remote_command(
["echo -n 'Starting application (could take a while).'"],
[executeInDocker($this->deployment_uuid, "docker compose --project-directory {$this->workdir} up --build -d"), "hidden" => true],
From 55846c563539871e5fd96c1b13eb2021a0b04e5b Mon Sep 17 00:00:00 2001
From: Andras Bacsai
Date: Mon, 13 Nov 2023 12:59:59 +0100
Subject: [PATCH 12/12] Fix service retrieval and add error handling
---
bootstrap/helpers/shared.php | 27 +++++++++++--------
.../livewire/project/new/select.blade.php | 2 +-
2 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php
index ae0f78642..d6766a8d0 100644
--- a/bootstrap/helpers/shared.php
+++ b/bootstrap/helpers/shared.php
@@ -447,20 +447,25 @@ function getServiceTemplates()
if (isDev()) {
$services = File::get(base_path('templates/service-templates.json'));
$services = collect(json_decode($services))->sortKeys();
- $version = config('version');
- $services = $services->map(function ($service) use ($version) {
- if (version_compare($version, data_get($service, 'minVersion', '0.0.0'), '<')) {
- $service->disabled = true;
- }
- return $service;
- });
} else {
- $services = Http::get(config('constants.services.official'));
- if ($services->failed()) {
- throw new \Exception($services->body());
+ try {
+ $response = Http::retry(3, 50)->get(config('constants.services.official'));
+ if ($response->failed()) {
+ return collect([]);
+ }
+ $services = $response->json();
+ $services = collect($services)->sortKeys();
+ } catch (\Throwable $e) {
+ $services = collect([]);
}
- $services = collect($services->json())->sortKeys();
}
+ // $version = config('version');
+ // $services = $services->map(function ($service) use ($version) {
+ // if (version_compare($version, data_get($service, 'minVersion', '0.0.0'), '<')) {
+ // $service->disabled = true;
+ // }
+ // return $service;
+ // });
return $services;
}
diff --git a/resources/views/livewire/project/new/select.blade.php b/resources/views/livewire/project/new/select.blade.php
index 145e7a152..05b1aa6db 100644
--- a/resources/views/livewire/project/new/select.blade.php
+++ b/resources/views/livewire/project/new/select.blade.php
@@ -182,7 +182,7 @@
@endif
@empty
- No service found.
+ No service found. Please try to reload the list!
@endforelse
@endif