From 7c69a8edd2532bac6e88672b7487eb0e25375b1e Mon Sep 17 00:00:00 2001 From: Jakub Janeczko Date: Wed, 16 Sep 2020 12:37:46 +0200 Subject: [PATCH] Add deployment example using FastCGI server and lighttpd --- README.md | 4 ++++ examples/lighttpd.conf.example | 11 +++++++++++ examples/ycast.fcgi.example | 17 +++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 examples/lighttpd.conf.example create mode 100644 examples/ycast.fcgi.example diff --git a/README.md b/README.md index c3c30d1..a8a4232 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,10 @@ This can be used together with [this systemd service example](examples/ycast.ser You can also setup a proper WSGI server. See the [official Flask documentation](https://flask.palletsprojects.com/en/1.1.x/deploying/). +For example deployment on embedded device have a look at: + * [ycast.fcgi](examples/ycast.fcgi.example) - FastCGI server file using [flup](https://www.saddi.com/software/flup/). + * [lighttpd configuration stub](examples/lighttpd.conf.example) for YCast FastCGI server. + ### Custom stations If you want to use the 'My Stations' feature, create a `stations.yml` and run YCast with the `-c` switch to specify the path to it. The config follows a basic YAML structure (see below). diff --git a/examples/lighttpd.conf.example b/examples/lighttpd.conf.example new file mode 100644 index 0000000..542b8d3 --- /dev/null +++ b/examples/lighttpd.conf.example @@ -0,0 +1,11 @@ +$HTTP["host"] =~ ".(radiosetup|vtuner).com" { +fastcgi.server = ( + "/" => + (( "socket" => "/tmp/ycast-fcgi.sock", + "bin-path" => "/jffs/srv/ycast.fcgi", + "check-local" => "disable", + "max-procs" => 1, + "fix-root-scriptname" => "enable", + )) +) +} diff --git a/examples/ycast.fcgi.example b/examples/ycast.fcgi.example new file mode 100644 index 0000000..866d77e --- /dev/null +++ b/examples/ycast.fcgi.example @@ -0,0 +1,17 @@ +#!/opt/bin/python + +# Path to cloned YCast repository +PATH_YCAST = '/jffs/srv/YCast' + +# Path to my stations file +PATH_MY_STATIONS = '/jffs/www/stations.yml' + +import sys +sys.path.insert(0, PATH_YCAST) + +from flup.server.fcgi import WSGIServer +from ycast import server + +if __name__ == '__main__': + server.check_my_stations_feature(PATH_MY_STATIONS) + WSGIServer(server.app).run()