UAlbertaALTLab / korp-frontend

Frontend for Korp, a frontend for the IMS Open Corpus Workbench (CWB).
https://spraakbanken.gu.se/en/tools/korp
MIT License
1 stars 1 forks source link

production site is belly up #27

Closed dwhieb closed 3 years ago

dwhieb commented 3 years ago

http://altlab.ualberta.ca/korp/ returns a 200 OK response but displays the belly-up crow error.

Looking in the console log, the most likely culprit is a failed request to https://sapir.artsrn.ualberta.ca/korpcgi/korp.cgi.

Access to XMLHttpRequest at 'https://sapir.artsrn.ualberta.ca/korpcgi/korp.cgi?command=info&corpus=C_DB_CRK%2CWOLFART_AHENAKEW%2CC_DB_CRKS%2CSWANTON_MODERN_LOON%2CSAPIR_BUFFALO%2CCORBIERE%2CMEDLER%2CMRP_VIDEO&log=1' (redirected from 'http://sapir.artsrn.ualberta.ca/korpcgi/korp.cgi?command=info&corpus=C_DB_CRK%2CWOLFART_AHENAKEW%2CC_DB_CRKS%2CSWANTON_MODERN_LOON%2CSAPIR_BUFFALO%2CCORBIERE%2CMEDLER%2CMRP_VIDEO&log=1') from origin 'http://altlab.ualberta.ca' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

