Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

refactor a lot of things fix: postgres_passwords could be longer feat: able to define postgresql databases from the ui

Andras Bacsaia378b5108ee9
diff --git a/app/Actions/Database/StartPostgresql.php b/app/Actions/Database/StartPostgresql.php
index 27e0620f13..4b9b99f3e6 100644
--- a/app/Actions/Database/StartPostgresql.php
+++ b/app/Actions/Database/StartPostgresql.php
@@ -150,7 +150,7 @@ class StartPostgresql
private function generate_init_scripts()
{
- if (count($this->database->init_scripts) === 0) {
+ if (is_null($this->database->init_scripts) || count($this->database->init_scripts) === 0) {
return;
}
foreach ($this->database->init_scripts as $init_script) {
diff --git a/app/Actions/License/CheckResaleLicense.php b/app/Actions/License/CheckResaleLicense.php
index 2ce3c574a7..71d1dddaa1 100644
--- a/app/Actions/License/CheckResaleLicense.php
+++ b/app/Actions/License/CheckResaleLicense.php
@@ -18,7 +18,7 @@ class CheckResaleLicense
return;
}
$base_url = config('coolify.license_url');
- if (isDev()) {
+ if (is_dev()) {
$base_url = 'http://host.docker.internal:8787';
}
$instance_id = config('app.id');
diff --git a/app/Actions/Server/UpdateCoolify.php b/app/Actions/Server/UpdateCoolify.php
index 8b5644a1d9..8f81852d86 100644
--- a/app/Actions/Server/UpdateCoolify.php
+++ b/app/Actions/Server/UpdateCoolify.php
@@ -17,7 +17,7 @@ class UpdateCoolify
$settings = InstanceSettings::get();
ray('Running InstanceAutoUpdateJob');
$localhost_name = 'localhost';
- if (isDev()) {
+ if (is_dev()) {
$localhost_name = 'testing-local-docker-container';
}
$this->server = Server::where('name', $localhost_name)->firstOrFail();
@@ -52,7 +52,7 @@ class UpdateCoolify
private function update()
{
- if (isDev()) {
+ if (is_dev()) {
ray("Running update on local docker container. Updating to $this->latest_version");
remote_process([
"sleep 10"
diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php
index b580979ff6..501303b2f8 100644
--- a/app/Console/Kernel.php
+++ b/app/Console/Kernel.php
@@ -18,7 +18,7 @@ class Kernel extends ConsoleKernel
protected function schedule(Schedule $schedule): void
{
// $schedule->call(fn() => $this->check_scheduled_backups($schedule))->everyTenSeconds();
- if (isDev()) {
+ if (is_dev()) {
$schedule->command('horizon:snapshot')->everyMinute();
$schedule->job(new InstanceApplicationsStatusJob)->everyMinute();
$schedule->job(new ProxyCheckJob)->everyFiveMinutes();
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php
index 9d9dabab60..b08c070124 100644
--- a/app/Exceptions/Handler.php
+++ b/app/Exceptions/Handler.php
@@ -45,7 +45,7 @@ class Handler extends ExceptionHandler
{
$this->reportable(function (Throwable $e) {
$this->settings = InstanceSettings::get();
- if ($this->settings->do_not_track || isDev()) {
+ if ($this->settings->do_not_track || is_dev()) {
return;
}
Integration::captureUnhandledException($e);
diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php
index 125f56d704..a2ed0f2f93 100644
--- a/app/Http/Controllers/Controller.php
+++ b/app/Http/Controllers/Controller.php
@@ -19,7 +19,7 @@ class Controller extends BaseController
public function subscription()
{
- if (!isCloud()) {
+ if (!is_cloud()) {
abort(404);
}
return view('subscription', [
@@ -29,7 +29,7 @@ class Controller extends BaseController
public function license()
{
- if (!isCloud()) {
+ if (!is_cloud()) {
abort(404);
}
return view('settings.license', [
diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php
index 80cdc7b471..9cab1063db 100644
--- a/app/Http/Controllers/ProjectController.php
+++ b/app/Http/Controllers/ProjectController.php
@@ -41,6 +41,9 @@ class ProjectController extends Controller
public function new()
{
+ $type = request()->query('type');
+ $destination_uuid = request()->query('destination');
+
$project = session('currentTeam')->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
if (!$project) {
return redirect()->route('dashboard');
@@ -49,9 +52,14 @@ class ProjectController extends Controller
if (!$environment) {
return redirect()->route('dashboard');
}
-
- $type = request()->query('type');
-
+ if (in_array($type, DATABASE_TYPES)) {
+ $standalone_postgresql = create_standalone_postgresql($environment->id, $destination_uuid);
+ return redirect()->route('project.database.configuration', [
+ 'project_uuid' => $project->uuid,
+ 'environment_name' => $environment->name,
+ 'database_uuid' => $standalone_postgresql->uuid,
+ ]);
+ }
return view('project.new', [
'type' => $type
]);
diff --git a/app/Http/Livewire/Project/Application/Heading.php b/app/Http/Livewire/Project/Application/Heading.php
index 41b84bb15c..fdbe5f71e5 100644
--- a/app/Http/Livewire/Project/Application/Heading.php
+++ b/app/Http/Livewire/Project/Application/Heading.php
@@ -17,7 +17,7 @@ class Heading extends Component
public function mount()
{
- $this->parameters = getRouteParameters();
+ $this->parameters = get_route_parameters();
}
public function check_status()
diff --git a/app/Http/Livewire/Project/Application/Previews.php b/app/Http/Livewire/Project/Application/Previews.php
index f6f4938270..b3582fbefe 100644
--- a/app/Http/Livewire/Project/Application/Previews.php
+++ b/app/Http/Livewire/Project/Application/Previews.php
@@ -20,7 +20,7 @@ class Previews extends Component
public function mount()
{
$this->pull_requests = collect();
- $this->parameters = getRouteParameters();
+ $this->parameters = get_route_parameters();
}
public function loadStatus($pull_request_id)
diff --git a/app/Http/Livewire/Project/Application/Rollback.php b/app/Http/Livewire/Project/Application/Rollback.php
index ee827b2063..d4ac53045a 100644
--- a/app/Http/Livewire/Project/Application/Rollback.php
+++ b/app/Http/Livewire/Project/Application/Rollback.php
@@ -16,7 +16,7 @@ class Rollback extends Component
public function mount()
{
- $this->parameters = getRouteParameters();
+ $this->parameters = get_route_parameters();
}
public function rollbackImage($commit)
diff --git a/app/Http/Livewire/Project/Database/Heading.php b/app/Http/Livewire/Project/Database/Heading.php
index 300804bad9..59f4955a6d 100644
--- a/app/Http/Livewire/Project/Database/Heading.php
+++ b/app/Http/Livewire/Project/Database/Heading.php
@@ -34,7 +34,7 @@ class Heading extends Component
public function mount()
{
- $this->parameters = getRouteParameters();
+ $this->parameters = get_route_parameters();
}
public function stop()
diff --git a/app/Http/Livewire/Project/DeleteEnvironment.php b/app/Http/Livewire/Project/DeleteEnvironment.php
index da08b5fc6e..f341d7cb52 100644
--- a/app/Http/Livewire/Project/DeleteEnvironment.php
+++ b/app/Http/Livewire/Project/DeleteEnvironment.php
@@ -12,7 +12,7 @@ class DeleteEnvironment extends Component
public function mount()
{
- $this->parameters = getRouteParameters();
+ $this->parameters = get_route_parameters();
}
public function delete()
diff --git a/app/Http/Livewire/Project/DeleteProject.php b/app/Http/Livewire/Project/DeleteProject.php
index bfb1b683c4..5bbfea17ad 100644
--- a/app/Http/Livewire/Project/DeleteProject.php
+++ b/app/Http/Livewire/Project/DeleteProject.php
@@ -12,7 +12,7 @@ class DeleteProject extends Component
public function mount()
{
- $this->parameters = getRouteParameters();
+ $this->parameters = get_route_parameters();
}
public function delete()
diff --git a/app/Http/Livewire/Project/New/GithubPrivateRepository.php b/app/Http/Livewire/Project/New/GithubPrivateRepository.php
index dcd4b8c811..77b2b2daba 100644
--- a/app/Http/Livewire/Project/New/GithubPrivateRepository.php
+++ b/app/Http/Livewire/Project/New/GithubPrivateRepository.php
@@ -38,7 +38,7 @@ class GithubPrivateRepository extends Component
public function mount()
{
- $this->parameters = getRouteParameters();
+ $this->parameters = get_route_parameters();
$this->query = request()->query();
$this->repositories = $this->branches = collect();
$this->github_apps = GithubApp::private();
diff --git a/app/Http/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php b/app/Http/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php
index afc0062a04..1bab8ce1ff 100644
--- a/app/Http/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php
+++ b/app/Http/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php
@@ -50,10 +50,10 @@ class GithubPrivateRepositoryDeployKey extends Component
public function mount()
{
- if (isDev()) {
+ if (is_dev()) {
$this->repository_url = 'https://github.com/coollabsio/coolify-examples';
}
- $this->parameters = getRouteParameters();
+ $this->parameters = get_route_parameters();
$this->query = request()->query();
$this->private_keys = PrivateKey::where('team_id', session('currentTeam')->id)->where('id', '!=', 0)->get();
}
diff --git a/app/Http/Livewire/Project/New/PublicGitRepository.php b/app/Http/Livewire/Project/New/PublicGitRepository.php
index a610bf47b7..7fd15cd345 100644
--- a/app/Http/Livewire/Project/New/PublicGitRepository.php
+++ b/app/Http/Livewire/Project/New/PublicGitRepository.php
@@ -45,11 +45,11 @@ class PublicGitRepository extends Component
public function mount()
{
- if (isDev()) {
+ if (is_dev()) {
$this->repository_url = 'https://github.com/coollabsio/coolify-examples';
$this->port = 3000;
}
- $this->parameters = getRouteParameters();
+ $this->parameters = get_route_parameters();
$this->query = request()->query();
}
diff --git a/app/Http/Livewire/Project/New/Select.php b/app/Http/Livewire/Project/New/Select.php
index e09862649b..f955991546 100644
--- a/app/Http/Livewire/Project/New/Select.php
+++ b/app/Http/Livewire/Project/New/Select.php
@@ -17,7 +17,7 @@ class Select extends Component
public function mount()
{
- $this->parameters = getRouteParameters();
+ $this->parameters = get_route_parameters();
}
public function set_type(string $type)
diff --git a/app/Http/Livewire/Project/Shared/Danger.php b/app/Http/Livewire/Project/Shared/Danger.php
index 3b5283ef21..911192a2a1 100644
--- a/app/Http/Livewire/Project/Shared/Danger.php
+++ b/app/Http/Livewire/Project/Shared/Danger.php
@@ -14,7 +14,7 @@ class Danger extends Component
public function mount()
{
$this->modalId = new Cuid2(7);
- $this->parameters = getRouteParameters();
+ $this->parameters = get_route_parameters();
}
public function delete()
diff --git a/app/Http/Livewire/Project/Shared/EnvironmentVariable/Add.php b/app/Http/Livewire/Project/Shared/EnvironmentVariable/Add.php
index 783c521833..cf14a894e4 100644
--- a/app/Http/Livewire/Project/Shared/EnvironmentVariable/Add.php
+++ b/app/Http/Livewire/Project/Shared/EnvironmentVariable/Add.php
@@ -26,7 +26,7 @@ class Add extends Component
public function mount()
{
- $this->parameters = getRouteParameters();
+ $this->parameters = get_route_parameters();
}
public function submit()
diff --git a/app/Http/Livewire/Project/Shared/EnvironmentVariable/Show.php b/app/Http/Livewire/Project/Shared/EnvironmentVariable/Show.php
index f17ac88939..f75a91b637 100644
--- a/app/Http/Livewire/Project/Shared/EnvironmentVariable/Show.php
+++ b/app/Http/Livewire/Project/Shared/EnvironmentVariable/Show.php
@@ -25,7 +25,7 @@ class Show extends Component
public function mount()
{
$this->modalId = new Cuid2(7);
- $this->parameters = getRouteParameters();
+ $this->parameters = get_route_parameters();
}
public function submit()
diff --git a/app/Http/Livewire/Project/Shared/Storages/Add.php b/app/Http/Livewire/Project/Shared/Storages/Add.php
index afd7b408bc..e7831f1cb2 100644
--- a/app/Http/Livewire/Project/Shared/Storages/Add.php
+++ b/app/Http/Livewire/Project/Shared/Storages/Add.php
@@ -25,7 +25,7 @@ class Add extends Component
public function mount()
{
- $this->parameters = getRouteParameters();
+ $this->parameters = get_route_parameters();
}
public function submit()
diff --git a/app/Http/Livewire/Server/PrivateKey.php b/app/Http/Livewire/Server/PrivateKey.php
index 4f9a1e0227..366aec85f5 100644
--- a/app/Http/Livewire/Server/PrivateKey.php
+++ b/app/Http/Livewire/Server/PrivateKey.php
@@ -39,6 +39,6 @@ class PrivateKey extends Component
public function mount()
{
- $this->parameters = getRouteParameters();
+ $this->parameters = get_route_parameters();
}
}
diff --git a/app/Http/Livewire/Source/Github/Change.php b/app/Http/Livewire/Source/Github/Change.php
index b85575cd5a..e2be4e0ab6 100644
--- a/app/Http/Livewire/Source/Github/Change.php
+++ b/app/Http/Livewire/Source/Github/Change.php
@@ -38,7 +38,7 @@ class Change extends Component
public function mount()
{
$this->webhook_endpoint = $this->ipv4;
- $this->parameters = getRouteParameters();
+ $this->parameters = get_route_parameters();
$this->is_system_wide = $this->github_app->is_system_wide;
}
diff --git a/app/Http/Livewire/Team/InviteLink.php b/app/Http/Livewire/Team/InviteLink.php
index 66a8add4e3..d525330124 100644
--- a/app/Http/Livewire/Team/InviteLink.php
+++ b/app/Http/Livewire/Team/InviteLink.php
@@ -15,7 +15,7 @@ class InviteLink extends Component
public function mount()
{
- $this->email = isDev() ? '[email protected]' : '';
+ $this->email = is_dev() ? '[email protected]' : '';
}
public function viaEmail()
diff --git a/app/Http/Livewire/Team/Storage/Create.php b/app/Http/Livewire/Team/Storage/Create.php
index 38aee59b56..3edf29c203 100644
--- a/app/Http/Livewire/Team/Storage/Create.php
+++ b/app/Http/Livewire/Team/Storage/Create.php
@@ -36,7 +36,7 @@ class Create extends Component
public function mount()
{
- if (isDev()) {
+ if (is_dev()) {
$this->name = 'Local MinIO';
$this->description = 'Local MinIO';
$this->key = 'minioadmin';
diff --git a/app/Http/Livewire/Upgrade.php b/app/Http/Livewire/Upgrade.php
index e79c73fb7e..f46e37ff73 100644
--- a/app/Http/Livewire/Upgrade.php
+++ b/app/Http/Livewire/Upgrade.php
@@ -18,7 +18,7 @@ class Upgrade extends Component
$this->latestVersion = get_latest_version_of_coolify();
$currentVersion = config('version');
version_compare($currentVersion, $this->latestVersion, '<') ? $this->isUpgradeAvailable = true : $this->isUpgradeAvailable = false;
- if (isDev()) {
+ if (is_dev()) {
$this->isUpgradeAvailable = true;
}
$settings = InstanceSettings::get();
diff --git a/app/Http/Middleware/SubscriptionValid.php b/app/Http/Middleware/SubscriptionValid.php
index e7fcdff3cb..c63c6d823e 100644
--- a/app/Http/Middleware/SubscriptionValid.php
+++ b/app/Http/Middleware/SubscriptionValid.php
@@ -12,7 +12,7 @@ class SubscriptionValid
public function handle(Request $request, Closure $next): Response
{
if (auth()->user()) {
- if (isCloud() && !isSubscribed()) {
+ if (is_cloud() && !isSubscribed()) {
ray('SubscriptionValid Middleware');
$allowed_paths = [
diff --git a/app/Jobs/DockerCleanupJob.php b/app/Jobs/DockerCleanupJob.php
index 2c0a3fc06f..52279c2414 100644
--- a/app/Jobs/DockerCleanupJob.php
+++ b/app/Jobs/DockerCleanupJob.php
@@ -32,7 +32,7 @@ class DockerCleanupJob implements ShouldQueue
try {
$servers = Server::all();
foreach ($servers as $server) {
- if (isDev()) {
+ if (is_dev()) {
$docker_root_filesystem = "/";
} else {
$docker_root_filesystem = instant_remote_process(['stat --printf=%m $(docker info --format "{{json .DockerRootDir}}" |sed \'s/"//g\')'], $server);
diff --git a/bootstrap/helpers/contants.php b/bootstrap/helpers/contants.php
new file mode 100644
index 0000000000..3c4d7d2909
--- /dev/null
+++ b/bootstrap/helpers/contants.php
@@ -0,0 +1,3 @@
+<?php
+
+const DATABASE_TYPES = ['postgresql'];
diff --git a/bootstrap/helpers/databases.php b/bootstrap/helpers/databases.php
new file mode 100644
index 0000000000..497d809a22
--- /dev/null
+++ b/bootstrap/helpers/databases.php
@@ -0,0 +1,28 @@
+<?php
+
+use App\Models\StandaloneDocker;
+use App\Models\StandalonePostgresql;
+use Visus\Cuid2\Cuid2;
+
+function generate_database_name(string $type): string
+{
+ $cuid = new Cuid2(7);
+ return $type . '-database-' . $cuid;
+}
+
+function create_standalone_postgresql($environment_id, $destination_uuid): StandalonePostgresql
+{
+ // TODO: If another type of destination is added, this will need to be updated.
+ $destination = StandaloneDocker::where('uuid', $destination_uuid)->first();
+ if (!$destination) {
+ throw new Exception('Destination not found');
+ }
+ return StandalonePostgresql::create([
+ 'name' => generate_database_name('postgresql'),
+ 'postgres_password' => \Illuminate\Support\Str::password(),
+ 'environment_id' => $environment_id,
+ 'destination_id' => $destination->id,
+ 'destination_type' => $destination->getMorphClass(),
+ ]);
+
+}
diff --git a/bootstrap/helpers/proxy.php b/bootstrap/helpers/proxy.php
index 1ae7476861..831d5fc0b2 100644
--- a/bootstrap/helpers/proxy.php
+++ b/bootstrap/helpers/proxy.php
@@ -13,7 +13,7 @@ function get_proxy_path()
function generate_default_proxy_configuration(Server $server)
{
$proxy_path = get_proxy_path();
- if (isDev()) {
+ if (is_dev()) {
$proxy_path = config('coolify.dev_config_path') . '/' . $server->name . '/proxy';
}
$networks = collect($server->standaloneDockers)->map(function ($docker) {
@@ -85,7 +85,7 @@ function generate_default_proxy_configuration(Server $server)
],
],
];
- if (isDev()) {
+ if (is_dev()) {
$config['services']['traefik']['command'][] = "--log.level=debug";
}
return Yaml::dump($config, 4, 2);
diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php
index 388d7f31c2..fed4a418f0 100644
--- a/bootstrap/helpers/shared.php
+++ b/bootstrap/helpers/shared.php
@@ -5,37 +5,45 @@ use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Str;
+use Nubs\RandomNameGenerator\All;
use Visus\Cuid2\Cuid2;
-function application_configuration_dir() :string {
+function application_configuration_dir(): string
+{
return '/data/coolify/applications';
}
-function database_configuration_dir(): string {
+
+function database_configuration_dir(): string
+{
return '/data/coolify/databases';
}
-function backup_dir(): string {
+
+function backup_dir(): string
+{
return '/data/coolify/backups';
}
-function generate_readme_file(string $name, string $updated_at): string {
- return "Resource name: {$name}\nLatest Deployment Date: {$updated_at}";
+
+function generate_readme_file(string $name, string $updated_at): string
+{
+ return "Resource name: $name\nLatest Deployment Date: $updated_at";
}
-function general_error_handler(\Throwable|null $err = null, $that = null, $isJson = false, $customErrorMessage = null)
+function general_error_handler(Throwable|null $err = null, $that = null, $isJson = false, $customErrorMessage = null): mixed
{
try {
- ray('ERROR OCCURED: ' . $err->getMessage());
+ ray('ERROR OCCURRED: ' . $err->getMessage());
if ($err instanceof QueryException) {
if ($err->errorInfo[0] === '23505') {
- throw new \Exception($customErrorMessage ?? 'Duplicate entry found.', '23505');
+ throw new Exception($customErrorMessage ?? 'Duplicate entry found.', '23505');
} else if (count($err->errorInfo) === 4) {
- throw new \Exception($customErrorMessage ?? $err->errorInfo[3]);
+ throw new Exception($customErrorMessage ?? $err->errorInfo[3]);
} else {
- throw new \Exception($customErrorMessage ?? $err->errorInfo[2]);
+ throw new Exception($customErrorMessage ?? $err->errorInfo[2]);
}
} else {
- throw new \Exception($customErrorMessage ?? $err->getMessage());
+ throw new Exception($customErrorMessage ?? $err->getMessage());
}
- } catch (\Throwable $error) {
+ } catch (Throwable $error) {
if ($that) {
return $that->emit('error', $customErrorMessage ?? $error->getMessage());
} elseif ($isJson) {
@@ -46,51 +54,54 @@ function general_error_handler(\Throwable|null $err = null, $that = null, $isJso
} else {
ray($customErrorMessage);
ray($error);
+ return $customErrorMessage ?? $error->getMessage();
}
}
}
-function getRouteParameters()
+function get_route_parameters(): array
{
return Route::current()->parameters();
}
-function get_latest_version_of_coolify()
+function get_latest_version_of_coolify(): string
{
try {
$response = Http::get('https://cdn.coollabs.io/coolify/versions.json');
$versions = $response->json();
return data_get($versions, 'coolify.v4.version');
- } catch (\Throwable $th) {
+ } catch (Throwable $th) {
//throw $th;
ray($th->getMessage());
return '0.0.0';
}
}
-function generate_random_name()
+function generate_random_name(): string
{
- $generator = \Nubs\RandomNameGenerator\All::create();
+ $generator = All::create();
$cuid = new Cuid2(7);
- return Str::kebab("{$generator->getName()}-{$cuid}");
+ return Str::kebab("{$generator->getName()}-$cuid");
}
-function generate_application_name(string $git_repository, string $git_branch)
+function generate_application_name(string $git_repository, string $git_branch): string
{
$cuid = new Cuid2(7);
- return Str::kebab("{$git_repository}:{$git_branch}-{$cuid}");
+ return Str::kebab("$git_repository:$git_branch-$cuid");
}
-function is_transactional_emails_active()
+function is_transactional_emails_active(): bool
{
return data_get(InstanceSettings::get(), 'smtp_enabled');
}
-function set_transanctional_email_settings()
+function set_transanctional_email_settings(): void
{
$settings = InstanceSettings::get();
$password = data_get($settings, 'smtp_password');
- if ($password) $password = decrypt($password);
+ if (isset($password)) {
+ $password = decrypt($password);
+ }
config()->set('mail.default', 'smtp');
config()->set('mail.mailers.smtp', [
@@ -105,16 +116,19 @@ function set_transanctional_email_settings()
]);
}
-function base_ip()
+function base_ip(): string
{
- if (isDev()) {
+ if (is_dev()) {
return "http://localhost";
}
$settings = InstanceSettings::get();
- return "http://{$settings->public_ipv4}";
+ return "http://$settings->public_ipv4";
}
-function base_url(bool $withPort = true)
+/**
+ * If fqdn is set, return it, otherwise return public ip.
+ */
+function base_url(bool $withPort = true): string
{
$settings = InstanceSettings::get();
if ($settings->fqdn) {
@@ -123,31 +137,32 @@ function base_url(bool $withPort = true)
$port = config('app.port');
if ($settings->public_ipv4) {
if ($withPort) {
- if (isDev()) {
- return "http://localhost:{$port}";
+ if (is_dev()) {
+ return "http://localhost:$port";
}
- return "http://{$settings->public_ipv4}:{$port}";
+ return "http://$settings->public_ipv4:$port";
}
- if (isDev()) {
+ if (is_dev()) {
return "http://localhost";
}
- return "http://{$settings->public_ipv4}";
+ return "http://$settings->public_ipv4";
}
if ($settings->public_ipv6) {
if ($withPort) {
- return "http://{$settings->public_ipv6}:{$port}";
+ return "http://$settings->public_ipv6:$port";
}
- return "http://{$settings->public_ipv6}";
+ return "http://$settings->public_ipv6";
}
return url('/');
}
-function isDev()
+function is_dev(): bool
{
return config('app.env') === 'local';
}
-function isCloud()
+function is_cloud(): bool
{
return !config('coolify.self_hosted');
}
+
diff --git a/database/migrations/2023_08_09_154921_change_postgres_password_of_standalone_postgresqls.php b/database/migrations/2023_08_09_154921_change_postgres_password_of_standalone_postgresqls.php
new file mode 100644
index 0000000000..f062f962ac
--- /dev/null
+++ b/database/migrations/2023_08_09_154921_change_postgres_password_of_standalone_postgresqls.php
@@ -0,0 +1,21 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration {
+ public function up(): void
+ {
+ Schema::table('standalone_postgresqls', function (Blueprint $table) {
+ $table->text('postgres_password')->change();
+ });
+ }
+
+ public function down(): void
+ {
+ Schema::table('standalone_postgresqls', function (Blueprint $table) {
+ $table->string('postgres_password')->change();
+ });
+ }
+};
diff --git a/resources/views/components/applications/links.blade.php b/resources/views/components/applications/links.blade.php
index 2ba3897d8b..f99fab82e9 100644
--- a/resources/views/components/applications/links.blade.php
+++ b/resources/views/components/applications/links.blade.php
@@ -25,7 +25,7 @@
<path d="M9 15l6 -6"/>
<path d="M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464"/>
<path
- d="M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"/>
+ d="M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"/>
</svg>{{ $fqdn }}
</a>
</li>
@@ -44,7 +44,7 @@
<path d="M9 15l6 -6"/>
<path d="M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464"/>
<path
- d="M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"/>
+ d="M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"/>
</svg>
PR{{ data_get($preview, 'pull_request_id') }} |
{{ data_get($preview, 'fqdn') }}
@@ -55,7 +55,7 @@
@endif
@if (data_get($application, 'ports_mappings_array'))
@foreach ($application->ports_mappings_array as $port)
- @if (isDev())
+ @if (is_dev())
<li>
<a class="text-xs text-white rounded-none hover:no-underline hover:bg-coollabs hover:text-white"
target="_blank" href="http://localhost:{{ explode(':', $port)[0] }}">
@@ -66,7 +66,7 @@
<path d="M9 15l6 -6"/>
<path d="M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464"/>
<path
- d="M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"/>
+ d="M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"/>
</svg>
Port {{ $port }}
</a>
@@ -83,7 +83,7 @@
<path d="M9 15l6 -6"/>
<path d="M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464"/>
<path
- d="M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"/>
+ d="M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"/>
</svg>
Port {{ $port }}
</a>
diff --git a/resources/views/components/settings/navbar.blade.php b/resources/views/components/settings/navbar.blade.php
index 85d18f5071..ea3dd6c490 100644
--- a/resources/views/components/settings/navbar.blade.php
+++ b/resources/views/components/settings/navbar.blade.php
@@ -10,7 +10,7 @@
href="{{ route('settings.emails') }}">
<button>SMTP</button>
</a>
- @if (isCloud())
+ @if (is_cloud())
<a class="{{ request()->routeIs('settings.license') ? 'text-white' : '' }}"
href="{{ route('settings.license') }}">
<button>Resale License</button>
diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php
index 9ce1c26339..75a0b1e269 100644
--- a/resources/views/dashboard.blade.php
+++ b/resources/views/dashboard.blade.php
@@ -22,7 +22,7 @@
<div class="stat-value">{{ $s3s->count() }}</div>
</div>
</div>
- @if (isDev())
+ @if (is_dev())
<livewire:dev.s3-test/>
<livewire:dev.scheduled-backups/>
@endif
diff --git a/resources/views/livewire/notifications/discord-settings.blade.php b/resources/views/livewire/notifications/discord-settings.blade.php
index e9c69f5852..9ec66ea1c5 100644
--- a/resources/views/livewire/notifications/discord-settings.blade.php
+++ b/resources/views/livewire/notifications/discord-settings.blade.php
@@ -23,7 +23,7 @@
@if (data_get($model, 'discord_enabled'))
<h4 class="mt-4">Subscribe to events</h4>
<div class="w-64 ">
- @if (isDev())
+ @if (is_dev())
<x-forms.checkbox instantSave="saveModel" id="model.discord_notifications_test" label="Test"/>
@endif
<h5 class="mt-4">Applications</h5>
diff --git a/resources/views/livewire/notifications/email-settings.blade.php b/resources/views/livewire/notifications/email-settings.blade.php
index c819ee16be..09d0f5acbc 100644
--- a/resources/views/livewire/notifications/email-settings.blade.php
+++ b/resources/views/livewire/notifications/email-settings.blade.php
@@ -60,7 +60,7 @@
@if (data_get($model, 'smtp_enabled'))
<h4 class="mt-4">Subscribe to events</h4>
<div class="w-64">
- @if (isDev())
+ @if (is_dev())
<x-forms.checkbox instantSave="saveModel" id="model.smtp_notifications_test" label="Test"/>
@endif
<h5 class="mt-4">Applications</h5>
diff --git a/resources/views/livewire/server/form.blade.php b/resources/views/livewire/server/form.blade.php
index eec027904f..dfed018e3c 100644
--- a/resources/views/livewire/server/form.blade.php
+++ b/resources/views/livewire/server/form.blade.php
@@ -87,7 +87,7 @@
<div class="pb-4">This will remove this server from Coolify. Beware! There is no coming
back!
</div>
- @if ($server->id !== 0 || isDev())
+ @if ($server->id !== 0 || is_dev())
<x-forms.button isError isModal modalId="deleteServer">
Delete
</x-forms.button>
diff --git a/resources/views/team/show.blade.php b/resources/views/team/show.blade.php
index 9f7596bc59..e28e91295b 100644
--- a/resources/views/team/show.blade.php
+++ b/resources/views/team/show.blade.php
@@ -1,7 +1,7 @@
<x-layout>
<x-team.navbar :team="session('currentTeam')"/>
<livewire:team.form/>
- @if (isCloud())
+ @if (is_cloud())
<div class="pb-8">
<h3>Subscription</h3>
@if (data_get(auth()->user()->currentTeam(),
diff --git a/routes/webhooks.php b/routes/webhooks.php
index eb698d8ff2..eff2cb6390 100644
--- a/routes/webhooks.php
+++ b/routes/webhooks.php
@@ -174,7 +174,7 @@ Route::post('/source/github/events', function () {
}
});
-if (isCloud()) {
+if (is_cloud()) {
Route::post('/payments/events', function () {
try {
$secret = config('coolify.lemon_squeezy_webhook_secret');
diff --git a/versions.json b/versions.json
index 04132c13cf..25d09437ef 100644
--- a/versions.json
+++ b/versions.json
@@ -1,10 +1,10 @@
{
- "coolify": {
- "main": {
- "version": "3.12.33"
- },
- "v4": {
- "version": "4.0.0-beta.18"
- }
+ "coolify": {
+ "main": {
+ "version": "3.12.36"
+ },
+ "v4": {
+ "version": "4.0.0-beta.18"
}
-}
\ No newline at end of file
+ }
+}