Skip to content

Commit

Permalink
Update for EmbassyOS v0.3.0 release (#12)
Browse files Browse the repository at this point in the history
* initial commit

* Minor updates

* Attempting to make

* Manifest updates

* More manifest updates

* Did that just work?

* Icon

* add more descriptions for service packagers

* notes

* use embassy-cli

* Adding simple clean to Makefile

* image tag fix

* Parse version from manifest.yaml

* spaces are bad :)

* Update README.md for 0.3.0

* changed git pull to git checkout for integration/0.3.0

* update commentary and simplify layout

* update verify command

* update dependency section for accuracy

* move and clarify config rules

* update version description and clean up makefile

* move config rules

* cleanup

* Refactor project structure and configuration files to correlate with EOSv0.3.0 release

* remove unecessary compression build line

* fix sdk install instructions

* update sdk build steps

* revert port

* add details to backup section of manifest

* proper release version

Co-authored-by: kn0wmad <[email protected]>
Co-authored-by: Mariusz Kogen <[email protected]>
Co-authored-by: kn0wmad <[email protected]>
Co-authored-by: Dme1sc <[email protected]>
  • Loading branch information
5 people authored Feb 12, 2022
1 parent a499891 commit 1c561d0
Show file tree
Hide file tree
Showing 12 changed files with 272 additions and 109 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM alpine:3.12
FROM arm64v8/alpine:3.12

RUN apk update
RUN apk add tini

ADD ./hello-world/target/armv7-unknown-linux-musleabihf/release/hello-world /usr/local/bin/hello-world
ADD ./hello-world/target/aarch64-unknown-linux-musl/release/hello-world /usr/local/bin/hello-world
ADD ./docker_entrypoint.sh /usr/local/bin/docker_entrypoint.sh
RUN chmod a+x /usr/local/bin/docker_entrypoint.sh

Expand Down
32 changes: 15 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
ASSETS := $(shell yq e '.assets.[].src' manifest.yaml)
ASSET_PATHS := $(addprefix assets/,$(ASSETS))
VERSION := $(shell toml get hello-world/Cargo.toml package.version)
VERSION := $(shell yq e ".version" manifest.yaml)
HELLO_WORLD_SRC := $(shell find ./hello-world/src) hello-world/Cargo.toml hello-world/Cargo.lock
S9PK_PATH=$(shell find . -name hello-world.s9pk -print)

# delete the target of a rule if it has changed and its recipe exits with a nonzero exit status
.DELETE_ON_ERROR:

all: hello-world.s9pk
all: verify

install: hello-world.s9pk
appmgr install hello-world.s9pk
verify: hello-world.s9pk $(S9PK_PATH)
embassy-sdk verify s9pk $(S9PK_PATH)

hello-world.s9pk: manifest.yaml config_spec.yaml config_rules.yaml image.tar instructions.md $(ASSET_PATHS)
appmgr -vv pack $(shell pwd) -o hello-world.s9pk
appmgr -vv verify hello-world.s9pk
clean:
rm -f image.tar
rm -f hello-world.s9pk

instructions.md: README.md
cp README.md instructions.md
hello-world.s9pk: manifest.yaml assets/compat/config_spec.yaml assets/compat/config_rules.yaml image.tar instructions.md $(ASSET_PATHS)
embassy-sdk pack

image.tar: Dockerfile docker_entrypoint.sh hello-world/target/armv7-unknown-linux-musleabihf/release/hello-world
DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build --tag start9/hello-world --platform=linux/arm/v7 -o type=docker,dest=image.tar .
image.tar: Dockerfile docker_entrypoint.sh hello-world/target/aarch64-unknown-linux-musl/release/hello-world
DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build --tag start9/hello-world/main:$(VERSION) --platform=linux/arm64 -o type=docker,dest=image.tar .

