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
Refactor database and service start commands
Andras Bacsaifd2a5330576b
diff --git a/app/Actions/Database/StartMariadb.php b/app/Actions/Database/StartMariadb.phpindex c0958acb83..ad8918a3ef 100644--- a/app/Actions/Database/StartMariadb.php+++ b/app/Actions/Database/StartMariadb.php@@ -106,7 +106,8 @@ class StartMariadb$this->commands[] = "echo 'Pulling {$database->image} image.'";$this->commands[] = "docker compose -f $this->configuration_dir/docker-compose.yml pull";$this->commands[] = "docker compose -f $this->configuration_dir/docker-compose.yml up -d";- $this->commands[] = "echo '{$database->name} started.'";+ $database_name = addslashes($database->name);+ $this->commands[] = "echo '{$database_name} started.'";return remote_process($this->commands, $database->destination->server, callEventOnFinish: 'DatabaseStatusChanged');}diff --git a/app/Actions/Database/StartMongodb.php b/app/Actions/Database/StartMongodb.phpindex 3b9b07c49d..34028bdcea 100644--- a/app/Actions/Database/StartMongodb.php+++ b/app/Actions/Database/StartMongodb.php@@ -122,7 +122,8 @@ class StartMongodb$this->commands[] = "echo 'Pulling {$database->image} image.'";$this->commands[] = "docker compose -f $this->configuration_dir/docker-compose.yml pull";$this->commands[] = "docker compose -f $this->configuration_dir/docker-compose.yml up -d";- $this->commands[] = "echo '{$database->name} started.'";+ $database_name = addslashes($database->name);+ $this->commands[] = "echo '{$database_name} started.'";return remote_process($this->commands, $database->destination->server, callEventOnFinish: 'DatabaseStatusChanged');}diff --git a/app/Actions/Database/StartMysql.php b/app/Actions/Database/StartMysql.phpindex b7ce747715..2a8f17ea8c 100644--- a/app/Actions/Database/StartMysql.php+++ b/app/Actions/Database/StartMysql.php@@ -106,7 +106,8 @@ class StartMysql$this->commands[] = "echo 'Pulling {$database->image} image.'";$this->commands[] = "docker compose -f $this->configuration_dir/docker-compose.yml pull";$this->commands[] = "docker compose -f $this->configuration_dir/docker-compose.yml up -d";- $this->commands[] = "echo '{$database->name} started.'";+ $database_name = addslashes($database->name);+ $this->commands[] = "echo '{$database_name} started.'";return remote_process($this->commands, $database->destination->server,callEventOnFinish: 'DatabaseStatusChanged');}diff --git a/app/Actions/Database/StartPostgresql.php b/app/Actions/Database/StartPostgresql.phpindex e1427ae538..635bb73436 100644--- a/app/Actions/Database/StartPostgresql.php+++ b/app/Actions/Database/StartPostgresql.php@@ -128,7 +128,8 @@ class StartPostgresql$this->commands[] = "echo 'Pulling {$database->image} image.'";$this->commands[] = "docker compose -f $this->configuration_dir/docker-compose.yml pull";$this->commands[] = "docker compose -f $this->configuration_dir/docker-compose.yml up -d";- $this->commands[] = "echo '{$database->name} started.'";+ $database_name = addslashes($database->name);+ $this->commands[] = "echo '{$database_name} started.'";return remote_process($this->commands, $database->destination->server, callEventOnFinish: 'DatabaseStatusChanged');}diff --git a/app/Actions/Database/StartRedis.php b/app/Actions/Database/StartRedis.phpindex 966015746e..4474819f45 100644--- a/app/Actions/Database/StartRedis.php+++ b/app/Actions/Database/StartRedis.php@@ -117,7 +117,8 @@ class StartRedis$this->commands[] = "echo 'Pulling {$database->image} image.'";$this->commands[] = "docker compose -f $this->configuration_dir/docker-compose.yml pull";$this->commands[] = "docker compose -f $this->configuration_dir/docker-compose.yml up -d";- $this->commands[] = "echo '{$database->name} started.'";+ $database_name = addslashes($database->name);+ $this->commands[] = "echo '{$database_name} started.'";return remote_process($this->commands, $database->destination->server, callEventOnFinish: 'DatabaseStatusChanged');}diff --git a/app/Actions/Service/StartService.php b/app/Actions/Service/StartService.phpindex cbee5918b3..9f361e0d6a 100644--- a/app/Actions/Service/StartService.php+++ b/app/Actions/Service/StartService.php@@ -13,11 +13,15 @@ class StartService{ray('Starting service: ' . $service->name);$service->saveComposeConfigs();++ $service_name = addslashes($service->name);+ $server_name = addslashes($service->server->name);+$commands[] = "cd " . $service->workdir();$commands[] = "echo 'Saved configuration files to {$service->workdir()}.'";$commands[] = "echo 'Creating Docker network.'";$commands[] = "docker network inspect $service->uuid >/dev/null 2>&1 || docker network create --attachable $service->uuid >/dev/null 2>&1 || true";- $commands[] = "echo 'Starting service $service->name on {$service->server->name}.'";+ $commands[] = "echo Starting service $service_name on $server_name.";$commands[] = "echo 'Pulling images.'";$commands[] = "docker compose pull";$commands[] = "echo 'Starting containers.'";