peach-package-builder/README.md

106 lines
3.0 KiB
Markdown
Raw Normal View History

# peach-vps
2020-11-10 16:14:21 +00:00
2021-02-19 15:27:44 +00:00
![Generic badge](https://img.shields.io/badge/version-0.3.1-<COLOR>.svg)
Scripts for configuring the PeachCloud VPS for various hosting and automation functions.
2020-11-13 11:45:01 +00:00
2020-12-18 09:18:59 +00:00
## Setup Build Environment
2020-12-18 09:18:59 +00:00
`scripts/setup_build_env.py`
2020-11-10 16:14:21 +00:00
2020-12-18 09:18:59 +00:00
An idempotent script for initializing a build and deployment environment for PeachCloud packages.
The script currently performs the following actions:
- Installs system requirements
- Creates directories for microservices and package archive
- Installs Rust
- Installs `cargo deb`
- Installs Rust aarch64 toolchain for cross-compilation
2020-12-18 09:18:59 +00:00
- Installs [Freight](https://github.com/freight-team/freight) for package archive creation and management
- Configures Freight
- Pulls microservices code from GitHub repos
- Exports the public GPG key
- Configures nginx
2020-12-18 09:18:59 +00:00
The script can also be run with the optional `-u` flag (`--update`) to update the Rust compiler and installed toolchains.
**NB:** Prior to executing the script for the first time, run the following commands on the target system:
2020-11-10 16:14:21 +00:00
```
2020-12-02 15:50:36 +00:00
sudo apt update
sudo apt install git python python3-pip rsync
2020-11-10 16:14:21 +00:00
git clone https://github.com/peachcloud/peach-vps.git
cd peach-vps
pip3 install -r requirements.txt
```
2020-12-18 09:18:59 +00:00
Open `scripts/setup_build_env.py` and set the following constants:
- USER_PATH
- GPG_KEY_EMAIL
- GPG_KEY_PASS_FILE
2020-12-18 09:18:59 +00:00
Then execute the script to run the full system initialization process (_note: several commands executed by the script require `sudo` permissions. You will be prompted for the user password during the execution of the scipt._):
```
2020-12-18 09:18:59 +00:00
python3 -u scripts/setup_build_env.py
```
2020-12-18 09:18:59 +00:00
## Build and Serve Debian Packages
`scripts/build_packages.py`
2020-12-18 09:18:59 +00:00
An idempotent script for building the latest versions of all PeachCloud packages and adding them to the Debian package archive.
The script currently performs the following actions:
- Builds and updates microservice packages
- Adds packages to Freight library
- Adds packages to Freight cache
2020-11-10 16:14:21 +00:00
```
2020-12-18 09:18:59 +00:00
python3 -u scripts/build_packages.py
2020-11-13 11:45:01 +00:00
```
Freight supports the ability to have multiple versions of a package in a single Debian package archive. If a particular version of a package already exists in the Freight library, it will not be readded or overwritten.
2020-12-18 09:18:59 +00:00
## Install Packages from Debian Package Archive
2020-12-18 09:18:59 +00:00
To add the PeachCloud Debian package archive as an apt source, run the following commands from your Pi:
2020-11-13 11:45:01 +00:00
```
vi /etc/apt/sources.list.d/peach.list
```
Append the following line:
2020-11-13 11:45:01 +00:00
```
deb http://apt.peachcloud.org/ buster main
2020-11-13 11:45:01 +00:00
```
Add the gpg pub key to the apt-key list:
2020-11-13 11:45:01 +00:00
```
wget -O - http://apt.peachcloud.org/pubkey.gpg | sudo apt-key add -
2020-11-13 11:45:01 +00:00
```
You can then install peach packages with apt:
2020-11-13 11:45:01 +00:00
```
sudo apt update
sudo apt install peach-oled
```
By default, the latest version of the package will be downloaded and installed.
Specific versions of packages can be selected for installation by supplying the semantic versioning number (this is useful for downgrading):
```
sudo apt install peach-network=0.2.0
```
## Licensing
AGPL-3.0