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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
feat: COOLIFY_CONTAINER_NAME predefined variable
Andras Bacsai1ecd0307edc9
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.phpindex fb577b895b..8f89da2d29 100644--- a/app/Jobs/ApplicationDeploymentJob.php+++ b/app/Jobs/ApplicationDeploymentJob.php@@ -828,6 +828,9 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueueif ($this->application->environment_variables_preview->where('key', 'COOLIFY_BRANCH')->isEmpty()) {$envs->push("COOLIFY_BRANCH={$local_branch}");}+ if ($this->application->environment_variables_preview->where('key', 'COOLIFY_CONTAINER_NAME')->isEmpty()) {+ $envs->push("COOLIFY_CONTAINER_NAME={$this->container_name}");+ }foreach ($sorted_environment_variables_preview as $env) {$real_value = $env->real_value;if ($env->version === '4.0.0-beta.239') {@@ -869,6 +872,9 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueueif ($this->application->environment_variables->where('key', 'COOLIFY_BRANCH')->isEmpty()) {$envs->push("COOLIFY_BRANCH={$local_branch}");}+ if ($this->application->environment_variables->where('key', 'COOLIFY_CONTAINER_NAME')->isEmpty()) {+ $envs->push("COOLIFY_CONTAINER_NAME={$this->container_name}");+ }foreach ($sorted_environment_variables as $env) {$real_value = $env->real_value;if ($env->version === '4.0.0-beta.239') {diff --git a/app/Models/Service.php b/app/Models/Service.phpindex 7851eb58a3..6e8ba25a87 100644--- a/app/Models/Service.php+++ b/app/Models/Service.php@@ -6,6 +6,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;use Illuminate\Database\Eloquent\Relations\HasMany;use Illuminate\Database\Eloquent\SoftDeletes;use Illuminate\Support\Collection;+use Symfony\Component\Yaml\Yaml;class Service extends BaseModel{@@ -837,6 +838,13 @@ class Service extends BaseModel$commands[] = "mkdir -p $workdir";$commands[] = "cd $workdir";+ $json = Yaml::parse($this->docker_compose);+ foreach($json['services'] as $service => $config) {+ $envs = collect($config['environment']);+ $envs->push("COOLIFY_CONTAINER_NAME=$service-{$this->uuid}");+ data_set($json, "services.$service.environment", $envs->toArray());+ }+ $this->docker_compose = Yaml::dump($json);$docker_compose_base64 = base64_encode($this->docker_compose);$commands[] = "echo $docker_compose_base64 | base64 -d | tee docker-compose.yml > /dev/null";$envs = $this->environment_variables()->get();