Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
39 changes: 13 additions & 26 deletions .github/workflows/buildService.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,20 @@ on:
workflow_dispatch:
pull_request:
paths-ignore: ['*.md']
branches: ['main', 'master']
branches: ['master']
push:
paths-ignore: ['*.md']
branches: ['main', 'master']
branches: ['master']

jobs:
BuildPackage:
runs-on: ubuntu-latest
steps:
- name: Prepare StartOS SDK
uses: Start9Labs/sdk@v1

- name: Checkout services repository
uses: actions/checkout@v4
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

- name: Build the service package
id: build
run: |
git submodule update --init --recursive
start-sdk init
make
PACKAGE_ID=$(yq -oy ".id" manifest.*)
echo "package_id=$PACKAGE_ID" >> $GITHUB_ENV
shell: bash

# - name: Upload .s9pk
# uses: actions/upload-artifact@v4
# with:
# name: ${{ env.package_id }}.s9pk
# path: ./${{ env.package_id }}.s9pk
jobs:
build:
if: github.event.pull_request.draft == false
uses: start9labs/shared-workflows/.github/workflows/buildService.yml@master
# with:
# FREE_DISK_SPACE: true
secrets:
DEV_KEY: ${{ secrets.DEV_KEY }}
71 changes: 10 additions & 61 deletions .github/workflows/releaseService.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,66 +6,15 @@ on:
- 'v*.*'

jobs:
ReleasePackage:
runs-on: ubuntu-latest
release:
uses: start9labs/shared-workflows/.github/workflows/releaseService.yml@master
with:
# FREE_DISK_SPACE: true
REGISTRY: ${{ vars.REGISTRY }}
S3_S9PKS_BASE_URL: ${{ vars.S3_S9PKS_BASE_URL }}
secrets:
DEV_KEY: ${{ secrets.DEV_KEY }}
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}
permissions:
contents: write
steps:
- name: Prepare StartOS SDK
uses: Start9Labs/sdk@v1

- name: Checkout services repository
uses: actions/checkout@v4

- name: Build the service package
run: |
git submodule update --init --recursive
start-sdk init
make

- name: Setting package ID and title from the manifest
id: package
run: |
echo "package_id=$(yq -oy ".id" manifest.*)" >> $GITHUB_ENV
echo "package_title=$(yq -oy ".title" manifest.*)" >> $GITHUB_ENV
shell: bash

- name: Generate sha256 checksum
run: |
PACKAGE_ID=${{ env.package_id }}
sha256sum ${PACKAGE_ID}.s9pk > ${PACKAGE_ID}.s9pk.sha256
shell: bash

- name: Generate changelog
run: |
PACKAGE_ID=${{ env.package_id }}
echo "## What's Changed" > change-log.txt
yq -oy '.release-notes' manifest.* >> change-log.txt
echo "## SHA256 Hash" >> change-log.txt
echo '```' >> change-log.txt
sha256sum ${PACKAGE_ID}.s9pk >> change-log.txt
echo '```' >> change-log.txt
shell: bash

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: ${{ env.package_title }} ${{ github.ref_name }}
prerelease: true
body_path: change-log.txt
files: |
./${{ env.package_id }}.s9pk
./${{ env.package_id }}.s9pk.sha256

