Skip to content

Commit 9707188

Browse files
committedJun 10, 2024
Revamped for StartOS 0.3.5.x
- Changed version to 0.3.5 - Updated manifest with correct OS name, GPU acceleration support, and supported architectures. - Added release and build GitHub workflows. - Added log message to announce when the service is starting. - Added new optimized and standardized icon. - Added simple healthcheck. - Updated to the latest stable Alpine-based Docker image. - Updated license file with the current year. - Code cleanup
1 parent eda6f08 commit 9707188

13 files changed

+155
-26
lines changed
 

‎.github/workflows/buildService.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build Service
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
paths-ignore: ['*.md']
7+
branches: ['main', 'master']
8+
push:
9+
paths-ignore: ['*.md']
10+
branches: ['main', 'master']
11+
12+
jobs:
13+
BuildPackage:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Prepare StartOS SDK
17+
uses: Start9Labs/sdk@v1
18+
19+
- name: Checkout services repository
20+
uses: actions/checkout@v4
21+
22+
- name: Build the service package
23+
id: build
24+
run: |
25+
git submodule update --init --recursive
26+
start-sdk init
27+
make
28+
PACKAGE_ID=$(yq -oy ".id" manifest.*)
29+
echo "package_id=$PACKAGE_ID" >> $GITHUB_ENV
30+
printf "\n SHA256SUM: $(sha256sum ${PACKAGE_ID}.s9pk) \n"
31+
shell: bash
32+
33+
- name: Upload .s9pk
34+
uses: actions/upload-artifact@v4
35+
with:
36+
name: ${{ env.package_id }}.s9pk
37+
path: ./${{ env.package_id }}.s9pk

‎.github/workflows/releaseService.yml

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Release Service
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*'
7+
8+
jobs:
9+
ReleasePackage:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- name: Prepare StartOS SDK
15+
uses: Start9Labs/sdk@v1
16+
17+
- name: Checkout services repository
18+
uses: actions/checkout@v4
19+
20+
- name: Build the service package
21+
run: |
22+
git submodule update --init --recursive
23+
start-sdk init
24+
make
25+
26+
- name: Setting package ID and title from the manifest
27+
id: package
28+
run: |
29+
echo "package_id=$(yq -oy ".id" manifest.*)" >> $GITHUB_ENV
30+
echo "package_title=$(yq -oy ".title" manifest.*)" >> $GITHUB_ENV
31+
shell: bash
32+
33+
- name: Generate sha256 checksum
34+
run: |
35+
PACKAGE_ID=${{ env.package_id }}
36+
printf "\n SHA256SUM: $(sha256sum ${PACKAGE_ID}.s9pk) \n"
37+
sha256sum ${PACKAGE_ID}.s9pk > ${PACKAGE_ID}.s9pk.sha256
38+
shell: bash
39+
40+
- name: Generate changelog
41+
run: |
42+
PACKAGE_ID=${{ env.package_id }}
43+
echo "## What's Changed" > change-log.txt
44+
yq -oy '.release-notes' manifest.* >> change-log.txt
45+
echo "## SHA256 Hash" >> change-log.txt
46+
echo '```' >> change-log.txt
47+
sha256sum ${PACKAGE_ID}.s9pk >> change-log.txt
48+
echo '```' >> change-log.txt
49+
shell: bash
50+
51+
- name: Create GitHub Release
52+
uses: softprops/action-gh-release@v2
53+
with:
54+
tag_name: ${{ github.ref_name }}
55+
name: ${{ env.package_title }} ${{ github.ref_name }}
56+
prerelease: true
57+
body_path: change-log.txt
58+
files: |
59+
./${{ env.package_id }}.s9pk
60+
./${{ env.package_id }}.s9pk.sha256
61+
62+
- name: Publish to Registry
63+
env:
64+
S9USER: ${{ secrets.S9USER }}
65+
S9PASS: ${{ secrets.S9PASS }}
66+
S9REGISTRY: ${{ secrets.S9REGISTRY }}
67+
run: |
68+
if [[ -z "$S9USER" || -z "$S9PASS" || -z "$S9REGISTRY" ]]; then
69+
echo "Publish skipped: missing registry credentials."
70+
else
71+
start-sdk publish https://$S9USER:$S9PASS@$S9REGISTRY ${{ env.package_id }}.s9pk
72+
fi

‎Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM alpine:3.17
1+
FROM alpine:3.20
22

33
RUN apk update
44
RUN apk add --no-cache tini && \

‎LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022 Start9 Labs
3+
Copyright (c) 2024 Start9 Labs
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

‎Makefile

+4-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ verify: $(PKG_ID).s9pk
1414
@echo " Filesize: $(shell du -h $(PKG_ID).s9pk) is ready"
1515

1616
install:
17-
ifeq (,$(wildcard ~/.embassy/config.yaml))
18-
@echo; echo "You must define \"host: http://start-server-name.local\" in ~/.embassy/config.yaml config file first"; echo
19-
else
20-
start-cli package install $(PKG_ID).s9pk
21-
endif
17+
@if [ ! -f ~/.embassy/config.yaml ]; then echo "You must define \"host: http://server-name.local\" in ~/.embassy/config.yaml config file first."; exit 1; fi
18+
@echo "\nInstalling to $$(grep -v '^#' ~/.embassy/config.yaml | cut -d'/' -f3) ...\n"
19+
@[ -f $(PKG_ID).s9pk ] || ( $(MAKE) && echo "\nInstalling to $$(grep -v '^#' ~/.embassy/config.yaml | cut -d'/' -f3) ...\n" )
20+
@start-cli package install $(PKG_ID).s9pk
2221

