From 057324a2f83b12ee5fb6a20cdadc5589ed047e86 Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Wed, 10 Apr 2024 10:24:22 -0500 Subject: [PATCH 1/6] Adding amd64 debian packager, checksums, README updates. --- .github/workflows/deb_packager.yml | 99 ++++++++++++++++++++++++++++++ README.md | 23 +++++++ packaging/genesis.toml | 18 ++++++ packaging/miden-node.service | 15 +++++ packaging/miden.toml | 18 ++++++ packaging/postinst | 11 ++++ packaging/postrm | 8 +++ 7 files changed, 192 insertions(+) create mode 100644 .github/workflows/deb_packager.yml create mode 100644 packaging/genesis.toml create mode 100644 packaging/miden-node.service create mode 100644 packaging/miden.toml create mode 100755 packaging/postinst create mode 100755 packaging/postrm diff --git a/.github/workflows/deb_packager.yml b/.github/workflows/deb_packager.yml new file mode 100644 index 000000000..1ca2fc7e4 --- /dev/null +++ b/.github/workflows/deb_packager.yml @@ -0,0 +1,99 @@ +name: deb_packager + +on: + push: + branches: + - 'main' + - 'next' + paths: + - '**' + tags: + - 'v*.*.*' + - 'v*.*.*-*' + +jobs: + build: + permissions: + id-token: write + contents: write + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + ##### TAG Variable ##### + - name: Adding TAG to ENV + run: echo "GIT_TAG=`echo $(git describe --tags --abbrev=0)`" >> $GITHUB_ENV + - name: adding version + run: | + NUMERIC_VERSION=$( echo ${{ env.GIT_TAG }} | sed 's/[^0-9.]//g' ) + echo "VERSION=$NUMERIC_VERSION" >> $GITHUB_ENV + + - name: Cleaning repo + run: cargo clean + - name: Building for amd64 + run: cargo build --release + + - name: create packaging subdir + run: mkdir -p packaging/deb/miden-node/DEBIAN + + - name: making directory for binary + run: mkdir -p packaging/deb/miden-node/usr/bin + + - name: create systemd location + run: mkdir -p packaging/deb/miden-node/lib/systemd/system + + - name: copy the miden-node service file + run: cp packaging/miden-node.service packaging/deb/miden-node/lib/systemd/system/ + + - name: make directory for example configs + run: mkdir -p packaging/deb/miden-node/etc/miden + + - name: copy the miden-node.toml file + run: cp node/miden.toml packaging/deb/miden-node/etc/miden/ + + - name: copy over the postinst + run: cp packaging/postinst packaging/deb/miden-node/DEBIAN/postinst + + - name: copy over the postrm + run: cp packaging/postrm packaging/deb/miden-node/DEBIAN/postrm + + - name: copying over the build + run: cp -rp target/release/miden-node packaging/deb/miden-node/usr/bin/ + + ########### Control file creation for amd64 ########## + - name: create control file + run: | + touch packaging/deb/miden-node/DEBIAN/control + echo "Package: miden-node" >> packaging/deb/miden-node/DEBIAN/control + echo "Version: ${{ env.VERSION }}" >> packaging/deb/miden-node/DEBIAN/control + echo "Section: base" >> packaging/deb/miden-node/DEBIAN/control + echo "Priority: optional" >> packaging/deb/miden-node/DEBIAN/control + echo "Architecture: amd64" >> packaging/deb/miden-node/DEBIAN/control + echo "Maintainer: devops@polygon.technology" >> packaging/deb/miden-node/DEBIAN/control + echo "Description: miden-node binary package" >> packaging/deb/miden-node/DEBIAN/control + + - name: Creating package for binary for miden-node ${{ env.ARCH }} + run: cp -rp packaging/deb/miden-node packaging/deb/miden-node-${{ env.GIT_TAG }}-${{ env.ARCH }} + env: + ARCH: amd64 + + - name: Running package build + run: dpkg-deb --build --root-owner-group packaging/deb/miden-node-${{ env.GIT_TAG }}-${{ env.ARCH }} + env: + ARCH: amd64 + + - name: shasum the package + run: cd packaging/deb/ && sha256sum miden-node-${{ env.GIT_TAG }}-${{ env.ARCH }}.deb > miden-node-${{ env.GIT_TAG }}-${{ env.ARCH }}.deb.checksum + env: + ARCH: amd64 + + - name: release miden-node Packages + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ env.GIT_TAG }} + prerelease: true + files: | + packaging/deb/miden-node**.deb + packaging/deb/miden-node**.deb.checksum \ No newline at end of file diff --git a/README.md b/README.md index 7ca94f900..58fee8cef 100644 --- a/README.md +++ b/README.md @@ -91,5 +91,28 @@ Please, refer to each component's documentation: Each directory containing the executables also contains an example configuration file. Make sure that the configuration files are mutually consistent. That is, make sure that the URLs are valid and point to the right endpoint. + +### Debian Packages + +The debian packages allow for easy install for miden on debian based systems. Note that there are checksums available for the package. +Current support is for amd64, arm64 support coming soon. + +To install the debian package: +```sh +sudo dpkg -i $package_name.deb +``` +Note, when using the debian package to run the `make-genesis` function, you should define the location of your output: +```sh +miden-node make-genesis -i $input_location_for_gensis.toml -o $output_for_gensis.dat_and_accounts +``` +The debian package has a checksum, you can verify this checksum by download the debian package and checksum file to the same directory and running the following command: +```sh +sha256sum --check $checksumfile +``` +Please make sure you have the sha256sum program installed, for most linux operating systems this is already installed. If you wish to installe it on your macOS, you can use brew: +```sh +brew install coreutils +``` + ## License This project is [MIT licensed](./LICENSE). diff --git a/packaging/genesis.toml b/packaging/genesis.toml new file mode 100644 index 000000000..5cf53bb9b --- /dev/null +++ b/packaging/genesis.toml @@ -0,0 +1,18 @@ +# This is an example genesis input file for the Miden node. +version = 1 +timestamp = 1672531200 + +[[accounts]] +type = "BasicWallet" +init_seed = "0xa123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +auth_scheme = "RpoFalcon512" +auth_seed = "0xb123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" + +[[accounts]] +type = "BasicFungibleFaucet" +init_seed = "0xc123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +auth_scheme = "RpoFalcon512" +auth_seed = "0xd123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +token_symbol = "POL" +decimals = 12 +max_supply = 1000000 diff --git a/packaging/miden-node.service b/packaging/miden-node.service new file mode 100644 index 000000000..bd7882b82 --- /dev/null +++ b/packaging/miden-node.service @@ -0,0 +1,15 @@ +[Unit] +Description=Miden node +Wants=network-online.target + +[Install] +WantedBy=multi-user.target + +[Service] +Type=exec +Environment="RUST_LOG=info" +ExecStart=miden-node start --config /etc/miden/miden.toml +WorkingDirectory=/opt/miden +User=miden +RestartSec=5 +Restart=always \ No newline at end of file diff --git a/packaging/miden.toml b/packaging/miden.toml new file mode 100644 index 000000000..7bdcfadf9 --- /dev/null +++ b/packaging/miden.toml @@ -0,0 +1,18 @@ +# This is an example configuration file for the Miden node. + +[block_producer] +# port defined as: sum(ord(c)**p for (p, c) in enumerate('miden-block-producer', 1)) % 2**16 +endpoint = { host = "localhost", port = 48046 } +store_url = "http://localhost:28943" + +[rpc] +# port defined as: sum(ord(c)**p for (p, c) in enumerate('miden-rpc', 1)) % 2**16 +endpoint = { host = "localhost", port = 57291 } +block_producer_url = "http://localhost:48046" +store_url = "http://localhost:28943" + +[store] +# port defined as: sum(ord(c)**p for (p, c) in enumerate('miden-store', 1)) % 2**16 +endpoint = { host = "localhost", port = 28943 } +database_filepath = "/opt/miden/miden-store.sqlite3" +genesis_filepath = "/opt/miden/genesis.dat" diff --git a/packaging/postinst b/packaging/postinst new file mode 100755 index 000000000..8005d2413 --- /dev/null +++ b/packaging/postinst @@ -0,0 +1,11 @@ +# This is a postinstallation script so the service can be configured and started when requested +# +sudo adduser --disabled-password --disabled-login --shell /usr/sbin/nologin --quiet --system --no-create-home --home /nonexistent miden +if [ -d "/opt/miden" ] +then + echo "Directory /opt/miden exists." +else + mkdir -p /opt/miden + sudo chown -R miden /opt/miden +fi +sudo systemctl daemon-reload \ No newline at end of file diff --git a/packaging/postrm b/packaging/postrm new file mode 100755 index 000000000..7a139ff3b --- /dev/null +++ b/packaging/postrm @@ -0,0 +1,8 @@ +#!/bin/bash +# +############### +# Remove bor installs +############## +sudo rm -rf /lib/systemd/system/miden-node.service +sudo deluser miden +sudo systemctl daemon-reload \ No newline at end of file From e37c59c04405bfadfbef0fe0bc8711a369c32e97 Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Wed, 10 Apr 2024 14:49:31 -0500 Subject: [PATCH 2/6] Cleaning up a bad reference in comment --- packaging/postrm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/postrm b/packaging/postrm index 7a139ff3b..2b8806559 100755 --- a/packaging/postrm +++ b/packaging/postrm @@ -1,7 +1,7 @@ #!/bin/bash # ############### -# Remove bor installs +# Remove miden installs ############## sudo rm -rf /lib/systemd/system/miden-node.service sudo deluser miden From 30b2965237463315228e70f706bd83c76c547c71 Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Thu, 11 Apr 2024 13:40:21 -0500 Subject: [PATCH 3/6] Adding #! to postinst, removed 'next' for the branch on push execution --- .github/workflows/deb_packager.yml | 1 - packaging/postinst | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deb_packager.yml b/.github/workflows/deb_packager.yml index 1ca2fc7e4..0b77c35db 100644 --- a/.github/workflows/deb_packager.yml +++ b/.github/workflows/deb_packager.yml @@ -4,7 +4,6 @@ on: push: branches: - 'main' - - 'next' paths: - '**' tags: diff --git a/packaging/postinst b/packaging/postinst index 8005d2413..96183d714 100755 --- a/packaging/postinst +++ b/packaging/postinst @@ -1,3 +1,4 @@ +#!/bin/bash # This is a postinstallation script so the service can be configured and started when requested # sudo adduser --disabled-password --disabled-login --shell /usr/sbin/nologin --quiet --system --no-create-home --home /nonexistent miden From f31456394624ee86091a9ae0dadcf3e6812777bc Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Thu, 11 Apr 2024 13:42:11 -0500 Subject: [PATCH 4/6] Added Homepage, VCS-git, and Vcs-browser to control file, removed the cargo clean --- .github/workflows/deb_packager.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deb_packager.yml b/.github/workflows/deb_packager.yml index 0b77c35db..4c509f1e6 100644 --- a/.github/workflows/deb_packager.yml +++ b/.github/workflows/deb_packager.yml @@ -29,8 +29,6 @@ jobs: NUMERIC_VERSION=$( echo ${{ env.GIT_TAG }} | sed 's/[^0-9.]//g' ) echo "VERSION=$NUMERIC_VERSION" >> $GITHUB_ENV - - name: Cleaning repo - run: cargo clean - name: Building for amd64 run: cargo build --release @@ -72,6 +70,9 @@ jobs: echo "Architecture: amd64" >> packaging/deb/miden-node/DEBIAN/control echo "Maintainer: devops@polygon.technology" >> packaging/deb/miden-node/DEBIAN/control echo "Description: miden-node binary package" >> packaging/deb/miden-node/DEBIAN/control + echo "Homepage: https://polygon.technology/polygon-miden" >> packaging/deb/miden-node/DEBIAN/control + echo "Vcs-Git: git@github.com:0xPolygonMiden/miden-node.git" >> packaging/deb/miden-node/DEBIAN/control + echo "Vcs-Browser: https://github.com/0xPolygonMiden/miden-node" >> packaging/deb/miden-node/DEBIAN/control - name: Creating package for binary for miden-node ${{ env.ARCH }} run: cp -rp packaging/deb/miden-node packaging/deb/miden-node-${{ env.GIT_TAG }}-${{ env.ARCH }} From bbdf22ad8ea7524bfa45537dc08fec2664c4f16a Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Thu, 11 Apr 2024 13:52:50 -0500 Subject: [PATCH 5/6] Updated email in maintainer in control file --- .github/workflows/deb_packager.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deb_packager.yml b/.github/workflows/deb_packager.yml index 4c509f1e6..6c1335e57 100644 --- a/.github/workflows/deb_packager.yml +++ b/.github/workflows/deb_packager.yml @@ -68,7 +68,7 @@ jobs: echo "Section: base" >> packaging/deb/miden-node/DEBIAN/control echo "Priority: optional" >> packaging/deb/miden-node/DEBIAN/control echo "Architecture: amd64" >> packaging/deb/miden-node/DEBIAN/control - echo "Maintainer: devops@polygon.technology" >> packaging/deb/miden-node/DEBIAN/control + echo "Maintainer: Polygon Devops " >> packaging/deb/miden-node/DEBIAN/control echo "Description: miden-node binary package" >> packaging/deb/miden-node/DEBIAN/control echo "Homepage: https://polygon.technology/polygon-miden" >> packaging/deb/miden-node/DEBIAN/control echo "Vcs-Git: git@github.com:0xPolygonMiden/miden-node.git" >> packaging/deb/miden-node/DEBIAN/control From c3d6b21d69b040cc7adb5e162c30c730b67ed9f8 Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Thu, 11 Apr 2024 13:58:25 -0500 Subject: [PATCH 6/6] Adding clean back in to the build :) --- .github/workflows/deb_packager.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/deb_packager.yml b/.github/workflows/deb_packager.yml index 6c1335e57..10eca7717 100644 --- a/.github/workflows/deb_packager.yml +++ b/.github/workflows/deb_packager.yml @@ -29,6 +29,9 @@ jobs: NUMERIC_VERSION=$( echo ${{ env.GIT_TAG }} | sed 's/[^0-9.]//g' ) echo "VERSION=$NUMERIC_VERSION" >> $GITHUB_ENV + - name: cleaning repo + run: cargo clean + - name: Building for amd64 run: cargo build --release