diff --git a/README.md b/README.md index e0c091c41..8d5ea5a74 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ You can find the installation script [here](./scripts/install.sh). ## Support -Contact us [here](https://coolify.io/contact). +Contact us [here](https://coolify.io/docs/contact). ## Recognitions diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index d6ea360ae..52bf06ed9 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -32,7 +32,6 @@ class Kernel extends ConsoleKernel $schedule->command('horizon:snapshot')->everyFiveMinutes(); $schedule->job(new CleanupInstanceStuffsJob)->everyTwoMinutes()->onOneServer(); $schedule->job(new CheckResaleLicenseJob)->hourly()->onOneServer(); - // $schedule->job(new DockerCleanupJob)->everyTenMinutes()->onOneServer(); $this->instance_auto_update($schedule); $this->check_scheduled_backups($schedule); $this->check_resources($schedule); diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 0f4934846..a2978e2ee 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -46,15 +46,6 @@ class Controller extends BaseController } return redirect()->route('login')->with('error', 'Invalid credentials.'); } - public function subscription() - { - if (!isCloud()) { - abort(404); - } - return view('subscription.index', [ - 'settings' => InstanceSettings::get(), - ]); - } public function license() { diff --git a/app/Http/Livewire/Boarding/Index.php b/app/Http/Livewire/Boarding/Index.php index c8a53d26e..53065918a 100644 --- a/app/Http/Livewire/Boarding/Index.php +++ b/app/Http/Livewire/Boarding/Index.php @@ -164,7 +164,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== { $this->validate([ 'remoteServerName' => 'required', - 'remoteServerHost' => 'required', + 'remoteServerHost' => 'required|ip', 'remoteServerPort' => 'required|integer', 'remoteServerUser' => 'required', ]); diff --git a/app/Http/Livewire/Dashboard.php b/app/Http/Livewire/Dashboard.php index d411312d5..723b00f7f 100644 --- a/app/Http/Livewire/Dashboard.php +++ b/app/Http/Livewire/Dashboard.php @@ -11,19 +11,11 @@ class Dashboard extends Component { public $projects = []; public $servers = []; - public int $s3s = 0; - public int $resources = 0; public function mount() { $this->servers = Server::ownedByCurrentTeam()->get(); - $this->s3s = S3Storage::ownedByCurrentTeam()->get()->count(); - $projects = Project::ownedByCurrentTeam()->get(); - foreach ($projects as $project) { - $this->resources += $project->applications->count(); - $this->resources += $project->postgresqls->count(); - } - $this->projects = $projects; + $this->projects = Project::ownedByCurrentTeam()->get(); } // public function getIptables() // { diff --git a/app/Http/Livewire/Project/New/Select.php b/app/Http/Livewire/Project/New/Select.php index 4a40c6b35..8f1271c35 100644 --- a/app/Http/Livewire/Project/New/Select.php +++ b/app/Http/Livewire/Project/New/Select.php @@ -2,12 +2,11 @@ namespace App\Http\Livewire\Project\New; +use App\Models\Project; use App\Models\Server; use Countable; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Cache; -use Illuminate\Support\Facades\File; -use Illuminate\Support\Facades\Http; use Livewire\Component; class Select extends Component @@ -24,7 +23,8 @@ class Select extends Component public Collection|array $services = []; public bool $loadingServices = true; public bool $loading = false; - + public $environments = []; + public ?string $selectedEnvironment = null; public ?string $existingPostgresqlUrl = null; protected $queryString = [ @@ -37,8 +37,18 @@ class Select extends Component if (isDev()) { $this->existingPostgresqlUrl = 'postgres://coolify:password@coolify-db:5432'; } + $projectUuid = data_get($this->parameters, 'project_uuid'); + $this->environments = Project::whereUuid($projectUuid)->first()->environments; + $this->selectedEnvironment = data_get($this->parameters, 'environment_name'); } + public function updatedSelectedEnvironment() + { + return redirect()->route('project.resources.new', [ + 'project_uuid' => $this->parameters['project_uuid'], + 'environment_name' => $this->selectedEnvironment, + ]); + } // public function addExistingPostgresql() // { // try { diff --git a/app/Http/Livewire/Server/New/ByIp.php b/app/Http/Livewire/Server/New/ByIp.php index f5c8529de..ec4827af7 100644 --- a/app/Http/Livewire/Server/New/ByIp.php +++ b/app/Http/Livewire/Server/New/ByIp.php @@ -11,13 +11,13 @@ class ByIp extends Component { public $private_keys; public $limit_reached; - public int|null $private_key_id = null; + public ?int $private_key_id = null; public $new_private_key_name; public $new_private_key_description; public $new_private_key_value; public string $name; - public string|null $description = null; + public ?string $description = null; public string $ip; public string $user = 'root'; public int $port = 22; @@ -26,16 +26,16 @@ class ByIp extends Component protected $rules = [ 'name' => 'required|string', 'description' => 'nullable|string', - 'ip' => 'required', + 'ip' => 'required|ip', 'user' => 'required|string', 'port' => 'required|integer', ]; protected $validationAttributes = [ - 'name' => 'name', - 'description' => 'description', - 'ip' => 'ip', - 'user' => 'user', - 'port' => 'port', + 'name' => 'Name', + 'description' => 'Description', + 'ip' => 'IP Address', + 'user' => 'User', + 'port' => 'Port', ]; public function mount() diff --git a/app/Http/Livewire/Server/Proxy/Logs.php b/app/Http/Livewire/Server/Proxy/Logs.php new file mode 100644 index 000000000..cb8c245a6 --- /dev/null +++ b/app/Http/Livewire/Server/Proxy/Logs.php @@ -0,0 +1,28 @@ +parameters = get_route_parameters(); + try { + $this->server = Server::ownedByCurrentTeam(['name', 'proxy'])->whereUuid(request()->server_uuid)->first(); + if (is_null($this->server)) { + return redirect()->route('server.all'); + } + } catch (\Throwable $e) { + return handleError($e, $this); + } + } + public function render() + { + return view('livewire.server.proxy.logs'); + } +} diff --git a/app/Http/Livewire/Server/Proxy/Show.php b/app/Http/Livewire/Server/Proxy/Show.php index daadf0ede..26ea54e49 100644 --- a/app/Http/Livewire/Server/Proxy/Show.php +++ b/app/Http/Livewire/Server/Proxy/Show.php @@ -9,6 +9,11 @@ class Show extends Component { public ?Server $server = null; public $parameters = []; + protected $listeners = ['proxyStatusUpdated']; + public function proxyStatusUpdated() + { + $this->server->refresh(); + } public function mount() { $this->parameters = get_route_parameters(); diff --git a/app/Http/Livewire/Subscription/Show.php b/app/Http/Livewire/Subscription/Show.php new file mode 100644 index 000000000..ff028f68f --- /dev/null +++ b/app/Http/Livewire/Subscription/Show.php @@ -0,0 +1,30 @@ +settings = InstanceSettings::get(); + $this->alreadySubscribed = currentTeam()->subscription()->exists(); + } + public function stripeCustomerPortal() { + $session = getStripeCustomerPortalSession(currentTeam()); + if (is_null($session)) { + return; + } + return redirect($session->url); + } + public function render() + { + return view('livewire.subscription.show')->layout('layouts.subscription'); + } +} diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index f4b839ec3..33324620a 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -620,7 +620,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted 'container_name' => $this->container_name, 'restart' => RESTART_MODE, 'environment' => $environment_variables, - 'labels' => generateLabelsApplication($this->application, $this->preview), + 'labels' => generateLabelsApplication($this->application, $this->preview, $ports), 'expose' => $ports, 'networks' => [ $this->destination->network, diff --git a/app/View/Components/Server/Sidebar.php b/app/View/Components/Server/Sidebar.php new file mode 100644 index 000000000..f968b6d0c --- /dev/null +++ b/app/View/Components/Server/Sidebar.php @@ -0,0 +1,27 @@ +push('traefik.enable=true'); @@ -158,7 +158,9 @@ function fqdnLabelsForTraefik(Collection $domains, bool $is_force_https_enabled) $path = $url->getPath(); $schema = $url->getScheme(); $port = $url->getPort(); - + if (is_null($port) && !is_null($onlyPort)) { + $port = $onlyPort; + } $http_label = "{$uuid}-http"; $https_label = "{$uuid}-https"; @@ -203,9 +205,12 @@ function fqdnLabelsForTraefik(Collection $domains, bool $is_force_https_enabled) return $labels; } -function generateLabelsApplication(Application $application, ?ApplicationPreview $preview = null): array +function generateLabelsApplication(Application $application, ?ApplicationPreview $preview = null, $ports): array { - + $onlyPort = null; + if (count($ports) === 1) { + $onlyPort = $ports[0]; + } $pull_request_id = data_get($preview, 'pull_request_id', 0); $container_name = generateApplicationContainerName($application, $pull_request_id); $appId = $application->id; @@ -221,7 +226,7 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview $domains = Str::of(data_get($application, 'fqdn'))->explode(','); } // Add Traefik labels no matter which proxy is selected - $labels = $labels->merge(fqdnLabelsForTraefik($domains, $application->settings->is_force_https_enabled)); + $labels = $labels->merge(fqdnLabelsForTraefik($domains, $application->settings->is_force_https_enabled,$onlyPort)); } return $labels->all(); } diff --git a/bootstrap/helpers/proxy.php b/bootstrap/helpers/proxy.php index 86034282e..abada1bda 100644 --- a/bootstrap/helpers/proxy.php +++ b/bootstrap/helpers/proxy.php @@ -102,6 +102,8 @@ function generate_default_proxy_configuration(Server $server) ]; if (isDev()) { $config['services']['traefik']['command'][] = "--log.level=debug"; + $config['services']['traefik']['command'][] = "--accesslog.filepath=/traefik/access.log"; + $config['services']['traefik']['command'][] = "--accesslog.bufferingsize=100"; } $config = Yaml::dump($config, 4, 2); SaveConfiguration::run($server, $config); diff --git a/bootstrap/helpers/subscriptions.php b/bootstrap/helpers/subscriptions.php index 3369776f0..130654db5 100644 --- a/bootstrap/helpers/subscriptions.php +++ b/bootstrap/helpers/subscriptions.php @@ -110,7 +110,10 @@ function getStripeCustomerPortalSession(Team $team) { Stripe::setApiKey(config('subscription.stripe_api_key')); $return_url = route('team.index'); - $stripe_customer_id = $team->subscription->stripe_customer_id; + $stripe_customer_id = data_get($team,'subscription.stripe_customer_id'); + if (!$stripe_customer_id) { + return null; + } $session = \Stripe\BillingPortal\Session::create([ 'customer' => $stripe_customer_id, 'return_url' => $return_url, diff --git a/config/coolify.php b/config/coolify.php index 5209958b5..05917d17a 100644 --- a/config/coolify.php +++ b/config/coolify.php @@ -1,7 +1,7 @@ 'https://coolify.io/contact', + 'docs' => 'https://coolify.io/docs/contact', 'self_hosted' => env('SELF_HOSTED', true), 'waitlist' => env('WAITLIST', false), 'license_url' => 'https://licenses.coollabs.io', diff --git a/config/sentry.php b/config/sentry.php index e601b9e8c..e5bda8c43 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -7,7 +7,7 @@ return [ // 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.73', + 'release' => '4.0.0-beta.74', // When left empty or `null` the Laravel environment will be used 'environment' => config('app.env'), diff --git a/config/version.php b/config/version.php index 8d6fa9270..37fb394e4 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ + @if ($server->isFunctional()) +
+ @else +