Finish up initial migration to ubuntu for docs

This commit is contained in:
KemoNine 2020-08-03 16:03:07 +00:00
parent ff211ac1b1
commit b3140d5ced
14 changed files with 168 additions and 174 deletions

View file

@ -14,17 +14,17 @@ Items marked ```REQUIRED``` are assumed to be setup and working. You've been war
* [Base Firmware (REQUIRED)](base.md)
* [Finalize Setup (REQUIRED)](finalize_setup.md)
* [Setup swap (REQUIRED)](swap.md)
* [CPU Governor](cpu_governor.md)
* [Additional Networking Setup (REQUIRED)](networking.md)
* [Slideshow Prep (REQUIRED)](slideshow_prep.md)
* [Slideshow Setup (REQUIRED)](slideshow.md)
* [Email Notifications (REQUIRED)](email_notifications.md)
* [cron / Scheduler (REQUIRED)](cron.md)
* [Backups via restic](restic.md)
* [Additional Networking Setup (REQUIRED)](cockpit.md)
* [Web Dashboard / Landing Page](landing_page.md)
* [System Monitoring (REQUIRED)](monit.md)
* [Resource Monitoring](munin.md)
* [HDMI Scheduled On/Off](scheduled_display.md)
* [CPU Governor](cpu_governor.md)
* [Backups via restic](restic.md)
* [Web Based Administration](cockpit.md)
* [Web Dashboard / Landing Page](landing_page.md)
* [Web File Manager (Picture Sync)](filebrowser.md)
* [SyncThing (Picture Sync)](syncthing.md)
* [rclone (Picture Sync)](rclone.md)
* [HDMI Scheduled On/Off](scheduled_display.md)
* [Resource Monitoring](munin.md)

View file

@ -2,17 +2,12 @@
The below commands will setup ```cockpit``` so you can manage your PiFrame from a web browser. This is wholly optional but can be useful when ssh/serial terminal access aren't available.
If you don't want the admin UI you still should install ```NetworkManager``` and ```firewalld``` as the rest of the documentation assumes these are installed.
``` sh
# Remote management on http://ip:9090
pacman -S cockpit cockpit-pcp packagekit udisks2 networkmanager firewalld
systemctl enable --now firewalld
apt install cockpit
firewall-cmd --zone=public --permanent --add-port=9090/tcp
firewall-cmd --zone=public --permanent --add-service=ssh
firewall-cmd --reload
systemctl enable --now NetworkManager
systemctl enable --now cockpit.socket
```

View file

@ -1,23 +0,0 @@
# cron/Scheduler
The below commands will setup a cron daemon (scheduler) for running things like backups, statistic gathering and more via a schedule. While technically not required, we *strongly* recommend using cron for backups so you get the output via e-mail (or similar). This is also required if you want to monitor resource utilization via ```munin```.
## Important Notes
* This assumes you have setup ```msmtp``` for email notifications
## Setup
``` sh
pacman -S cronie
mkdir /etc/systemd/system/cronie.service.d
cat > /etc/systemd/system/cronie.service.d/override.conf <<EOF
[Service]
ExecStart=
ExecStart=/usr/bin/crond -n -m '/usr/bin/msmtp -t'
EOF
systemctl daemon-reload
systemctl enable --now cronie
```

View file

@ -12,7 +12,7 @@ This is optional but strongly recommended to setup.
``` sh
pacman -S msmtp msmtp-mta
apt install msmtp msmtp-mta
cat > /etc/aliases <<EOF
# Example aliases file

View file

@ -13,18 +13,18 @@ The below will setup ```filebrowser``` as a file manager for your photos on the
``` sh
curl -fsSL https://filebrowser.org/get.sh | bash
mkdir /home/feh/filebrowser
filebrowser -c /home/feh/filebrowser/pictures.config \
mkdir /home/fim/filebrowser
filebrowser -d /home/fim/filebrowser/pictures.db \
config init
filebrowser -c /home/feh/filebrowser/pictures.config \
filebrowser -d /home/fim/filebrowser/pictures.db \
config set --address 0.0.0.0
filebrowser -c /home/feh/filebrowser/pictures.config \
filebrowser -d /home/fim/filebrowser/pictures.db \
config set --port 9191
filebrowser -c /home/feh/filebrowser/pictures.config \
filebrowser -d /home/fim/filebrowser/pictures.db \
config set --branding.name "PiFrame - Pictures"
filebrowser -c /home/feh/filebrowser/pictures.config \
filebrowser -d /home/fim/filebrowser/pictures.db \
users add admin apassword
chown feh: -R /home/feh/filebrowser
chown fim: -R /home/fim/filebrowser
firewall-cmd --zone=public --permanent --add-port=9191/tcp
firewall-cmd --reload
cat > /etc/systemd/system/filebrowser-pictures.service <<EOF
@ -33,9 +33,9 @@ Description=Filebrowser - Pictures
After=network.target
[Service]
User=feh
User=fim
PrivateTmp=true
ExecStart=/usr/local/bin/filebrowser -c /home/feh/filebrowser/pictures.config -d /home/feh/filebrowser/pictures.db -r /tank/pictures --img-processors 1 --disable-thumbnails
ExecStart=/usr/local/bin/filebrowser -d /home/fim/filebrowser/pictures.db -r /tank/pictures --img-processors 1 --disable-thumbnails
[Install]
WantedBy=multi-user.target

