From 8df1fe08427c19378adaa7704db764fa393a64c6 Mon Sep 17 00:00:00 2001 From: kn0wmad Date: Mon, 6 Dec 2021 11:26:58 -0700 Subject: [PATCH] SPG init --- source/dev-docs/packaging-example.rst | 73 ++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) diff --git a/source/dev-docs/packaging-example.rst b/source/dev-docs/packaging-example.rst index f5b4112..afb0118 100644 --- a/source/dev-docs/packaging-example.rst +++ b/source/dev-docs/packaging-example.rst @@ -4,4 +4,75 @@ Packaging Example ***************** -A rough walkthrough of how to package a service using our example "Hello World" wrapper. \ No newline at end of file +A rough walkthrough of how to package a service using our example "Hello World" wrapper. + +1. Introduction + +Hello! The following guide will serve as a walkthrough of the process to packaging a service for the Start9 Embassy, in the format of an example. This is an attempt to cover the process in as much detail as possible, but keep in mind that it is by no means exhaustive. + +The example service being packaged is Hello World, a simple example that will display a greeting in its own web UI. + +2. Selecting a Service + +There are many considerations when choosing a service to package. The following parameters are suggested for those coming at service packaging for the first time, as they simplify the process. Some of these may be ignored, at the cost of having a larger workload. Requirements are indicated. A package will be more straightforward to package if it: + +- is a self-hosted, open-source service. Here’s a great list of options - *this is a requirement* +- has already been dockerized, ideally using Alpine Linux +- + + +3. Pre-requisites + +It is not necessary to have extensive programming or development experience, however, it is useful to have some understanding of the linux command line, git, docker, and basic development tools. This guide will use a debian-based environment, but differences ought to be minimal when using another Linux flavor, or brew on a Mac. + +EmbassyOS will be required for testing the packaged service. You can get this by: +- building from source +- following the DIY guide +- purchasing an Embassy device + +Let’s get started on our example service, Polaris. + +4. Dependencies + +First, we’ll get the base required packages (if you don’t have them already). At minimum you will need the following: + +- docker +- docker buildx +- appmgr + +And to optimize the build process, we recommend the following: + +- cargo +- yq (version 4) +- make +- musl + +We’ll get all of these for our example. First, docker/buildx and make: + +```sudo apt install docker.io make``` + +For appmgr, clone the repo and enter it’s directory: + +```git clone https://github.com/Start9Labs/embassy-os.git +cd embassy-os/appmgr’’’ + +Then install the portable version: + +```cargo install --path=. --features=portable –no-default-features``` + +Next, we’ll get rust and cargo: + +```curl https://sh.rustup.rs -sSf | sh``` + +Then yq: + +```wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY}.tar.gz -O - |\ +tar xz && mv ${BINARY} /usr/bin/yq``` + +And finally, musl: + +```docker build -t start9/rust-musl-cross:armv7-musleabihf . +alias 'rust-musl-builder=docker run --rm -it -v "$HOME"/.cargo/registry:/root/.cargo/registry -v "$(pwd)":/home/rust/src start9/rust-musl-cross:armv7-musleabihf'``` + + +5. \ No newline at end of file