Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup script fails with psycopg connection error #160

Open
pjhartzell opened this issue Mar 10, 2023 · 3 comments
Open

setup script fails with psycopg connection error #160

pjhartzell opened this issue Mar 10, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@pjhartzell
Copy link
Contributor

Describe the bug
Running ./scripts/setup fails with error connecting in 'pool-1': connection is bad: Temporary failure in name resolution. Per git bisect, this problem exists from #147 onward.

Partial shell output:

... snip ...
[+] Building 19.8s (9/9) FINISHED                                                                                                                                                                                               
 => [internal] load build definition from Dockerfile.dev                                                                                                                                                                   0.0s 
 => => transferring dockerfile: 194B                                                                                                                                                                                       0.0s 
 => [internal] load .dockerignore                                                                                                                                                                                          0.0s 
 => => transferring context: 2B                                                                                                                                                                                            0.0s
 => [internal] load metadata for docker.io/library/pc-apis-tiler:latest                                                                                                                                                    0.0s
 => [internal] load build context                                                                                                                                                                                          0.0s
 => => transferring context: 42B                                                                                                                                                                                           0.0s
 => [1/4] FROM docker.io/library/pc-apis-tiler                                                                                                                                                                             0.2s
 => [2/4] COPY requirements-dev.txt requirements-dev.txt                                                                                                                                                                   0.1s
 => [3/4] RUN pip install -r requirements-dev.txt                                                                                                                                                                         13.9s
 => [4/4] RUN pip install -e ./pccommon -e ./pctiler                                                                                                                                                                       4.7s 
 => exporting to image                                                                                                                                                                                                     0.8s 
 => => exporting layers                                                                                                                                                                                                    0.8s 
 => => writing image sha256:a7ed39a9cc859d4bf5209d73bdb50c18f2ec65de2b219018ed58e5e7d0b25d46                                                                                                                               0.0s 
 => => naming to docker.io/library/pc-apis-tiler-dev                                                                                                                                                                       0.0s 
migrating...                                                                                                                                                                                                                    
WARN[0000] The "APP_INSIGHTS_INSTRUMENTATION_KEY" variable is not set. Defaulting to a blank string.                                                                                                                            
WARN[0000] The "APP_INSIGHTS_INSTRUMENTATION_KEY" variable is not set. Defaulting to a blank string. 
[+] Running 4/4
 ⠿ Network pc-apis-dev-network                Created                                                                                                                                                                      0.0s
 ⠿ Container planetary-computer-apis-redis-1  Created                                                                                                                                                                      0.3s
 ⠿ Container pc-stac-db                       Created                                                                                                                                                                      0.3s
 ⠿ Container pcapis-azurite                   Created                                                                                                                                                                      0.3s
[+] Running 3/3
 ⠿ Container pcapis-azurite                   Started                                                                                                                                                                      1.2s
 ⠿ Container pc-stac-db                       Started                                                                                                                                                                      1.3s
 ⠿ Container planetary-computer-apis-redis-1  Started                                                                                                                                                                      1.0s
error connecting in 'pool-1': connection is bad: Temporary failure in name resolution
error connecting in 'pool-1': connection is bad: Temporary failure in name resolution
error connecting in 'pool-1': connection is bad: Temporary failure in name resolution
error connecting in 'pool-1': connection is bad: Temporary failure in name resolution
error connecting in 'pool-1': connection is bad: Temporary failure in name resolution
error connecting in 'pool-1': connection is bad: Temporary failure in name resolution
error connecting in 'pool-1': connection is bad: Temporary failure in name resolution
error connecting in 'pool-1': connection is bad: Temporary failure in name resolution
Traceback (most recent call last):
  File "/usr/local/bin/pypgstac", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.9/site-packages/pypgstac/pypgstac.py", line 121, in cli
    fire.Fire(PgstacCLI)
  File "/usr/local/lib/python3.9/site-packages/fire/core.py", line 141, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/usr/local/lib/python3.9/site-packages/fire/core.py", line 466, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
  File "/usr/local/lib/python3.9/site-packages/fire/core.py", line 681, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/pypgstac/pypgstac.py", line 50, in pgready
    self._db.wait()
  File "/usr/local/lib/python3.9/site-packages/pypgstac/db.py", line 125, in wait
    raise psycopg.errors.CannotConnectNow
psycopg.errors.CannotConnectNow

Additional context
os = Windows 11 / WSL2
docker version = Docker version 20.10.23, build 7155243
docker-compose version = Docker Compose version v2.15.1

@pjhartzell pjhartzell added the bug Something isn't working label Mar 10, 2023
@vincentsarago
Copy link
Contributor

I think this is due to recent update of pgstac which needs a bit more time to be started

@mmcfarland
Copy link
Member

@pjhartzell I've been seeing this issue pop up in various projects that bring in pgstac when the postgres version has been bumped (as it has the referenced PR). Unfortunately, I can't seem to reproduce this issue locally, but I'm pretty confident that the fix would be to delete this line entirely.

Can you try to see if that resolves your issue (I tested locally and it continues to work). This matches changes we made in stac-fastapi and pctasks.

@pjhartzell
Copy link
Contributor Author

@mmcfarland Yep, deleting that line fixed the problem. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants