Error of communication with Cytomine core [Part2]

@geektortoise
New image.sc users are temporarily limited to 3 replies in the same topic.
So created this topic.

This is my browser consoles. I can not see 400,404 or 500 code.

Hello,

I wasn’t aware of this limit, so I will try to be exhaustive.

What we know :

  • All the containers are up;
  • No error in the logs of core container (except indexMissingRetrieval);
  • The API of core is on as you get a valid JSON from the localhost-core/server/ping.json URL
  • When you try to access the localhost-core, you got the gray screen with the error message and your browser failed to establish an HTTP connection with localhost-core/server/ping.json

The ERR_NAME_NOT_RESOLVED Google Chrome error indicates that Chrome doesn’t know what is “localhost-core”. However, you’re currently fetching the front-end from this URL … :confused:

Questions :

  • Do you have the
    127.0.0.1 localhost-core
    line into your /etc/hosts files (I assume than you are on a Linux OS) ?
  • What is your OS/distribution ?
  • Did you install Cytomine on your laptop (more exactly the same PC that is running your browser) ? Or is it installed on another computer that the one you are using ?
  • Can you get localhost-core/server/ping.json from a curl command in a terminal (
    curl -v localhost-core
    ,
    curl -v localhost-core/server/ping.json
    and
    curl -vX POST http://localhost-core/server/ping.json
    ) as well as in your browser ?
  • Can you send me the following file :
    – configs/core/cytomineconfig.groovy
    – configs/nginx/nginx.conf
    – configs/nginx/dist/configuration.json

You can send them to me by MP (remove the sensible information as private password) and, if it is relevant, I will share on this forum only the relevant line

Have a nice day

Do you have the
127.0.0.1 localhost-core
line into your /etc/hosts files (I assume than you are on a Linux OS) ?

Yes

root@tcs1:~# cat /etc/hosts
127.0.0.1	localhost.localdomain	localhost
::1		localhost6.localdomain6	localhost6
127.0.1.1 tcs1

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

127.0.0.1   localhost-core
127.0.0.1   localhost-ims
127.0.0.1   localhost-ims2
127.0.0.1   localhost-upload
127.0.0.1   rabbitmq

What is your OS/distribution ?

Linux/Ubuntu18.04

root@tcs1:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.4 LTS
Release:	18.04
Codename:	bionic

Did you install Cytomine on your laptop (more exactly the same PC that is running your browser) ? Or is it installed on another computer that the one you are using ?

Another computer (server) and this server’s hostname is tcs1

Can you get localhost-core/server/ping.json from a curl command in a terminal (
curl -v localhost-core
,
curl -v localhost-core/server/ping.json
and
curl -vX POST http://localhost-core/server/ping.json
) as well as in your browser ?

I think that (in my case) I need to replace localhost-core to tcs1.
And the result is

