I try to connect to Prisma server (a docker contai...
# orm-help
b
I try to connect to Prisma server (a docker container) from a nodejs server app container. I run
prisma deploy -e .env.prod
but an error show up:
Copy code
▸    prisma:4000/my-app/prod is not a valid endpoint. It must start with http:// or https://
`prisma.yml`'s content:
Copy code
endpoint: ${env:PRISMA_END_POINT}
datamodel:
  - common.graphql
generate:
  - generator: typescript-client
    output: ../src/generated/prisma-client/
hooks:
  post-deploy:
    - prisma generate --endpoint ${env:PRISMA_END_POINT}
    - npx nexus-prisma-generate --client ./src/generated/prisma-client --output ./src/generated/nexus-prisma
`.env.prod`'s content:
Copy code
PRISMA_END_POINT=prisma/my-app/prod
prisma
is the name of a service in
docker-compose.yml
So does it mean I should create a network for my services, then assign static ip for each service? Something like that:
Copy code
version: "3"
services:
  my-app:
    restart: always
    build: ./m-app/
    networks:
      - my-net
  prisma:
    image: prismagraphql/prisma:1.32.2
    restart: always
    networks:
      my-net:
        ipv4_address: 192.168.0.2
networks:
  my-net:
    driver: bridge
    config:
      - subnet: "192.168.0.0/24"
r
They should just need to be on the same network - unless there’s a very specific reason for doing so, you don’t need to specify the subnets. Then to make your app ports available, make sure you’re setting the ports directive on each Docker service i.e. ports: - “portVisibleAs:portInContainer”
k
I think you also need to add http:// to the beginning of your PRISMA_END_POINT variable. And as the above comment said, you need to make sure both of your containers are in the same docker network if you want to use the docker name. An alternative would be to expose a port and access the prisma server via http://localhost:port