MJPG, OctoPrint build, first-time and Nginx improvements

First-time will now ask you to configure your timezone

MJPG Streamer now has -w because that was needed according to the
internet

OctoPrint build now no longer makes useless folder

Nginx now has HSTS header to save some typing

FFmpeg is now installed
This commit is contained in:
Logan G 2020-08-16 16:15:54 -06:00
parent 4550badacd
commit a3fff10d3f
Signed by: logan
GPG key ID: E328528C921E7A7A
8 changed files with 20 additions and 11 deletions

View file

@ -13,3 +13,5 @@
- Wayland using labwc/waybox - Wayland using labwc/waybox
- Python 3 - Python 3
- Detect if frontend did not load correctly (probably not easy) - Detect if frontend did not load correctly (probably not easy)
- HTTP/Port 80 redirect

View file

@ -4,4 +4,5 @@ python-setuptools
python-virtualenv python-virtualenv
git git
libyaml-dev libyaml-dev
nginx nginx
ffmpeg

View file

@ -7,12 +7,10 @@ echo -e "listen 443;" > ${ROOTFS_DIR}/etc/nginx/listen.conf
on_chroot << EOF on_chroot << EOF
# If OctoPrint already exists, skip this (for debugging) # If OctoPrint already exists, skip this (for debugging)
if [[ ! -f /srv/octoprint/venv/bin/octoprint ]]; then if [[ ! -f /srv/octoprint/bin/octoprint ]]; then
if [[ ! -d /srv/octoprint ]]; then mkdir -p /srv/octoprint; fi cd /srv/ || exit 1
cd /srv/octoprint || exit 1 virtualenv octoprint || exit 1
# https://community.octoprint.org/t/setting-up-octoprint-on-a-raspberry-pi-running-raspbian/2337/ source octoprint/bin/activate || exit 1
virtualenv venv || exit 1
source venv/bin/activate || exit 1
pip install pip --upgrade pip install pip --upgrade
pip install octoprint || exit 1 pip install octoprint || exit 1
# Fix permissions # Fix permissions

View file

@ -22,12 +22,13 @@
upstream "mjpg-streamer" { upstream "mjpg-streamer" {
server 127.0.0.1:8080; server 127.0.0.1:8080;
} }
server { server {
include /etc/nginx/listen.conf; include /etc/nginx/listen.conf;
ssl on; ssl on;
ssl_certificate /etc/ssl/certs/nginx-octoprint.crt; ssl_certificate /etc/ssl/certs/nginx-octoprint.crt;
ssl_certificate_key /etc/ssl/private/nginx-octoprint.key; ssl_certificate_key /etc/ssl/private/nginx-octoprint.key;
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains";
server_name localhost; server_name localhost;
location / { location / {

View file

@ -6,7 +6,7 @@ Wants=nginx.service
Type=simple Type=simple
User=octoprint User=octoprint
Group=octoprint Group=octoprint
ExecStart=/srv/octoprint/venv/bin/octoprint --host localhost --port 5000 ExecStart=/srv/octoprint/bin/octoprint --host localhost --port 5000
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View file

@ -16,6 +16,10 @@ if ! which mjpg_streamer; then
cd / cd /
# Cleanup # Cleanup
rm -rf /tmp/mjpg-streamer rm -rf /tmp/mjpg-streamer
# Create needed folder
mkdir -p /var/www/mjpg
# Permissions
chown octoprint:octoprint /var/www/mjpg
fi fi
EOF EOF

View file

@ -1,2 +1,2 @@
#!/bin/bash #!/bin/bash
/usr/local/bin/mjpg_streamer -i input_uvc.so -o "output_http.so --port 8080" /usr/local/bin/mjpg_streamer -i input_uvc.so -o "output_http.so --port 8080 -w /var/www/mjpg"

View file

@ -12,7 +12,7 @@ source /usr/local/lib/octo-lib.sh
install_package () { install_package () {
echo "==========Installing $1==========" >>/home/pi/install.log echo "==========Installing $1==========" >>/home/pi/install.log
source /srv/octoprint/venv/bin/activate || return 1 source /srv/octoprint/bin/activate || return 1
pip install $1 2>&1 >>/home/pi/install.log || return 1 pip install $1 2>&1 >>/home/pi/install.log || return 1
} }
@ -72,6 +72,9 @@ change_password
dialog --title "Network Configuration" --nocancel --msgbox "Setup will now open nmtui, a program to help configure your ethernet/wireless interfaces. Hit Quit when you are done." 10 50 dialog --title "Network Configuration" --nocancel --msgbox "Setup will now open nmtui, a program to help configure your ethernet/wireless interfaces. Hit Quit when you are done." 10 50
nmtui nmtui
# Configure the timezone
dpkg-reconfigure tzdata
# Enable/disable OctoPrint, GUI, MJPG and SSH # Enable/disable OctoPrint, GUI, MJPG and SSH
service_select service_select