From 2db6e2de0c0002cce7730e73c0eb97fc77c9d543 Mon Sep 17 00:00:00 2001 From: David Zwart Date: Sat, 23 Nov 2024 16:20:36 +0100 Subject: [PATCH] release: sqlite version --- .github/workflows/release.yaml | 206 +++++++++--------- src/config | 2 +- src/modules/monsterpi/config | 3 - .../fdm-monster-daemon/install-fdm-monster.js | 14 ++ src/modules/monsterpi/start_chroot_script | 14 +- 5 files changed, 122 insertions(+), 117 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 4eb9920..02b6274 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,110 +1,114 @@ ---- - name: Release on: push: branches: - - 'release/*' - - 'release-sqlite/*' + - "release/*" + - "release-sqlite/*" jobs: release: - if: startsWith(github.ref, 'refs/heads/release') runs-on: ubuntu-latest steps: - - name: Install Dependencies - run: | - sudo apt update - sudo apt install coreutils p7zip-full qemu-user-static - - - name: Checkout CustomPiOS - uses: actions/checkout@v4.2.2 - with: - repository: 'guysoft/CustomPiOS' - path: CustomPiOS - ref: "baaa155f33f54fa0e777039dd47cca751fa55802" - - - name: Checkout Project Repository - uses: actions/checkout@v4.2.2 - with: - path: repository - submodules: true - fetch-depth: 0 - - - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v3.0.3 - with: - versionSpec: '5.x' - - - name: Use GitVersion - uses: gittools/actions/gitversion/execute@v3.0.3 - id: gitversion - with: - targetPath: repository - - - name: Download Raspbian 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' - - - name: Update CustomPiOS Paths - run: | - cd repository/src - ../../CustomPiOS/src/update-custompios-paths - - - name: Set release image version - run: | - source repository/src/config - echo "DIST_VERSION=${{ steps.gitversion.outputs.majorMinorPatch }}" > repository/src/config.local - - - name: Build Image - run: | - sudo modprobe loop - cd repository/src - sudo bash -x ./build_dist - - - name: Copy output - id: copy - run: | - source repository/src/config - TAG=${DIST_VERSION} - IMAGE=monsterpi-$TAG - - cp repository/src/workspace/*.img $IMAGE.img - - echo "tag=$TAG" >> $GITHUB_OUTPUT - echo "image=$IMAGE" >> $GITHUB_OUTPUT - - - name: Show size and version info - run: | - echo "Tag ${{steps.copy.outputs.tag}}" - echo "File size of ${{ steps.copy.outputs.image }}.img" - stat --printf="%s" ${{ steps.copy.outputs.image }}.img - - - name: Zip Image - run: | - zip ${{ steps.copy.outputs.image }}.zip ${{ steps.copy.outputs.image }}.img - echo "File size of ${{ steps.copy.outputs.image }}.zip" - stat --printf="%s" ${{ steps.copy.outputs.image }}.zip - - - name: Create release - uses: actions/create-release@v1 - id: create_release - with: - draft: ${{ github.ref_name == 'develop' }} - prerelease: ${{ contains(steps.copy.outputs.tag, 'rc') || contains(steps.copy.outputs.tag, 'unstable') }} - tag_name: ${{ steps.copy.outputs.tag }} - release_name: MonsterPi ${{ steps.copy.outputs.image }} - body: "The MonsterPi image for running FDM Monster on Raspberry Pi. Release notes will be added manually." # ${{ 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: - 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 + - name: Install Dependencies + run: | + sudo apt update + sudo apt install coreutils p7zip-full qemu-user-static + + - name: Checkout CustomPiOS + uses: actions/checkout@v4.2.2 + with: + repository: "guysoft/CustomPiOS" + path: CustomPiOS + ref: "baaa155f33f54fa0e777039dd47cca751fa55802" + + - name: Checkout Project Repository + uses: actions/checkout@v4.2.2 + with: + path: repository + submodules: true + fetch-depth: 0 + + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v3.0.3 + with: + versionSpec: "5.x" + + - name: Use GitVersion + uses: gittools/actions/gitversion/execute@v3.0.3 + id: gitversion + with: + targetPath: repository + + - name: Determine Release Tag + id: determine_tag + run: | + BRANCH_NAME="${GITHUB_REF#refs/heads/}" + TAG="${{ steps.gitversion.outputs.majorMinorPatch }}-sqlite" + echo "tag=$TAG" >> $GITHUB_OUTPUT + + - name: Download Raspbian 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' + + - name: Update CustomPiOS Paths + run: | + cd repository/src + ../../CustomPiOS/src/update-custompios-paths + + - name: Set release image version + run: | + source repository/src/config + echo "DIST_VERSION=${{ steps.determine_tag.outputs.tag }}" > repository/src/config.local + + - name: Build Image + run: | + sudo modprobe loop + cd repository/src + sudo bash -x ./build_dist + + - name: Copy output + id: copy + run: | + source repository/src/config + TAG=${{ steps.determine_tag.outputs.tag }} + IMAGE=monsterpi-$TAG + + cp repository/src/workspace/*.img $IMAGE.img + + echo "tag=$TAG" >> $GITHUB_OUTPUT + echo "image=$IMAGE" >> $GITHUB_OUTPUT + + - name: Show size and version info + run: | + echo "Tag ${{steps.copy.outputs.tag}}" + echo "File size of ${{ steps.copy.outputs.image }}.img" + stat --printf="%s" ${{ steps.copy.outputs.image }}.img + + - name: Zip Image + run: | + zip ${{ steps.copy.outputs.image }}.zip ${{ steps.copy.outputs.image }}.img + echo "File size of ${{ steps.copy.outputs.image }}.zip" + stat --printf="%s" ${{ steps.copy.outputs.image }}.zip + + - name: Create release + uses: actions/create-release@v1 + id: create_release + with: + draft: false + prerelease: ${{ contains(steps.copy.outputs.tag, 'rc') || contains(steps.copy.outputs.tag, 'unstable') }} + tag_name: ${{ steps.copy.outputs.tag }} + release_name: MonsterPi ${{ steps.copy.outputs.image }} + body: "The MonsterPi image for running FDM Monster on Raspberry Pi. Release notes will be added manually." # ${{ 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: + 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 diff --git a/src/config b/src/config index ffcd077..4b3c8e2 100644 --- a/src/config +++ b/src/config @@ -1,5 +1,5 @@ export DIST_NAME=MonsterPi -export DIST_VERSION=0.4.5 +export DIST_VERSION=0.4.5-sqlite export BASE_DISTRO=ubuntu export BASE_ARCH=aarch64 # This does not work without $BASE_IMAGE_PATH diff --git a/src/modules/monsterpi/config b/src/modules/monsterpi/config index 3badacd..0d28df5 100644 --- a/src/modules/monsterpi/config +++ b/src/modules/monsterpi/config @@ -1,9 +1,6 @@ ############################################################################### # All our config settings must start with MONSTERPI_ -# MongoDB -[ -n "$MONSTERPI_MONGODB_VERSION" ] || MONSTERPI_MONGODB_VERSION=4.4 - # Node.js [ -n "$MONSTERPI_NODEJS_VERSION" ] || MONSTERPI_NODEJS_VERSION=20.x diff --git a/src/modules/monsterpi/filesystem/home/pi/fdm-monster-daemon/install-fdm-monster.js b/src/modules/monsterpi/filesystem/home/pi/fdm-monster-daemon/install-fdm-monster.js index 4d5f8bc..78e434d 100644 --- a/src/modules/monsterpi/filesystem/home/pi/fdm-monster-daemon/install-fdm-monster.js +++ b/src/modules/monsterpi/filesystem/home/pi/fdm-monster-daemon/install-fdm-monster.js @@ -17,6 +17,20 @@ const svc = new Service({ script: join(rootPath, "dist/index.js"), nodeOptions: ["--harmony", "--max_old_space_size=4096"], workingDirectory: rootPath, + env: [ + { + name: "ENABLE_EXPERIMENTAL_TYPEORM", + value: "true", + }, + { + name: "DATABASE_PATH", + value: "./database", + }, + { + name: "DATABASE_FILE", + value: "fdm-monster.sqlite", + }, + ], }); svc.on("install", function () { diff --git a/src/modules/monsterpi/start_chroot_script b/src/modules/monsterpi/start_chroot_script index 5082cc5..55e4889 100644 --- a/src/modules/monsterpi/start_chroot_script +++ b/src/modules/monsterpi/start_chroot_script @@ -1,6 +1,6 @@ #!/usr/bin/env bash # start_chroot_script -# This installs MongoDB as well as FDM Monster and HAProxy +# This installs FDM Monster and HAProxy # Written by David Zwart # GPL V3 ######## @@ -45,7 +45,7 @@ else fi # Install GPG -apt install -y gnupg +# apt install -y gnupg # Install Node.js based on MONSTERPI_NODEJS_VERSION curl -sL https://deb.nodesource.com/setup_$MONSTERPI_NODEJS_VERSION | bash - @@ -68,16 +68,6 @@ pushd /home/"${BASE_USER}" fi popd -# Add MongoDB as trusted source list -wget -qO - https://www.mongodb.org/static/pgp/server-"$MONSTERPI_MONGODB_VERSION".asc | sudo apt-key add - -echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/`cat /etc/os-release | grep "^ID=" | cut -d "=" -f2` `cat /etc/os-release | grep "^VERSION_CODENAME=" | cut -d "=" -f2`/mongodb-org/$MONSTERPI_MONGODB_VERSION multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-$MONSTERPI_MONGODB_VERSION.list -apt update - -# Install MongoDB -sudo apt install -y mongodb-org=4.4.15 mongodb-org-server=4.4.15 mongodb-org-shell=4.4.15 mongodb-org-mongos=4.4.15 mongodb-org-tools=4.4.15 -systemctl enable mongod -systemctl start mongod - # add some "How To" info to boot output # Note, this code is also in /filesystem/home/pi/scripts/ sed -i 's@exit 0@@' /etc/rc.local