-
Notifications
You must be signed in to change notification settings - Fork 0
Program SunServer
- Module: SunServer.py
- Type: command line program
An HTTP web server is provided. This displays the data from the database as graphics and in tables.
SunServer.py MODE
- FASHION:
- daemon Starts a never-ending process to query the status and write to the database
- example Outputs an example file for configuring the module
- init-service Initializes the module as a SystemD service called sunmonitor
sudo SunServer.py init-service SunServer.py example SunServer.py daemon -v
An example configuration can be output with "SunServer.py example":
The configuration must be created under /etc/sunmonitor/server.conf:
# Configuration for sunserver: net.interface=localhost net.port=8080 net.timeout=10 db.name=appsunmonitor db.user=sun db.code=sun4sun base=/opt/sunmonitor i18n.data=~{base}/sunserver.i18n i18n.languages=de en snippets.file=~{base}/sunserver.snippets.html
Important: The SunServer.py program uses the database that is populated by SunMon.py. Therefore, both programs must be able to access the same database, so it is best to install both on the same Linux system.
Therefore the directory /opt/sunmonitor and the database already exist.
BASE=/opt/sunmonitor cd $BASE DOMAIN=localhost sudo ./installSunServer $DOMAIN # Specify the GUI language: ln -s sunserver.i18n.de sunserver.i18n.current
In this case, the HTTP server should be addressed with the HTTPS protocol. This is done by a reverse proxy provided by Nginx.
BASE=/opt/sunmonitor cd $BASE DOMAIN=localhost sudo ./installSunServer $DOMAIN # Specify the GUI language: ln -s sunserver.i18n.de sunserver.i18n.current
sudo systemctl stop sunserver # Start in the console, since errors may be output there: python3 /opt/sunmonitor/SunServer.py daemon -v
- In the browser:
- If intranet: http://localhost:8080
- If internet: https://sun.example.com (adapt domain!)
All texts are collected in the file sunserver.i18n.de and can be changed there.
If another language is to be used, for example French:
- Copy sunserver.i18n.en (or sunserver.i18n.de) to sunserver.i18n.fr
- Edit sunserver.i18n.fr: Replace English texts with French texts (behind the "=" character)
- Activate language (through symbolic link)
LANG_SRC=en LANG_TRG=fr cp sunserver.i18n.$LANG_SRC sunserver.i18n.$LANG_TRG test -e sunserver.i18n.current && rm sunserver.i18n.current ln -s sunserver.i18n.$LANG_TRG sunserver.i18n.current