Skip to content

Commit

Permalink
use 127.0.0.1 in with-test-db.sh for colima (bluesky-social#1297)
Browse files Browse the repository at this point in the history
So, since Docker Desktop has licensing issues, some folks use colima for
running containers on their macOS machines (The licensing exempted
CLI-only version of Docker only exists on Linux).

Unfortunately, colima binds host ports only on the IPv4 localhost
address (`127.0.0.1`) while the atproto postgres clients will attempt to
connect to the IPv6 localhost address (`::1`) that macOS sets in
/etc/hosts.  See abiosoft/colima#583 and
lima-vm/lima#1330 for the tickets against
colima. (Docker Desktop binds to both IPv4 and IPv6 localhost addresses
and so doesn't have this issue.)

To workaround this silly issue, we can use `localhost` within the docker
containers and docker-compose, but need to set the `DB_POSTGRES_URL` env
var to use the IPv4 localhost explicitly.

(Asking folks to edit /etc/hosts causes other tools to break and will be
overridden on each OS upgrade.)
  • Loading branch information
jmhodges authored Jul 17, 2023
1 parent 6a32ee8 commit 88ad67c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/pg/with-test-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export PGHOST=localhost
export PGUSER=pg
export PGPASSWORD=password
export PGDATABASE=postgres
export DB_POSTGRES_URL="postgresql://pg:password@localhost:5433/postgres"
export DB_POSTGRES_URL="postgresql://pg:password@127.0.0.1:5433/postgres"
"$@"
code=$?

Expand Down

0 comments on commit 88ad67c

Please sign in to comment.