Prisma-docker无法连接到服务器

时间:2019-08-18 00:49:32

标签: mongodb docker docker-compose graphql prisma

我尝试了这个answer,但是我得到了ls一个空列表

问题:我无法将pyramida连接到免费的图集集群上

在使用graphql-yoga和apollo-server设置graphql服务器时,已经发生过两次,所以这次我没有服务器,而仅用pyramida尝试了。

我的步骤

在图册中,我使用了加载样本数据

prisma init

我选择了连接到现有的mongodb并提供了连接字符串(生成的文件在问题的末尾)

docker-compose up -d

容器已创建(此处没有错误)

prisma deploy

我收到此消息:

  

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

所以我去拿了集装箱日志

docker logs <id>

Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)

docker-compose.yml

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: mongo
            schema: sample_weatherdata
            uri: >-
              mongodb+srv://admin:admin@demonic-one-sdk7x.mongodb.net/test?retryWrites=true&w=majority

prisma.yml

endpoint: http://localhost:4466
datamodel: datamodel.prisma
databaseType: document

generate:
  - generator: javascript-client
    output: ./generated/prisma-client/

1 个答案:

答案 0 :(得分:4)

这可以解决您遇到的错误。我无法连接到您的MongoDB实例进行全面测试,但至少它可以解决您的问题。

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: mongo
            host: demonic-one-sdk7x.mongodb.net
            user: admin
            password: admin
            uri: >-
              mongodb+srv://admin:admin@demonic-one-sdk7x.mongodb.net/test?retryWrites=true&w=majority