From 4b16d506685a269ea8a9600e4d5df47907c1315a Mon Sep 17 00:00:00 2001 From: Behnam Momeni Date: Thu, 5 Sep 2024 13:04:23 +0330 Subject: [PATCH] Warn about the missing host.containers.internal in podman v5 with pasta The solution is to switch back to slirp4netns until the pasta resolves the issue. # https://bbs.archlinux.org/viewtopic.php?id=296042 # https://github.com/containers/podman/issues/19213 --- pkg/adapter/db/postgres/migration/schi/loadfdw.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/adapter/db/postgres/migration/schi/loadfdw.go b/pkg/adapter/db/postgres/migration/schi/loadfdw.go index 6bb101b..3b5b7d6 100644 --- a/pkg/adapter/db/postgres/migration/schi/loadfdw.go +++ b/pkg/adapter/db/postgres/migration/schi/loadfdw.go @@ -14,6 +14,7 @@ import ( "strconv" "strings" + "github.com/momeni/clean-arch/pkg/core/log" "github.com/momeni/clean-arch/pkg/core/repo" "github.com/momeni/clean-arch/pkg/core/usecase/migrationuc" ) @@ -92,6 +93,15 @@ OPTIONS (user '%s', password '%s')`, FROM SERVER %s INTO %s`, remoteSchema, server, localSchema), ); err != nil { + if h == "host.containers.internal" { + log.Warn(ctx, `if database is running in a podman container, +it may fail to access the host system via host.containers.internal name +because it is not supported by "pasta" which is the new default +rootless network handler; in this case, consider switching back to +"slirp4netns" by editing /etc/containers/containers.conf file and +putting this line in the [network] section: +default_rootless_network_cmd = "slirp4netns"`) + } return fmt.Errorf( "importing %q foreign schema of %q server into %q: %w", remoteSchema, server, localSchema, err,