我已经安装了graphile/postgraphile
码头工人镜像,现在正尝试使用它。我已经确认输入postgres://USER:PASSWORD ETC
的所有信息都是正确的,并且可以通过终端成功登录:
hutber@hutber:/var/www/gd.api.hutber.com$ psql -h localhost -U depotadmin goldendemon
Password for user depotadmin:
psql (10.10 (Ubuntu 10.10-0ubuntu0.18.04.1))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.
goldendemon=# \dn
List of schemas
Name | Owner
--------+----------
public | postgres
(1 row)
然后是错误
$hutber: docker run --init -p 5000:5000 graphile/postgraphile --connection postgres://POSTGRES_USER:POSTGRES_PASSWORD@POSTGRES_HOST:POSTGRES_PORT/POSTGRES_DATABASE --schema app_public --watch
PostGraphile v4.5.5 server listening on port 5000 ?
‣ GraphQL API: http://0.0.0.0:5000/graphql
‣ GraphiQL GUI/IDE: http://0.0.0.0:5000/graphiql (enhance with '--enhance-graphiql')
‣ Postgres connection: postgres://depotadmin:[SECRET]@localhost/goldendemon (watching)
‣ Postgres schema(s): public
‣ Documentation: https://graphile.org/postgraphile/introduction/
‣ Join James Cavanaugh in supporting PostGraphile development: https://graphile.org/sponsor/
* * *
A serious error occurred when building the initial schema. We'll try again in 100ms. Error details:
Error: connect ECONNREFUSED 127.0.0.1:5432
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1129:14)
但是我已经检查并看到我的本地postgresql
没有运行:
^Chutber@hutber:/var/www/gd.api.hutber.com$ service postgresql status
● postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Wed 2019-12-25 22:38:28 GMT; 4min 34s ago
Process: 3327 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 3327 (code=exited, status=0/SUCCESS)
Dec 23 08:57:17 hutber systemd[1]: Starting PostgreSQL RDBMS...
Dec 23 08:57:17 hutber systemd[1]: Started PostgreSQL RDBMS.
Dec 25 22:38:28 hutber systemd[1]: Stopped PostgreSQL RDBMS.