Prisma Deploy Docker 错误“无法连接到服务器" [英] Prisma Deploy Docker error "Could not connect to server"

查看:20
本文介绍了Prisma Deploy Docker 错误“无法连接到服务器"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我已经完成的步骤

棱镜初始化

我在本地为数据库设置了 postgresql(不存在).

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

docker-compose up -d

我确认它运行成功但是如果我调用 prisma deploy,它会显示我错误

无法连接到位于 http://localhost:4466 的服务器.请检查您的服务器是否正在运行.

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

这是 docker-compose.yml

版本:'3'服务:棱镜:图片:prismagraphql/prisma:1.11重启:总是端口:- 4466:4466"环境:PRISMA_CONFIG: |端口:4466# 取消注释下一行并提供环境变量 PRISMA_MANAGEMENT_API_SECRET=my-secret 以激活集群安全# managementApiSecret: 我的秘密数据库:默认:连接器:postgres主机:本地主机端口:'5432'数据库:数据库名架构:公共用户: postgres密码:root迁移:真的

我错过了什么?

解决方案

文档提及:

<块引用>

docker ps

您应该会看到类似这样的输出:

$ docker ps容器 ID 图像命令创建状态端口名称2b799c529e73prismagraphql/prisma:1.7 "/bin/sh -c/app/sta..." 17 小时前 7 小时前 0.0.0.0:4466->4466/tcp myapp_prisma_1757dfba212f7 mysql:5.7 "docker-entrypoint.s..." 17 小时前

(这里用 mysql 显示,但对 postgresql 也有效)

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

检查 docker-compose logs 以了解为什么第二个(数据库)没有启动.

This is steps I have done

prisma init

I set postgresql for database in my local(not exist).

It created 3 files, datamodel.graphql, docker-compose.yml, prisma.yml

docker-compose up -d

I confirmed it running successfully But if I call prisma deploy, it shows me error

Could not connect to server at http://localhost:4466. Please check if your server is running.

All I have done is standard operation described in manual and there is no customization in https://www.prisma.io/docs/tutorials/deploy-prisma-servers/local-(docker)-meemaesh3k

And this is 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

What am I missing?

解决方案

The documentation mentions:

docker ps

You should see output similar to this:

$ docker ps
CONTAINER ID        IMAGE                               COMMAND                  CREATED             STATUS              PORTS                    NAMES
2b799c529e73        prismagraphql/prisma:1.7            "/bin/sh -c /app/sta…"   17 hours ago        Up 7 hours          0.0.0.0:4466->4466/tcp   myapp_prisma_1
757dfba212f7        mysql:5.7                           "docker-entrypoint.s…"   17 hours ago  

(Here shown with mysql, but valid with postgresql too)

The point is: there should be two containers running, not one.

Check docker-compose logs to see why the second one (database) did not start.

这篇关于Prisma Deploy Docker 错误“无法连接到服务器"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