Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update/040 #29

Draft
wants to merge 124 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
124 commits
Select commit Hold shift + click to select a range
b0d5e97
initial refactor, wip
MattDHill Apr 21, 2023
b23475e
chore: Update with the latest api's and make sure we match the sdk
Blu-J Apr 24, 2023
83b2f3e
chore: Update something
Blu-J Apr 25, 2023
40767d7
progress
MattDHill Apr 25, 2023
8c30c5a
chore: Update the version
Blu-J Apr 25, 2023
11d43a8
update latest
MattDHill Apr 25, 2023
609cad3
intro setupInit
MattDHill Apr 25, 2023
dbcc460
minor formatting
MattDHill Apr 25, 2023
ebc4e18
SDK RC1
MattDHill Apr 26, 2023
ca05df4
minor changes
MattDHill Apr 26, 2023
f07e354
effects console
MattDHill Apr 26, 2023
5c7b89a
prettier
MattDHill Apr 27, 2023
e8148eb
chore: Update to rc2
Blu-J Apr 27, 2023
5c329a4
Merge branch 'update/040' of https://github.com/Start9Labs/hello-worl…
Blu-J Apr 27, 2023
5ad1547
rc3
MattDHill Apr 27, 2023
8519639
use configspec type in wrapper data
MattDHill Apr 30, 2023
596a684
Update Makefile
k0gen May 1, 2023
1708d7e
chore: update to use latest of sdk
Blu-J May 2, 2023
fd091d5
Merge pull request #28 from Start9Labs/update/040_3547cb6
MattDHill May 2, 2023
e933057
update to latest
MattDHill May 2, 2023
ba68ea3
update to latest
MattDHill May 3, 2023
a7a9921
reverse proxy WIP
MattDHill May 3, 2023
d5d2811
update sdk
MattDHill May 3, 2023
ea6263b
error free
MattDHill May 3, 2023
3695aff
switch to startlabs sdk
MattDHill May 4, 2023
c3e4658
update sdk
MattDHill May 4, 2023
e30b084
latest sdk
MattDHill May 5, 2023
35aea4c
node types and 4001 migration
MattDHill May 5, 2023
ef3d668
chore: This is after the update
Blu-J May 9, 2023
aceb627
add vault
MattDHill May 9, 2023
0f1cff9
chore: Update to use the new vault
Blu-J May 9, 2023
6528698
Merge branch 'feat/040/new-sdk' of https://github.com/Start9Labs/hell…
Blu-J May 9, 2023
7cd7d78
chore: UPdate name to metadata
Blu-J May 9, 2023
c7ecd6f
minor bug fix and commnets
MattDHill May 10, 2023
3f3b8ef
move sdk.ts to root
MattDHill May 10, 2023
523bd80
dependencies done
MattDHill May 11, 2023
46729b2
Merge pull request #31 from Start9Labs/feat/040/new-sdk
MattDHill May 11, 2023
12eaceb
export mounts
MattDHill May 11, 2023
49002fa
nested dep dirs
MattDHill May 11, 2023
96571b8
update to rc2
MattDHill May 11, 2023
bfc802b
latest
MattDHill May 16, 2023
ac75aee
rc4
MattDHill May 17, 2023
e277d00
add vault example
MattDHill May 17, 2023
0d466fc
rc5 and more features with underlying file and utils
MattDHill May 21, 2023
b3cb1c5
don't type vault
MattDHill May 21, 2023
740334b
type for vault and store
MattDHill May 21, 2023
775ab9a
remove vault and export store items
MattDHill Jun 9, 2023
498351c
rc7
MattDHill Jun 9, 2023
7443952
clean up a little
MattDHill Sep 6, 2023
223ed21
more cleanup
MattDHill Sep 6, 2023
f052876
Update sdk
MattDHill Sep 6, 2023
f02c313
fix type error
MattDHill Sep 6, 2023
d62f046
minor typo
MattDHill Sep 12, 2023
d20799b
latest sdk changes
MattDHill Mar 18, 2024
d7b3c60
update for sdk changes
dr-bonez Mar 18, 2024
70ea372
minor fix
MattDHill Mar 18, 2024
5dc7b73
update comments
MattDHill Mar 19, 2024
49c8c2d
minor updates
MattDHill Mar 19, 2024
ed6cd08
wip
Dominion5254 Mar 20, 2024
fd25033
latest changes
MattDHill Mar 20, 2024
d02853c
remove manifest type
MattDHill Mar 20, 2024
b9446f5
chore: Update the types to match the sdk
Blu-J Mar 21, 2024
29184a5
update package json
MattDHill Mar 21, 2024
a435418
bring back properties and then some
MattDHill Mar 21, 2024
503c0a7
update action for sdk change
MattDHill Mar 22, 2024
14953a6
dynamic action
MattDHill Mar 22, 2024
e566f67
chore: Update to the latest sdk
Blu-J Mar 23, 2024
3c98ed0
use nested propert for example
MattDHill Mar 24, 2024
11c7cbb
minor
MattDHill Mar 24, 2024
37f30d7
restructure directories
MattDHill Apr 5, 2024
5d00fe3
minor type change
MattDHill May 9, 2024
f9db052
fix start-sdk dep
MattDHill May 9, 2024
f10721b
some rearranging
MattDHill May 9, 2024
e8dfe48
restructuring
dr-bonez Jun 11, 2024
c6b57ba
fix id
dr-bonez Jun 11, 2024
a97d45e
Automate npm link command and refine clean rule in Makefile
k0gen Jun 11, 2024
0c3ea24
Added install target, comments, and rearranged for better readability
k0gen Jun 11, 2024
b1cf0e1
chore: change to a valid version of the start-sdk
Blu-J Jun 11, 2024
4ef5c41
bump sdk
MattDHill Jun 12, 2024
aad5572
use dockerTag, improve makefile and readme
MattDHill Jun 20, 2024
4c0f052
Update for 0.3.6-alpha6 sdk
Dominion5254 Jul 24, 2024
b4dcf8e
minor tweaks
MattDHill Jul 31, 2024
4e5ef27
barely worth a commit
MattDHill Aug 4, 2024
474749d
update to alpha7
MattDHill Aug 9, 2024
2a1c849
update readme
MattDHill Aug 9, 2024
0eb9a39
new version graph strategy
MattDHill Aug 19, 2024
1b0a1c4
small change
MattDHill Aug 20, 2024
f6ed594
replace 'migrations' with 'versions'
Dominion5254 Aug 21, 2024
e9133a7
remove most comments
MattDHill Sep 6, 2024
79f1b1f
updates for new actions
MattDHill Sep 19, 2024
23bae82
update for sdk changes
dr-bonez Sep 23, 2024
d609af4
allow backups to be dynamic
dr-bonez Sep 25, 2024
267a459
simplify types
dr-bonez Sep 25, 2024
51d67be
delete properties
MattDHill Oct 3, 2024
1c90418
use async for action metadata
MattDHill Oct 3, 2024
27f6cd3
update for latest types
MattDHill Oct 9, 2024
7e2ae0b
severity as param
MattDHill Oct 10, 2024
12409c9
prefer const and fix bugs
MattDHill Oct 10, 2024
368eebd
fix circular import
dr-bonez Oct 11, 2024
bf9f993
not much
MattDHill Oct 11, 2024
3902ac6
misc fixes
dr-bonez Oct 16, 2024
e2bde86
alpha.12
dr-bonez Oct 16, 2024
798ed20
better action names
MattDHill Oct 17, 2024
23b592f
fix bug
MattDHill Oct 17, 2024
8185793
cleaning up after webinar
MattDHill Oct 18, 2024
9eb2eeb
update action for new response type
MattDHill Oct 22, 2024
8d75dc0
bump sdk
MattDHill Oct 31, 2024
8551fe7
alpha 14
MattDHill Nov 13, 2024
b7b19b6
alpha 16
MattDHill Nov 14, 2024
44b4c39
alpha 18
MattDHill Nov 20, 2024
dc420cb
alpha 18
MattDHill Nov 20, 2024
f23d9c1
include dependency startos dirs
MattDHill Nov 20, 2024
2364040
alpha 20
MattDHill Nov 21, 2024
12952f8
alpha 21
MattDHill Nov 21, 2024
0d1d1a6
alpha 22
MattDHill Nov 22, 2024
cb2087a
alpha 23
MattDHill Dec 3, 2024
ad5bf7b
beta 0
MattDHill Dec 5, 2024
7584825
beta 1
MattDHill Dec 6, 2024
42a5edc
beta 3
MattDHill Jan 10, 2025
213b814
remove hasPrimary
MattDHill Jan 14, 2025
97bd511
update to beta4
elvece Jan 28, 2025
ead4855
beta 9
MattDHill Feb 18, 2025
8a5d121
grab PACKAGE_ID from manifest.ts
k0gen Feb 19, 2025
85dea08
add build completion status
k0gen Feb 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
hello-world.s9pk
image.tar
scripts/*.js
*.s9pk
startos/*.js
node_modules/
.DS_Store
.vscode/
docker-images
docker-images
javascript
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

11 changes: 0 additions & 11 deletions Dockerfile

This file was deleted.

92 changes: 26 additions & 66 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,75 +1,35 @@
PKG_ID := $(shell yq e ".id" manifest.yaml)
PKG_VERSION := $(shell yq e ".version" manifest.yaml)
TS_FILES := $(shell find ./ -name \*.ts)
HELLO_WORLD_SRC := $(shell find ./hello-world/src) hello-world/Cargo.toml hello-world/Cargo.lock
PACKAGE_ID := $(shell grep -o "id: '[^']*'" startos/manifest.ts | sed "s/id: '\([^']*\)'/\1/")

# delete the target of a rule if it has changed and its recipe exits with a nonzero exit status
.DELETE_ON_ERROR:
# Phony targets
.PHONY: all clean install

all: verify

verify: $(PKG_ID).s9pk
@embassy-sdk verify s9pk $(PKG_ID).s9pk
# Default target
all: ${PACKAGE_ID}.s9pk
@echo " Done!"
@echo " Filesize: $(shell du -h $(PKG_ID).s9pk) is ready"

install:
ifeq (,$(wildcard ~/.embassy/config.yaml))
@echo; echo "You must define \"host: http://embassy-server-name.local\" in ~/.embassy/config.yaml config file first"; echo
else
embassy-cli package install $(PKG_ID).s9pk
endif

clean:
rm -rf docker-images
rm -f image.tar
rm -f $(PKG_ID).s9pk
rm -f scripts/*.js
@echo " Filesize: $(shell du -h $(PACKAGE_ID).s9pk) is ready"

clean-manifest:
@sed -i '' '/^[[:blank:]]*#/d;s/#.*//' manifest.yaml
@echo; echo "Comments successfully removed from manifest.yaml file."; echo
# Build targets
${PACKAGE_ID}.s9pk: $(shell start-cli s9pk list-ingredients)
start-cli s9pk pack

