This commit is contained in:
Andras Bacsai 2023-06-16 11:01:27 +02:00
parent 2b8467e6a1
commit 2c3ddfd363
14 changed files with 35 additions and 18 deletions

View File

@ -16,7 +16,7 @@ class UpdateCoolify
try { try {
ray('Running InstanceAutoUpdateJob'); ray('Running InstanceAutoUpdateJob');
$localhost_name = 'localhost'; $localhost_name = 'localhost';
if (config('app.env') === 'local') { if (isDev()) {
$localhost_name = 'testing-local-docker-container'; $localhost_name = 'testing-local-docker-container';
} }
$this->server = Server::where('name', $localhost_name)->firstOrFail(); $this->server = Server::where('name', $localhost_name)->firstOrFail();
@ -48,7 +48,7 @@ class UpdateCoolify
} }
private function update() private function update()
{ {
if (config('app.env') === 'local') { if (isDev()) {
ray('Running update on local docker container'); ray('Running update on local docker container');
remote_process([ remote_process([
"sleep 10" "sleep 10"

View File

@ -12,7 +12,7 @@ class Kernel extends ConsoleKernel
{ {
protected function schedule(Schedule $schedule): void protected function schedule(Schedule $schedule): void
{ {
if (config('app.env') === 'local') { if (isDev()) {
$schedule->command('horizon:snapshot')->everyMinute(); $schedule->command('horizon:snapshot')->everyMinute();
// $schedule->job(new InstanceDockerCleanupJob)->everyMinute(); // $schedule->job(new InstanceDockerCleanupJob)->everyMinute();
// $schedule->job(new InstanceAutoUpdateJob(true))->everyMinute(); // $schedule->job(new InstanceAutoUpdateJob(true))->everyMinute();

View File

@ -47,7 +47,7 @@ class Handler extends ExceptionHandler
{ {
$this->reportable(function (Throwable $e) { $this->reportable(function (Throwable $e) {
$this->settings = InstanceSettings::get(); $this->settings = InstanceSettings::get();
if ($this->settings->do_not_track || config('app.env') === 'local') { if ($this->settings->do_not_track || isDev()) {
return; return;
} }
Integration::captureUnhandledException($e); Integration::captureUnhandledException($e);

View File

@ -50,7 +50,7 @@ class GithubPrivateRepositoryDeployKey extends Component
]; ];
public function mount() public function mount()
{ {
if (config('app.env') === 'local') { if (isDev()) {
$this->repository_url = 'https://github.com/coollabsio/coolify-examples'; $this->repository_url = 'https://github.com/coollabsio/coolify-examples';
} }
$this->parameters = getRouteParameters(); $this->parameters = getRouteParameters();

View File

@ -39,7 +39,7 @@ class PublicGitRepository extends Component
]; ];
public function mount() public function mount()
{ {
if (config('app.env') === 'local') { if (isDev()) {
$this->repository_url = 'https://github.com/coollabsio/coolify-examples'; $this->repository_url = 'https://github.com/coollabsio/coolify-examples';
$this->port = 3000; $this->port = 3000;
} }

View File

@ -14,7 +14,7 @@ class InviteLink extends Component
public string $role = 'member'; public string $role = 'member';
public function mount() public function mount()
{ {
$this->email = config('app.env') === 'local' ? 'test3@example.com' : ''; $this->email = isDev() ? 'test3@example.com' : '';
} }
public function viaEmail() public function viaEmail()
{ {

View File

@ -16,7 +16,7 @@ class Upgrade extends Component
$latestVersion = get_latest_version_of_coolify(); $latestVersion = get_latest_version_of_coolify();
$currentVersion = config('version'); $currentVersion = config('version');
version_compare($currentVersion, $latestVersion, '<') ? $this->isUpgradeAvailable = true : $this->isUpgradeAvailable = false; version_compare($currentVersion, $latestVersion, '<') ? $this->isUpgradeAvailable = true : $this->isUpgradeAvailable = false;
if (config('app.env') === 'local') { if (isDev()) {
$this->isUpgradeAvailable = true; $this->isUpgradeAvailable = true;
} }
} }

View File

@ -7,7 +7,7 @@ if (!function_exists('getProxyConfiguration')) {
function getProxyConfiguration(Server $server) function getProxyConfiguration(Server $server)
{ {
$proxy_path = config('coolify.proxy_config_path'); $proxy_path = config('coolify.proxy_config_path');
if (config('app.env') === 'local') { if (isDev()) {
$proxy_path = $proxy_path . '/testing-host-1/'; $proxy_path = $proxy_path . '/testing-host-1/';
} }
$networks = collect($server->standaloneDockers)->map(function ($docker) { $networks = collect($server->standaloneDockers)->map(function ($docker) {
@ -77,7 +77,7 @@ if (!function_exists('getProxyConfiguration')) {
], ],
], ],
]; ];
if (config('app.env') === 'local') { if (isDev()) {
$config['services']['traefik']['command'][] = "--log.level=debug"; $config['services']['traefik']['command'][] = "--log.level=debug";
} }
return Yaml::dump($config, 4, 2); return Yaml::dump($config, 4, 2);

View File

@ -82,7 +82,7 @@ function set_transanctional_email_settings()
]); ]);
} }
function base_url() function base_url(bool $withPort = true)
{ {
$settings = InstanceSettings::get(); $settings = InstanceSettings::get();
if ($settings->fqdn) { if ($settings->fqdn) {
@ -90,10 +90,27 @@ function base_url()
} }
$port = config('app.port'); $port = config('app.port');
if ($settings->public_ipv4) { if ($settings->public_ipv4) {
return "http://{$settings->public_ipv4}:{$port}"; if ($withPort) {
if (isDev()) {
return "http://localhost:{$port}";
}
return "http://{$settings->public_ipv4}:{$port}";
}
if (isDev()) {
return "http://localhost";
}
return "http://{$settings->public_ipv4}";
} }
if ($settings->public_ipv6) { if ($settings->public_ipv6) {
return "http://{$settings->public_ipv6}:{$port}"; if ($withPort) {
return "http://{$settings->public_ipv6}:{$port}";
}
return "http://{$settings->public_ipv6}";
} }
return url('/'); return url('/');
} }
function isDev()
{
return config('app.env') === 'local';
}

View File

@ -1,3 +1,3 @@
<?php <?php
return '4.0.0-nightly.15'; return '4.0.0-nightly.16';

View File

@ -48,7 +48,7 @@
@endif @endif
@if (data_get($application, 'ports_mappings_array')) @if (data_get($application, 'ports_mappings_array'))
@foreach ($application->ports_mappings_array as $port) @foreach ($application->ports_mappings_array as $port)
@if (config('app.env') === 'local') @if (isDev())
<li> <li>
<a class="text-xs text-white rounded-none hover:no-underline hover:bg-coollabs" <a class="text-xs text-white rounded-none hover:no-underline hover:bg-coollabs"
target="_blank" href="http://localhost:{{ explode(':', $port)[0] }}"> target="_blank" href="http://localhost:{{ explode(':', $port)[0] }}">

View File

@ -14,7 +14,7 @@
<button class="text-white btn-link">{{ data_get($docker, 'network') }} </button> <button class="text-white btn-link">{{ data_get($docker, 'network') }} </button>
</a> </a>
@empty @empty
<div class="text-sm">No destinations added</div> <div class="text-sm">N\A</div>
@endforelse @endforelse
</div> </div>
<div class="grid gap-2 pt-2"> <div class="grid gap-2 pt-2">

View File

@ -4,7 +4,7 @@
<div class="flex gap-2"> <div class="flex gap-2">
<h2>General</h2> <h2>General</h2>
<x-forms.button type="submit">Save</x-forms.button> <x-forms.button type="submit">Save</x-forms.button>
@if ($server->id !== 0 || config('app.env') === 'local') @if ($server->id !== 0 || isDev())
<x-forms.button x-on:click.prevent="deleteServer = true"> <x-forms.button x-on:click.prevent="deleteServer = true">
Delete Delete
</x-forms.button> </x-forms.button>

View File

@ -12,7 +12,7 @@
<li> <li>
<a target="_blank" <a target="_blank"
class="text-xs text-white rounded-none hover:no-underline hover:bg-coollabs" class="text-xs text-white rounded-none hover:no-underline hover:bg-coollabs"
href="http://{{ request()->getHost() }}:8080"> href="{{ base_url(withPort: false) }}:8080">
Traefik Dashboard Traefik Dashboard
<x-external-link /> <x-external-link />
</a> </a>