Erudika / scoold-pro

Cloud-ready Q&A platform for the enterprise (self-hosted, on premise)
https://scoold.com
Other
7 stars 0 forks source link

Running scoold-pro as a systemd service, and attemps to connect to Para #27

Closed jjorba closed 4 years ago

jjorba commented 4 years ago

Hi,

What is the best way to execute the jar of scoold in systemd?

ExecStart=jar ... directly or ExecStart= /bin/bash -c "jar ..."

And what is the recommendation for the para service, starting both in the same service, or having two different services?

I was trying with two services with (after, before) dependences, and I had problems with scooldPRO not detecting at start (parallel systemd start) para port available.

In fact this generates in scooldPRO log a:

2020-02-18 16:49:28 [INFO ] Initialized ParaClient with endpoint http://localhost:8080 and access key 'app:scoold' feb 18 16:49:29 scoold java[14084]: 2020-02-18 16:49:29 [ERROR] No connection to Para backend. Retrying connection in 10s (attempt 1 of 10)... feb 18 16:49:29 scoold java[14084]: 2020-02-18 16:49:29 [INFO ] SpringResourceLoader for Velocity: using resource loader [org.springframework.boot.web feb 18 16:49:30 scoold java[14084]: 2020-02-18 16:49:30 [INFO ] Started ScooldServer in 5.285 seconds (JVM running for 6.623)

After the "attempt 1 of 10" no more any attemps? What is wrong with that? And log stops here no more entries in the log.

And I have in application.conf: para.connection_retries_max = 10 para.connection_retry_interval_sec = 10

after a stop/start manually of the service no problem:

2020-02-18 17:07:29 [INFO ] Listening on port 8000... feb 18 17:07:29 scoold java[1655]: 2020-02-18 17:07:29 [INFO ] Initialized ParaClient with endpoint http://localhost:8080 and access key 'app:scoold'. feb 18 17:07:30 scoold java[1655]: 2020-02-18 17:07:30 [INFO ] SpringResourceLoader for Velocity: using resource loader [org.springframework.boot.web. feb 18 17:07:31 scoold java[1655]: 2020-02-18 17:07:31 [INFO ] Started ScooldServer in 3.909 seconds (JVM running for 4.875)

What is the problem to no realise more than one attempt to connect in the first case?

albogdano commented 4 years ago

I'm not a systemd expert so I can't really tell you how to do it. I guess ExecStart= /usr/bin/java -jar ... should work. Para should be started separately from Scoold as another service. They can be started simultaneously on the same machine, provided it has enough memory (min. 2 GB). Initially Scoold will not be able to connect to Para but will connect eventually, after a few retries. You can change the number of retries with para.connection_retries_max. In your case Scoold has connected after the first retry so there is no problem there.

jjorba commented 4 years ago

Yes I have: para.connection_retries_max = 10 para.connection_retry_interval_sec = 10

but as you see in the first log, only 1 attempt is made, is that one bug? (the scoold isn't accesible).

If I restart manually, it works, because para is initiated, and the connection is posible.

Starting the two in parallel doesn't work, only 1 attempt.

albogdano commented 4 years ago

I don't see a bug there, it just reconnects on the second try. Why is it not accessible? What error do you see?

jjorba commented 4 years ago

The service is not avalaible (scoold-pro), not any response.

If you see the times: 16:49:30 Attemp 1/10 -> not avalaible retrying in 10sec second 31 the service is avalaible ... whera are the 10sec to retry at a second attemp?

The service is not working. if I kill proces, and restart manually the service, it connects to para at first attempt and works.

albogdano commented 4 years ago

By "service is not working" do you mean your systemd service shows up asdead or what? Scoold will reconnect and be available from the browser. If it isn't, you will see the error Error 500: No connection to Para backend.

There is no second attempt in your case because it is connected already. Here's the timeline:

Para starting...                        Started   
|------------------------------------------O------------>
Scoold starting...       Started   Reconnect #1         Connected                         
|--------------------------O-----------O------------------O---->
jjorba commented 4 years ago

system show it working (active - running), and not available from the browser.

if in second 30, isn't avalaible, and need 10sec to retry, has no sense that in second 31 is connected.

And after nothing more in para.log, and not available from the browser (connecting to ... all the time)

albogdano commented 4 years ago

I don't know exactly why it's not available in the browser but Scoold has definitely reconnected to Para and should be running fine. Check on which port you're trying to access it from the browser. Even after the 10 attempts if Para is started it should reconnect without a problem.

jjorba commented 4 years ago

without any trace in the logs?

I will try in some days, to reproduce the problem with the individual jar's without systemd,

but is curious, that stop-start works at first attempt. For me seems that the system try only one time the connection.

I will try to reproduce the problem.

Thanks