Skip to content

Commit

Permalink
Merge pull request #34 from fdm-monster/feat/fdm-monster-1.5.0-rc1
Browse files Browse the repository at this point in the history
fix: prepare to convert MonsterPi for 1.5.0-rc2 dist install
  • Loading branch information
davidzwa authored Oct 15, 2023
2 parents 680378f + 0e38fed commit 45f78cc
Show file tree
Hide file tree
Showing 12 changed files with 355 additions and 174 deletions.
31 changes: 28 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
submodules: true

# wget -c --trust-server-names 'https://cdimage.ubuntu.com/releases/22.04/release/ubuntu-22.04.2-preinstalled-server-arm64+raspi.img.xz'
- name: Download Raspbian Image
- name: Download Raspbian or Ubuntu Image
run: |
cd repository/src/image
wget -c --trust-server-names 'https://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.5-preinstalled-server-arm64+raspi.img.xz'
Expand Down Expand Up @@ -64,14 +64,39 @@ jobs:
run: |
source repository/src/config
NOW=$(date +"%Y-%m-%d")
IMAGE=monsterpi-$DIST_VERSION-$NOW-nightly
VERSION=${DIST_VERSION}-${NOW}-nightly
IMAGE=monsterpi-$VERSION
cp repository/src/workspace/*.img $IMAGE.img
echo "::set-output name=image::$IMAGE"
echo "tag=$VERSION" >> $GITHUB_OUTPUT
echo "image=$IMAGE" >> $GITHUB_OUTPUT
- name: Zip Image
if: github.event_name == 'schedule'
run: |
zip ${{ steps.copy.outputs.image }}.zip ${{ steps.copy.outputs.image }}.img
- name: Create release
uses: actions/create-release@v1
if: github.event_name == 'schedule'
id: create_release
with:
draft: ${{ github.ref_name == 'develop' }}
prerelease: ${{ contains(env.DIST_VERSION, 'rc') || contains(env.DIST_VERSION, 'unstable') }}
tag_name: ${{ steps.copy.outputs.version }}
release_name: MonsterPi ${{ steps.copy.outputs.image }}
body: "Release notes not added" # ${{ steps.build_changelog.outputs.changelog }}
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Upload server bundle zip
uses: actions/upload-release-asset@v1
if: github.event_name == 'schedule'
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.copy.outputs.image }}.zip
asset_name: ${{ steps.copy.outputs.image }}.zip
asset_content_type: application/zip
61 changes: 23 additions & 38 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,51 +65,36 @@ jobs:
id: copy
run: |
source repository/src/config
IMAGE=monsterpi-$DIST_VERSION
VERSION=${DIST_VERSION}
IMAGE=monsterpi-$VERSION
cp repository/src/workspace/*.img $IMAGE.img
echo "::set-output name=image::$IMAGE"
echo "tag=$VERSION" >> $GITHUB_OUTPUT
echo "image=$IMAGE" >> $GITHUB_OUTPUT
- name: Zip Image
run: |
zip ${{ steps.copy.outputs.image }}.zip ${{ steps.copy.outputs.image }}.img
- name: Extract owner and repo
uses: jungwinter/split@v2.1.0
id: repo
- name: Create release
uses: actions/create-release@v1
id: create_release
with:
separator: '/'
msg: ${{ github.repository }}

- name: Install GitReleaseManager
uses: gittools/actions/gitreleasemanager/setup@v0.10.2
with:
versionSpec: '0.13.x'

- name: Create release with GitReleaseManager
uses: gittools/actions/gitreleasemanager/create@v0.10.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
owner: ${{ steps.repo.outputs._0 }}
repository: ${{ steps.repo.outputs._1 }}
milestone: ${{ steps.gitversion.outputs.majorMinorPatch }}
name: 'Release ${{ steps.gitversion.outputs.majorMinorPatch }}'
assets: |
${{ steps.copy.outputs.image }}.zip
- name: Publish release with GitReleaseManager
uses: gittools/actions/gitreleasemanager/publish@v0.10.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
owner: ${{ steps.repo.outputs._0 }}
repository: ${{ steps.repo.outputs._1 }}
tagName: ${{ steps.gitversion.outputs.majorMinorPatch }}

- name: Close release with GitReleaseManager
uses: gittools/actions/gitreleasemanager/close@v0.10.2
draft: ${{ github.ref_name == 'develop' }}
prerelease: ${{ contains(env.DIST_VERSION, 'rc') || contains(env.DIST_VERSION, 'unstable') }}
tag_name: ${{ steps.copy.outputs.version }}
release_name: MonsterPi ${{ steps.copy.outputs.image }}
body: "Release notes not added" # ${{ steps.build_changelog.outputs.changelog }}
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Upload server bundle zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
owner: ${{ steps.repo.outputs._0 }}
repository: ${{ steps.repo.outputs._1 }}
milestone: ${{ steps.gitversion.outputs.majorMinorPatch }}
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.copy.outputs.image }}.zip
asset_name: ${{ steps.copy.outputs.image }}.zip
asset_content_type: application/zip
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@ src/vagrant/.vagrant
gh-md-toc

*.xz

src/modules/monsterpi/filesystem/home/pi/fdm-monster-daemon/node_modules/

src/modules/monsterpi/filesystem/home/pi/fdm-monster/dist-active/

src/modules/monsterpi/filesystem/home/pi/fdm-monster/dist-zips/
5 changes: 3 additions & 2 deletions src/config
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
export DIST_NAME=MonsterPi
export DIST_VERSION=0.2.3
export DIST_VERSION=0.3.0-rc1

export BASE_DISTRO=ubuntu
export BASE_ARCH=aarch64
export BASE_ZIP_IMG=`ls -t $BASE_IMAGE_PATH/*-{ubuntu}-*-arm64-*.xz | head -n 1`
# This does not work without $BASE_IMAGE_PATH
# export BASE_ZIP_IMG=`ls -t $BASE_IMAGE_PATH/*-{ubuntu}-*-arm64-*.xz | head -n 1`
export BASE_IGNORE_VARIANT_NAME=yes
export BASE_USER=pi
export BASE_USER_PASSWORD=raspberry
Expand Down
2 changes: 1 addition & 1 deletion src/modules/monsterpi/config
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
[ -n "$MONSTERPI_INCLUDE_HAPROXY" ] || MONSTERPI_INCLUDE_HAPROXY=yes

# FDM Monster version
[ -n "$MONSTERPI_FDMMONSTER_VERSION" ] || MONSTERPI_FDMMONSTER_VERSION=1.4.5
[ -n "$MONSTERPI_FDMMONSTER_VERSION" ] || MONSTERPI_FDMMONSTER_VERSION=1.5.0-rc2
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
/**
* Created by D. Zwart
* Description: Installs the Linux Service for MonsterPi's FDM Monster
* v1.0
* 05/05/2023
* v2.0
* 14/10/2023
*/

