torch-pi-cloud-init/README.md

60 lines
2.2 KiB
Markdown

# TORch RPi Cloud Init Installer
This project aims to create an easy way to burn a RPi SD card with an [Ubuntu Server pre-installed image](https://ubuntu.com/download/raspberry-pi) with [Torch](/bj/torch-agent) installed and configured to broadcast it's connection info to you.
Based on the [Raspberry Pi Cloud-Init for WiFi](https://gitlab.com/Bjorn_Samuelsson/raspberry-pi-cloud-init-wifi) project by [Björn Samuelsson](https://gitlab.com/Bjorn_Samuelsson).
## Quick Start
### Configure Torch and SSH Parameters
Place your settings in `parameters.env`
```bash
cat <<EOF > parameters.env
DISABLE_IPV6=1
USERNAME=ubuntu
USERFULLNAME="Mr. Ubuntu"
SSH_PUBKEY="ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAiOr5aUytobxxu6TG0CQqqyk3hOaaVyC8ZIt4Es9HGSDmKhBznrvMEJ5GyUIMB85+YLh0ohlVZJyrk8BWaIzoHD8IszKEJvpeYMRTGq8LVRe7YW1lFyJLFdTbLliKY0v1PvJmbrPiijHYjg8/l4gGEGlrg4XcnzdYtl9aHjfdc5nyVWkX1GYwDIP08slyt/gM8u7FIuYi1qyMxgjiEm4dcBECghlC8vN6TRBDW7ssald/jpNDUBOLYVQmGiW1KKI0mHxDFF1HoBAYYKtRz9Y4CdWXGTZ35/I50RhXHaI6hkIzfWiouBasnsMIYAvP1qhTW3EC9FlJVi2j16dN44awqw== rsa-key-20201012"
TORCH_CONFIG_DIR=~/.torch
EOF
```
* DISABLE_IPV6 - Disabled IPv6 on the RPi
* USERNAME - Created a user with the given username
* USERFULLNAME - Full name of the user to create
* SSH_PUBKEY - Pubkey to copy to the `~/.ssh` directory for SSH access
* TORCH_CONFIG_DIR - Directory containing Torch [configuration](/bj/torch-agent) files
### Manual Image Configuration
Run `build.sh`
```bash
./build.sh
```
Find the built configuration bundle `rpi-cloud-init.tgz` in the `build` directory.
Extract `rpi-cloud-init.tgz` to the boot partition of the SD card after the Ubuntu server image has been burned.
```bash
tar -xzvf build/rpi-cloud-init.tgz -C /mnt/rpi-boot
```
### Automatic Image Configuration
Place a decompressed Ubuntu Server `*.img` file in the project directory and
use `img-config.sh` to both build the project and dope the boot partition of `*.img` file directly
**Note**: Must be run from an account with `sudo` permissions
```bash
./img-config.sh ubuntu-20.04.1-preinstalled-server-arm64+raspi.img
```
## Roadmap
* Create a Debian repo for Torch and have the `.deb` package installed from there instead of embedding it in the /boot partition