diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php
new file mode 100644
index 000000000..b479a6d19
--- /dev/null
+++ b/app/Http/Controllers/ProjectController.php
@@ -0,0 +1,109 @@
+route('project_uuid');
+ $project = session('currentTeam')->projects->where('uuid', $project_uuid)->first();
+ if (!$project) {
+ return redirect()->route('home');
+ }
+ return view('project.environments', ['project' => $project]);
+ }
+ public function resources()
+ {
+ $project_uuid = request()->route('project_uuid');
+ $project = session('currentTeam')->projects->where('uuid', $project_uuid)->first();
+ if (!$project) {
+ return redirect()->route('home');
+ }
+ return view('project.resources', ['project' => $project]);
+ }
+ public function application()
+ {
+ $project_uuid = request()->route('project_uuid');
+ $environment_name = request()->route('environment_name');
+ $application_uuid = request()->route('application_uuid');
+ $project = session('currentTeam')->projects->where('uuid', $project_uuid)->first();
+ if (!$project) {
+ return redirect()->route('home');
+ }
+ $environment = $project->environments->where('name', $environment_name)->first();
+ if (!$environment) {
+ return redirect()->route('home');
+ }
+ $application = $environment->applications->where('uuid', $application_uuid)->first();
+ if (!$application) {
+ return redirect()->route('home');
+ }
+ return view('project.application', ['project' => $project, 'application' => $application]);
+ }
+ public function database()
+ {
+ $project_uuid = request()->route('project_uuid');
+ $environment_name = request()->route('environment_name');
+ $database_uuid = request()->route('database_uuid');
+ $project = session('currentTeam')->projects->where('uuid', $project_uuid)->first();
+ if (!$project) {
+ return redirect()->route('home');
+ }
+ $environment = $project->environments->where('name', $environment_name)->first();
+ if (!$environment) {
+ return redirect()->route('home');
+ }
+ $database = $environment->databases->where('uuid', $database_uuid)->first();
+ if (!$database) {
+ return redirect()->route('home');
+ }
+
+ return view('project.database', ['project' => $project, 'database' => $database]);
+ }
+ public function service()
+ {
+ $project_uuid = request()->route('project_uuid');
+ $environment_name = request()->route('environment_name');
+ $service_uuid = request()->route('service_uuid');
+
+ $project = session('currentTeam')->projects->where('uuid', $project_uuid)->first();
+ if (!$project) {
+ return redirect()->route('home');
+ }
+ $environment = $project->environments->where('name', $environment_name)->first();
+ if (!$environment) {
+ return redirect()->route('home');
+ }
+ $service = $environment->services->where('uuid', $service_uuid)->first();
+ if (!$service) {
+ return redirect()->route('home');
+ }
+
+ return view('project.service', ['project' => $project, 'service' => $service]);
+ }
+ public function deployment()
+ {
+ $project_uuid = request()->route('project_uuid');
+ $environment_name = request()->route('environment_name');
+ $application_uuid = request()->route('application_uuid');
+ $deployment_uuid = request()->route('deployment_uuid');
+
+ $project = session('currentTeam')->projects->where('uuid', $project_uuid)->first();
+ if (!$project) {
+ return redirect()->route('home');
+ }
+ $environment = $project->environments->where('name', $environment_name)->first();
+ if (!$environment) {
+ return redirect()->route('home');
+ }
+ $application = $environment->applications->where('uuid', $application_uuid)->first();
+ if (!$application) {
+ return redirect()->route('home');
+ }
+ $deployment = $application->deployments->where('uuid', $deployment_uuid)->first();
+ return view('project.deployment', ['project' => $project, 'deployment' => $deployment]);
+ }
+}
diff --git a/app/Http/Livewire/DemoDeployApplication.php b/app/Http/Livewire/DemoDeployApplication.php
deleted file mode 100644
index f038a72cb..000000000
--- a/app/Http/Livewire/DemoDeployApplication.php
+++ /dev/null
@@ -1,81 +0,0 @@
-command[] = "docker exec {$this->deployment_id} sh -c '{$command}'";
- }
- public function deploy()
- {
- $this->isKeepAliveOn = true;
-
- $this->coolify_instance_settings = CoolifyInstanceSettings::find(1);
- $this->application = Application::where('uuid', $this->application_uuid)->first();
- $this->destination = $this->application->destination->getMorphClass()::where('id', $this->application->destination->id)->first();
- $project_wildcard_domain = data_get($this->application, 'environment.project.settings.wildcard_domain');
- $global_wildcard_domain = data_get($this->coolify_instance_settings, 'wildcard_domain');
- $this->wildcard_domain = $project_wildcard_domain ?? $global_wildcard_domain ?? null;
-
- $source = $this->application->source->getMorphClass()::where('id', $this->application->source->id)->first();
- $this->deployment_id = new Cuid2(10);
-
- $this->workdir = "/tmp/{$this->deployment_id}";
-
- $this->command[] = "echo 'Starting deployment of {$this->application->name} ({$this->application->uuid})'";
- $this->command[] = "docker run -d --name {$this->deployment_id} --rm -v /var/run/docker.sock:/var/run/docker.sock coolify-builder >/dev/null";
-
- $this->dockerPreCommand('hostname');
- $this->dockerPreCommand("mkdir -p {$this->workdir}");
- $this->dockerPreCommand("ls -ld {$this->workdir}");
- $this->dockerPreCommand("git clone -b {$this->application->git_branch} {$source->html_url}/{$this->application->git_repository}.git {$this->workdir}");
- $this->dockerPreCommand("ls -l {$this->workdir}");
- $this->command[] = "docker stop -t 0 {$this->deployment_id} >/dev/null";
-
- $this->activity = remoteProcess(implode("\n", $this->command), $this->destination->server->name);
-
- Deployment::create([
- 'uuid' => $this->deployment_id,
- 'type_id' => $this->application->id,
- 'type_type' => Application::class,
- 'activity_log_id' => $this->activity->id,
- ]);
- }
- public function polling()
- {
- $this->activity?->refresh();
- if (data_get($this->activity, 'properties.exitCode') !== null) {
- $this->isKeepAliveOn = false;
- }
- }
- public function render()
- {
- return view('livewire.demo-deploy-application');
- }
-}
diff --git a/app/Http/Livewire/DeployApplication.php b/app/Http/Livewire/DeployApplication.php
new file mode 100644
index 000000000..367b2d3e7
--- /dev/null
+++ b/app/Http/Livewire/DeployApplication.php
@@ -0,0 +1,72 @@
+command[] = "docker exec {$this->deployment_uuid} sh -c '{$command}'";
+ }
+ private function start_builder_container()
+ {
+ // @TODO: Add --pull=always if the container is published to ghcr.io
+ $this->command[] = "docker run -d --name {$this->deployment_uuid} --rm -v /var/run/docker.sock:/var/run/docker.sock coolify-builder >/dev/null";
+ }
+ public function deploy()
+ {
+ $coolify_instance_settings = CoolifyInstanceSettings::find(1);
+ $application = Application::where('uuid', $this->application_uuid)->first();
+ $destination = $application->destination->getMorphClass()::where('id', $application->destination->id)->first();
+ $source = $application->source->getMorphClass()::where('id', $application->source->id)->first();
+
+ // Get Wildcard Domain
+ $project_wildcard_domain = data_get($application, 'environment.project.settings.wildcard_domain');
+ $global_wildcard_domain = data_get($coolify_instance_settings, 'wildcard_domain');
+ $wildcard_domain = $project_wildcard_domain ?? $global_wildcard_domain ?? null;
+
+ // Create Deployment ID
+ $this->deployment_uuid = new Cuid2(10);
+ $workdir = "/artifacts/{$this->deployment_uuid}";
+
+ // Start build process
+ $this->command[] = "echo 'Starting deployment of {$application->name} ({$application->uuid})'";
+ $this->start_builder_container();
+ $this->execute_in_builder('hostname');
+ $this->execute_in_builder("git clone -b {$application->git_branch} {$source->html_url}/{$application->git_repository}.git {$workdir}");
+ $this->execute_in_builder("ls -l {$workdir}");
+ $this->command[] = "docker stop -t 0 {$this->deployment_uuid} >/dev/null";
+
+ $this->activity = remoteProcess(implode("\n", $this->command), $destination->server->name);
+
+ // Create Deployment
+ Deployment::create([
+ 'uuid' => $this->deployment_uuid,
+ 'type_id' => $application->id,
+ 'type_type' => Application::class,
+ 'activity_log_id' => $this->activity->id,
+ ]);
+ // Redirect to deployment page
+ return redirect()->route('project.deployment', [
+ "deployment_uuid" => $this->deployment_uuid,
+ "project_uuid" => $application->environment->project->uuid,
+ "environment_name" => $application->environment->name,
+ "application_uuid" => $application->uuid
+ ]);
+ }
+ public function render()
+ {
+ return view('livewire.deploy-application');
+ }
+}
diff --git a/app/Http/Livewire/PollActivity.php b/app/Http/Livewire/PollActivity.php
new file mode 100644
index 000000000..c754cca00
--- /dev/null
+++ b/app/Http/Livewire/PollActivity.php
@@ -0,0 +1,27 @@
+activity = Activity::find($this->activity_log_id);
+ }
+ public function polling()
+ {
+ $this->activity?->refresh();
+ if (data_get($this->activity, 'properties.exitCode') !== null) {
+ $this->isKeepAliveOn = false;
+ }
+ }
+ public function render()
+ {
+ return view('livewire.poll-activity');
+ }
+}
diff --git a/app/Traits/Shared.php b/app/Traits/Shared.php
deleted file mode 100644
index c6884a7a0..000000000
--- a/app/Traits/Shared.php
+++ /dev/null
@@ -1,14 +0,0 @@
- 1,
- 'name'=> "My first database",
+ 'name'=> "My first service",
'environment_id' => $environment_1->id,
'destination_id' => $standalone_docker_1->id,
'destination_type' => StandaloneDocker::class,
diff --git a/docker/builder/Dockerfile b/docker/builder/Dockerfile
index 16aa2a965..32099603b 100644
--- a/docker/builder/Dockerfile
+++ b/docker/builder/Dockerfile
@@ -12,6 +12,7 @@ ARG PACK_VERSION=0.27.0
ARG NIXPACKS_VERSION=1.6.0
USER root
+WORKDIR /artifacts
RUN apk add --no-cache bash curl git git-lfs openssh-client tar tini
RUN mkdir -p ~/.docker/cli-plugins
RUN curl -SL https://cdn.coollabs.io/bin/$TARGETPLATFORM/docker-$DOCKER_VERSION -o /usr/bin/docker
diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php
index 030b2379b..d0477bc9e 100644
--- a/resources/views/home.blade.php
+++ b/resources/views/home.blade.php
@@ -1,46 +1,8 @@
Project Settings:{{ $project->settings }} Application: {{ $application->settings }} Destination Class: {{ $application->destination->getMorphClass() }} Source Class: {{ $application->source->getMorphClass() }} Database: {{ $database }} Destination Class: {{ $database->destination->getMorphClass() }} Service: {{ $service }} Destination Class: {{ $service->destination->getMorphClass() }} No environments found No projects found.
- Coolify v4 🎉
-
Projects
-
- @forelse ($projects as $project)
-
+ @forelse ($projects as $project)
+ {{ data_get($project, 'name') }}
+ @empty
+ {{ $project->name }}
- Environments
- @forelse ($project->environments as $environment)
- Environment: {{ $environment->name }}
- Applications
- @forelse ($environment->applications as $application)
- {{ $application->name }}
- Databases
- @forelse ($environment->databases as $database)
- {{ $database->name }}
- Services
- @forelse ($environment->services as $service)
- {{ $service->name }}
-
{{ data_get($activity, 'description') }}+ @endisset +
Name: {{ $project->name }}
+UUID: {{ $project->uuid }}
+Name: {{ $project->name }}
+UUID: {{ $project->uuid }}
+ +Deployment UUID: {{ $deployment->uuid }}
+