const { Service } = require('node-linux');
const { Service } = require("node-linux");
const { join } = require("path");

// Create a new service object
const rootPath = join(__dirname, "../fdm-monster/server/");
const rootPath = join(__dirname, "../fdm-monster/dist-active");
const svc = new Service({
name: 'FDM Monster',
description: "The 3D Printer Farm server for managing your 100+ OctoPrints printers.",
script: join(rootPath, "index.mjs"),
nodeOptions: [
'--harmony',
'--max_old_space_size=4096'
],
workingDirectory: rootPath,
name: "FDM Monster",
description:
"The 3D Printer Farm server for managing your 100+ OctoPrints printers.",
script: join(rootPath, "dist/index.js"),
nodeOptions: ["--harmony", "--max_old_space_size=4096"],
workingDirectory: rootPath,
});

svc.on('install', function () {
svc.start();
console.log("Install complete. Service exists:", svc.exists());
console.log("Service running: ", svc.isRunning);
svc.on("install", function () {
svc.start();
console.log("Install complete. Service exists:", svc.exists());
console.log("Service running: ", svc.isRunning);
});

if (svc.exists()) {
svc.uninstall();
svc.uninstall();
}

svc.install();

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"name": "fdm-monster-daemon",
"version": "1.0.0",
"version": "2.0.0",
"description": "Daemon service wrapper ",
"main": "./install-fdm-monster.js",
"license": "MIT",
"scripts": {
"install": "node ./install-fdm-monster.js",
"uninstall": "node ./uninstall-fdm-monster.js"
"install": "node ./install-fdm-monster.js",
"uninstall": "node ./uninstall-fdm-monster.js"
},
"dependencies": {}
}
"dependencies": {
"node-linux": "^0.1.12"
}
}
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
/**
* Created by D. Zwart
* Description: Uninstalls the Linux Service for MonsterPi's FDM Monster
* v1.0
* 05/05/2023
* v2.0
* 14/10/2023
*/

const { Service } = require('node-linux');
const { Service } = require("node-linux");
const { join } = require("path");

// Create a new service object
const rootPath = join(__dirname, "../fdm-monster/server/");
const rootPath = join(__dirname, "../fdm-monster/dist-active");
const svc = new Service({
name: 'FDM Monster',
description: "The 3D Printer Farm server for managing your 100+ OctoPrints printers.",
script: join(rootPath, "index.mjs"),
nodeOptions: [
'--harmony',
'--max_old_space_size=4096'
],
workingDirectory: rootPath,
name: "FDM Monster",
description:
"The 3D Printer Farm server for managing your 100+ OctoPrints printers.",
script: join(rootPath, "dist/index.js"),
nodeOptions: ["--harmony", "--max_old_space_size=4096"],
workingDirectory: rootPath,
});

svc.on('install', function () {
svc.start();
console.log("Install complete. Service exists:", svc.exists());
console.log("Service running: ", svc.isRunning);
svc.on("install", function () {
svc.start();
console.log("Install complete. Service exists:", svc.exists());
console.log("Service running: ", svc.isRunning);
});

svc.uninstall();
Loading

0 comments on commit 45f78cc

Please sign in to comment.