# BEGIN REBRANDING
rebranding:
@read -p "Enter new package ID name (must be a single word): " NEW_PKG_ID; \
read -p "Enter new package title: " NEW_PKG_TITLE; \
find . \( -name "*.md" -o -name ".gitignore" -o -name "manifest.yaml" -o -name "*Service.yml" \) -type f -not -path "./hello-world/*" -exec sed -i '' -e "s/hello-world/$$NEW_PKG_ID/g; s/Hello World/$$NEW_PKG_TITLE/g" {} +; \
echo; echo "Rebranding complete."; echo " New package ID name is: $$NEW_PKG_ID"; \
echo " New package title is: $$NEW_PKG_TITLE"; \
sed -i '' -e '/^# BEGIN REBRANDING/,/^# END REBRANDING/ s/^#*/#/' Makefile
@echo; echo "Note: Rebranding code has been commented out in Makefile"; echo
# END REBRANDING
javascript/index.js: $(shell git ls-files startos) tsconfig.json node_modules package.json
npm run build

scripts/embassy.js: $(TS_FILES)
deno bundle scripts/embassy.ts scripts/embassy.js
node_modules: package.json package-lock.json
npm ci

docker-images/aarch64.tar: Dockerfile docker_entrypoint.sh hello-world/target/aarch64-unknown-linux-musl/release/hello-world
ifeq ($(ARCH),x86_64)
else
mkdir -p docker-images
docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --build-arg ARCH=aarch64 --platform=linux/arm64 -o type=docker,dest=docker-images/aarch64.tar .
endif
package-lock.json: package.json
npm i