- name: Publish to Registry
env:
S9USER: ${{ secrets.S9USER }}
S9PASS: ${{ secrets.S9PASS }}
S9REGISTRY: ${{ secrets.S9REGISTRY }}
run: |
if [[ -z "$S9USER" || -z "$S9PASS" || -z "$S9REGISTRY" ]]; then
echo "Publish skipped: missing registry credentials."
else
start-sdk publish https://$S9USER:$S9PASS@$S9REGISTRY ${{ env.package_id }}.s9pk
fi
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
*.s9pk
.vscode/
startos/*.js
node_modules/
.DS_Store
scripts/*.js
.vscode/
docker-images
javascript
ncc-cache
3 changes: 3 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## How the upstream version is pulled
- Image is `dockerBuild` from root
- Check `Dockerfile` for upstream version reference (FROM or ARG)
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Contributing

## Building and Development

See the [StartOS Packaging Guide](https://docs.start9.com/packaging/) for complete environment setup and build instructions.

### Quick Start

```bash
# Install dependencies
npm ci

# Build universal package
make
```
54 changes: 4 additions & 50 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,52 +1,6 @@
# Stage 1: Build
FROM node:18-alpine AS build
FROM germannewsmaker/myspeed:1.0.9

# Install necessary build dependencies
RUN apk add --no-cache g++ make cmake python3 py3-setuptools git
RUN apk add --no-cache tini

# Set the working directory
WORKDIR /myspeed

# Clone the MySpeed repository from GitHub
RUN git clone https://github.com/gnmyt/myspeed.git .

# Install dependencies for the entire application (using npm for compatibility with package-lock.json)
RUN npm install --legacy-peer-deps

# Build the client application using npm instead of yarn to avoid conflicts
RUN cd client && npm install --legacy-peer-deps
RUN cd client && npm run build

# Move built client files to the correct location
RUN mv client/build .

# Stage 2: Production
FROM node:18-alpine

# Install production dependencies
RUN apk add --no-cache tzdata

# Set environment variables
ENV NODE_ENV=production
ENV TZ=Etc/UTC

# Set the working directory
WORKDIR /myspeed

# Copy the built files and server files from the build stage
COPY --from=build /myspeed/build /myspeed/build
COPY --from=build /myspeed/server /myspeed/server
COPY --from=build /myspeed/node_modules /myspeed/node_modules
COPY --from=build /myspeed/package.json /myspeed/package.json

# Declare a volume for persistent data
VOLUME ["/myspeed/data"]

# Expose the necessary port
EXPOSE 5216

# Start the application
CMD ["node", "server/server.js"]

# Add the entrypoint script
ADD ./docker_entrypoint.sh /usr/local/bin/docker_entrypoint.sh
ENTRYPOINT ["tini", "--"]
CMD ["node", "server"]
63 changes: 3 additions & 60 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,60 +1,3 @@
PKG_ID := $(shell yq e ".id" manifest.yaml)
PKG_VERSION := $(shell yq e ".version" manifest.yaml)
TS_FILES := $(shell find ./ -name \*.ts)

.DELETE_ON_ERROR:

all: verify

arm:
@rm -f docker-images/x86_64.tar
@ARCH=aarch64 $(MAKE)

x86:
@rm -f docker-images/aarch64.tar
@ARCH=x86_64 $(MAKE)

verify: $(PKG_ID).s9pk
@start-sdk verify s9pk $(PKG_ID).s9pk
@echo " Done!"
@echo " Filesize: $(shell du -h $(PKG_ID).s9pk) is ready"

install:
@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
@echo "\nInstalling to $$(grep -v '^#' ~/.embassy/config.yaml | cut -d'/' -f3) ...\n"
@[ -f $(PKG_ID).s9pk ] || ( $(MAKE) && echo "\nInstalling to $$(grep -v '^#' ~/.embassy/config.yaml | cut -d'/' -f3) ...\n" )
@start-cli package install $(PKG_ID).s9pk

clean:
rm -rf docker-images
rm -f $(PKG_ID).s9pk
rm -f scripts/*.js

scripts/embassy.js: $(TS_FILES)
deno bundle scripts/embassy.ts scripts/embassy.js

docker-images/aarch64.tar: manifest.yaml Dockerfile docker_entrypoint.sh
ifeq ($(ARCH),x86_64)
else
mkdir -p docker-images
docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) \
--platform=linux/arm64 -o type=docker,dest=docker-images/aarch64.tar .
endif

docker-images/x86_64.tar: manifest.yaml Dockerfile docker_entrypoint.sh
ifeq ($(ARCH),aarch64)
else
mkdir -p docker-images
docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) \
--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 scripts/procedures/healthChecks.ts scripts/embassy.ts
ifeq ($(ARCH),aarch64)
@echo "start-sdk: Preparing aarch64 package ..."
else ifeq ($(ARCH),x86_64)
@echo "start-sdk: Preparing x86_64 package ..."
else
@echo "start-sdk: Preparing Universal Package ..."
endif
@start-sdk pack
ARCHES := x86 arm
# overrides to s9pk.mk must precede the include statement
include s9pk.mk
Loading