(This is obviously a backend issue, but I don't have write access to the korp-backend repo yet. I can transfer this issue there once I do.)

dwhieb commented 3 years ago

@eddieantonio same question here: Could this be related to changes made for https://github.com/UAlbertaALTLab/cree-intelligent-dictionary/issues/624?

eddieantonio commented 3 years ago

There may have been some changes done to the Apache config on Sapir that caused this, but why is the korp instance on altlab-kor making requests to sapir?!?!?!?!? It should be making requests to altlab-kor!

eddieantonio commented 3 years ago

🤦🏼 I just noticed:

Access to XMLHttpRequest [...] from origin 'http://altlab.ualberta.ca' has been blocked by CORS policy: No Access-Control-Allow-Origin header is present on the requested resource.

We got rid of that on Sapir sending Access-Control-Allow-Origin: * is bad practice (see: UAlbertaALTLab/cree-intelligent-dictionary#650)

What stumps me is why configuration for /cree-dictionary leaked and affected Korp's CGI based backed and WHY IS ALTLAB-KOR MAKING REQUETS TO SAPIR IN THE FIRST PLACE!

cc @andrewdotn (feel free to ignore this until Tuesday; I'm having lousy work/life balance this weekend 🙃 )

eddieantonio commented 3 years ago

:facepalm: :facepalm: :facepalm:

https://korp.altlab.dev/ is the production site, which is ALSO down right now, for unrelated (???) reasons?

http://altlab.ualberta.ca/korp/ is the old version that mysteriously stopped working a year ago. Perhaps it should redirect to https://korp.altlab.dev/...

dwhieb commented 3 years ago

Right, https://korp.altlab.dev is the one I got running the other week, using the production code. It mysteriously stopped working sometime between our meeting Friday (1/12) afternoon when I demoed it and Saturday (1/13) afternoon when I opened this issue. I hadn't made any changes to the repo in that time.

Yeah, http://altlab.ualberta.ca/korp/ has been belly-up for ages.

We want production on altlab.korp.app and development on altlab.korp.dev, right?

eddieantonio commented 3 years ago

We want production on altlab.korp.app and development on altlab.korp.dev, right?

I honestly don't know. @aarppe: would you like two different sites? A production and a development korp?

It mysteriously stopped working sometime between our meeting Friday (1/12) afternoon when I demoed it and Saturday (1/13) afternoon when I opened this issue. I hadn't made any changes to the repo in that time.he

I ran docker-compose up -d and it's up now: https://korp.altlab.dev/

Here's my preliminary perusal of the logs:

root@altlab-kor:/lib/systemd/system# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
266e2fa1837e        korp_frontend       "docker-entrypoint.s…"   9 days ago          Up 17 minutes       0.0.0.0:9111->9111/tcp   korp_frontend_1
46cc9af7447d        korp_backend        "/bin/sh -c 'python3…"   4 months ago        Up 17 minutes       0.0.0.0:1234->1234/tcp   korp_backend_1
 $ docker logs 46cc9af7447d
192.168.190.12 - - [2021-02-12 20:23:46] "POST /query HTTP/1.0" 200 540832 0.118308
Serving using gevent
192.168.190.12 - - [2021-02-14 21:57:41] "GET /corpus_info?corpus=WOLFART_AHENAKEW HTTP/1.0" 200 620 0.021974
192.168.190.12 - - [2021-02-14 21:57:41] "GET /timespan?granularity=y&corpus=WOLFART_AHENAKEW HTTP/1.0" 200 321 0.011636
 $ docker logs  266e2fa1837e
Fri Feb 12 2021 20:22:40 GMT+0000 (Coordinated Universal Time)]  "GET /%3Cdiv%20ng-controller=ExtendedToken%3E%3Cdiv%20ui-sortable=%22%7B%20items:%20'%3E%20.token',%20delay%20:%20100%20%7D%22%20ng-model=data%3E%3Cdiv%20class=%22token%20query_token%22%20ng-repeat=%22token%20in%20data%20track%20by%20$index%22%3E%3Cdiv%20class=token_header%3E%3Ci%20class=%22close_btn%20fa%20fa-times-circle-o%20fa-1%22%20ng-click=removeToken($index)%3E%3C/i%3E%3Cdiv%20style=clear:both%3E%3C/div%3E%3C/div%3E%3Cdiv%20class=args%3E%3Cdiv%20class=%22and%20query_arg%22%20ng-repeat=%22and%20in%20token.and_block%22%3E%3Cspan%20ng-show=$index%3E%7B%7B'and'%20%7C%20loc:lang%7D%7D%3C/span%3E%3Cdiv%20class=or_container%3E%3Cdiv%20class=%22or%20or_arg%22%20ng-repeat=%22or%20in%20and%22%3E%3Cextended-or-block%20or=or%20on-remove=%22removeOr(token,%20and,%20$index)%22%3E%3C/extended-or-block%3E%3C/div%3E%3C/div%3E%3Cdiv%20class=arg_footer%3E%3Cspan%20class=link%20ng-click=addOr(and)%3E%7B%7B'or'%20%7C%20loc:lang%7D%7D%3C/span%3E%3Cdiv%20style=clear:both%3E%3C/div%3E%3C/div%3E%3C/div%3E%3C/div%3E%3Cdiv%20class=token_footer%3E%3Cdiv%3E%3Cbutton%20class=%22insert_arg%20btn%20btn-xs%20btn-default%22%20ng-click=addAnd(token)%3E%3Ci%20class=%22fa%20fa-arrow-down%22%3E%3C/i%3E%20%3Cspan%20style=margin-left:1px;position:relative;top:-1px%3E%7B%7B%22and%22%20%7C%20loc:lang%7D%7D%3C/span%3E%3C/button%3E%20%3Cbutton%20popper%20class=%22btn%20btn-xs%20btn-default%20token-cog-btn%22%3E%3Ci%20class=%22fa%20fa-cog%22%3E%3C/i%3E%3C/button%3E%3Cul%20class=%22popper_menu%20dropdown-menu%22%3E%3Cli%3E%3Ca%20ng-click=toggleRepeat(token)%20rel=localize[repeat]%3E%7B%7B'repeat'%20%7C%20loc:lang%7D%7D%3C/a%3E%3C/li%3E%3Cli%3E%3Ca%20ng-click=toggleStart(token)%20rel=localize[sent_start]%3E%7B%7B'sent_start'%20%7C%20loc:lang%7D%7D%3C/a%3E%3C/li%3E%3Cli%3E%3Ca%20ng-click=toggleEnd(token)%20rel=localize[sent_end]%3E%7B%7B'sent_end'%20%7C%20loc:lang%7D%7D%3C/a%3E%3C/li%3E%3C/ul%3E%3Cdiv%20class=repeat%20ng-show=token.repeat%3E%3Cspan%20rel=localize[repeat]%3E%7B%7B'repeat'%20%7C%20loc:lang%7D%7D%3C/span%3E%20%3Cinput%20type=number%20ng-model=token.repeat[0]%20ng-change=%22repeatChange(0,%20$index)%22%20ng-blur=%22repeatBlur(0,%20$index)%22%20ng-class=%22%7B'input-error':%20repeatError%7D%22%3E%20%3Cspan%20rel=localize[to]%3E%7B%7B'to'%20%7C%20loc:lang%7D%7D%3C/span%3E%20%3Cinput%20type=number%20ng-model=token.repeat[1]%20ng-change=%22repeatChange(1,%20$index)%22%20ng-blur=%22repeatBlur(1,%20$index)%22%3E%20%3Cspan%20rel=localize[times]%3E%7B%7B'times'%20%7C%20loc:lang%7D%7D%3C/span%3E%3C/div%3E%3Cdiv%20style=clear:both%3E%3C/div%3E%3C/div%3E%3Cdiv%20class=lower_footer%3E%3Cspan%20class=%22lbound%20close_token%22%20ng-show=token.bound.lbound%3E%3Cspan%20rel=localize[sent_start]%3E%7B%7B'sent_start'%20%7C%20loc:lang%7D%7D%3C/span%3E%20%3Ci%20class=%22fa%20fa-1%20fa-times%22%20ng-click=toggleStart(token)%3E%3C/i%3E%20%3C/span%3E%3Cspan%20class=%22rbound%20close_token%22%20ng-show=token.bound.rbound%3E%3Cspan%20rel=localize[sent_end]%3E%7B%7B'sent_end'%20%7C%20loc:lang%7D%7D%3C/span%3E%20%3Ci%20class=%22fa%20fa-1%20fa-times%22%20ng-click=toggleEnd(token)%3E%3C/i%3E%3C/span%3E%3C/div%3E%3C/div%3E%3C/div%3E%3Cspan%20class=%22image_button%20insert_token%22%20ng-click=addToken()%3E%3Cimg%20class=plus-btn%20src=plus.a25d8be3eebd842553bae31dd1773bc0.png%3E%20%3Cspan%3E%7B%7B%22add_token%22%20%7C%20loc:lang%7D%7D%3C/span%3E%3C/span%3E%3C/div%3E%3C/div%3E" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36"
yarn run v1.22.4
$ http-server -p 9111 ./dist
Starting up http-server, serving ./dist
Available on:
  http://127.0.0.1:9111
  http://172.18.0.2:9111
Hit CTRL-C to stop the server
[Sun Feb 14 2021 21:57:38 GMT+0000 (Coordinated Universal Time)]  "GET /" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36"

I feel like there's something wrong with the systemd unit file, since it should restart the application if it crashes. Unfortunately, there's no record of any crashes so I have no idea why it stopped working :/

andrewdotn commented 3 years ago

The altlab.ualberta.ca korp instance had been belly-up for a long time.

I don’t believe systemd has the ability to auto-restart a container started by docker-compose, but stack overflow tells me you can add restart: always to the docker-compose.yml file.

The docs mention both restart_policy and restart though, so you might want to check what version the docker-compose file specifies and test that it works as intended.

eddieantonio commented 3 years ago

@dwhieb: we'll want to use restart, as that is the one that docker-compose up will actually honour.