Hi all, I wanna ask related to docker. I'd like to...
# orm-help
a
Hi all, I wanna ask related to docker. I'd like to setup on my local computer which already has mysql that runs on vagrant. Is it possible for prisma that runs on docker to connect to the mysql?
h
you can use
host.docker.internal
to refer you host machine in docker
I havent used vagrant so I don't know it maps your mysql to localhost or some other ip
ok did some digging you can map the port of your Vagrant box to your host port using
config.vm.network "forwarded_port", guest: 3306, host: 3306
then you can use
host.docker.internal
in docker-compose.yml file as host for you database and port as
3366
a
for the vagrant, it's already done, my computer connect with the IP and port to the vm. I guess I need to learn that
host.docker.internal
first then 🙂 Thanks!
h
Remember though this will only work in windows and mac
NOT linux
a
editing the compose, run the docker and seeing no error on the docker logs. Try to run the
<http://localhost:4466>
, the IDE is there but it never finish the loading whenever I open the schema or docs.
h
Can you share a screenshot?
a
for the /management it's working
Copy code
version: '3'
services:
  prisma:
    image: prismagraphql/prisma:1.23
    restart: always
    ports:
    - "4466:4466"
    environment:
      PRISMA_CONFIG: |
        port: 4466
        databases:
          mydbname:
            connector: mysql
            host: host.docker.internal
            port: 3306
            user: myuser
            password: mypassword
            migrations: true
#   mysql:
#     image: mysql:5.7
#     restart: always
#     ports: 
#     - "3306:3306"
#     environment:
#       MYSQL_ROOT_PASSWORD: prisma
#     volumes:
#       - mysql:/var/lib/mysql
# volumes:
#   mysql:
and this is my docker-compose
h
have you deployed a prisma service yet? otherwise it will not work. Try to
prisma deploy
a service first
a
already done, and it's working. But I guess it didn't connect to the
mydbname
. Instead it build its own database with name
default@default
🙌 1
h
yes 🙂 , we use that naming scheme as to track various services
a
is it not possible to connect to my existing mysql db?
h
You can use introspection for that but, you will lose out migrations and other awesome feature. Do this only if you have existing data in your database
a
I have existing data. Find out that introspection still not supported for mysql, isn't it?
h
a
haha, oke then. Hope the issue can be solved soon 🙂