【发布时间】:2019-12-04 12:48:12
【问题描述】:
我正在尝试与 Prisma 合作。我也尝试过有关 GitHub 问题和 StackOverflow 的可用解决方案。
我已经使用以下命令安装了 Prisma
npm install -g prisma
我在系统中安装了 docker 和 docker-compose。
以下是我的 docker-compose 文件
version: '3'
services:
prisma:
image: prismagraphql/prisma:1.34
restart: always
ports:
- "4466:4466"
environment:
PRISMA_CONFIG: |
port: 4466
# uncomment the next line and provide the env var PRISMA_MANAGEMENT_API_SECRET=my-secret to activate cluster security
# managementApiSecret: my-secret
databases:
default:
connector: postgres
host: host.docker.internal
database: db
schema: public
user: prisma
password: prisma
ssl: false
rawAccess: true
port: '5432'
migrations: true
postgres:
image: postgres:11
restart: always
environment:
POSTGRES_USER: prisma
POSTGRES_PASSWORD: prisma
volumes:
- postgres:/var/lib/postgresql/data
volumes:
postgres: ~
所以,现在我尝试使用以下命令启动我的容器
docker-compose up -d
现在,我使用以下命令检查容器是否运行良好。
docker-compose ps
以下是输出
Name Command State Ports
------------------------------------------------------------------------------------------
graphql-prisma_postgres_1 docker-entrypoint.sh postgres Up 5432/tcp
graphql-prisma_prisma_1 /bin/sh -c /app/start.sh Up 0.0.0.0:4466->4466/tcp
现在,如果我尝试执行以下操作
prisma deploy
docker-compose ps
以下是输出
environment FetchError: request to http://localhost:4466/management failed, reason: connect ECONNREFUSED 127.0.0.1:4466
environment at ClientRequest.<anonymous> (/home/tomonso/.nvm/versions/node/v12.4.0/lib/node_modules/prisma/node_modules/node-fetch/lib/index.js:1393:11)
environment at ClientRequest.emit (events.js:200:13)
environment at ClientRequest.EventEmitter.emit (domain.js:471:20)
environment at Socket.socketErrorListener (_http_client.js:402:9)
environment at Socket.emit (events.js:200:13)
environment at Socket.EventEmitter.emit (domain.js:471:20)
environment at emitErrorNT (internal/streams/destroy.js:91:8)
environment at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
environment at processTicksAndRejections (internal/process/task_queues.js:84:9) +0ms
environment FetchError: request to http://localhost:4466/management failed, reason: connect ECONNREFUSED 127.0.0.1:4466
environment at ClientRequest.<anonymous> (/home/tomonso/.nvm/versions/node/v12.4.0/lib/node_modules/prisma/node_modules/node-fetch/lib/index.js:1393:11)
environment at ClientRequest.emit (events.js:200:13)
environment at ClientRequest.EventEmitter.emit (domain.js:471:20)
environment at Socket.socketErrorListener (_http_client.js:402:9)
environment at Socket.emit (events.js:200:13)
environment at Socket.EventEmitter.emit (domain.js:471:20)
environment at emitErrorNT (internal/streams/destroy.js:91:8)
environment at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
environment at processTicksAndRejections (internal/process/task_queues.js:84:9) +3ms
command Failed to fetch server version +0ms
command TypeError: Cannot read property 'replace' of null +0ms
environment FetchError: request to http://localhost:4466/management failed, reason: connect ECONNREFUSED 127.0.0.1:4466
environment at ClientRequest.<anonymous> (/home/tomonso/.nvm/versions/node/v12.4.0/lib/node_modules/prisma/node_modules/node-fetch/lib/index.js:1393:11)
environment at ClientRequest.emit (events.js:200:13)
environment at ClientRequest.EventEmitter.emit (domain.js:471:20)
environment at Socket.socketErrorListener (_http_client.js:402:9)
environment at Socket.emit (events.js:200:13)
environment at Socket.EventEmitter.emit (domain.js:471:20)
environment at emitErrorNT (internal/streams/destroy.js:91:8)
environment at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
environment at processTicksAndRejections (internal/process/task_queues.js:84:9) +4ms
environment FetchError: request to http://localhost:4466/management failed, reason: connect ECONNREFUSED 127.0.0.1:4466
environment at ClientRequest.<anonymous> (/home/tomonso/.nvm/versions/node/v12.4.0/lib/node_modules/prisma/node_modules/node-fetch/lib/index.js:1393:11)
environment at ClientRequest.emit (events.js:200:13)
environment at ClientRequest.EventEmitter.emit (domain.js:471:20)
environment at Socket.socketErrorListener (_http_client.js:402:9)
environment at Socket.emit (events.js:200:13)
environment at Socket.EventEmitter.emit (domain.js:471:20)
environment at emitErrorNT (internal/streams/destroy.js:91:8)
environment at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
environment at processTicksAndRejections (internal/process/task_queues.js:84:9) +1ms
Error: Could not connect to server at http://localhost:4466. Please check if your server is running.
at Deploy.<anonymous> (/home/tomonso/.nvm/versions/node/v12.4.0/lib/node_modules/prisma/node_mod
ules/prisma-cli-core/src/commands/deploy/deploy.ts:137:13)
at step (/home/tomonso/.nvm/versions/node/v12.4.0/lib/node_modules/prisma/node_modules/prisma-cli-core/dist/commands/deploy/deploy.js:45:23)
at Object.next (/home/tomonso/.nvm/versions/node/v12.4.0/lib/node_modules/prisma/node_modules/prisma-cli-core/dist/commands/deploy/deploy.js:26:53)
at fulfilled (/home/tomonso/.nvm/versions/node/v12.4.0/lib/node_modules/prisma/node_mod
ules/prisma-cli-core/dist/commands/deploy/deploy.js:17:58)
at processTicksAndRejections (internal/process/task_queues.js:89:5)
(node:25136) [DEP0066] DeprecationWarning:
OutgoingMessage.prototype._headers is deprecated
util timed out +0ms
output Exiting with code: 0 +0ms
【问题讨论】:
-
你是如何设置postgresql的?
标签: postgresql docker docker-compose prisma