Skip to content

Commit

Permalink
feat: FluiddPI!
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Bassett <craig.bassett@gmail.com>
  • Loading branch information
cadriel committed Jun 21, 2021
1 parent 73b62a6 commit 2a84f09
Show file tree
Hide file tree
Showing 20 changed files with 168 additions and 101 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/BuildRaspiOS.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build MainsailOS - RapsiOS
name: Build FluiddPI - RapsiOS
on:
push:
branches:
Expand All @@ -7,6 +7,9 @@ on:
- '**'
pull_request:
types: [ opened, edited ]
workflow_dispatch:
schedule:
- cron: '0 0 * * *'

jobs:
raspiosbuild:
Expand All @@ -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 }}
Expand All @@ -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
name: fluiddpi-raspios-lite-latest.zip
path: fluiddpi-raspios-lite-latest.zip
16 changes: 8 additions & 8 deletions .github/workflows/ReleaseRaspiOS.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Release MainsailOS - RapsiOS
name: Build and Release FluiddPI - RapsiOS
on:
release:
types: [ published ]
Expand All @@ -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 }}
Expand All @@ -34,22 +34,22 @@ 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
env:
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
94 changes: 76 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -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!
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/config
Original file line number Diff line number Diff line change
@@ -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)"
export MODULES="base(network,raspicam,klipper,moonraker,fluidd,mjpgstreamer,password-for-sudo)"
1 change: 1 addition & 0 deletions src/modules/fluidd/config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FLUIDD_VAR="This is a module variable"
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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 _;
Expand Down
40 changes: 40 additions & 0 deletions src/modules/fluidd/start_chroot_script
Original file line number Diff line number Diff line change
@@ -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 /
1 change: 0 additions & 1 deletion src/modules/mainsail/config

This file was deleted.

39 changes: 0 additions & 39 deletions src/modules/mainsail/start_chroot_script

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 2a84f09

Please sign in to comment.