Prisma cannot prisma deploy on Docker Toolbox


#1

What is the problem?

Is there anyone here who encounters the same problem when using Docker Toolbox? This project works on a Mac and on my Ubuntu VM but in my Windows laptop it doesn’t.

I introspected a Postgres Schema through prisma init but then I cannot start a new Docker container when I type docker-compose up -d in my Docker Quickstart Terminal. Here’s the error:

prisma_1    | Caused by: org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
prisma_1    |   at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:245)
prisma_1    |   at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
prisma_1    |   at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:195)
prisma_1    |   at org.postgresql.Driver.makeConnection(Driver.java:452)
prisma_1    |   at org.postgresql.Driver.connect(Driver.java:254)
prisma_1    |   at slick.jdbc.DriverDataSource.getConnection(DriverDataSource.scala:101)
prisma_1    |   at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:341)
prisma_1    |   at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:193)
prisma_1    |   at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:430)
prisma_1    |   at com.zaxxer.hikari.pool.HikariPool.access$500(HikariPool.java:64)
prisma_1    |   at com.zaxxer.hikari.pool.HikariPool$PoolEntryCreator.call(HikariPool.java:570)
prisma_1    |   at com.zaxxer.hikari.pool.HikariPool$PoolEntryCreator.call(HikariPool.java:563)
prisma_1    |   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
prisma_1    |   ... 3 more
prisma_1    | Caused by: java.net.ConnectException: Connection refused (Connection refused)
prisma_1    |   at java.net.PlainSocketImpl.socketConnect(Native Method)
prisma_1    |   at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
prisma_1    |   at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
prisma_1    |   at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
prisma_1    |   at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
prisma_1    |   at java.net.Socket.connect(Socket.java:589)
prisma_1    |   at org.postgresql.core.PGStream.<init>(PGStream.java:69)
prisma_1    |   at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:156)
prisma_1    |   ... 15 more

NOTE: I already tried editing my hosts file, also my pg_hba.conf file in trying to resolve TCP/IP Connections but the error persists. I didn’t post it earlier because I thought it was just occurring in my machine only. But it also occurred on another Windows 10 computer too.

Steps to recreate the problem

files:

docker-compose.yml

version: '3'
services:
  prisma:
    image: prismagraphql/prisma:1.9
    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: devjdbrc
            schema: public
            user: postgres
            password: root
            migrations: false
  postgres:
    image: postgres
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: root
    volumes:
      - postgres:/var/lib/postgresql/data
volumes:
  postgres:

datamodel.graphql

   type Cartlab @pgTable(name: "Cartlab") {
      asOf: DateTime!
      createdAt: DateTime!
      gradeLevel: Int
      id: Int! @unique 
      itemRemarks: String
      location: String!
      specs: String
      type: String!
      updatedAt: DateTime!
      Creserves: [Creserve!]!
    }
type Creserve @pgTable(name: "Creserve") {
  cartlab: Cartlab @pgRelation(column: "cartlabId")
  createdAt: DateTime!
  currentStatus: String @default(value: "reserved")
  grade: Int!
  id: Int! @unique
  rDateEnd: DateTime!
  rDateStart: DateTime!
  section: String!
  timezone: String!
  updatedAt: DateTime!
  user: User @pgRelation(column: "userId")
}

type Report @pgTable(name: "Report") {
  createdAt: DateTime!
  creserveId: Int
  id: Int! @unique
  status: String
  updatedAt: DateTime!
}

type User @pgTable(name: "User") {
  createdAt: DateTime!
  department: String!
  firstName: String
  id: Int! @unique
  lastName: String
  password: String!
  subject: String!
  updatedAt: DateTime!
  userType: String
  username: String!
  Creserves: [Creserve!]!
}

prisma.yml

endpoint: http://localhost:4466
datamodel: datamodel.graphql

commands:

  1. prisma init -> Existing Database -> PostgreSQL -> docker-compose up -d

Specs:
Windows 10 Home
Docker Toolbox for Windows
8 GB RAM