docker-images/x86_64.tar: Dockerfile docker_entrypoint.sh hello-world/target/x86_64-unknown-linux-musl/release/hello-world
ifeq ($(ARCH),aarch64)
else
mkdir -p docker-images
docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --build-arg ARCH=x86_64 --platform=linux/amd64 -o type=docker,dest=docker-images/x86_64.tar .
endif

$(PKG_ID).s9pk: manifest.yaml instructions.md icon.png LICENSE scripts/embassy.js docker-images/aarch64.tar docker-images/x86_64.tar
ifeq ($(ARCH),aarch64)
@echo "embassy-sdk: Preparing aarch64 package ..."
else ifeq ($(ARCH),x86_64)
@echo "embassy-sdk: Preparing x86_64 package ..."
else
@echo "embassy-sdk: Preparing Universal Package ..."
endif
@embassy-sdk pack

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 messense/rust-musl-cross:aarch64-musl cargo build --release
# Clean target
clean:
rm -rf ${PACKAGE_ID}.s9pk
rm -rf javascript
rm -rf node_modules

hello-world/target/x86_64-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 messense/rust-musl-cross:x86_64-musl cargo build --release
# Install target
install:
@if [ ! -f ~/.startos/config.yaml ]; then echo "You must define \"host: http://server-name.local\" in ~/.startos/config.yaml config file first."; exit 1; fi
@echo "\nInstalling to $$(grep -v '^#' ~/.startos/config.yaml | cut -d'/' -f3) ...\n"
@[ -f $(PACKAGE_ID).s9pk ] || ( $(MAKE) && echo "\nInstalling to $$(grep -v '^#' ~/.startos/config.yaml | cut -d'/' -f3) ...\n" )
@start-cli package install -s $(PACKAGE_ID).s9pk
114 changes: 6 additions & 108 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,113 +1,11 @@
# Wrapper for hello-world
# Hello World for StartOS

