Navigator2Go  2.0
Manage your local Ocean Navigator installation.
servermanager.h
1 #ifndef SERVERMANAGER_H
2 #define SERVERMANAGER_H
3 
4 #include "nodiscard.h"
5 
6 #include <QProcess>
7 
8 /***********************************************************************************/
10 class ServerManager : public QObject {
11  Q_OBJECT
12 
13 public:
14  explicit ServerManager(QObject* parent = nullptr);
15  ServerManager(const bool autoStartServers = true, QObject* parent = nullptr);
16 
17  ~ServerManager() override;
18 
19  Q_DISABLE_COPY(ServerManager)
20 
21 
22  void refreshServers();
23 
24  NODISCARD auto isWebUIRunning() const noexcept { return m_isGunicornRunning; }
25  NODISCARD auto isTHREDDSRunning() const noexcept { return m_isApacheRunning; }
26 
27 private:
28  void startServers();
29  void startWebServer();
30  void startTHREDDS();
31 
32  void stopServers();
33  void stopWebServer();
34  void stopTHREDDS();
35 
36  void setEnvironment();
37 
38  QProcess m_apacheProcess{this}, m_gunicornProcess{this};
39  bool m_isGunicornRunning{false};
40  bool m_isApacheRunning{false};
41  qint64 m_gunicornPID{0};
42  qint64 m_apachePID{0};
43 };
44 
45 #endif // SERVERMANAGER_H
bool m_isApacheRunning
Apache tomcat server.
Definition: servermanager.h:40
void refreshServers()
Restarts the Apache and gUnicorn servers after 5 seconds.
Definition: servermanager.cpp:32
Manages the Apache and gUnicorn servers for the Ocean Navigator.
Definition: servermanager.h:10
bool m_isGunicornRunning
gUnicorn server
Definition: servermanager.h:39
qint64 m_gunicornPID
PID of gUnicorn process.
Definition: servermanager.h:41
qint64 m_apachePID
PID of apache tomcat process.
Definition: servermanager.h:42