Hey everybody, I have a problem with my setup, tha...
# orm-help
p
Hey everybody, I have a problem with my setup, that's driving me nuts.... I used @max’s tutorial (https://github.com/maxdarque/prisma-docker), to setup a local cluster, which is called live. I deployed my local node.js based system to live, but even though, it writes a successmsg for the deploy, the db, that is used, is still not my external (self-hosted on dedicated root server) mysql db, but a freshly created db in a local docker container. I'll post my relevant files in a threas, so you can see, what I'm talking about. Maybe someone of you sees the error. I've tried to sort out the issue for the past two days, but hadn't had the slightest success. Thanks in advance! 🙂
.env file of the docker container (used for creating the new cluster)
Copy code
HOST=<http://localhost>
DB_USERNAME=dbusr
DB_PWD=dbpw
DB_HOST=HOSTADDRESS
DB_PORT=3306
INTERNAL_GRAPHCOOL_DB_NAME=graphcool

PORT=4467

SQL_CLIENT_CONNECTION_LIMIT=30
SQL_INTERNAL_CONNECTION_LIMIT=30

SCHEMA_MANAGER_SECRET=581f44276f0dc75a0d42bb34ffb6b4f91d015cf8
CLUSTER_PUBLIC_KEY='-----BEGIN PUBLIC KEY-----\r\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApSFz7re5QU6ee1hb7aif\r\neg4hOQ/DuqpEGbKaOvLWBUGr//ZMdrZOP3gIYFkLXO1YhNDy6icwk2qZPUFoUqCJ\r\nu89f/fpZ8NIsuviRoaem6B8zl+2tMwgCutvNfT4bwAO6sH3u2Ms/qnLhlEok4i+h\r\n0RBlm94BqvbIZwEEpzRS6lb1pTkh9/OHo3H7powwGSm6FWHsy+7VOTTLFTzutWH/\r\ne6xb2frsyo6rS4hZ6xkoubgUL7hTjEMLpLGuHA0Byv0iLASxjZ/i+NvY0SiqNyCu\r\nmyGLy3hk/wQroJaSgbkOX50OvObaGJjLUj3gHt+1dBJ1g0ebdHuw8OgyyI+Vgv/A\r\n4QIDAQAB\r\n-----END PUBLIC KEY-----\r\n'

CLUSTER_VERSION=local
BUGSNAG_API_KEY="empty"
RABBITMQ_URI=""
docker-compose.yml (same as the one in @max’s repo)
Copy code
version: "3"
services:
  prisma:
    image: prismagraphql/prisma:latest
    container_name: "prisma"
    restart: always
    ports:
      - "0.0.0.0:${PORT}:${PORT}"
    environment:
      PORT: $PORT
      SCHEMA_MANAGER_SECRET: $SCHEMA_MANAGER_SECRET
      SCHEMA_MANAGER_ENDPOINT: ${HOST}:${PORT}/cluster/schema
      CLUSTER_ADDRESS: ${HOST}:${PORT}
      # CLUSTER_PUBLIC_KEY: "${CLUSTER_PUBLIC_KEY}"
      CLUSTER_PUBLIC_KEY: "-----BEGIN PUBLIC KEY-----\r\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApSFz7re5QU6ee1hb7aif\r\neg4hOQ/DuqpEGbKaOvLWBUGr//ZMdrZOP3gIYFkLXO1YhNDy6icwk2qZPUFoUqCJ\r\nu89f/fpZ8NIsuviRoaem6B8zl+2tMwgCutvNfT4bwAO6sH3u2Ms/qnLhlEok4i+h\r\n0RBlm94BqvbIZwEEpzRS6lb1pTkh9/OHo3H7powwGSm6FWHsy+7VOTTLFTzutWH/\r\ne6xb2frsyo6rS4hZ6xkoubgUL7hTjEMLpLGuHA0Byv0iLASxjZ/i+NvY0SiqNyCu\r\nmyGLy3hk/wQroJaSgbkOX50OvObaGJjLUj3gHt+1dBJ1g0ebdHuw8OgyyI+Vgv/A\r\n4QIDAQAB\r\n-----END PUBLIC KEY-----\r\n"
      SQL_CLIENT_HOST_CLIENT1: $DB_HOST
      SQL_CLIENT_HOST_READONLY_CLIENT1: $DB_HOST
      SQL_CLIENT_HOST: $DB_HOST
      SQL_CLIENT_PORT: $DB_PORT
      SQL_CLIENT_USER: $DB_USERNAME
      SQL_CLIENT_PASSWORD: $DB_PWD
      SQL_CLIENT_CONNECTION_LIMIT: $SQL_CLIENT_CONNECTION_LIMIT
      SQL_INTERNAL_HOST: $DB_HOST
      SQL_INTERNAL_PORT: $DB_PORT
      SQL_INTERNAL_USER: $DB_USERNAME
      SQL_INTERNAL_PASSWORD: $DB_PWD
      SQL_INTERNAL_DATABASE: $INTERNAL_GRAPHCOOL_DB_NAME
      SQL_INTERNAL_CONNECTION_LIMIT: $SQL_INTERNAL_CONNECTION_LIMIT
      BUGSNAG_API_KEY: ""
      ENABLE_METRICS: "0"
      JAVA_OPTS: "-Xmx1G"