Hello World is a simple, minimal project that serves as a template for creating a service that runs on embassyOS. This repository creates the `s9pk` package that is installed to run `hello-world` on [embassyOS](https://github.com/Start9Labs/embassy-os/). Learn more about service packaging in the [Developer Docs](https://start9.com/latest/developer-docs/).
A bare bones project serving as a template for [StartOS Service Packaging](https://docs.star9.com/packaging-guide).

## Dependencies
## Building from source

Install the system dependencies below to build this project by following the instructions in the provided links. You can also find detailed steps to setup your environment in the service packaging [documentation](https://github.com/Start9Labs/service-pipeline#development-environment).
`make`

- [docker](https://docs.docker.com/get-docker)
- [docker-buildx](https://docs.docker.com/buildx/working-with-buildx/)
- [yq](https://mikefarah.gitbook.io/yq)
- [deno](https://deno.land/)
- [make](https://www.gnu.org/software/make/)
- [embassy-sdk](https://github.com/Start9Labs/embassy-os/tree/master/backend)
## Creating your own project

## Build environment
Prepare your embassyOS build environment. In this example we are using Ubuntu 20.04.
1. Install docker
```
curl -fsSL https://get.docker.com | bash
sudo usermod -aG docker "$USER"
exec sudo su -l $USER
```
2. Set buildx as the default builder
```
docker buildx install
docker buildx create --use
```
3. Enable cross-arch emulated builds in docker
```
docker run --privileged --rm linuxkit/binfmt:v0.8
```
4. Install yq
```
sudo snap install yq
```
5. Install deno
```
sudo snap install deno
```
6. Install essentials build packages
```
sudo apt-get install -y build-essential openssl libssl-dev libc6-dev clang libclang-dev ca-certificates
```
7. Install Rust
```
curl https://sh.rustup.rs -sSf | sh
# Choose nr 1 (default install)
source $HOME/.cargo/env
```
8. Build and install embassy-sdk
```
cd ~/ && git clone --recursive https://github.com/Start9Labs/embassy-os.git
cd embassy-os/backend/
./install-sdk.sh
embassy-sdk init
```
Now you are ready to build the `hello-world` package!

## Cloning

Clone the project locally:

```
git clone https://github.com/Start9Labs/hello-world-wrapper.git
cd hello-world-wrapper
git submodule update --init --recursive
```

## Building

To build the `hello-world` package for all platforms using embassy-sdk version >=0.3.3, run the following command:

```
make
```

To build the `hello-world` package for a single platform using embassy-sdk version <=0.3.2, run:

```
# for amd64
make ARCH=x86_64
```
or
```
# for arm64
make ARCH=aarch64
```

## Installing (on embassyOS)

Run the following commands to determine successful install:
> :information_source: Change embassy-server-name.local to your Embassy address

```
embassy-cli auth login
# Enter your embassy password
embassy-cli --host https://embassy-server-name.local package install hello-world.s9pk
```

If you already have your `embassy-cli` config file setup with a default `host`, you can install simply by running:

```
make install
```

> **Tip:** You can also install the hello-world.s9pk using **Sideload Service** under the **System > Manage** section.

### Verify Install

Go to your Embassy Services page, select **Hello World**, configure and start the service. Then, verify its interfaces are accessible.

**Done!**
Follow the [Quick Start Guide](https://docs.star9.com/packaging-guide/quick-start/) for StartOS service packaging, replacing references to `hello-world-startos` with this service ID.
3 changes: 0 additions & 3 deletions docker_entrypoint.sh

This file was deleted.

1 change: 0 additions & 1 deletion hello-world
Submodule hello-world deleted from 48ce8a
8 changes: 5 additions & 3 deletions instructions.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Instructions for Hello World
# Hello World for StartOS

Instructions go here. These appear to the user in the UI on the Service page under **Instructions**.
A bare bones project serving as a template for [StartOS Service Packaging](https://docs.star9.com/packaging-guide).

You are allowed to include basic [Markdown formatting](https://www.markdownguide.org/basic-syntax).
## Building from source

Follow the [Quick Start Guide](https://docs.star9.com/packaging-guide/quick-start/) for StartOS service packaging, replacing references to `hello-world-startos` with this service ID.
Loading