Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

requests.exceptions.HTTPError: 401 Client Error #51

Open
alirizaaribas-ibg opened this issue Apr 14, 2022 · 14 comments
Open

requests.exceptions.HTTPError: 401 Client Error #51

alirizaaribas-ibg opened this issue Apr 14, 2022 · 14 comments
Assignees

Comments

@alirizaaribas-ibg
Copy link

Hello, I installed PORI docker stack for local machine. When I tried to upload a demo report, I got the error below. I noticed that even I provided a URL, ipr didn't use it and uses https://graphkb-api.bcgsc.ca/api/token not local address. OS is centos 7, RAM 8GB, disk 20gb space, browser firefox 91.7, docker v20. How can I solve this problem?

(ipr_stable) [aliriza@localhost Desktop]$ ipr -c demo_report.json --ipr_url http://127.0.0.1:8081/api --username iprdemo --password iprdemo
Traceback (most recent call last):
  File "/home/aliriza/miniconda3/envs/ipr_stable/bin/ipr", line 8, in <module>
    sys.exit(command_interface())
  File "/home/aliriza/miniconda3/envs/ipr_stable/lib/python3.8/site-packages/ipr/main.py", line 87, in command_interface
    create_report(
  File "/home/aliriza/miniconda3/envs/ipr_stable/lib/python3.8/site-packages/ipr/main.py", line 185, in create_report
    graphkb_conn.login(username, password)
  File "/home/aliriza/miniconda3/envs/ipr_stable/lib/python3.8/site-packages/graphkb/__init__.py", line 137, in login
    resp.raise_for_status()
  File "/home/aliriza/miniconda3/envs/ipr_stable/lib/python3.8/site-packages/requests/models.py", line 960, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://graphkb-api.bcgsc.ca/api/token

docker images are working fine:
image

Thanks.

@brayden-bcgsc
Copy link

brayden-bcgsc commented Apr 19, 2022

@alirizaaribas-ibg
You can set the graphKB URL for the IPR API to use by setting the 'IPR_GRAPHKB_URI' environment variable when starting the IPR API. So, something like this:

IPR_GRAPHKB_URI: https://graphkb-instance.ca/api

Here it is in the PORI docker-compose file:
https://github.com/bcgsc/pori/blob/master/docker-compose.prod.yml#L111

@alirizaaribas-ibg
Copy link
Author

@brayden-bcgsc
I modified docker-compose.dev.yml and now have another problem. Docker container log says:
my config file
custom_docker.txt

2022-04-20T11:51:37.542808799Z > ipr-api@7.4.0 start

2022-04-20T11:51:37.542829276Z > node --max-old-space-size=2800 bin/server.js

2022-04-20T11:51:37.542847573Z 

2022-04-20T11:51:38.277572368Z [2022-04-20 11:51:38][INFO] Initializing logging 

2022-04-20T11:51:38.278439946Z [2022-04-20 11:51:38][DEBUG] Log level set to debug 

2022-04-20T11:51:38.279689722Z [2022-04-20 11:51:38][INFO] setting connection to database ipr_demo(ipr_db):5432 as ipr_ro 

2022-04-20T11:51:41.534404978Z Illegal instruction (core dumped)

IPR_API is always restarting. I think ipr cannot connect to.

the command:
ipr --username graphkb_admin --password secret -c /root/pori/demo_report.json --ipr_url 'http://10.100.120.219:8080/api' --graphkb_url 'http://10.100.120.219:2424'

output:

04-20-22 15:01:03 ipr INFO connecting to graphkb: http://10.100.120.219:2424
Traceback (most recent call last):
  File "/root/miniconda3/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/root/miniconda3/lib/python3.9/site-packages/urllib3/connectionpool.py", line 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/root/miniconda3/lib/python3.9/site-packages/urllib3/connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "/root/miniconda3/lib/python3.9/http/client.py", line 1371, in getresponse
    response.begin()
  File "/root/miniconda3/lib/python3.9/http/client.py", line 319, in begin
    version, status, reason = self._read_status()
  File "/root/miniconda3/lib/python3.9/http/client.py", line 301, in _read_status
    raise BadStatusLine(line)
http.client.BadStatusLine: %

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/miniconda3/lib/python3.9/site-packages/requests/adapters.py", line 440, in send
    resp = conn.urlopen(
  File "/root/miniconda3/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/root/miniconda3/lib/python3.9/site-packages/urllib3/util/retry.py", line 532, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/root/miniconda3/lib/python3.9/site-packages/urllib3/packages/six.py", line 769, in reraise
    raise value.with_traceback(tb)
  File "/root/miniconda3/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/root/miniconda3/lib/python3.9/site-packages/urllib3/connectionpool.py", line 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/root/miniconda3/lib/python3.9/site-packages/urllib3/connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "/root/miniconda3/lib/python3.9/http/client.py", line 1371, in getresponse
    response.begin()
  File "/root/miniconda3/lib/python3.9/http/client.py", line 319, in begin
    version, status, reason = self._read_status()
  File "/root/miniconda3/lib/python3.9/http/client.py", line 301, in _read_status
    raise BadStatusLine(line)
urllib3.exceptions.ProtocolError: ('Connection aborted.', BadStatusLine('\x00%'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/miniconda3/bin/ipr", line 8, in <module>
    sys.exit(command_interface())
  File "/root/miniconda3/lib/python3.9/site-packages/ipr/main.py", line 87, in command_interface
    create_report(
  File "/root/miniconda3/lib/python3.9/site-packages/ipr/main.py", line 185, in create_report
    graphkb_conn.login(username, password)
  File "/root/miniconda3/lib/python3.9/site-packages/graphkb/__init__.py", line 131, in login
    resp = requests.request(
  File "/root/miniconda3/lib/python3.9/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/root/miniconda3/lib/python3.9/site-packages/requests/sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "/root/miniconda3/lib/python3.9/site-packages/requests/sessions.py", line 645, in send
    r = adapter.send(request, **kwargs)
  File "/root/miniconda3/lib/python3.9/site-packages/requests/adapters.py", line 501, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine('\x00%'))

@alirizaaribas-ibg
Copy link
Author

I want to clarify the big picture. Are the ports correct?:
image

@alirizaaribas-ibg
Copy link
Author

When I changed the order of parameters, ipr is working. I tried many combination, finally the command is fixed.
ipr --username graphkb_admin --password secret -c demo_report.json --graphkb_url http://10.100.120.219:8080/api --ipr_url http://10.100.120.219:8081/api

@creisle creisle self-assigned this Apr 25, 2022
@creisle creisle transferred this issue from bcgsc/pori_ipr_api Apr 25, 2022
@creisle
Copy link
Member

creisle commented Apr 25, 2022

I transferred this issue to the main PORI repo since it involves the docker compose setup/install

@alirizaaribas-ibg
Copy link
Author

ipr report upload gives the error. The command is ipr --username graphkb_admin --password secret -c demo_report.json --graphkb_url http://10.100.120.213:8080/api --ipr_url http://10.100.120.213:8081/api

Error:

04-26-22 06:57:51 ipr INFO connecting to graphkb: http://10.100.120.213:8080/api
04-26-22 06:57:51 ipr INFO annotating small mutations
04-26-22 06:57:51 ipr INFO matched 0 positional variants to 0 graphkb annotations
04-26-22 06:57:51 ipr INFO annotating structural variants
04-26-22 06:57:51 ipr INFO matched 0 positional variants to 0 graphkb annotations
04-26-22 06:57:51 ipr INFO annotating copy variants
04-26-22 06:57:51 ipr INFO Starting annotation of 0 category_variants
04-26-22 06:57:51 ipr INFO matched 0 category variants to 0 graphkb annotations
04-26-22 06:57:51 ipr INFO annotating expression variants
04-26-22 06:57:51 ipr INFO Starting annotation of 0 category_variants
04-26-22 06:57:51 ipr INFO matched 0 category variants to 0 graphkb annotations
04-26-22 06:57:51 ipr INFO fetching gene annotations
04-26-22 06:57:51 ipr INFO fetching variant related genes list
04-26-22 06:57:52 ipr INFO fetching oncogenes list
04-26-22 06:57:52 ipr INFO fetching tumour supressors list
04-26-22 06:57:52 ipr INFO fetching therapeutic associated genes lists
04-26-22 06:57:52 ipr INFO generating analyst comments
04-26-22 06:57:53 ipr INFO Uploading to IPR http://10.100.120.213:8081/api
04-26-22 06:57:53 ipr ERROR ipr_conn.upload_report failed: HTTPConnectionPool(host='10.100.120.213', port=8081): Max retries exceeded with url: /api/reports (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7efe1161dff0>: Failed to establish a new connection: [Errno 111] Connection refused'))
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 169, in _new_conn
    conn = connection.create_connection(
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 96, in create_connection
    raise err
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 86, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 394, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 234, in request
    super(HTTPConnection, self).request(method, url, body=body, headers=headers)
  File "/usr/lib/python3.10/http/client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.10/http/client.py", line 1328, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.10/http/client.py", line 1277, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.10/http/client.py", line 1037, in _send_output
    self.send(msg)
  File "/usr/lib/python3.10/http/client.py", line 975, in send
    self.connect()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 200, in connect
    conn = self._new_conn()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 181, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7efe1161dff0>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 574, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='10.100.120.213', port=8081): Max retries exceeded with url: /api/reports (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7efe1161dff0>: Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/ipr/main.py", line 291, in create_report
    ipr_result = ipr_conn.upload_report(output)
  File "/usr/local/lib/python3.10/dist-packages/ipr/connection.py", line 66, in upload_report
    return self.post('reports', content)
  File "/usr/local/lib/python3.10/dist-packages/ipr/connection.py", line 58, in post
    return self.request(
  File "/usr/local/lib/python3.10/dist-packages/ipr/connection.py", line 40, in request
    resp = requests.request(
  File "/usr/lib/python3/dist-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='10.100.120.213', port=8081): Max retries exceeded with url: /api/reports (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7efe1161dff0>: Failed to establish a new connection: [Errno 111] Connection refused'))
04-26-22 06:57:53 ipr INFO made 13 requests to graphkb
04-26-22 06:57:53 ipr INFO average load 9 req/s
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 169, in _new_conn
    conn = connection.create_connection(
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 96, in create_connection
    raise err
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 86, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 394, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 234, in request
    super(HTTPConnection, self).request(method, url, body=body, headers=headers)
  File "/usr/lib/python3.10/http/client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.10/http/client.py", line 1328, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.10/http/client.py", line 1277, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.10/http/client.py", line 1037, in _send_output
    self.send(msg)
  File "/usr/lib/python3.10/http/client.py", line 975, in send
    self.connect()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 200, in connect
    conn = self._new_conn()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 181, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7efe1161dff0>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 574, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='10.100.120.213', port=8081): Max retries exceeded with url: /api/reports (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7efe1161dff0>: Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/ipr", line 8, in <module>
    sys.exit(command_interface())
  File "/usr/local/lib/python3.10/dist-packages/ipr/main.py", line 87, in command_interface
    create_report(
  File "/usr/local/lib/python3.10/dist-packages/ipr/main.py", line 305, in create_report
    raise upload_error
  File "/usr/local/lib/python3.10/dist-packages/ipr/main.py", line 291, in create_report
    ipr_result = ipr_conn.upload_report(output)
  File "/usr/local/lib/python3.10/dist-packages/ipr/connection.py", line 66, in upload_report
    return self.post('reports', content)
  File "/usr/local/lib/python3.10/dist-packages/ipr/connection.py", line 58, in post
    return self.request(
  File "/usr/local/lib/python3.10/dist-packages/ipr/connection.py", line 40, in request
    resp = requests.request(
  File "/usr/lib/python3/dist-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='10.100.120.213', port=8081): Max retries exceeded with url: /api/reports (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7efe1161dff0>: Failed to establish a new connection: [Errno 111] Connection refused'))

@creisle
Copy link
Member

creisle commented Apr 26, 2022

Can you confirm the IPR API docker container is running? execute docker ps and copy the result here

@alirizaaribas-ibg
Copy link
Author

Here docker ps:

user@ubuntu:~$ sudo docker ps
CONTAINER ID   IMAGE                              COMMAND                  CREATED      STATUS                           PORTS                                                                                            NAMES
ed0126f2bef9   bcgsc/pori-ipr-client:latest       "/bin/bash -c '/usr/…"   2 days ago   Up 43 hours                      0.0.0.0:3000->80/tcp, :::3000->80/tcp                                                            pori_ipr_client_1
286bd60d6181   bcgsc/pori-ipr-api:latest          "docker-entrypoint.s…"   2 days ago   Up 1 second (health: starting)   0.0.0.0:8081->8080/tcp, :::8081->8080/tcp                                                        pori_ipr_api_1
0eb2fcd6607d   bcgsc/pori-graphkb-client:latest   "/bin/bash -c '/usr/…"   2 days ago   Up 43 hours                      0.0.0.0:5000->80/tcp, :::5000->80/tcp                                                            pori_graphkb_client_1
2b0151741ab2   bcgsc/pori-graphkb-api:latest      "docker-entrypoint.s…"   2 days ago   Up 22 hours (healthy)            0.0.0.0:8080->8080/tcp, :::8080->8080/tcp                                                        pori_graphkb_api_1
3e6c5f4ec4ff   pori_keycloak                      "/opt/jboss/tools/do…"   2 days ago   Up 43 hours (healthy)            8080/tcp, 8443/tcp, 0.0.0.0:8888->8888/tcp, :::8888->8888/tcp                                    pori_keycloak_1
3ce673e1f825   orientdb:3.0                       "server.sh"              2 days ago   Up 43 hours                      0.0.0.0:2424->2424/tcp, :::2424->2424/tcp, 0.0.0.0:2480->2480/tcp, :::2480->2480/tcp             pori_graphkb_db_1
7918139ace8c   bcgsc/pori-ipr-demodb:latest       "docker-entrypoint.s…"   2 days ago   Up 43 hours (healthy)            0.0.0.0:5432->5432/tcp, :::5432->5432/tcp                                                        pori_ipr_db_1
3c4e3db0db5f   redis:6.2-alpine                   "docker-entrypoint.s…"   2 days ago   Up 43 hours (healthy)            0.0.0.0:6379->6379/tcp, :::6379->6379/tcp                                                        pori_redis_1
68670cd53912   portainer/portainer-ce             "/portainer"             2 days ago   Up 43 hours                      0.0.0.0:8000->8000/tcp, :::8000->8000/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp, 9000/tcp   portainer

after 10 minutes docker ps:

user@ubuntu:~$ sudo docker ps
CONTAINER ID   IMAGE                              COMMAND                  CREATED      STATUS                           PORTS                                                                                            NAMES
ed0126f2bef9   bcgsc/pori-ipr-client:latest       "/bin/bash -c '/usr/…"   2 days ago   Up 43 hours                      0.0.0.0:3000->80/tcp, :::3000->80/tcp                                                            pori_ipr_client_1
286bd60d6181   bcgsc/pori-ipr-api:latest          "docker-entrypoint.s…"   2 days ago   Restarting (132) 8 seconds ago                                                                                                    pori_ipr_api_1
0eb2fcd6607d   bcgsc/pori-graphkb-client:latest   "/bin/bash -c '/usr/…"   2 days ago   Up 43 hours                      0.0.0.0:5000->80/tcp, :::5000->80/tcp                                                            pori_graphkb_client_1
2b0151741ab2   bcgsc/pori-graphkb-api:latest      "docker-entrypoint.s…"   2 days ago   Up 22 hours (healthy)            0.0.0.0:8080->8080/tcp, :::8080->8080/tcp                                                        pori_graphkb_api_1
3e6c5f4ec4ff   pori_keycloak                      "/opt/jboss/tools/do…"   2 days ago   Up 43 hours (healthy)            8080/tcp, 8443/tcp, 0.0.0.0:8888->8888/tcp, :::8888->8888/tcp                                    pori_keycloak_1
3ce673e1f825   orientdb:3.0                       "server.sh"              2 days ago   Up 43 hours                      0.0.0.0:2424->2424/tcp, :::2424->2424/tcp, 0.0.0.0:2480->2480/tcp, :::2480->2480/tcp             pori_graphkb_db_1
7918139ace8c   bcgsc/pori-ipr-demodb:latest       "docker-entrypoint.s…"   2 days ago   Up 43 hours (healthy)            0.0.0.0:5432->5432/tcp, :::5432->5432/tcp                                                        pori_ipr_db_1
3c4e3db0db5f   redis:6.2-alpine                   "docker-entrypoint.s…"   2 days ago   Up 43 hours (healthy)            0.0.0.0:6379->6379/tcp, :::6379->6379/tcp                                                        pori_redis_1
68670cd53912   portainer/portainer-ce             "/portainer"             2 days ago   Up 43 hours                      0.0.0.0:8000->8000/tcp, :::8000->8000/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp, 9000/tcp   portainer

image

Also copied last 100 lines of ipr_api_logs:

2022-04-25T08:04:25.373215930Z Creating env variables script: ./ipr-env-config.js
2022-04-25T08:04:25.394371986Z KEYCLOAK_CLIENT_ID=IPR (DEFAULT)
2022-04-25T08:04:25.408131065Z KEYCLOAK_REALM=PORI (CUSTOM)
2022-04-25T08:04:25.420288700Z KEYCLOAK_URL=http://10.100.120.213:8888/auth (CUSTOM)
2022-04-25T08:04:25.433205062Z API_BASE_URL=http://10.100.120.213:8081/api (CUSTOM)
2022-04-25T08:04:25.446771386Z GRAPHKB_URL=http://10.100.120.213:5000 (CUSTOM)
2022-04-25T08:04:25.459446719Z CONTACT_EMAIL=ipr@bcgsc.ca (DEFAULT)
2022-04-25T08:04:25.472319400Z CONTACT_TICKET_URL=https://www.bcgsc.ca/jira/projects/IPR (DEFAULT)
2022-04-25T08:04:25.485035384Z IS_DEMO= (DEFAULT)
2022-04-25T08:04:25.497690039Z PUBLIC_PATH=/ (CUSTOM)
2022-04-25T08:04:25.502423439Z window._env_ = {
2022-04-25T08:04:25.502496002Z   KEYCLOAK_CLIENT_ID: 'IPR',
2022-04-25T08:04:25.502513568Z   KEYCLOAK_REALM: 'PORI',
2022-04-25T08:04:25.502529497Z   KEYCLOAK_URL: 'http://10.100.120.213:8888/auth',
2022-04-25T08:04:25.502545038Z   API_BASE_URL: 'http://10.100.120.213:8081/api',
2022-04-25T08:04:25.502560601Z   GRAPHKB_URL: 'http://10.100.120.213:5000',
2022-04-25T08:04:25.502575645Z   CONTACT_EMAIL: 'ipr@bcgsc.ca',
2022-04-25T08:04:25.502590415Z   CONTACT_TICKET_URL: 'https://www.bcgsc.ca/jira/projects/IPR',
2022-04-25T08:04:25.502605500Z   IS_DEMO: '',
2022-04-25T08:04:25.502620468Z   PUBLIC_PATH: '/',
2022-04-25T08:04:25.502635447Z };
2022-04-25T08:04:25.503101000Z REPLACE %PUBLIC_PATH% with / in index.html
2022-04-25T08:06:44.651191231Z 10.100.12.36 - - [25/Apr/2022:08:06:44 +0000] "GET / HTTP/1.1" 200 1077 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" "-"
2022-04-25T08:06:44.706503142Z 10.100.12.36 - - [25/Apr/2022:08:06:44 +0000] "GET /ipr-env-config.js HTTP/1.1" 200 353 "http://10.100.120.213:3000/" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" "-"
2022-04-25T08:06:44.706860110Z 10.100.12.36 - - [25/Apr/2022:08:06:44 +0000] "GET /runtime.bundle.js HTTP/1.1" 200 14440 "http://10.100.120.213:3000/" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" "-"
2022-04-25T08:06:44.709806973Z 10.100.12.36 - - [25/Apr/2022:08:06:44 +0000] "GET /main.bundle.js HTTP/1.1" 200 383564 "http://10.100.120.213:3000/" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" "-"
2022-04-25T08:06:44.741581894Z 10.100.12.36 - - [25/Apr/2022:08:06:44 +0000] "GET /9943.bundle.js HTTP/1.1" 200 3752450 "http://10.100.120.213:3000/" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" "-"
2022-04-25T08:06:45.028925982Z 10.100.12.36 - - [25/Apr/2022:08:06:45 +0000] "GET /4801.ae3a01fa2899718a14c0.chunk.js HTTP/1.1" 200 217082 "http://10.100.120.213:3000/login" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" "-"
2022-04-25T08:06:45.047260687Z 10.100.12.36 - - [25/Apr/2022:08:06:45 +0000] "GET /font/4673b4537a84c7f7a130..woff2 HTTP/1.1" 200 15688 "http://10.100.120.213:3000/" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" "-"
2022-04-25T08:06:45.054840548Z 10.100.12.36 - - [25/Apr/2022:08:06:45 +0000] "GET /img/apple-touch-icon.png HTTP/1.1" 200 5963 "http://10.100.120.213:3000/" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" "-"
2022-04-25T08:06:45.055049440Z 10.100.12.36 - - [25/Apr/2022:08:06:45 +0000] "GET /img/favicon-16x16.png HTTP/1.1" 200 691 "http://10.100.120.213:3000/" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" "-"
2022-04-25T08:07:19.069545760Z 10.100.12.36 - - [25/Apr/2022:08:07:19 +0000] "GET / HTTP/1.1" 200 1077 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" "-"
2022-04-25T08:07:19.107987413Z 10.100.12.36 - - [25/Apr/2022:08:07:19 +0000] "GET /ipr-env-config.js HTTP/1.1" 304 0 "http://10.100.120.213:3000/" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" "-"
2022-04-25T08:07:19.377219859Z 10.100.12.36 - - [25/Apr/2022:08:07:19 +0000] "GET /font/4673b4537a84c7f7a130..woff2 HTTP/1.1" 200 15688 "http://10.100.120.213:3000/" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" "-"
2022-04-25T08:07:19.385501022Z 10.100.12.36 - - [25/Apr/2022:08:07:19 +0000] "GET /img/apple-touch-icon.png HTTP/1.1" 200 5963 "http://10.100.120.213:3000/" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" "-"
2022-04-25T08:07:19.385667503Z 10.100.12.36 - - [25/Apr/2022:08:07:19 +0000] "GET /img/favicon-16x16.png HTTP/1.1" 200 691 "http://10.100.120.213:3000/" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" "-"
2022-04-25T08:07:42.103893841Z 10.100.12.36 - - [25/Apr/2022:08:07:42 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" "-"
2022-04-25T08:07:42.163123348Z 10.100.12.36 - - [25/Apr/2022:08:07:42 +0000] "GET /ipr-env-config.js HTTP/1.1" 304 0 "http://10.100.120.213:3000/" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" "-"
2022-04-25T08:08:11.963477966Z 10.100.12.36 - - [25/Apr/2022:08:08:11 +0000] "GET /login HTTP/1.1" 200 1077 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" "-"
2022-04-25T08:08:12.013900311Z 10.100.12.36 - - [25/Apr/2022:08:08:12 +0000] "GET /ipr-env-config.js HTTP/1.1" 304 0 "http://10.100.120.213:3000/login" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" "-"
2022-04-25T12:34:20.562655919Z Creating env variables script: ./ipr-env-config.js
2022-04-25T12:34:21.228979159Z KEYCLOAK_CLIENT_ID=IPR (DEFAULT)
2022-04-25T12:34:21.240989001Z KEYCLOAK_REALM=PORI (CUSTOM)
2022-04-25T12:34:21.253033738Z KEYCLOAK_URL=http://10.100.120.213:8888/auth (CUSTOM)
2022-04-25T12:34:21.265292830Z API_BASE_URL=http://10.100.120.213:8081/api (CUSTOM)
2022-04-25T12:34:21.277241806Z GRAPHKB_URL=http://10.100.120.213:5000 (CUSTOM)
2022-04-25T12:34:21.289160736Z CONTACT_EMAIL=ipr@bcgsc.ca (DEFAULT)
2022-04-25T12:34:21.301130424Z CONTACT_TICKET_URL=https://www.bcgsc.ca/jira/projects/IPR (DEFAULT)
2022-04-25T12:34:21.313167884Z IS_DEMO= (DEFAULT)
2022-04-25T12:34:21.325383404Z PUBLIC_PATH=/ (CUSTOM)
2022-04-25T12:34:21.329997843Z window._env_ = {
2022-04-25T12:34:21.330078311Z   KEYCLOAK_CLIENT_ID: 'IPR',
2022-04-25T12:34:21.330096169Z   KEYCLOAK_REALM: 'PORI',
2022-04-25T12:34:21.330112405Z   KEYCLOAK_URL: 'http://10.100.120.213:8888/auth',
2022-04-25T12:34:21.330128591Z   API_BASE_URL: 'http://10.100.120.213:8081/api',
2022-04-25T12:34:21.330143960Z   GRAPHKB_URL: 'http://10.100.120.213:5000',
2022-04-25T12:34:21.330159197Z   CONTACT_EMAIL: 'ipr@bcgsc.ca',
2022-04-25T12:34:21.330174292Z   CONTACT_TICKET_URL: 'https://www.bcgsc.ca/jira/projects/IPR',
2022-04-25T12:34:21.330189707Z   IS_DEMO: '',
2022-04-25T12:34:21.330204536Z   PUBLIC_PATH: '/',
2022-04-25T12:34:21.330219672Z };
2022-04-25T12:34:21.330670358Z REPLACE %PUBLIC_PATH% with / in index.html
2022-04-25T14:56:21.315148631Z 10.100.153.175 - - [25/Apr/2022:14:56:21 +0000] "GET / HTTP/1.1" 200 1077 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:99.0) Gecko/20100101 Firefox/99.0" "-"
2022-04-25T14:56:21.404570437Z 10.100.153.175 - - [25/Apr/2022:14:56:21 +0000] "GET /ipr-env-config.js HTTP/1.1" 200 353 "http://10.100.120.213:3000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:99.0) Gecko/20100101 Firefox/99.0" "-"
2022-04-25T14:56:21.440351449Z 10.100.153.175 - - [25/Apr/2022:14:56:21 +0000] "GET /runtime.bundle.js HTTP/1.1" 200 14440 "http://10.100.120.213:3000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:99.0) Gecko/20100101 Firefox/99.0" "-"
2022-04-25T14:56:21.448755113Z 10.100.153.175 - - [25/Apr/2022:14:56:21 +0000] "GET /main.bundle.js HTTP/1.1" 200 383564 "http://10.100.120.213:3000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:99.0) Gecko/20100101 Firefox/99.0" "-"
2022-04-25T14:56:21.660975528Z 10.100.153.175 - - [25/Apr/2022:14:56:21 +0000] "GET /9943.bundle.js HTTP/1.1" 200 3752450 "http://10.100.120.213:3000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:99.0) Gecko/20100101 Firefox/99.0" "-"
2022-04-25T14:56:22.179029749Z 10.100.153.175 - - [25/Apr/2022:14:56:22 +0000] "GET /4801.ae3a01fa2899718a14c0.chunk.js HTTP/1.1" 200 217082 "http://10.100.120.213:3000/login" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:99.0) Gecko/20100101 Firefox/99.0" "-"
2022-04-25T14:56:22.190287407Z 10.100.153.175 - - [25/Apr/2022:14:56:22 +0000] "GET /font/4673b4537a84c7f7a130..woff2 HTTP/1.1" 200 15688 "http://10.100.120.213:3000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:99.0) Gecko/20100101 Firefox/99.0" "-"
2022-04-25T14:56:22.217354804Z 10.100.153.175 - - [25/Apr/2022:14:56:22 +0000] "GET /img/apple-touch-icon.png HTTP/1.1" 200 5963 "http://10.100.120.213:3000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:99.0) Gecko/20100101 Firefox/99.0" "-"
2022-04-25T14:56:22.218385950Z 10.100.153.175 - - [25/Apr/2022:14:56:22 +0000] "GET /img/favicon-32x32.png HTTP/1.1" 200 1227 "http://10.100.120.213:3000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:99.0) Gecko/20100101 Firefox/99.0" "-"
2022-04-25T14:56:29.401685964Z 10.100.153.175 - - [25/Apr/2022:14:56:29 +0000] "GET /login HTTP/1.1" 200 1077 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:99.0) Gecko/20100101 Firefox/99.0" "-"
2022-04-25T14:56:29.600822322Z 10.100.153.175 - - [25/Apr/2022:14:56:29 +0000] "GET /img/apple-touch-icon.png HTTP/1.1" 200 5963 "http://10.100.120.213:3000/login" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:99.0) Gecko/20100101 Firefox/99.0" "-"
2022-04-25T14:56:29.600939635Z 10.100.153.175 - - [25/Apr/2022:14:56:29 +0000] "GET /img/favicon-32x32.png HTTP/1.1" 200 1227 "http://10.100.120.213:3000/login" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:99.0) Gecko/20100101 Firefox/99.0" "-"

@alirizaaribas-ibg
Copy link
Author

alirizaaribas-ibg commented Apr 27, 2022

Now another error appears in docker logs:

2022-04-27T12:01:32.479536229Z [2022-04-27 12:01:32][INFO] Initializing logging 
2022-04-27T12:01:32.480385691Z [2022-04-27 12:01:32][DEBUG] Log level set to debug 
2022-04-27T12:01:32.481662703Z [2022-04-27 12:01:32][INFO] setting connection to database ipr_demo(ipr_db):5432 as ipr_ro 
2022-04-27T12:01:33.518706313Z Illegal instruction (core dumped)
2022-04-27T12:02:35.132075934Z 
2022-04-27T12:02:35.132172253Z > ipr-api@7.4.0 start
2022-04-27T12:02:35.132191252Z > node --max-old-space-size=2800 bin/server.js
2022-04-27T12:02:35.132207426Z 
2022-04-27T12:02:35.845769632Z [2022-04-27 12:02:35][INFO] Initializing logging 
2022-04-27T12:02:35.846699643Z [2022-04-27 12:02:35][DEBUG] Log level set to debug 
2022-04-27T12:02:35.848045892Z [2022-04-27 12:02:35][INFO] setting connection to database ipr_demo(ipr_db):5432 as ipr_ro 
2022-04-27T12:02:36.887892163Z Illegal instruction (core dumped)
2022-04-27T12:03:38.443785527Z 
2022-04-27T12:03:38.443879688Z > ipr-api@7.4.0 start
2022-04-27T12:03:38.443900496Z > node --max-old-space-size=2800 bin/server.js
2022-04-27T12:03:38.443917365Z 
2022-04-27T12:03:39.158719339Z [2022-04-27 12:03:39][INFO] Initializing logging 
2022-04-27T12:03:39.159549338Z [2022-04-27 12:03:39][DEBUG] Log level set to debug 
2022-04-27T12:03:39.160879995Z [2022-04-27 12:03:39][INFO] setting connection to database ipr_demo(ipr_db):5432 as ipr_ro 
2022-04-27T12:03:40.188833429Z Illegal instruction (core dumped)

@creisle
Copy link
Member

creisle commented Apr 28, 2022

The first set of logs above appear to be from the client rather than the API. The second set of logs is quite helpful tho! your API is being connected with a read only user (which is the default for the demo version). To be able to upload reports you will need to change this to use a user with read/write capabilities

https://github.com/bcgsc/pori/blob/master/docker-compose.dev.yml#L135

this line would change to

      IPR_DATABASE_USERNAME: ipr_service

to match the non-read only user declared here: https://github.com/bcgsc/pori/blob/master/docker-compose.dev.yml#L98

@creisle
Copy link
Member

creisle commented Apr 28, 2022

I will add some notes to our documentation to make this clear for future users

@alirizaaribas-ibg
Copy link
Author

I tried with the customized settings:

ipr_api:
    image: bcgsc/pori-ipr-api:latest
    command: npm start
    ports:
      - 8081:8080
    environment:
      IPR_DATABASE_HOSTNAME: ipr_db
      IPR_DATABASE_NAME: ipr_demo
      IPR_DATABASE_USERNAME: ipr_service
      IPR_GRAPHKB_USERNAME: ipr_graphkb_link
      IPR_KEYCLOAK_KEYFILE: /keys/keycloak.key

but logs are the same:

2022-04-29T08:44:44.285682804Z > ipr-api@7.4.0 start
2022-04-29T08:44:44.285705568Z > node --max-old-space-size=2800 bin/server.js
2022-04-29T08:44:44.285725046Z 
2022-04-29T08:44:44.997911415Z [2022-04-29 08:44:44][INFO] Initializing logging 
2022-04-29T08:44:44.998804474Z [2022-04-29 08:44:44][DEBUG] Log level set to debug 
2022-04-29T08:44:45.000113938Z [2022-04-29 08:44:44][INFO] setting connection to database ipr_demo(ipr_db):5432 as ipr_service 
2022-04-29T08:44:46.023451266Z Illegal instruction (core dumped)
2022-04-29T08:45:13.311380668Z 
2022-04-29T08:45:13.311503165Z > ipr-api@7.4.0 start
2022-04-29T08:45:13.311525808Z > node --max-old-space-size=2800 bin/server.js
2022-04-29T08:45:13.311545486Z 
2022-04-29T08:45:14.017047245Z [2022-04-29 08:45:14][INFO] Initializing logging 
2022-04-29T08:45:14.017876141Z [2022-04-29 08:45:14][DEBUG] Log level set to debug 
2022-04-29T08:45:14.019145561Z [2022-04-29 08:45:14][INFO] setting connection to database ipr_demo(ipr_db):5432 as ipr_service 
2022-04-29T08:45:15.058890121Z Illegal instruction (core dumped)

@brayden-bcgsc
Copy link

brayden-bcgsc commented May 11, 2022

This error is most likely because the database schema is not up-to-date.

You can try adding this to your docker-compose file:

  migration:
    image: bcgsc/pori-ipr-api:latest
    command: npx sequelize-cli db:migrate --url postgres://${DB_USER}:${DB_PASSWORD}@database:5432/${DB_NAME}
    deploy:
      restart_policy:
        condition: on-failure
        max_attempts: 10
    depends_on:
      - database

Where DB_USER, DB_PASSWORD, and DB_NAME are replaced with your database user, database password, and database name. Also 'database' will need to be replaced by whatever the ipr database container is named in your docker-compose file.

The container should exit and be stopped once it is done and you can check the docker logs of the container to see if the migrations were successful.

The ipr_api would now also 'depends_on' the 'migration' container.

@alirizaaribas-ibg
Copy link
Author

I will try with these settings from docker-compose.dev.yml. I always delete all the environment to start a clean setup.

  migration:
    image: bcgsc/pori-ipr-api:latest
    command: npx sequelize-cli db:migrate --url postgres://postgres:root@ipr_db:5432/ipr_demo
    deploy:
      restart_policy:
        condition: on-failure
        max_attempts: 10
    depends_on:
      - ipr_db

All content here:
docker-compose.dev_v1.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants