From 9ea2dc4f2e3d82c0743f4709963f696b73745222 Mon Sep 17 00:00:00 2001 From: Trevor Mack Date: Thu, 25 Jun 2020 10:52:41 -0400 Subject: [PATCH] include nginx and self-signed ssh certificate creation to get raspberrypi setup working with ZSeries which requires http+ssl (#25) --- README.md | 2 +- scripts/pi/firstboot.sh | 63 +++++++++++++++++++++++++++++++++++++++-- server.py | 15 +++++++++- 3 files changed, 76 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8a5c219..66a6ea0 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ Python >= 3.6.9 #### Setup/Run Clone this repo, then run `sudo pip3 install -r requirements.txt` on *nix or `pip3 install -r requirements.txt` as an Administrator in windows -`sudo python3 server.py` on *nix or `python3 server.py` as an Administrator in windows +`sudo python3 server.py` on *nix or `python3 server.py` as an Administrator in windows (default host interface is `0.0.0.0` and port `80`, but these can be specified via command-line arguments like so `python3 server.py `) ## Manual Recipe Editing The table for adding/removing/editing recipe steps has several validation checks in it, but there is always the possiblity of ruining your Pico. diff --git a/scripts/pi/firstboot.sh b/scripts/pi/firstboot.sh index 74c80c2..17e9be2 100644 --- a/scripts/pi/firstboot.sh +++ b/scripts/pi/firstboot.sh @@ -55,7 +55,7 @@ apt -y update #apt -y upgrade apt -y --autoremove purge ifupdown dhcpcd5 isc-dhcp-client isc-dhcp-common rsyslog avahi-daemon apt-mark hold ifupdown dhcpcd5 isc-dhcp-client isc-dhcp-common rsyslog raspberrypi-net-mods openresolv avahi-daemon libnss-mdns -apt -y install libnss-resolve hostapd dnsmasq samba git python3 python3-pip +apt -y install libnss-resolve hostapd dnsmasq samba git python3 python3-pip nginx openssh-server # Install Picobrew server cd / @@ -181,6 +181,7 @@ sed -i 's/.*IGNORE_RESOLVCONF.*/IGNORE_RESOLVCONF=yes/g' /etc/default/dnsmasq # Setup dnsmasq cat >> /etc/dnsmasq.conf <> /etc/hosts < /certs/req.cnf < /certs/bundle.crt + +# Setup nginx for http and https +cat > /etc/nginx/sites-available/picobrew.com.conf < /etc/samba/smb.conf < ".format(sys.argv[0], sys.argv[0])) + sys.exit() + +if len(sys.argv) == 3: + HOST=sys.argv[1] + PORT=sys.argv[2] app = create_app(debug=True) if __name__ == '__main__': - socketio.run(app, host='0.0.0.0', port=80) + socketio.run(app, host=HOST, port=PORT)