## Setup of web server Two instances of the **photodiag-web** server are hosted on the **sf-phmon-01.psi.ch** virtual machine, both accessible only from the beamline networks/control rooms: - **Production server**: [https://sf-photodiag.psi.ch](https://sf-photodiag.psi.ch) - **Test server**: [https://sf-photodiag-test.psi.ch](https://sf-photodiag-test.psi.ch) ### Server updates - The service repository is hosted at: [https://gitlab.psi.ch/photon-diagnostics/photodiag_web](https://gitlab.psi.ch/photon-diagnostics/photodiag_web) - **Pushing a commit** on the `main` branch updates the **test server**. - **Pushing a tagged commit** on the `main` branch updates **both** the test and production servers. To push a **release** to the main server: 1. Pull the latest tested and operational version: git pull 2. Create a new release (choose one of `patch`, `minor`, or `major`): python make_release.py patch 3. Push the new tag(s): git push origin main --tags You can check the release status via **GitLab CI/CD pipelines**. ### Server logs When logged into either **sf-phmon-01** or **sf-phmon-02**, you can view logs with: sudo journalctl -u photodiag- -e Replace `` with the desired instance. For example, to see the last 100 lines of logs on **sf-phmon-02**: ssh sf-phmon-02 sudo -i journalctl -u photodiag-test.service -n 100 ### Restarting the VM or the service 1. **Restart the entire VM**: sudo reboot 2. **Restart a single service** (for example, photodiag test or prod): sudo systemctl restart .service Replace `` with `photodiag-test` or `photodiag-prod`. ## Server Monitoring To monitor the status and performance of the **photodiag-web** servers, you can access real-time server statistics via Grafana. These dashboards show CPU usage, memory consumption, network traffic, and disk I/O, which can help diagnose performance issues. ### **Server Status Links** - **sf-phmon-01**: [Grafana Metrics - sf-phmon-01](https://metrics.psi.ch/d/1SL13Nxmz/gfa-linux-tabular?orgId=1&from=now-6h&to=now&timezone=browser&var-env=PEE0939DC8375D041&var-host=sf-phmon-01.psi.ch) - **sf-phmon-02**: [Grafana Metrics - sf-phmon-02](https://metrics.psi.ch/d/1SL13Nxmz/gfa-linux-tabular?orgId=1&from=now-6h&to=now&timezone=browser&var-env=PEE0939DC8375D041&var-host=sf-phmon-02.psi.ch) ### **Available Metrics** The Grafana dashboards provide the following system performance data: - **CPU Usage**: Tracks system, user, idle, and I/O wait time. - **Memory Usage**: Displays total and used memory statistics. - **Network Traffic**: Monitors inbound and outbound data transfer rates. - **Disk I/O**: Reports read/write operations per second.