index.js of my node.js system (with everything unnecessary removed)
Copy code
const { GraphQLServer } = require('graphql-yoga')
const { Prisma } = require('prisma-binding')

const resolvers = {}

const server = new GraphQLServer({
  typeDefs: './src/schema.graphql',
  resolvers,
  context: req => ({
    ...req,
    db: new Prisma({
      typeDefs: 'src/generated/prisma.graphql',
      endpoint: '<http://localhost:4466/test-prisma/dev>',
      secret: '776adc6b61ad8aaa84c79e474231849f32efbf20',
      debug: false,
    }),
  }),
})

server.start()
database/prisma.yml inside the node.js project
Copy code
# the name for the service (will be part of the service's HTTP endpoint)
service: test-prisma

# the cluster and stage the service is deployed to
stage: dev

# to disable authentication:
# disableAuth: true
secret: 776adc6b61ad8aaa84c79e474231849f32efbf20

# the file path pointing to your data model
datamodel: datamodel.graphql

cluster: local
And I access the graphql server on localhost:4000 at my frontend application. That is all.
After actually changing the port in ~/,prisma to 4467 I get now the following error:
Copy code
"code": 3016,
  "requestId": "api:api:cjg2sryqx000i01226jywsn95",
  "error": "Project not found: 'test-prisma@dev'",
  "status": 200
Okay, now I deleted the local cluster variable in ~/.prisma and removed all docker containers entirely. My cluster 'livetest' was set to port 4466. After a new deploy, my cluster should run on 4466, which it does, but besides my livetest cluster the local cluster was started again aswell. The 'local' variable was also reset in the ~/.prisma config, but points now at port 4467. My prisma service was correctly deployed according to the output:
Copy code
Deploying service `test-prisma` to stage `dev` on cluster `livetest` 1.2s
But the endpoints are strangely served at port 4467 (local). Why is that so? They should be on port 4466 or am I wrong? Either way, I still get the error with code 3016 (Project not found). These are the currently running containers on my system:
Copy code
9494e5a87690        prismagraphql/prisma:1.6      "/bin/sh -c /app/sta…"   18 minutes ago      Up 18 minutes       0.0.0.0:4467->4467/tcp   local_prisma-database_1
fc9e733de382        mysql:5.7                     "docker-entrypoint.s…"   18 minutes ago      Up 18 minutes       0.0.0.0:3307->3306/tcp   prisma-db
99fd49058ee5        prismagraphql/prisma:latest   "/app/bin/single-ser…"   20 minutes ago      Up 19 minutes       0.0.0.0:4466->4466/tcp   prisma
@nilan Do you maybe have an idea, what could cause this behaviour? Any insight would be much appreciated, as I am out of options right now and don't know what else to do. 🙂
m
@pasa doesn’t your
.env
file set the PORT?
PORT=4467
p
@max Which one? For the docker container (cluster) or the prisma folder?
m
your prisma docker .env file
the first one you posted in this thread
p
Yes, but as i said, I changed it to 4466 (in the config at ~/.prisma too). I did this, because I thought I could prevent the deployment process from setting up another db for local and instead use my remotely installed instance instead like this.
n
Please don't highlight me 🙂 Also, a good rule of thumb is that when you need to share a code snippet etc, the Forum is the better place to discuss your question.