Revert "fix: services should have destination as well"

This reverts commit 9ab5a1f7bd.
This commit is contained in:
Andras Bacsai
2023-10-01 15:31:25 +02:00
parent 9ab5a1f7bd
commit b3c8c881b7
5 changed files with 9 additions and 78 deletions

View File

@@ -13,20 +13,14 @@ class StartService
$service->saveComposeConfigs();
$commands[] = "cd " . $service->workdir();
$commands[] = "echo '####### Saved configuration files to {$service->workdir()}.'";
if (is_null($service->destination)) {
$dockerNetwork = $service->uuid;
$commands[] = "echo '####### Creating Docker network.'";
$commands[] = "docker network create --attachable {$dockerNetwork} >/dev/null 2>/dev/null || true";
}
$commands[] = "echo '####### Creating Docker network.'";
$commands[] = "docker network create --attachable {$service->uuid} >/dev/null 2>/dev/null || true";
$commands[] = "echo '####### Starting service {$service->name} on {$service->server->name}.'";
$commands[] = "echo '####### Pulling images.'";
$commands[] = "docker compose pull";
$commands[] = "echo '####### Starting containers.'";
$commands[] = "docker compose up -d --remove-orphans --force-recreate";
if (is_null($service->destination)) {
$commands[] = "echo '####### Connecting to proxy network.'";
$commands[] = "docker network connect coolify-proxy {$dockerNetwork} 2>/dev/null || true";
}
$commands[] = "docker network connect $service->uuid coolify-proxy 2>/dev/null || true";
$activity = remote_process($commands, $service->server);
return $activity;
}

View File

@@ -20,9 +20,7 @@ class StopService
instant_remote_process(["docker rm -f {$db->name}-{$service->uuid}"], $service->server);
$db->update(['status' => 'exited']);
}
if (is_null($service->destination)) {
instant_remote_process(["docker network disconnect {$service->uuid} coolify-proxy 2>/dev/null"], $service->server, false);
instant_remote_process(["docker network rm {$service->uuid} 2>/dev/null"], $service->server, false);
}
instant_remote_process(["docker network disconnect {$service->uuid} coolify-proxy 2>/dev/null"], $service->server, false);
instant_remote_process(["docker network rm {$service->uuid} 2>/dev/null"], $service->server, false);
}
}