~ curl -v tcs1
*   Trying 10.5.1.200...
* TCP_NODELAY set
* Connected to tcs1 (10.5.1.200) port 80 (#0)
> GET / HTTP/1.1
> Host: tcs1
> User-Agent: curl/7.64.1
> Accept: */*
> 
< HTTP/1.1 200 OK
< Server: nginx/1.10.1
< Date: Thu, 27 Feb 2020 06:29:48 GMT
< Content-Type: text/html
< Content-Length: 856
< Last-Modified: Tue, 12 Nov 2019 16:11:29 GMT
< Connection: keep-alive
< ETag: "5dcad9b1-358"
< Accept-Ranges: bytes
< 
* Connection #0 to host tcs1 left intact
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href="/favicon.ico?v=2"><title>Cytomine</title><link href=/css/app.d95aa9a0.css rel=preload as=style><link href=/css/chunk-vendors.69a279aa.css rel=preload as=style><link href=/js/app.157744bd.js rel=preload as=script><link href=/js/chunk-vendors.052d898b.js rel=preload as=script><link href=/css/chunk-vendors.69a279aa.css rel=stylesheet><link href=/css/app.d95aa9a0.css rel=stylesheet></head><body><noscript><strong>We're sorry but this Cytomine Web-UI doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/js/chunk-vendors.052d898b.js></script><script src=/js/app.157744bd.js></script></body></html>* Closing connection 0
~ 
~ curl -v tcs1/server/ping.json
*   Trying 10.5.1.200...
* TCP_NODELAY set
* Connected to tcs1 (10.5.1.200) port 80 (#0)
> GET /server/ping.json HTTP/1.1
> Host: tcs1
> User-Agent: curl/7.64.1
> Accept: */*
> 
< HTTP/1.1 200 OK
< Server: nginx/1.10.1
< Date: Thu, 27 Feb 2020 06:33:21 GMT
< Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< 
* Connection #0 to host tcs1 left intact
{"alive":true,"authenticated":false,"version":"2.0.0","serverURL":"http://localhost-core","serverID":"8a1f3593-a640-41d1-a903-e499ee4fefe5"}* Closing connection 0
~ 

~ curl -vX POST http://tcs1/server/ping.json
*   Trying 10.5.1.200...
* TCP_NODELAY set
* Connected to tcs1 (10.5.1.200) port 80 (#0)
> POST /server/ping.json HTTP/1.1
> Host: tcs1
> User-Agent: curl/7.64.1
> Accept: */*
> 
< HTTP/1.1 200 OK
< Server: nginx/1.10.1
< Date: Thu, 27 Feb 2020 06:34:09 GMT
< Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< 
* Connection #0 to host tcs1 left intact
{"alive":true,"authenticated":false,"version":"2.0.0","serverURL":"http://localhost-core","serverID":"8a1f3593-a640-41d1-a903-e499ee4fefe5"}* Closing connection 0
~ 
root@tcs1:~/Cytomine_bootstrap# cat configs/core/cytomineconfig.groovy
dataSource.url='jdbc:postgresql://postgresql:5432/docker'
dataSource.username='docker'
dataSource.password='docker'

cytomine.customUI.global = [
        dashboard: ["ALL"],
        search : ["ROLE_ADMIN"],
        project: ["ALL"],
        ontology: ["ROLE_ADMIN"],
        storage : ["ROLE_USER","ROLE_ADMIN"],
        activity : ["ALL"],
        feedback : ["ROLE_USER","ROLE_ADMIN"],
        explore : ["ROLE_USER","ROLE_ADMIN"],
        admin : ["ROLE_ADMIN"],
        help : ["ALL"]
]


grails.serverURL='http://localhost-core'
grails.imageServerURL=['http://localhost-ims','http://localhost-ims2']
grails.uploadURL='http://localhost-upload'

storage_buffer='/data/images/_buffer'
storage_path='/data/images'

grails.adminPassword=
grails.adminPrivateKey=
grails.adminPublicKey=
grails.superAdminPrivateKey=
grails.superAdminPublicKey=
grails.ImageServerPrivateKey=
grails.ImageServerPublicKey=
grails.rabbitMQPrivateKey=
grails.rabbitMQPublicKey=

grails.notification.email='your.email@gmail.com'
grails.notification.password='passwd'
grails.notification.smtp.host='smtp.gmail.com'
grails.notification.smtp.port='587'
grails.admin.email='info@cytomine.coop'

grails.mongo.host = 'mongodb'
grails.mongo.options.connectionsPerHost=10
grails.mongo.options.threadsAllowedToBlockForConnectionMultiplier=5

grails.messageBrokerServerURL='rabbitmq:5672'

grails.serverID=

I don’t know why I can not send the

cat configs/core/cytomineconfig.groovy

result…

Hello,

we got the explaination ! :slight_smile:

The documentation has a branching at the step 2

  • If you want to deploy on a local host
    and
  • If you want to make your Cytomine instance accessible from anywhere

For our conception of “local” host, we mean “your computer” has the localhost denomination is related to the notion of “current computer” (as the IP 127.0.0.1).
The lines

127.0.0.1   localhost-core
127.0.0.1   localhost-ims
...

in the hosts file of a computer indicates at this computer that the localhost-core, localhost-ims “URL” are in fact the computer itself.
As Cytomine is composed of multiple services reachable through URLs, we do this operation to allow the proxy to dispatch the HTTP requests at the good component (if the proxy get a request to 127.0.0.1, it doesn’t know where to redirect it, if it is a request to localhost-ims, it knows the request is for the IMS component).

As the tcs1 is not your current computer, you are in the second situation. Is it possible for you to define the needed URLs, get DNS entries and make them associated to your tcs1 ?

You mean
"I need to replace

127.0.0.1   localhost-core
127.0.0.1   localhost-ims
...

to

127.0.0.1   tcs1-core
127.0.0.1   tcs1-ims
...

"?

Do I need to change any files other than /etc/hosts?
Do I need to restart any services after changing /etc/hosts?
(If my understanding is correct.)

Dear @kozo2,
No, you don’t get the point.
127.0.0.1 is an IP reserved for localhosts. This mean that IP 127.0.0.1 is restricted to services running on the same computer. Each computer can call internal services throw this IP, not services running on other computers. So asking your computer to call an other one on IP 127.0.0.1 have no sense.

You seem to have 2 computers. One is your workstation, and an other one is hosting Cytomine.
Let’s call your workstation the “Client” and the cytomine hosting computer the “Server”. If you want to be able to browse Cytomine which is running on the Server from the Client, you need to set a DNS (Domain Name Server) to allow 4 URLs to your Server (so associate theses 4 URLs to the IP of this Server on your network).
Why 4 URL ? Because one will be the main one (the web ui), 2 others will be for the image managing system (IMS) of Cytomine, and the last one to upload images. These 4 URLs must be declared in the configuration.sh at first step of installation.

Configuring the /etc/hosts file of your Client computer with 127.0.0.1 IP is only necessary if Cytomine is running inside this computer. By doing this you say to your computer “do not search this URL (localhost-core in our exemple) on the network (intranet or internet) but consider it’s an internal URL”. It’s only usefull if your computer is both the Client and the Server.

If your server is not the one on which you want to browse Cytomine, and your Server is inside your intranet, you must ask your network administrator to set a DNS and give you 4 custom URLs, for example tcs1.cytomine.local for URL#1, tcs1-ims1.cytomine.local for URL#2, tcs1-ims2.cytomine.local for URL#3, and tcs1-upload.cytomine.local for URL #4.

If your Server is somewhere in the internet, you must set 4 URL on your prefered domain Name Provider, and associate them to your Server public IP.

I hope that all these explanaitions helped you to better understand that your problem is not a Cytomine problem, but a network and DNS problem.

Regards,

Grégoire

1 Like

Thank you for the information.
I will consider changing the settings based on the information.
I have checked your reply as solution.

@kozo2 : you’re welcome.
Please let us know if you succeed to set it up.
Have a nice day,
Grégoire