prisma / prisma1

💾 Database Tools incl. ORM, Migrations and Admin UI (Postgres, MySQL & MongoDB) [deprecated]
https://v1.prisma.io/docs/
Apache License 2.0
16.54k stars 862 forks source link

Local development using CLI and docker not working as docs describe #1856

Closed peterschussheim closed 6 years ago

peterschussheim commented 6 years ago

Summary

Existing local prisma service (docker) and newly-created local prisma services do not work.

Steps to reproduce

1) Following along with Typescript example, running prisma init <PROJECT_NAME>, produces errors (shown below) starting with prisma deploy command.

prisma init ts-example                                                                ✔

? How to set up a new Prisma service?

Running $ graphql create ...
? Choose GraphQL boilerplate project: typescript-advanced     GraphQL server (incl. database & authentication)
[graphql create] Downloading boilerplate from https://github.com/graphql-boilerplates/typescript-graphql-server/archive/master.zip...
[graphql create] Installing node dependencies for /Users/peter/Sources/Repos/prisma-learning/ts-example/package.json...
yarn install v1.3.2
warning package.json: No license field
warning graphql-boilerplate: No license field
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning "graphql-yoga > graphql-playground-middleware-lambda@1.4.0" has unmet peer dependency "aws-lambda@^0.1.2".
warning "graphql-cli > graphql-playground-middleware-express@1.5.4" has unmet peer dependency "express@^4.16.2".
warning "prisma > prisma-cli-core > graphql-cli > graphql-playground-middleware-express@1.5.2" has unmet peer dependency "express@^4.16.2".
[4/4] 📃  Building fresh packages...
✨  Done in 38.34s.
[graphql create] Installing node dependencies for /Users/peter/Sources/Repos/prisma-learning/ts-example/.install/package.json...
yarn install v1.3.2
warning package.json: No license field
warning ../package.json: No license field
warning install@0.0.0: No license field
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning " > graphql-boilerplate-install@0.1.8" has unmet peer dependency "prisma@1.0.4".
[4/4] 📃  Building fresh packages...
✨  Done in 0.84s.
[graphql create] Running boilerplate install script...
Running $ prisma deploy...

? Please choose the cluster you want to deploy "ts-example@dev" to
Added cluster: local to prisma.yml
Creating stage dev for service ts-example !
 ▸    Could not connect to cluster local. Please use prisma local start to start your local
 ▸    Prisma cluster.

Get in touch if you need help: https://www.graph.cool/forum
To get more detailed output, run $ export DEBUG="*"

Next steps:
  1. Change directory: `cd ts-example`
  2. Start local server and open Playground: `yarn dev`

2) As instructed by the CLI, prisma local start should start my local cluster. This throws more errors:

prisma local start                                                                ✔
Booting local development cluster !
 ▸    Pulling prisma-database (prismagraphql/prisma:1.1)...
 ▸    1.1: Pulling from prismagraphql/prisma
 ▸    Digest: sha256:f63b77d346c90f49f62d2639e16409c8b5cf09ec0768d7b2539a7e4a89042537
 ▸    Status: Downloaded newer image for prismagraphql/prisma:1.1
Creating prisma-db ... error
 ▸    Creating local_prisma-database_1 ...
 ▸
 ▸    ERROR: for prisma-db  Cannot create container for service prisma-db: Conflict. The container name "/prisma-db" is
Creating local_prisma-database_1 ... error
 ▸    (or rename) that container to be able to reuse that name.
 ▸
 ▸    ERROR: for local_prisma-database_1  Cannot create container for service prisma-database: Conflict. The container
 ▸    name "/local_prisma-database_1" is already in use by container
 ▸    "6f92db8cbab3ea62125e742974b2e85529d9eab29f09bb8b63bf1ae1ae03e608". You have to remove (or rename) that container
 ▸    to be able to reuse that name.
 ▸
 ▸    ERROR: for prisma-database  Cannot create container for service prisma-database: Conflict. The container name
 ▸    "/local_prisma-database_1" is already in use by container
 ▸    "6f92db8cbab3ea62125e742974b2e85529d9eab29f09bb8b63bf1ae1ae03e608". You have to remove (or rename) that container
 ▸    to be able to reuse that name.
 ▸
 ▸    ERROR: for prisma-db  Cannot create container for service prisma-db: Conflict. The container name "/prisma-db" is
 ▸    already in use by container "d32ea9738a4222b21201c0afcfdd483022231d0da69c75684c89a83caadd4610". You have to remove
 ▸    (or rename) that container to be able to reuse that name.
 ▸    Encountered errors while bringing up the project.
 ▸

Get in touch if you need help: https://www.graph.cool/forum
To get more detailed output, run $ export DEBUG="*"

Potentially related issues

peterschussheim commented 6 years ago

I think we should close this issue. I did some googling and noticed that the behavior I reported above was due to problems with the edge release of docker for mac. See this issue on moby tracker.

marktani commented 6 years ago

I came across this problem before and your findings seem to align with my experience. Thanks for digging into this @peterschussheim!

If anyone else is hitting these problems and is not running on the edge release, please create a new issue 🙂