Skip to content

Commit

Permalink
Merge pull request #637 from jay-m-dev/deploy-rpi
Browse files Browse the repository at this point in the history
Update build_rpi instructions
  • Loading branch information
jay-m-dev authored Nov 8, 2023
2 parents 0a04150 + 3484c84 commit 19d9882
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 5 deletions.
30 changes: 25 additions & 5 deletions raspberrypi/build_rpi/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,33 @@
a. verify that docker is installed. Run `docker --version`
4. save the autostart file in /etc/xdg/openbox/
5. copy the .bash_profile file into the initial user's home directory (~/.bash_profile)
6. copy the ./Aliro/raspberrypi/intropage directory into the user's home directory (~/intropage)
7. copy the extracted contents of the Aliro-*.zip file from the GitHub release page into the user's home page. (~/target)
8. change directory into ~/target/production/Aliro-*/ and run `docker compose pull`
6. copy the ./Aliro/raspberrypi/intropage directory into the root directory (/intropage)
7. copy the extracted contents of the Aliro-*.zip file from the GitHub release page into the root directory. (/target)
8. change directory into /target/production/Aliro-*/ and run `docker compose pull`
**NOTE:** The docker images will only be **pulled**. The containers will not be built inside the Pi (to keep the final custom OS as light as possible)
9. run clean.sh
9. copy the aliroed-compose.service file in /etc/systemd/system/ (`sudo cp aliroed-compose.service /etc/systemd/system/`
10. enable the aliroed-compose service with `sudo systemctl enable aliroed-compose.service`
12. Remove any unused kernels:
use `uname -r` to check the current kernel in use
use `dpkg -l | grep linux-image` to see a list of installed kernels
remove the ones we don't need with `sudo apt purge linux-image-<kernel-name>`
13. Zero out free space for better compression:
This one was useless!
Inside the Raspberry Pi, run `sudo dd if=/dev/zero of=/EMPTY bs=1M` and `sudo rm -f /EMPTY`
14. run clean.sh

# Building the aliro-image executable
## Windows

Perform these steps after performing the steps in Linux to extract the .img file, shrinking with PiShrink and compressing with xz.
These steps work on a Windows 11 machine:
1. Ensure you have a Code Signing Certificate installed.
2. Embed the aliro.img.xz file in the same level as the **src** directory.
3. Open the Epistasis/aliro-imager project in Qt Creator (follow the instructions on the aliro-imager repository)
4. Configure the version number as needed. The current scheme is to use the version of the latest Aliro Release (e.g. 0.21)
5. Proceed to `Build All Projects` in Qt Creator
6. Use `nsis-binary-7336-1` to build the installer, using the **aliro-imager.nsi** script output by the Qt Creator build.
## Linux
1. Extract the image into a **.img** file with a tool like **dd**: `sudo dd if=/dev/sdX of=aliroed.img bs=4M`
2. Use PiShrink to shrink the image. The image should also be compressed with **xz**. There are 2 options for this: `sudo ./pishrink.sh aliroed.img`
a. use PiShrink with the -Z option, or
b. use the `xz` utility independently: `xz -9 aliroed.img` (**Note: This option has worked best so far**)
12 changes: 12 additions & 0 deletions raspberrypi/build_rpi/aliroed-compose.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=AliroEd Docker Service
After=docker.service
Requires=docker.service

[Service]
Restart=always
WorkingDirectory=/target/production/Aliro-0.21
ExecStart=/usr/bin/docker compose up -d

[Install]
WantedBy=multi-user.target
4 changes: 4 additions & 0 deletions raspberrypi/build_rpi/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ sudo apt purge bluez -y
sudo apt autoremove -y
sudo apt autoclean -y
sudo apt clean -y
sudo journalctl --vacuum-time=7d
docker builder prune --all
sudo rm -rf /var/log/*
sudo rm -rf /tmp/*
# clear bash history
history -c

0 comments on commit 19d9882

Please sign in to comment.