diff --git a/README.md b/README.md index 86f37a4..9f7d042 100644 --- a/README.md +++ b/README.md @@ -79,13 +79,49 @@ Check the service has started up correctly with `sudo journalctl -u spothole -f` ### nginx Reverse Proxy configuration -TODO nginx +It's best not to serve Spothole directly on port 80, as that requires root privileges and prevents us using HTTPS, amongst other reasons. To set up nginx as a reverse proxy that sits in front of Spothole, first ensure it's installed e.g. `sudo apt install nginx`, and enabled e.g. `sudo systemd enable nginx`. -TODO certbot +Create a file at `/etc/nginx/sites-available/` called `spothole`. Give it the following contents, replacing `spothole.m0trt.radio` with the domain name on which you want to run Spothole. If you changed the port on which Spothole runs, update that on the "proxy_pass" line too. + +```nginx +server { + server_name spothole.m0trt.radio; + + # Wellknown area for Lets Encrypt + location /.well-known/ { + alias /var/www/html/.well-known/; + } + + location / { + proxy_pass http://127.0.0.1:8080; + } +} +``` + +Now, make a symbolic link to enable the site: + +```bash +cd /etc/nginx/sites-enabled +sudo ln -sf ../sites-available/spothole +``` + +Test that your nginx config isn't broken using `nginx -t`. If it works, restart nginx with `sudo systemctl restart nginx`. + +If you haven't already done so, set up a DNS entry to make sure requests for your domain name end up at the server that's running Spothole. + +You should now be able to access the web interface by going to the domain from your browser. + +Once that's working, [install certbot](https://certbot.eff.org/instructions?ws=nginx&os=snap) onto your server. Run it as root, and when prompted pick your domain name from the list. After a few seconds, it should successfully provision a certificate and modify your nginx config files automatically. You should then be able to access the site via HTTPS. ### Writing your own client -TODO +Various approaches exist to writing your own client, but in general: + +* Refer to the API docs. These are built on an OpenAPI definition file (`/webassets/apidocs/openapi.yml`), which you can automatically use to generate a client skeleton using various software. +* Call the main "spots" API to get the data you want. Apply filters if necessary. +* Call the "options" API to get an idea of which bands, modes etc. the server knows about. You might want to do that first before calling the spots API. +* Refer to the provided HTML/JS interface for a reference +* Let me know if you get stuck, I'm happy to help! ### Extending the server @@ -103,8 +139,10 @@ When constructing spots, use the comments in the Spot class and the existing imp Finally, simply add the appropriate config to the `providers` section of `config.yml`, and your provider should be instantiated on startup. -### Third Party Libraries +### Thanks The project contains a self-hosted copy of Font Awesome's free library, in the `/webasset/fa/` directory. This is subject to Font Awesome's licence and is not covered by the overall licence declared in the `LICENSE` file. This approach was taken in preference to using their hosted kits due to the popularity of this project exceeding the page view limit for their free hosted offering. The software uses a number of Python libraries as listed in `requirements.txt`, and a number of JavaScript libraries such as jQuery and moment.js. This project would not have been possible without these libraries, so many thanks to their developers. + +The project's name was suggested by Harm, DK4HAA. Thanks!