Prisma部署Docker错误“无法连接到服务器”

Web*_*per 6 docker graphql prisma

这是我已经完成的步骤

prisma init
Run Code Online (Sandbox Code Playgroud)

我在本地设置数据库的PostgreSQL(不存在)。

它创建了3个文件,分别是datamodel.graphql,docker-compose.yml,prisma.yml

docker-compose up -d
Run Code Online (Sandbox Code Playgroud)

我确认它成功运行 在此处输入图片说明 但是如果我打电话给我prisma deploy,那说明我出错了

Could not connect to server at http://localhost:4466. Please check if your server is running.
Run Code Online (Sandbox Code Playgroud)

我所做的只是手册中描述的标准操作,https://www.prisma.io/docs/tutorials/deploy-prisma-servers/local-(docker)-meemaesh3k中没有自定义

这是docker-compose.yml

version: '3'
services:
  prisma:
    image: prismagraphql/prisma:1.11
    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: localhost
            port: '5432'
            database: databasename
            schema: public
            user: postgres
            password: root
            migrations: true
Run Code Online (Sandbox Code Playgroud)

我想念什么?

小智 6

I found this solution to the same problem i was facing

docker-machine ip default
Run Code Online (Sandbox Code Playgroud)

Use this address and replace the "localhost" with the IP with the above command to look something like this in prisma.yml file

endpoint: http://1xx.1xx.xx.xxx:4466
Run Code Online (Sandbox Code Playgroud)

The answer is referred from this Github Link


Von*_*onC 1

文档提到

\n\n
\n
docker ps\n
Run Code Online (Sandbox Code Playgroud)\n\n

您应该看到与此类似的输出:

\n\n
$ docker ps\nCONTAINER ID        IMAGE                               COMMAND                  CREATED             STATUS              PORTS                    NAMES\n2b799c529e73        prismagraphql/prisma:1.7            "/bin/sh -c /app/sta\xe2\x80\xa6"   17 hours ago        Up 7 hours          0.0.0.0:4466->4466/tcp   myapp_prisma_1\n757dfba212f7        mysql:5.7                           "docker-entrypoint.s\xe2\x80\xa6"   17 hours ago  \n
Run Code Online (Sandbox Code Playgroud)\n
\n\n

(此处显示的是 mysql,但也适用于 postgresql)

\n\n

要点是:应该有两个容器在运行,而不是一个。

\n\n

检查docker-compose logs一下为什么第二个(数据库)没有启动。

\n