#2

this was the solution for me ->


#3

Hello, thanks for replying.

However, I also tried that solution since in one of Ben Awad’s videos about Prisma, he did that solution which worked for him but not for me. My error changed, however, to:

prisma_1  | Exception in thread "main" java.sql.SQLTransientConnectionException: database - Connection is not available, request timed out after 5000ms.
prisma_1  |     at com.zaxxer.hikari.pool.HikariPool.createTimeoutException(HikariPool.java:548)
prisma_1  |     at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:186)
prisma_1  |     at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:145)
prisma_1  |     at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:83)
prisma_1  |     at slick.jdbc.hikaricp.HikariCPJdbcDataSource.createConnection(HikariCPJdbcDataSource.scala:18)
prisma_1  |     at slick.jdbc.JdbcBackend$BaseSession.<init>(JdbcBackend.scala:439)
prisma_1  |     at slick.jdbc.JdbcBackend$DatabaseDef.createSession(JdbcBackend.scala:47)
prisma_1  |     at slick.jdbc.JdbcBackend$DatabaseDef.createSession(JdbcBackend.scala:38)
prisma_1  |     at slick.basic.BasicBackend$DatabaseDef.acquireSession(BasicBackend.scala:218)
prisma_1  |     at slick.basic.BasicBackend$DatabaseDef.acquireSession$(BasicBackend.scala:217)
prisma_1  |     at slick.jdbc.JdbcBackend$DatabaseDef.acquireSession(JdbcBackend.scala:38)
prisma_1  |     at slick.basic.BasicBackend$DatabaseDef$$anon$2.run(BasicBackend.scala:239)
prisma_1  |     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
prisma_1  |     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
prisma_1  |     at java.lang.Thread.run(Thread.java:748)
prisma_1  | Caused by: org.postgresql.util.PSQLException: The connection attempt failed.
prisma_1  |     at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:257)
prisma_1  |     at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
prisma_1  |     at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:195)
prisma_1  |     at org.postgresql.Driver.makeConnection(Driver.java:452)
prisma_1  |     at org.postgresql.Driver.connect(Driver.java:254)
prisma_1  |     at slick.jdbc.DriverDataSource.getConnection(DriverDataSource.scala:101)
prisma_1  |     at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:341)
prisma_1  |     at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:193)
prisma_1  |     at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:430)
prisma_1  |     at com.zaxxer.hikari.pool.HikariPool.access$500(HikariPool.java:64)
prisma_1  |     at com.zaxxer.hikari.pool.HikariPool$PoolEntryCreator.call(HikariPool.java:570)
prisma_1  |     at com.zaxxer.hikari.pool.HikariPool$PoolEntryCreator.call(HikariPool.java:563)
prisma_1  |     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
prisma_1  |     ... 3 more
prisma_1  | Caused by: java.net.UnknownHostException: host.docker.internal
prisma_1  |     at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
prisma_1  |     at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
prisma_1  |     at java.net.Socket.connect(Socket.java:589)
prisma_1  |     at org.postgresql.core.PGStream.<init>(PGStream.java:69)
prisma_1  |     at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:156)
prisma_1  |     ... 15 more

here’s my docker-compose file:

version: '3'
services:
  prisma:
    image: prismagraphql/prisma:1.10
    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
            port: 5432
            database: devjdbrc
            schema: public
            user: postgres
            password: root
            migrations: false

#4

I have the same issue

it is because of linux doesnt support host.docker.internal

I found no solution to docker-compose prisma and psql in ubuntu


#5

host:localhost
result: doesn’t works in both window and ubuntu

host:host.docker.internal
result: works in window, not in ubuntu

host:postgres
result: doesn’t works in both window and ubuntu

has anyone manage to docker compose psql and prisma in ubuntu, please shed some light on me


#6

Prisma is the cloud services for users. For instant support related to the Computer or Laptop Problem such as Data Recover & Virus Removal please Call Geek Squad Support Number for the best solution.