From 2a84f09aa919bb576c4b0bfd1fd9552aac7ad3cc Mon Sep 17 00:00:00 2001 From: Craig Bassett Date: Mon, 21 Jun 2021 16:56:38 -0500 Subject: [PATCH] feat: FluiddPI! Signed-off-by: Craig Bassett --- .github/workflows/BuildRaspiOS.yml | 15 +-- .github/workflows/ReleaseRaspiOS.yml | 16 ++-- Makefile | 2 +- README.md | 94 +++++++++++++++---- docker-compose.yml | 2 +- src/README.md | 8 +- src/config | 4 +- src/modules/fluidd/config | 1 + .../home/pi/klipper_config/fluidd.cfg} | 0 .../filesystem/root/etc/logrotate.d/rsyslog | 0 .../root/etc/nginx/conf.d/common_vars.conf | 0 .../root/etc/nginx/conf.d/upstreams.conf | 0 .../root/etc/nginx/sites-available/fluidd} | 8 +- src/modules/fluidd/start_chroot_script | 40 ++++++++ src/modules/mainsail/config | 1 - src/modules/mainsail/start_chroot_script | 39 -------- .../home/pi/klipper_config/webcam.txt | 2 +- .../root/etc/systemd/system/webcamd.service | 2 +- .../filesystem/root/usr/local/bin/webcamd | 2 +- .../home/pi/klipper_config/moonraker.conf | 33 ++++--- 20 files changed, 168 insertions(+), 101 deletions(-) create mode 100644 src/modules/fluidd/config rename src/modules/{mainsail/filesystem/home/pi/klipper_config/mainsail.cfg => fluidd/filesystem/home/pi/klipper_config/fluidd.cfg} (100%) rename src/modules/{mainsail => fluidd}/filesystem/root/etc/logrotate.d/rsyslog (100%) rename src/modules/{mainsail => fluidd}/filesystem/root/etc/nginx/conf.d/common_vars.conf (100%) rename src/modules/{mainsail => fluidd}/filesystem/root/etc/nginx/conf.d/upstreams.conf (100%) rename src/modules/{mainsail/filesystem/root/etc/nginx/sites-available/mainsail => fluidd/filesystem/root/etc/nginx/sites-available/fluidd} (91%) create mode 100644 src/modules/fluidd/start_chroot_script delete mode 100644 src/modules/mainsail/config delete mode 100644 src/modules/mainsail/start_chroot_script diff --git a/.github/workflows/BuildRaspiOS.yml b/.github/workflows/BuildRaspiOS.yml index 36bf101..217a51a 100644 --- a/.github/workflows/BuildRaspiOS.yml +++ b/.github/workflows/BuildRaspiOS.yml @@ -1,4 +1,4 @@ -name: Build MainsailOS - RapsiOS +name: Build FluiddPI - RapsiOS on: push: branches: @@ -7,6 +7,9 @@ on: - '**' pull_request: types: [ opened, edited ] + workflow_dispatch: + schedule: + - cron: '0 0 * * *' jobs: raspiosbuild: @@ -22,7 +25,7 @@ jobs: repository: 'guysoft/CustomPiOS' path: CustomPiOS - - name: Checkout MainsailOS Project + - name: Checkout FluiddPI Project uses: actions/checkout@v2 with: repository: ${{ github.repository }} @@ -39,12 +42,12 @@ jobs: run: sudo modprobe loop && cd repository/src && sudo bash -x ./build_dist - name: Copy output image - run: cp ${{ github.workspace }}/repository/src/workspace/*-raspios-*-lite.img mainsailos-raspios-lite-latest.img + run: cp ${{ github.workspace }}/repository/src/workspace/*-raspios-*-lite.img fluiddpi-raspios-lite-latest.img - name: Compress the image - run: zip mainsailos-raspios-lite-latest.zip mainsailos-raspios-lite-latest.img + run: zip fluiddpi-raspios-lite-latest.zip fluiddpi-raspios-lite-latest.img - uses: actions/upload-artifact@v1 with: - name: mainsailos-raspios-lite-latest.zip - path: mainsailos-raspios-lite-latest.zip \ No newline at end of file + name: fluiddpi-raspios-lite-latest.zip + path: fluiddpi-raspios-lite-latest.zip \ No newline at end of file diff --git a/.github/workflows/ReleaseRaspiOS.yml b/.github/workflows/ReleaseRaspiOS.yml index 2db00c0..58f173f 100644 --- a/.github/workflows/ReleaseRaspiOS.yml +++ b/.github/workflows/ReleaseRaspiOS.yml @@ -1,4 +1,4 @@ -name: Build and Release MainsailOS - RapsiOS +name: Build and Release FluiddPI - RapsiOS on: release: types: [ published ] @@ -17,7 +17,7 @@ jobs: repository: 'guysoft/CustomPiOS' path: CustomPiOS - - name: Checkout MainsailOS Project + - name: Checkout FluiddPI Project uses: actions/checkout@v2 with: repository: ${{ github.repository }} @@ -34,15 +34,15 @@ jobs: run: sudo modprobe loop && cd repository/src && sudo bash -x ./build_dist - name: Copy output image - run: cp ${{ github.workspace }}/repository/src/workspace/*-raspios-*-lite.img mainsailos-raspios-lite-latest.img + run: cp ${{ github.workspace }}/repository/src/workspace/*-raspios-*-lite.img fluiddpi-raspios-lite-latest.img - name: Compress the image - run: zip mainsailos-raspios-lite-latest.zip mainsailos-raspios-lite-latest.img + run: zip fluiddpi-raspios-lite-latest.zip fluiddpi-raspios-lite-latest.img - uses: actions/upload-artifact@v1 with: - name: mainsailos-raspios-lite-latest.zip - path: mainsailos-raspios-lite-latest.zip + name: fluiddpi-raspios-lite-latest.zip + path: fluiddpi-raspios-lite-latest.zip - name: Upload RaspiOS Asset uses: actions/upload-release-asset@v1 @@ -50,6 +50,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ github.event.release.upload_url }} - asset_path: mainsailos-raspios-lite-latest.zip - asset_name: mainsailos-rpi-lite-${{ github.event.release.tag_name }}.zip + asset_path: fluiddpi-raspios-lite-latest.zip + asset_name: fluiddpi-rpi-lite-${{ github.event.release.tag_name }}.zip asset_content_type: application/zip \ No newline at end of file diff --git a/Makefile b/Makefile index a4e7d3a..e2802b0 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ all: build build: verifyimage docker-compose up -d - docker exec -it mainsailos-build build + docker exec -it fluiddpi-build build docker-compose down verifyimage: diff --git a/README.md b/README.md index 3a11be3..af2b85e 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,96 @@ -# Developing +# fluiddpi -## Requirements +A pi image with Klipper, Moonraker and Fluidd pre-installed. + +This repository contains the necessary code to generate the distribution from an existing Raspbian lite distro image. + +## Where to download? + +You can download the latest release [here](https://github.com/cadriel/FluiddPI/releases/latest). + +Older releases can be found [here](https://github.com/cadriel/FluiddPI/releases). + +## How to use? + +1. Download the image as per above and install on an sdcard like you would any other Raspberry pi image. +2. Optionally, if you require WiFi, configure by editing the `fluiddpi-wpa-supplicant.txt` on the root of the sd card - whilst it is still connected to your computer. +3. Boot your Pi from the new sd card. +4. Log into your Pi via SSH (located at `fluiddpi.local`). Default username is `pi` and password is `raspberry`. +5. Best practice would have you; + - `sudo apt-get update` + - `sudo apt-get upgrade` + - `sudo raspi-config` + - Change your password + - Define your timezone via 'Localization Options' + - Optionally Change your hostname +6. Reboot. + +Fluidd will be available at `http://fluiddpi.local` - and will present an error about a missing `printer.cfg` file. + +Please ensure your `printer.cfg` is configured correctly for Fluidd, see the fluidd docs [here](https://docs.fluidd.xyz). Once this is complete, you can now progress with your standard printer setup. + +## Compiling / Developing Quick Start + +Regular users of FluiddPI should **not** need to follow any of these steps. This is +for those that wish to compile their own image and / or help in the development +of this project. + +### Requirements + +Recommended environment is Ubuntu or similar, with docker and docker-compose installed. + +- bash +- git +- [docker](https://docs.docker.com/engine/install/ubuntu/) +- [docker-compose](https://docs.docker.com/compose/install/) - [qemu-arm-static](http://packages.debian.org/sid/qemu-user-static) - [CustomPiOS](https://github.com/guysoft/CustomPiOS) - [Downloaded Raspbian Image](http://www.raspbian.org/) -- Bash -- Git -- [Docker](https://docs.docker.com/engine/install/ubuntu/) -- [Docker-Compose](https://docs.docker.com/compose/install/) - QEMU for emulation -- About 5GB of free diskspace for the build +- around ~5gb free space -### Packages for Ubuntu 18.04/20.04 -** Dekstop variants are known to cause issues during build due to snaps takeing up loop mounts ** ```bash +# Packages for Ubuntu 18.04/20.04 +# Dekstop variants are known to cause issues during build due to snaps takeing up loop mounts ** + sudo apt-get install gawk make build-essential util-linux \ qemu-user-static qemu-system-arm \ git p7zip-full python3 curl ``` -## Compiling source ```bash -git clone https://github.com/raymondh2/MainsailOS.git -cd MainsailOS/ +# To build; +git clone https://github.com/cadriel/FluiddPI.git +cd FluiddPI/ make build ``` -### Other make options ```bash -make clean - Clean all previous build items except the source raspian image -make distclean - Clean up the source image and trigger a new download +# To test; +# To exit emulation - Ctrl-a x +./run.sh +``` + +```bash +# Other make options + +# Clean all previous build items except the source raspian image +make clean + +# Clean up the source image and trigger a new download +make distclean ``` ### Build layout -MainsailOS/emulation - Contains dependencies for emulation testing -MainsailOS/src/image - Contains our base raspbian image -MainsailOS/src/workspace - Created during build, and output for compiled images + +```bash +fluiddpi/ + /emulation - Contains dependencies for emulation testing + /src/image - Contains our base raspbian image + /src/workspace - Created during build, and output for compiled images +``` + +### With Thanks + +FluiddPI wouldn't be possible without the hard work of Raymond Himle, Stefan Dej +and the team behind CustomPiOS. Thank you! diff --git a/docker-compose.yml b/docker-compose.yml index 148fe18..706c394 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ version: '3.6' services: custompios: image: guysoft/custompios:devel - container_name: mainsailos-build + container_name: fluiddpi-build tty: true restart: always privileged: true diff --git a/src/README.md b/src/README.md index a08077a..feae70c 100644 --- a/src/README.md +++ b/src/README.md @@ -1,11 +1,11 @@ -Build MainsailOS From within MainsailOS / OctoPi / Raspbian / Debian / Ubuntu -MainsailOS can be built from Debian, Ubuntu, Raspbian, OctoPi, or even MainsailOS. Build requires about 5 GB of free space available. You can build it by issuing the following commands: +Build FluiddPI From within FluiddPI / OctoPi / Raspbian / Debian / Ubuntu +FluiddPI can be built from Debian, Ubuntu, Raspbian, OctoPi, or even FluiddPI. Build requires about 5 GB of free space available. You can build it by issuing the following commands: sudo apt-get install gawk util-linux qemu-user-static git p7zip-full python3 git clone https://github.com/guysoft/CustomPiOS.git -git clone https://github.com/raymondh2/MainsailOS.git -cd MainsailOS/src/image +git clone https://github.com/cadriel/FluiddPI.git +cd FluiddPI/src/image wget -c --trust-server-names 'https://downloads.raspberrypi.org/raspios_lite_armhf_latest' cd .. ../../CustomPiOS/src/update-custompios-paths diff --git a/src/config b/src/config index dc8a476..2f4cc76 100644 --- a/src/config +++ b/src/config @@ -1,5 +1,5 @@ -export DIST_NAME=MainSailOS +export DIST_NAME=FluiddPI export DIST_VERSION=0.4.0 export BASE_IMAGE_ENLARGEROOT=2000 export BASE_IMAGE_RESIZEROOT=500 -export MODULES="base(network,raspicam,klipper,moonraker,mainsail,mjpgstreamer,password-for-sudo)" \ No newline at end of file +export MODULES="base(network,raspicam,klipper,moonraker,fluidd,mjpgstreamer,password-for-sudo)" \ No newline at end of file diff --git a/src/modules/fluidd/config b/src/modules/fluidd/config new file mode 100644 index 0000000..a0bfd9b --- /dev/null +++ b/src/modules/fluidd/config @@ -0,0 +1 @@ +FLUIDD_VAR="This is a module variable" diff --git a/src/modules/mainsail/filesystem/home/pi/klipper_config/mainsail.cfg b/src/modules/fluidd/filesystem/home/pi/klipper_config/fluidd.cfg similarity index 100% rename from src/modules/mainsail/filesystem/home/pi/klipper_config/mainsail.cfg rename to src/modules/fluidd/filesystem/home/pi/klipper_config/fluidd.cfg diff --git a/src/modules/mainsail/filesystem/root/etc/logrotate.d/rsyslog b/src/modules/fluidd/filesystem/root/etc/logrotate.d/rsyslog similarity index 100% rename from src/modules/mainsail/filesystem/root/etc/logrotate.d/rsyslog rename to src/modules/fluidd/filesystem/root/etc/logrotate.d/rsyslog diff --git a/src/modules/mainsail/filesystem/root/etc/nginx/conf.d/common_vars.conf b/src/modules/fluidd/filesystem/root/etc/nginx/conf.d/common_vars.conf similarity index 100% rename from src/modules/mainsail/filesystem/root/etc/nginx/conf.d/common_vars.conf rename to src/modules/fluidd/filesystem/root/etc/nginx/conf.d/common_vars.conf diff --git a/src/modules/mainsail/filesystem/root/etc/nginx/conf.d/upstreams.conf b/src/modules/fluidd/filesystem/root/etc/nginx/conf.d/upstreams.conf similarity index 100% rename from src/modules/mainsail/filesystem/root/etc/nginx/conf.d/upstreams.conf rename to src/modules/fluidd/filesystem/root/etc/nginx/conf.d/upstreams.conf diff --git a/src/modules/mainsail/filesystem/root/etc/nginx/sites-available/mainsail b/src/modules/fluidd/filesystem/root/etc/nginx/sites-available/fluidd similarity index 91% rename from src/modules/mainsail/filesystem/root/etc/nginx/sites-available/mainsail rename to src/modules/fluidd/filesystem/root/etc/nginx/sites-available/fluidd index 1022a79..1c2b1ec 100644 --- a/src/modules/mainsail/filesystem/root/etc/nginx/sites-available/mainsail +++ b/src/modules/fluidd/filesystem/root/etc/nginx/sites-available/fluidd @@ -1,8 +1,8 @@ server { listen 80 default_server; - access_log /var/log/nginx/mainsail-access.log; - error_log /var/log/nginx/mainsail-error.log; + access_log /var/log/nginx/fluidd-access.log; + error_log /var/log/nginx/fluidd-error.log; # disable this section on smaller hardware like a pi zero gzip on; @@ -14,8 +14,8 @@ server { gzip_http_version 1.1; gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/json application/xml; - # web_path from mainsail static files - root /home/pi/mainsail; + # web_path from fluidd static files + root /home/pi/fluidd; index index.html; server_name _; diff --git a/src/modules/fluidd/start_chroot_script b/src/modules/fluidd/start_chroot_script new file mode 100644 index 0000000..e22e4e1 --- /dev/null +++ b/src/modules/fluidd/start_chroot_script @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +# Fluidd installation script +# Installs Fluidd and nginx +# Originally Written by Raymond Himle +# With contributions from Meteyou and Cadriel +# With thanks to KevinOConnor & Arksine +# GPL V3 +######## + + +# Source error handling, leave this in place +set -x +set -e + +source /common.sh +install_cleanup_trap + +unpack /filesystem/home/pi /home/pi pi + +echo "Installing Fluidd" + +apt update +apt install nginx -y +rm /etc/nginx/sites-enabled/default +ln -s /etc/nginx/sites-available/fluidd /etc/nginx/sites-enabled/ +cd /home/pi/ +[ ! -d /home/pi/gcode_files ] && su -c "mkdir /home/pi/gcode_files" - pi +su -c "mkdir /home/pi/fluidd" - pi +su -c "wget -q -O fluidd.zip https://github.com/cadriel/fluidd/releases/latest/download/fluidd.zip" - pi +su -c "unzip fluidd.zip -d /home/pi/fluidd" - pi +rm /home/pi/fluidd.zip + +# link logfiles to klipper_logs +ln -s /var/log/nginx/fluidd-access.log /home/pi/klipper_logs/ +ln -s /var/log/nginx/fluidd-error.log /home/pi/klipper_logs/ + +# Run installation steps defined above + +# Unpack root at the end, so files are modified before +unpack /filesystem/root / \ No newline at end of file diff --git a/src/modules/mainsail/config b/src/modules/mainsail/config deleted file mode 100644 index f61b899..0000000 --- a/src/modules/mainsail/config +++ /dev/null @@ -1 +0,0 @@ -MAINSAIL_VAR="This is a module variable" diff --git a/src/modules/mainsail/start_chroot_script b/src/modules/mainsail/start_chroot_script deleted file mode 100644 index 7159608..0000000 --- a/src/modules/mainsail/start_chroot_script +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env bash -# MainSail installation script -# Installs MainSail and nginx -# Written by Raymond Himle -# Thanks to meteyou -# GPL V3 -######## - - -# Source error handling, leave this in place -set -x -set -e - -source /common.sh -install_cleanup_trap - -unpack /filesystem/home/pi /home/pi pi - -echo "Installing Mainsail" - -apt update -apt install nginx -y -rm /etc/nginx/sites-enabled/default -ln -s /etc/nginx/sites-available/mainsail /etc/nginx/sites-enabled/ -cd /home/pi/ -[ ! -d /home/pi/gcode_files ] && su -c "mkdir /home/pi/gcode_files" - pi -su -c "mkdir /home/pi/mainsail" - pi -su -c "wget -q -O mainsail.zip https://github.com/meteyou/mainsail/releases/latest/download/mainsail.zip" - pi -su -c "unzip mainsail.zip -d /home/pi/mainsail" - pi -rm /home/pi/mainsail.zip - -# link logfiles to klipper_logs -ln -s /var/log/nginx/mainsail-access.log /home/pi/klipper_logs/ -ln -s /var/log/nginx/mainsail-error.log /home/pi/klipper_logs/ - -# Run installation steps defined above - -# Unpack root at the end, so files are modified before -unpack /filesystem/root / \ No newline at end of file diff --git a/src/modules/mjpgstreamer/filesystem/home/pi/klipper_config/webcam.txt b/src/modules/mjpgstreamer/filesystem/home/pi/klipper_config/webcam.txt index e8bd44c..8b7bb9c 100644 --- a/src/modules/mjpgstreamer/filesystem/home/pi/klipper_config/webcam.txt +++ b/src/modules/mjpgstreamer/filesystem/home/pi/klipper_config/webcam.txt @@ -68,7 +68,7 @@ # # Current working directory is the mjpg-streamer base directory. # -#camera_http_webroot="./www-mainsail" +#camera_http_webroot="./www-fluidd" #camera_http_options="-n" ### EXPERIMENTAL diff --git a/src/modules/mjpgstreamer/filesystem/root/etc/systemd/system/webcamd.service b/src/modules/mjpgstreamer/filesystem/root/etc/systemd/system/webcamd.service index d5c1211..4758526 100644 --- a/src/modules/mjpgstreamer/filesystem/root/etc/systemd/system/webcamd.service +++ b/src/modules/mjpgstreamer/filesystem/root/etc/systemd/system/webcamd.service @@ -1,6 +1,6 @@ [Unit] -Description=the MainsailOS webcam daemon (based on OctoPi) with the user specified config +Description=the FluiddPI webcam daemon (based on OctoPi) with the user specified config [Service] WorkingDirectory=/usr/local/bin diff --git a/src/modules/mjpgstreamer/filesystem/root/usr/local/bin/webcamd b/src/modules/mjpgstreamer/filesystem/root/usr/local/bin/webcamd index 7d3dbed..f19c39c 100755 --- a/src/modules/mjpgstreamer/filesystem/root/usr/local/bin/webcamd +++ b/src/modules/mjpgstreamer/filesystem/root/usr/local/bin/webcamd @@ -23,7 +23,7 @@ echo "Starting up webcamDaemon..." echo "" cfg_files=() -#cfg_files+=/boot/mainsail.txt +#cfg_files+=/boot/fluidd.txt if [[ -d ${config_dir} ]]; then cfg_files+=( `ls ${config_dir}/webcam*.txt` ) fi diff --git a/src/modules/moonraker/filesystem/home/pi/klipper_config/moonraker.conf b/src/modules/moonraker/filesystem/home/pi/klipper_config/moonraker.conf index 27794e4..10ddd21 100644 --- a/src/modules/moonraker/filesystem/home/pi/klipper_config/moonraker.conf +++ b/src/modules/moonraker/filesystem/home/pi/klipper_config/moonraker.conf @@ -3,22 +3,25 @@ host: 0.0.0.0 port: 7125 enable_debug_logging: False config_path: ~/klipper_config +temperature_store_size: 600 +gcode_store_size: 1000 log_path: ~/klipper_logs [authorization] +force_logins: True cors_domains: - https://my.mainsail.xyz - http://my.mainsail.xyz - http://*.local - http://*.lan + *.local + *.lan + *://app.fluidd.xyz + trusted_clients: - 10.0.0.0/8 - 127.0.0.0/8 - 169.254.0.0/16 - 172.16.0.0/12 - 192.168.0.0/16 - FE80::/10 - ::1/128 + 10.0.0.0/8 + 127.0.0.0/8 + 169.254.0.0/16 + 172.16.0.0/12 + 192.168.0.0/16 + FE80::/10 + ::1/128 # enables partial support of Octoprint API [octoprint_compat] @@ -28,8 +31,10 @@ trusted_clients: # this enables moonraker's update manager [update_manager] +enable_auto_refresh: True -[update_manager client mainsail] +# this enabled fluidd updates +[update_manager client fluidd] type: web -repo: meteyou/mainsail -path: ~/mainsail \ No newline at end of file +repo: cadriel/fluidd +path: ~/fluidd \ No newline at end of file