spiderweb/README.md

263 lines
8.6 KiB
Markdown
Raw Normal View History

2023-01-01 22:03:51 +00:00
<img align="center" src="static/images/icons/icon-72x72.png"/> SPIDERWEB
2020-02-01 06:12:53 +00:00
===
### Ham radio cluster web viewer for DxSpider
2021-12-04 06:24:26 +00:00
[![GPLv3 license](https://img.shields.io/badge/License-GPLv3-blue.svg)](http://perso.crans.org/besson/LICENSE.html)
[![Linux](https://svgshare.com/i/Zhy.svg)](https://svgshare.com/i/Zhy.svg)
2023-01-02 06:31:40 +00:00
[![made-with-python](https://img.shields.io/badge/B.e.-Python-1f425f.svg)](https://www.python.org/)
[![made-with-javascript](https://img.shields.io/badge/F.e.-JavaScript-yellow)](https://www.javascript.com)
[![bootstrap](https://img.shields.io/badge/CSS%20Fwk-Bootstrap-purple)](https://getbootstrap.com/)
[![jQuery](https://img.shields.io/badge/JS%20Fwk-jQuery-blue)](https://jquery.com/)
2022-01-31 15:34:06 +00:00
[![CodeFactor](https://www.codefactor.io/repository/github/coulisse/spiderweb/badge)](https://www.codefactor.io/repository/github/coulisse/spiderweb)
2021-12-04 06:24:26 +00:00
2023-01-02 06:31:40 +00:00
2023-01-01 22:03:51 +00:00
- **Release:** v2.4
2020-03-14 16:48:56 +00:00
- **Author:** Corrado Gerbaldo - IU1BOW.
- **Mail:** <corrado.gerbaldo@gmail.com>
- **Licensing:** Gpl V3.0 see ["LICENSE"](LICENSE) file.
2023-01-01 22:03:51 +00:00
- **Languages:** This application is written in Python 3.11/flask,Javascript and HTML
2020-03-08 22:09:21 +00:00
___
2020-06-02 06:14:37 +00:00
**DXSpider** is a great DX Cluster software that has a usefull telnet interface.
2020-03-08 22:09:21 +00:00
I wrote this application in order to add a web user interface to DXSpider and show the spots collected.
The user could see 50 spots at time and filter them by band, spotter continent and spotted continent.
2020-02-01 06:12:53 +00:00
2020-02-09 09:03:12 +00:00
For this application I've used:
- **Bootstrap** for stylesheet CSS
2023-01-01 22:03:51 +00:00
- **jQuery**
- **Apache ECharts** for managing charts
2020-02-09 09:03:12 +00:00
- **qrz.com** For each callsing found you can click on lens and you'll see him on qrz.com
2020-10-18 15:19:53 +00:00
- **flag-icon-css** [https://github.com/lipis/flag-icon-css](https://github.com/lipis/flag-icon-css) I used it for show the country flags
2021-05-06 14:54:58 +00:00
- **ng3k.com** [ng3k.com](http://ng3k.com/misc/adxo.html) I used to get information about "Announced Dx Operations". Thanks to Bill/NG3K !!!
2023-01-01 22:03:51 +00:00
- **silso** [sidc.be/silso](https://sidc.be/silso/) used to show propagation trend in "Chart & stats" secion
2020-02-01 06:12:53 +00:00
2020-10-25 18:07:35 +00:00
You can find my web site at [https://www.iu1bow.it](https://www.i1bow.it)
2020-03-12 17:27:40 +00:00
2020-09-20 05:10:13 +00:00
### Changelog
2021-01-12 12:05:57 +00:00
see file ["CHANGELOG.md"](docs/CHANGELOG.md)
2020-09-08 07:31:14 +00:00
2020-03-08 22:09:21 +00:00
### Install
**1) DXSpider**
First of all you have to installed [DXspider] (http://www.dxcluster.org/) and connected with some other cluster nodes.
**2) MariaDB / MySQL**
Then you have to install MariaDB on your web server, on the same server where DXSpider is running and configure DXSpider to use it: in your spider folder edit `local/DXVars.pm` adding these lines:
```DXWars.pm
# the SQL database DBI dsn
$dsn = "dbi:mysql:dxcluster:localhost:3306";
$dbuser = "your-user";
$dbpass = "your-password";
```
If you would change some MariaDB parameters, then you can find them in `/etc/mysql/my.cnf` or `/etc/my.cnf`, depending on your distro.
2020-12-29 14:16:17 +00:00
If the database will not be created automatically, please see ["DB_ISSUES.md"](docs/DB_ISSUES.md)
2020-03-08 22:09:21 +00:00
2021-05-25 10:12:29 +00:00
**3) Python modules**
2021-05-14 12:38:59 +00:00
You could install python modules using automatic or manual way.
2021-05-25 10:12:29 +00:00
*3.1) Automatic modules install*
2021-05-14 12:38:59 +00:00
after downloaded spiderweb move in the main folder and install using requirements.txt file
```console
foo@bar:~$ cd spiderweb
foo@bar:~$ pip install -r requirements.txt
```
2021-05-25 10:12:29 +00:00
*3.2) Manual modules install*
2020-10-04 15:05:07 +00:00
First of all you have to install the python3 pip installer
```console
foo@bar:~$ sudo apt install python3-pip
```
This application is based on Flask
2020-03-08 22:09:21 +00:00
To install **Flask**:
```console
2021-11-28 17:31:32 +00:00
foo@bar:~$ pip install flask
foo@bar:~$ pip install Flask-minify
foo@bar:~$ pip install flask_wtf
2023-01-01 22:03:51 +00:00
foo@bar:~$ pip install pandas
2020-03-08 22:09:21 +00:00
```
2020-10-04 15:05:07 +00:00
Then you have to install mysql libraries**:
2020-03-08 22:09:21 +00:00
```console
2021-05-25 10:12:29 +00:00
foo@bar:~$ pip install mysql-connector-python
foo@bar:~$ pip install --upgrade mysql-connector-python==8.0.12
2020-03-08 22:09:21 +00:00
```
2020-09-26 16:07:19 +00:00
2021-01-12 12:05:57 +00:00
### Configuration
2020-09-26 16:07:19 +00:00
In the path `spiderweb/cfg/` rename `config.json.template` in `config.json`:
2020-03-12 17:27:40 +00:00
```console
2020-09-26 16:07:19 +00:00
foo@bar:~$ mv config.json.template config.json
2020-03-12 17:27:40 +00:00
```
2020-10-11 16:37:38 +00:00
then edit it and set the user and password of your database, the menu items, and other stuffs (callsign, mail address...).
2021-12-19 09:57:19 +00:00
There is also a specific parameter, named "enable_cq_filter" used to enable the CQ Zone filtering.
2021-12-23 15:26:12 +00:00
Othewhise, if you prefer, you could use an utility for edit your configuration and menu. Go in "script" folder and run ./config.sh
2020-03-12 17:27:40 +00:00
2020-10-04 09:13:45 +00:00
```console
foo@bar:~$ cd scripts
foo@bar:~$ ./config.sh
*** DxSpider configuration ***
Configuration file loaded from: ../cfg/config.json
h: help
vc: view config.
ec: edit config.
vm: view menu
em: edit menu
s: save
t: load config. from template
x: exit
Make your choiche:
```
2023-01-01 22:03:51 +00:00
### Crontab
Starting from version 2.4, since all activities are managed by the application, you don't need to schedule anythings
2020-06-02 06:14:37 +00:00
2020-03-08 22:09:21 +00:00
### Run test
Now you can run your web application with the following command:
```console
2020-10-11 10:05:18 +00:00
foo@bar:~$ python3 webapp.py
2020-03-08 22:09:21 +00:00
```
The flask default port is 5000, so you can see your web app, typing `http://localhost:5000` in your web browser.
2020-06-20 05:03:06 +00:00
Keep in mind that the flask web server, usually is used as a test server.
2020-03-08 22:09:21 +00:00
### Production
2020-10-25 18:07:35 +00:00
There are some ways to use it in production.
My configuration is:
Cloudflare + Nginx + Bjoern
2021-05-25 10:12:29 +00:00
**Bjoern is a lightweight WSGI for python.**
2020-10-25 18:07:35 +00:00
2021-01-12 12:05:57 +00:00
for install it:
2020-10-25 18:07:35 +00:00
```console
foo@bar:~$ sudo apt install libev-dev libevdev2
foo@bar:~$ pip3 install bjoern
```
If you want you can make it as a _daemon service_.
Create and edit a file named for example spiderweb.service (in the systemd folder)
```console
foo@bar:~$ sudo nano /etc/systemd/system/spiderweb.service
```
Below an example of configuration:
```console
[Unit]
Description=bjoern instance spiderweb
After=network.target
After=multi-user.target
[Service]
User=web
Group=www-data
Type=simple
WorkingDirectory=/home/web/spiderweb
Environment="PATH=/home/web/spiderweb"
ExecStart=/usr/bin/python3 /home/web/spiderweb/wsgi.py
[Install]
WantedBy=multi-user.target
```
Then you can install and start the daemon:
```console
foo@bar:~$ sudo systemctl enable spiderweb.service
foo@bar:~$ sudo systemctl start spiderweb.service
foo@bar:~$ sudo systemctl status spiderweb.service
● spiderweb.service - bjoern instance spiderweb
Loaded: loaded (/etc/systemd/system/spiderweb.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2020-10-25 09:56:35 UTC; 8h ago
Main PID: 6518 (python3)
Tasks: 1 (limit: 420)
CGroup: /system.slice/spiderweb.service
└─6518 /usr/bin/python3 /home/web/spiderweb/wsgi.py
Oct 25 09:56:35 dxcluster01 systemd[1]: Started bjoern instance spiderweb.
```
2021-05-25 10:12:29 +00:00
Now you can install and configur **NGINX**
2020-10-25 18:07:35 +00:00
2021-05-25 10:12:29 +00:00
Install with:
2020-10-25 18:07:35 +00:00
```console
foo@bar:~$ sudo apt install nginx
```
Configure:
```console
sudo nano /etc/nginx/sites-available/myapp
```
```console
server {
listen 80;
server_name iu1bow.it www.iu1bow.it;
location ^~ /.well-known/ {
alias /home/web/verify/.well-known/;
}
location / {
ssi off;
include proxy_params;
proxy_pass http://localhost:8080/;
proxy_set_header Host $host;
}
}
```
For SSL I'm using [Cloudflare](https://www.cloudflare.com/). This is a free service that alow you to use https and a proxy cache.
2020-03-08 22:09:21 +00:00
2020-12-29 14:16:17 +00:00
**Search engine indexing:** when you are on-line, if you would to index your website on search engines, you have to generate a file named sitemap.xml and put it in /static/ folder. There are many tool to generate sitemap.xml, for example [www.xml-sitemaps.com] (https://www.xml-sitemaps.com/)
2020-09-20 05:10:13 +00:00
2021-01-12 12:05:57 +00:00
**Index on MySQL:** if you would to increase speed on callsign search, you could define some index on the table 'spot'. You can see more details on ["create_mysql_index.sql"](scripts/create_mysql_index.sql)
2020-11-07 10:03:40 +00:00
2022-02-27 06:13:50 +00:00
**Cookie settings:** if you don't use https, but you use http, you have to change the following setting in webapp.py:
```
SESSION_COOKIE_SECURE=True,
```
to
```
SESSION_COOKIE_SECURE=False,
```
2023-01-01 22:03:51 +00:00
### Mobile
This application is designed for desktop and mobile phone. It is a [PWA](https://en.wikipedia.org/wiki/Progressive_web_app) so it could installed and used like an app on mobile.
2020-11-08 10:44:50 +00:00
2021-12-12 14:34:59 +00:00
### API
**Spot list**
You can retrive last spots calling "**/spotlist**"; For example [www.iu1bow.com/spotlist] (https://www.iu1bow.com/spotlist)
**country of a callsign**
You cam retrive some informations about a callsign with **callsign**; For example [www.iu1bow.com/callsign?c=IU1BOW] (https://www.iu1bow.com/callsign?c=IU1BOW)
2020-09-20 09:20:56 +00:00
### Screenshots
----------
2023-01-01 22:03:51 +00:00
**desktop**
<img src="docs/images/01_desktop_main.png" width="300"/>
<img src="docs/images/02_desktop_plot.png" width="300"/>
2023-01-02 06:31:40 +00:00
2023-01-01 22:03:51 +00:00
**mobile**
2023-01-02 06:31:40 +00:00
<p float="left">
2023-01-01 22:03:51 +00:00
<img src="docs/images/m01_mobile.png" width="200"/>
<img src="docs/images/m02_mobile.png" width="200"/>
<img src="docs/images/m03_mobile.png" width="200"/>
<img src="docs/images/m04_mobile.png" width="200"/>
2020-09-26 16:07:19 +00:00
</p>