0

I'm trying to host DataJoint LabBook on our lab's server so our team can interact with our database. I'm afraid I don't know much about web development (I'm a datascientist) so am not finding it easy. I would like to host an instance of LabBook on the same server that the MySQL database is hosted on.

Currently I have the DataJoint/MySQL database running in the official Docker container on our server, and have a pipeline working on my local machine which interacts with the database via the DataJoint python package. This works great. I've deployed the DataJoint LabBook containers via the docker-compose-deploy.yaml on the same server, and can see the login screen in my browser from my local machine. However, when I try to login with the same credentials in my dj_local_conf.json which works for interacting via python, I just get (2003, "Can't connect to MySQL server on 'server_url' (timed out)"). I can't figure out why I'm getting this error, so I'm wondering if someone can help me. I'm not even sure if deploying the MySQL database and DataJoint LabBook on the same server like this is the intended deployment method? For the database address I'm entering our server url with the port that the MySQL database runs through. Thanks in advance for any help!

rbedford
  • 5
  • 2

1 Answers1

0

For example, you ran your mysql DB using docker-compose (not fully showing here):

services:
  db:
    image: datajoint/mysql:8.0
    # other stuff

and your labbook docker-compose(not fully showing here):

# this part is called yaml anchor
x-net: &net
  networks:
    - main

services:
  pharus:
    <<: *net # this inserts yaml anchor, which is the network setting
    # pharus stuff
  fakeservices.datajoint.io:
    <<: *net # same here
    # nginx stuff, including labbook

# this part creates the network
network:
  main:

So, in order to let containers to comminicate, they have to be in the same network. In this case, db is on a default network, pharus and nginx are on the created main network. It'd be easier for you to merge these two compose files in to one, and use the yaml anchor in the db container as well to put all three container under main network.

Also, the db container is accessed in a different way, since it's exposed at 3306 port on the server and assume the server's private IP 192.168.1.123 and public IP 3.165.9.456, you can connect the db on your laptop using these 2 IPs depending on your laptop's internet connection. But if you access if from fakeservices.datajoint.io labbook nginx, you are actually comminicating from the container to the db container, so you need to use the container service name db:3306 instead of any IPs. If you change your mysql container service name from db to your-db you need to use your-db:3306 instead.

At the end, if you don't add fakeervices.datajoint.io 127.0.0.1 to your server's /etc/host , it won't break anything. It'll just show cert not valid like this:

error page

Drew Yang
  • 76
  • 3