View file

@ -32,7 +32,7 @@ systemctl reboot
sudo -sHu root /bin/bash
# Useful packages
apt install build-essential cmake nano tmux vim htop iotop nload git
apt install build-essential cmake nano tmux vim htop iotop nload git net-tools
# Raspberry Pi tools
apt install linux-tools-raspi

View file

@ -16,11 +16,8 @@ The below commands will setup a basic web server and a landing page for your PiF
# web server w/ useful links
########################################
pacman -S lighttpd
mkdir /etc/lighttpd/conf.d
echo "include \"/etc/lighttpd/conf.d/*.conf\"" >> /etc/lighttpd/lighttpd.conf
mkdir /srv/http
cat > /srv/http/index.html <<EOF
apt install lighttpd
cat > /var/www/html/index.html <<EOF
<html>
<head>

View file

@ -4,32 +4,31 @@ The below commands will setup ```monit``` to track key elements of the PiFrame h
``` sh
pacman -S monit
mkdir /etc/monit.d
nano -w /etc/monitrc
include /etc/monit.d/*
apt install monit
nano -w /etc/monit/monitrc
set httpd port 2812 and
use address 0.0.0.0
allow admin:monit
set mailserver domain.tld port 587
username "piframe@domain.tld" password "apassword"
using tls
cat > /etc/monit.d/rootfs <<EOF
cat > /etc/monit/conf.d/rootfs <<EOF
check filesystem rootfs with path /
if space usage > 80% then alert
EOF
cat > /etc/monit.d/tankfs <<EOF
cat > /etc/monit/conf.d/tankfs <<EOF
check filesystem tankfs with path /tank
if space usage > 80% then alert
EOF
cat > /etc/monit.d/feh <<EOF
check process feh matching /usr/bin/feh
start program = "/usr/bin/systemctl start greetd"
stop program = "/usr/bin/systemctl stop greetd"
cat > /etc/monit/conf.d/fim <<EOF
check process fim matching /usr/bin/fim
start program = "/usr/bin/systemctl start fim"
stop program = "/usr/bin/systemctl stop fim"
if does not exist then alert
if does not exist for 2 cycles then restart
EOF
systemctl enable --now monit
systemctl restart monit
firewall-cmd --zone=public --permanent --add-port=2812/tcp
firewall-cmd --reload

View file

@ -11,19 +11,19 @@ The below commands will setup ```munin``` for monitoring resource utilization on
``` sh
pacman -S munin perl-cgi-fast
apt install munin
nano -w /etc/munin/munin.conf
graph_strategy cgi
html_strategy cron
[piframe]
address 127.0.0.1
use_node_name yes
chown munin: /var/lib/munin/cgi-tmp
chown munin: -R /usr/share/munin/www
touch /var/log/munin/munin-cgi-graph.log
chown munin: /var/log/munin/munin-cgi-graph.log
munin-node-configure --shell # activate useful plugins
sudo -sHu munin munin-cron # prime munin data
systemctl enable --now munin-node
crontab /etc/munin/munin-cron-entry -u munin
systemctl restart munin-node
cat > /etc/lighttpd/lighttpd-munin.conf <<EOF
# Apply the following tweaks to the /etc/munin/munin.conf file ahead of running lighttpd for munin
## Use cgi rendering for graph and html
@ -33,10 +33,11 @@ cat > /etc/lighttpd/lighttpd-munin.conf <<EOF
server.username = "munin"
server.groupname = "munin"
server.document-root = "/srv/http"
server.document-root = "/var/www/html"
server.port = 2813
server.errorlog = "/var/log/munin/lighttpd-error.log"
server.errorlog = "/dev/stdout"
accesslog.filename = "/dev/stdout"
dir-listing.activate = "disable"
server.modules = (
"mod_access",
@ -47,18 +48,19 @@ server.modules = (
"mod_cgi",
"mod_fastcgi",
)
server.pid-file = "/run/lighttpd-munin.pid"
server.follow-symlink = "enable"
index-file.names = ( "index.html", "index.htm" )
url.redirect += ( "^/*$" => "/munin/" )
\$HTTP["url"] =~ "/munin-cgi/munin-cgi-graph" {
alias.url += ( "/munin-cgi/munin-cgi-graph" => "/usr/share/munin/cgi/munin-cgi-graph" )
alias.url += ( "/munin-cgi/munin-cgi-graph" => "/usr/lib/munin/cgi/munin-cgi-graph" )
cgi.assign = ( "" => "" )
}
#alias.url += ( "/munin/static" => "/etc/munin/static" )
alias.url += ( "/munin" => "/usr/share/munin/www" )
alias.url += ( "/munin/static" => "/etc/munin/static" )
alias.url += ( "/munin" => "/var/cache/munin/www" )
mimetype.assign = (
".html" => "text/html",
@ -79,7 +81,7 @@ After=syslog.target network.target
[Service]
PrivateTmp=true
ExecStart=/usr/bin/lighttpd-angel -D -f /etc/lighttpd/lighttpd-munin.conf
ExecStart=/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd-munin.conf
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGINT

31
docs/networking.md Normal file
View file

@ -0,0 +1,31 @@
# Networking Setup
The below commands will setup ```NetworkManager``` and ```firewalld``` for the networking infrastructure. These tools are a bit easier to work with via the web (See the Cockpit docs) and NetworkManager is commonly found when working with Raspberry Pi Documentation. We have kept ufw for the time being as a lot of Ubuntu meta packages assume it to be present.
``` sh
apt install network-manager firewalld
rm /etc/netplan/50-cloud-init.yaml
systemctl disable systemd-networkd.service
systemctl mask systemd-networkd.service
systemctl stop systemd-networkd.service
cat > /etc/netplan/50-cloud-init.yaml <<EOF
network:
version: 2
renderer: NetworkManager
EOF
netplan generate
ufw disable
systemctl disable ufw
firewall-cmd --zone=public --permanent --add-service=ssh
firewall-cmd --reload
systemctl enable --now NetworkManager
systemctl enable --now firewalld
# Setup Ethernet
# Setup by the above netplan tweaks
# Setup Wifi (optional)
nmtui
```

View file

@ -16,7 +16,11 @@ The below commands will setup a **local** backup of your photo frame using ```re
# restic backups
########################################
pacman -S restic
wget https://github.com/restic/restic/releases/download/v0.9.6/restic_0.9.6_linux_arm64.bz2
bunzip2 restic_0.9.6_linux_arm64.bz2
mv restic_0.9.6_linux_arm64 /usr/local/bin/restic
chmod a+x /usr/local/bin/restic
restic self-update
btrfs subvolume create /tank/backup
restic init -r /tank/backup
cat > /root/restic_backup.sh <<EOF

View file

@ -211,7 +211,7 @@ systemctl daemon-reload
systemctl enable --now no-cursor-tty1
systemctl enable --now fim
apt install incron
cat > /etc/incron.d/feh <<EOF
cat > /etc/incron.d/fim <<EOF
/tank/pictures IN_DELETE systemctl restart fim
EOF
systemctl enable --now incrond

View file

@ -4,10 +4,12 @@ The below will setup ```syncthing``` and give some basics for setup. This is who
``` sh
pacman -S syncthing
curl -s https://syncthing.net/release-key.txt | sudo apt-key add -
echo "deb https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list
apt update & apt install syncthing
touch /tank/pictures/.stfolder
chown feh: /tank/pictures/.stfolder
systemctl enable --now syncthing@feh.service # use feh user so perms are right for pics
chown fim: /tank/pictures/.stfolder
systemctl enable --now syncthing@fim.service # use feh user so perms are right for pics
ssh -L 8385:127.0.0.1:8384 user@piframe
http://localhost:8385
Change settings

View file

@ -1,13 +0,0 @@
# WiFi
Below are some handy commands and notes regarding WiFi on the Raspberry Pi 4.
``` sh
# Wifi config using NetworkManager
nmtui
# Vanilla WiFi config (you probably don't want this if you're following our docs)
wifi-menu
```