2322
clean:
2423
rm -rf docker-images

‎docker_entrypoint.sh

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
#!/bin/sh
22

3+
printf "\n\n [i] Starting Hello World ...\n\n"
34
exec tini hello-world

‎icon.png

23.6 KB
Loading

‎manifest.yaml

+29-8
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,23 @@ id: hello-world
55
# A human readable service title
66
title: "Hello World"
77
# Service version - accepts up to four digits, where the last confirms to revisions necessary for StartOS - see documentation: https://github.com/Start9Labs/emver-rs. This value will change with each release of the service.
8-
version: 1.0.0.1
8+
version: 0.3.5
99
# Release notes for the update - can be a string, paragraph or URL
10-
release-notes: "Revamped for EmabssyOS 0.3.3"
10+
release-notes: |
11+
Revamped for StartOS 0.3.5.x
12+
- Changed version to 0.3.5
13+
- Updated manifest with correct OS name, GPU acceleration support, and supported architectures.
14+
- Added release and build GitHub workflows.
15+
- Added log message to announce when the service is starting.
16+
- Added new optimized and standardized icon.
17+
- Added simple healthcheck.
18+
- Updated to the latest stable Alpine-based Docker image.
19+
- Updated license file with the current year.
20+
- Code cleanup
1121
# The type of license for the project. Include the LICENSE in the root of the project directory. A license is required for a Start9 package.
12-
license: mit
13-
# The Start9 wrapper repository URL for the package. This repo contains the manifest file (this), any scripts necessary for configuration, backups, actions, or health checks (more below). This key must exist. But could be embedded into the source repository.
14-
wrapper-repo: "https://github.com/Start9Labs/hello-world-wrapper"
22+
license: MIT
23+
# The repository URL for the package. This repo contains the manifest file (this), any scripts necessary for configuration, backups, actions, or health checks (more below). This key must exist. But could be embedded into the source repository.
24+
wrapper-repo: "https://github.com/Start9Labs/hello-world-startos"
1525
# The original project repository URL. There is no upstream repo in this example
1626
upstream-repo: "https://github.com/Start9Labs/hello-world"
1727
# URL to the support site / channel for the project. This key can be omitted if none exists, or it can link to the original project repository issues.
@@ -31,7 +41,7 @@ description:
3141
assets:
3242
# Default = LICENSE.md
3343
license: LICENSE
34-
# Default = icon.png (.svg allowed)
44+
# Default = icon.png
3545
icon: icon.png
3646
# Default = INSTRUCTIONS.md
3747
instructions: instructions.md
@@ -64,8 +74,19 @@ main:
6474
mounts:
6575
# Specifies where on the service's file system its persistence directory should be mounted prior to service startup
6676
main: /root
67-
# This is where health checks would be defined - see a more advanced example in https://github.com/Start9Labs/start-pages-wrapper
68-
health-checks: {}
77+
# Specifies whether GPU acceleration is enabled or not. False by default.
78+
gpu-acceleration: false
79+
# Defines what architectures will be supported by the service. This service supports x86_64 and aarch64 architectures.
80+
hardware-requirements:
81+
arch:
82+
- x86_64
83+
- aarch64
84+
# This is where health checks would be defined - see a more advanced example in https://github.com/Start9Labs/start9-pages-startos
85+
health-checks:
86+
web-ui:
87+
name: Web Interface
88+
success-message: The Hello World is accessible
89+
type: script
6990
config: ~
7091
properties: ~
7192
# type: script

‎scripts/deps.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
export * from "https://deno.land/x/embassyd_sdk@v0.3.3.0.5/mod.ts";
2-
export * from "https://deno.land/x/embassyd_sdk@v0.3.3.0.5/util.ts";
1+
export * from "https://deno.land/x/embassyd_sdk@v0.3.3.0.11/mod.ts";

‎scripts/embassy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ export { setConfig } from "./procedures/setConfig.ts";
22
export { getConfig } from "./procedures/getConfig.ts";
33
export { properties } from "./procedures/properties.ts";
44
export { migration } from "./procedures/migrations.ts";
5-
export { main } from "./procedures/main.ts";
5+
export { health } from "./procedures/healthChecks.ts";

‎scripts/procedures/healthChecks.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { types as T, healthUtil } from "../deps.ts";
2+
3+
export const health: T.ExpectedExports.health = {
4+
async "web-ui"(effects, duration) {
5+
return healthUtil.checkWebUrl("http://hello-world.embassy:80")(effects, duration).catch(healthUtil.catchError(effects))
6+
},
7+
};

‎scripts/procedures/main.ts

-7
This file was deleted.

‎scripts/procedures/migrations.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import { compat, types as T } from "../deps.ts";
22

33
export const migration: T.ExpectedExports.migration = compat.migrations
4-
.fromMapping({}, "1.0.0.1" );
4+
.fromMapping({}, "0.3.5" );

0 commit comments

Comments
 (0)
Please sign in to comment.