Prisma1: Fresh prisma init fails on docker-compose up

Created on 16 Dec 2018  路  2Comments  路  Source: prisma/prisma1

Describe the bug
I used prisma init to create a basic docker-compose file and basic settings. Docker-compose up fails. Scripts seem to be out of sync.

postgres_1 | 2018-12-16 19:33:49.954 UTC [1] FATAL: database files are incompatible with server
postgres_1 | 2018-12-16 19:33:49.954 UTC [1] DETAIL: The data directory was initialized by PostgreSQL version 10, which is not compatible with this version 11.1 (Debian 11.1-1.pgdg90+1).

This documentation could be out of date or perhaps someone didn't create a tag for latest?
https://www.prisma.io/docs/1.22/prisma-server/deployment-environments/docker-rty1/

To Reproduce
Steps to reproduce the behavior:

npm update -g prisma
prisma init server
? Set up a new Prisma server or deploy to an existing server? Create new database
? What kind of database do you want to deploy to? PostgreSQL
? Select the programming language for the generated Prisma client Prisma TypeScript Client
cd server
docker-compose up

Expected behavior
prisma should be able to connect to postgres.

Actual behavior:

postgres_1  | 2018-12-16 19:33:49.954 UTC [1] FATAL:  database files are incompatible with server
postgres_1  | 2018-12-16 19:33:49.954 UTC [1] DETAIL:  The data directory was initialized by PostgreSQL version 10, which is not compatible with this version 11.1 (Debian 11.1-1.pgdg90+1).
prisma_1    | Dec 16, 2018 7:33:52 PM org.postgresql.core.v3.ConnectionFactoryImpl log
prisma_1    | WARNING: ConnectException occurred while connecting to postgres:5432
prisma_1    | 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    |   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    |   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    |


Screenshots
If applicable, add screenshots to help explain your problem.

Versions (please complete the following information):

  • OSX 10.14.2
  • prisma/1.22.2 (darwin-x64) node-v11.2.0

Additional context
This is the docker-compose.yml. Nothing special here. It's exactly as prisma init created it:

version: '3'
services:
  prisma:
    image: prismagraphql/prisma:1.22
    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: postgres
            user: prisma
            password: prisma
            rawAccess: true
            port: 5432
            migrations: true
  postgres:
    image: postgres
    restart: always
    environment:
      POSTGRES_USER: prisma
      POSTGRES_PASSWORD: prisma
    volumes:
      - postgres:/var/lib/postgresql/data
volumes:
  postgres:

arecli bu0-needs-info

Most helpful comment

Looks like that fixed it. You saved me!

All 2 comments

Hi,

This seemed to be a versioning issue and you might have used two different versions of Postgres which have accessed the same volume. You might be using version 10 first and then when you pulled prisma with docker-compose, it pulled the latest tag which is 11. Since docker-compose uses directory based naming prefixes it is possible that you may have accessed the same volume if you have used the same folder name. Can you please try to remove the containers and the docker-compose internal network by using the following command:

docker-compose down -v --rmi all --remove-orphans

Give this another shot after this.

Looks like that fixed it. You saved me!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marktani picture marktani  路  3Comments

marktani picture marktani  路  3Comments

tbrannam picture tbrannam  路  3Comments

thomaswright picture thomaswright  路  3Comments

sorenbs picture sorenbs  路  3Comments