Cutelyst as a system service
arietto opened this issue · comments
Hello! I am studying C++/Qt REST framework Cutelyst. I'd like to make cutelyst-wsgi2 (see cutelyst-wsgi2 sources) as a system service.
In fact, I'd like to have a a crossplatform (Win/Linux) ability to start/stop REST service, autorestart it in case of crashes. REST service will be used in local network, I'd like to avoid Apache and other reverse proxies.
What will you advise? For example, is it reasonable to make a thin system service based on QtService
that will in turn start cutelyst-wsgi2? I suppose that in-source mixing cutelyst-wsgi2 and QtService
will be hard according to main.cpp
contents. For example, cutelyst-wsgi2 has own calls to QCoreApplication::exec()
. Also, I don't want to fork multiple cutelyst-wsgi2 processes (so, I choose only a restricted subset of cutelyst-wsgi2 features - multithreaded, but single process).
BTW, what's the difference between https://github.com/qtproject/qt-solutions/tree/master/qtservice and your project?
Your first approach seems to be the most sensical. Creating a wrapper around cutelyst-wsgi2 using QProcess
seems like an easy to implement task, but should work just fine. I would recommend you to do exactly that.
Modifiying the cutelyst-wsgi2 may be possible too, but at least judging from the sources would not be a trivial task.
The main difference between the projects is that the qt solutions variant is outdated and only really works well for windows. It does not integrate with systemd/launchd and is not extensible. Furthermore, it is not actively maintained, more just a kept alive Qt4 port...
OK, thank your for your quick and full answer.