Web app on Linux

more than one year ago, I installed a web application on Linux, following the directions in this post: Tutorial: Deploying Web Apps on Linux – Xojo Programming Blog
so using Nginx and the Xojo webapp started as a Linux service.
it happens sometimes that the application is not accessible.
although Nginx and Xojo process are active.
I didn’t find any indication in the logs of Linux, Nginx and Xojo application.
in these cases, to fix it just kill the Xojo webapp process (which is recreated shortly after, thanks to the service settings).
does anyone know how to figure out that the Xojo service (apparently active) needs to be restarted instead?

thank you.

Generally, I setup a cron job to restart my Xojo Web app services periodically, depending on complexity, or they’ll balloon in RAM and eventually become unstable. While there have been many recent improvements with Xojo Web’s memory use, I keep this in place.

I would, however, recommend that you use Lifeboat if you want to run the servers yourself and not using Xojo Cloud. It does a great job setting up systems for Xojo Web applications and helping you manage them.

2 Likes

Lifeboat has a tool to help you schedule Web App restarts as well.

4 Likes

Like you, I ran my own servers since the inception of Xojo Web (there’s no way I could’ve afforded to pay for Xojo Cloud for all that I need). I still have a few servers I need to migrate over to Lifeboat, but each one I move reduces my workload as it’s really just about half an hour to set it up the way I need after uploading the app and I’m done. I don’t even have to think much about it anymore and that’s thanks to Lifeboat.

1 Like

One way to do this is to use systemd to run your app as a daemon and then communicate with the watchdog system to tell it that your app is still alive. If the system doesn’t receive a message from your app after a certain number of seconds (set by you) SystemD automatically restarts your app.

2 Likes

Really?

thank you for your answers.
I would like to try Lifeboat since it is talked about so well here in the forum.
I would also like to try the solution from @Greg_O, but I don’t have sufficient skills in Linux environment.
I ask Greg if he has an example for his suggestion.
thank you again.

could you share some more details about the solution you propose?
can I also ask you for an example project?

I’ll try to dig that out today or tomorrow and post something.

2 Likes

I’ve posted a project on GitHub with some explanations of how stuff should work and an example systemd .service file with instructions on where to put it and how to enable it. This is a subset of my XojoOptionConsoleParser project that has been reworked to target just the Signals and SystemD stuff.

Please note, if you are using Xojo Cloud, you should not use this code. It may conflict with their system to keep your app running. If you want it in your project, make sure you wrap it in pragmas:

#If Not TargetXojoCloud
  // Put SystemD and Signal code in here
#End If
2 Likes