hello-world/target/armv7-unknown-linux-musleabihf/release/hello-world: $(HELLO_WORLD_SRC)
docker run --rm -it -v ~/.cargo/registry:/root/.cargo/registry -v "$(shell pwd)"/hello-world:/home/rust/src start9/rust-musl-cross:armv7-musleabihf cargo +beta build --release
docker run --rm -it -v ~/.cargo/registry:/root/.cargo/registry -v "$(shell pwd)"/hello-world:/home/rust/src start9/rust-musl-cross:armv7-musleabihf musl-strip target/armv7-unknown-linux-musleabihf/release/hello-world

manifest.yaml: hello-world/Cargo.toml
yq e -i '.version = $(VERSION)' manifest.yaml
hello-world/target/aarch64-unknown-linux-musl/release/hello-world: $(HELLO_WORLD_SRC)
docker run --rm -it -v ~/.cargo/registry:/root/.cargo/registry -v "$(shell pwd)"/hello-world:/home/rust/src start9/rust-musl-cross:aarch64-musl cargo build --release
25 changes: 17 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
- [docker-buildx](https://docs.docker.com/buildx/working-with-buildx/)
- [yq](https://mikefarah.gitbook.io/yq)
- [toml](https://crates.io/crates/toml-cli)
- [appmgr](https://github.com/Start9Labs/embassy-os/tree/master/appmgr)
- [embassy-sdk](https://github.com/Start9Labs/embassy-os/tree/master/backend)
- [make](https://www.gnu.org/software/make/)

## Build enviroment
Expand Down Expand Up @@ -47,13 +47,12 @@ source $HOME/.cargo/env
```
cargo install toml-cli
```
8. Build and install appmgr
8. Build and install embassy-sdk
```
cd ~/ && git clone https://github.com/Start9Labs/embassy-os.git
cd embassy-os/appmgr/
cargo install --path=. --features=portable --no-default-features && cd ~/
cd embassy-os/backend/
./install-sdk.sh
```
Now you are ready to build your first EmbassyOS service

## Cloning

Expand All @@ -63,7 +62,10 @@ Clone the project locally. Note the submodule link to the original project(s).
git clone https://github.com/Start9Labs/hello-world-wrapper.git
cd hello-world-wrapper
```

During the 0.3.0 beta (you won't need this after merge to main), run:
```
git checkout integration/0.3.0
```
## Building

To build the project, run the following commands:
Expand All @@ -76,8 +78,15 @@ make

SSH into an Embassy device.
`scp` the `.s9pk` to any directory from your local machine.
Run the following command to determine successful install:
Run the following command to install the package:

```
sudo appmgr install hello-world.s9pk
embassy-cli auth login
#Enter your embassy password then run:
embassy-cli package install /path/to/hello-world.s9pk
```
## Verify Install

Go to your Embassy Services page, select Hello World and start the service.

#Done
3 changes: 3 additions & 0 deletions assets/compat/config_rules.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This is where any configuration rules related to the configuration would go. These ensure that the user can only create a valid config.

[]
13 changes: 13 additions & 0 deletions assets/compat/config_spec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# To utilize the default config system built in the compat system image, this file is required. It defines the *structure* of the configuration file. These structured options display as changeable UI elements within the "Config" section of the service details page in the Embassy UI.

# Example:
# tor-address:
# name: Network Tor Address
# description: The Tor address for the network interface.
# type: pointer
# subtype: package
# package-id: hello-world
# target: tor-address
# interface: main

{}
1 change: 0 additions & 1 deletion config_rules.yaml

This file was deleted.

1 change: 0 additions & 1 deletion config_spec.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions docker_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/bin/sh

export HOST_IP=$(ip -4 route list match 0/0 | awk '{print $3}')

exec tini hello-world
3 changes: 0 additions & 3 deletions docs/instructions.md

This file was deleted.

Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Instructions for Hello World

Instructions go here. These appear to the user in the UI on the Service page under 'Instructions.'
Loading

0 comments on commit 1c561d0

Please sign in to comment.