fix(proxy): restore project networks after host reboot (#11476)
This commit is contained in:
parent
c1219576cf
commit
16352fad23
2 changed files with 3 additions and 3 deletions
|
|
@ -123,7 +123,7 @@ function connectProxyToNetworks(Server $server)
|
|||
}
|
||||
|
||||
return collect([
|
||||
'for network in $(docker inspect $(docker ps --filter label=coolify.managed=true --format "{{.ID}}") --format=\'{{range $network, $_ := .NetworkSettings.Networks}}{{println $network}}{{end}}\' 2>/dev/null | sort -u); do',
|
||||
'for network in $(docker inspect $(docker ps -a --filter label=coolify.managed=true --format "{{.ID}}") --format=\'{{range $network, $_ := .NetworkSettings.Networks}}{{println $network}}{{end}}\' 2>/dev/null | sort -u); do',
|
||||
' if [ -z "$network" ] || [ "$network" = "bridge" ] || [ "$network" = "host" ] || [ "$network" = "none" ] || [ "$network" = "default" ]; then',
|
||||
' continue',
|
||||
' fi',
|
||||
|
|
|
|||
|
|
@ -6,14 +6,14 @@
|
|||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
it('discovers running container networks instead of relying on cached resource statuses', function () {
|
||||
it('discovers managed container networks regardless of container status', function () {
|
||||
$team = Team::factory()->create();
|
||||
$server = Server::factory()->create(['team_id' => $team->id]);
|
||||
|
||||
$commands = connectProxyToNetworks($server)->implode("\n");
|
||||
|
||||
expect($commands)
|
||||
->toContain('docker ps --filter label=coolify.managed=true')
|
||||
->toContain('docker ps -a --filter label=coolify.managed=true')
|
||||
->toContain('.NetworkSettings.Networks')
|
||||
->toContain('docker network inspect "$network"')
|
||||
->toContain('docker network connect "$network" coolify-proxy')
|
||||
|
|
|
|||
Loading…
Reference in a new issue