Skip to content

PGPORT environment variable doesn't seem to be respected in v1.3.0 #675

@cfeenstra67

Description

@cfeenstra67

Hi there guys, wanted to alert you to an issue that I started facing starting after the v1.3.0 release on Friday. I use sqitch via the docker image & the recommended script as documented in the README and docker hub. I am not sure if this an issue with the v1.3.0 release in general or just the docker setup. I'm also not sure if it's all PG* environment variables or just PGPORT. Basically, the behavior I'm seeing is that even though PGPORT is in the environment, when trying to run migrations I get an error like this:

Adding registry tables to pg-localdev
psql: error: could not connect to server: Connection refused
        Is the server running on host "localhost" (::1) and accepting
        TCP/IP connections on port 5432?
could not connect to server: Connection refused
        Is the server running on host "localhost" (127.0.0.1) and accepting
        TCP/IP connections on port 5432?
"psql" unexpectedly returned exit value 2

Steps to reproduce:

  1. Have a postgres instance running on port 5433
  2. Download the sqitch docker running script from the README of this repo
  3. Try to run some migrations with PGPORT=5433 in the environment

This is what my sqitch config file looks like:

[core]
  engine = pg
  top_dir = db/
[engine "pg"]
  target = pg-localdev
[target "pg-localdev"]
  uri = db:postgresql://postgres:password@localhost/database

I was able to solve this issue for myself by just pinning the tag in the sqitch runner script to v1.2.1.1 (side note: v1.2.1 is listed as a supported tag on docker hub but doesn't seem to work: https://hub.docker.com/r/sqitch/sqitch/ ; I had to come look at the tags in the repo to find that you use a versioning scheme w/ 4 components instead of 3). So I'm not blocked here or anything, just thought you guys might want a heads up as this caused some github actions to start failing for me; I am using their "port mapping" functionality (https://docs.github.com/en/actions/using-containerized-services/about-service-containers) and was specifying the port with PGPORT, and my tests suddenly started failing. I'm guessing the same might be true for some others as well.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions