wip: services

feat: able to map port<->domain
This commit is contained in:
Andras Bacsai
2023-09-22 14:47:25 +02:00
parent c91f426af3
commit 67078fdc71
36 changed files with 233 additions and 248 deletions

View File

@@ -11,7 +11,7 @@ class StartService
public function handle(Service $service)
{
$workdir = service_configuration_dir() . "/{$service->uuid}";
$commands[] = "echo 'Starting service {$service->name} on {$service->server->name}.'";
$commands[] = "echo '####### Starting service {$service->name} on {$service->server->name}.'";
$commands[] = "mkdir -p $workdir";
$commands[] = "cd $workdir";
@@ -22,11 +22,10 @@ class StartService
foreach ($envs as $env) {
$commands[] = "echo '{$env->key}={$env->value}' >> .env";
}
$commands[] = "echo 'Pulling images and starting containers...'";
$commands[] = "docker compose pull";
$commands[] = "docker compose up -d";
$commands[] = "echo 'Waiting for containers to start...'";
$commands[] = "sleep 5";
$commands[] = "echo '####### Pulling images.'";
$commands[] = "docker compose pull --quiet";
$commands[] = "echo '####### Starting containers.'";
$commands[] = "docker compose up -d >/dev/null 2>&1";
$commands[] = "docker network connect $service->uuid coolify-proxy 2>/dev/null || true";
$activity = remote_process($commands, $service->server);
return $activity;