Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
35 changes: 21 additions & 14 deletions .github/actions/debian/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ inputs:
options:
- miden-node
- miden-remote-prover
service:
package:
required: true
description: The service to build the packages for.
description: The Debian package name.
type: choice
options:
- miden-node
- miden-prover
- miden-prover-proxy
package:
packaging_dir:
required: true
description: Name of packaging directory.
type: choice
Expand Down Expand Up @@ -78,7 +78,7 @@ runs:
- name: Create package directories
shell: bash
run: |
pkg=${{ inputs.service }}
pkg=${{ inputs.package }}
mkdir -p \
packaging/deb/$pkg/DEBIAN \
packaging/deb/$pkg/usr/bin \
Expand All @@ -89,13 +89,16 @@ runs:
- name: Copy package install scripts
shell: bash
run: |
svc=${{ inputs.service }}
pkg=${{ inputs.package }}
pkg_dir=${{ inputs.packaging_dir }}
crate=${{ inputs.crate_dir }}
git show ${{ steps.git-sha.outputs.sha }}:bin/$crate/.env > packaging/deb/$svc/lib/systemd/system/$svc.env
git show ${{ steps.git-sha.outputs.sha }}:packaging/$pkg/$svc.service > packaging/deb/$svc/lib/systemd/system/$svc.service
git show ${{ steps.git-sha.outputs.sha }}:packaging/$pkg/postinst > packaging/deb/$svc/DEBIAN/postinst
git show ${{ steps.git-sha.outputs.sha }}:packaging/$pkg/postrm > packaging/deb/$svc/DEBIAN/postrm
git show ${{ steps.git-sha.outputs.sha }}:packaging/$pkg_dir/postinst > packaging/deb/$pkg/DEBIAN/postinst
git show ${{ steps.git-sha.outputs.sha }}:packaging/$pkg_dir/postrm > packaging/deb/$pkg/DEBIAN/postrm
for service_file in $(ls packaging/$pkg_dir/*.service | sed "s/.*miden/miden/g"); do
svc=$(echo $service_file | sed "s/.service//g")
git show ${{ steps.git-sha.outputs.sha }}:packaging/$pkg_dir/$service_file > packaging/deb/$pkg/lib/systemd/system/$service_file
git show ${{ steps.git-sha.outputs.sha }}:bin/$crate/.env > packaging/deb/$pkg/lib/systemd/system/$svc.env
done
chmod 0775 packaging/deb/$svc/DEBIAN/postinst
chmod 0775 packaging/deb/$svc/DEBIAN/postrm

Expand All @@ -108,7 +111,7 @@ runs:
# Control file's version field must be x.y.z format so strip the rest.
version=$(git describe --tags --abbrev=0 | sed 's/[^0-9.]//g' )

pkg=${{ inputs.service }}
pkg=${{ inputs.package }}
cat > packaging/deb/$pkg/DEBIAN/control << EOF
Package: $pkg
Version: $version
Expand All @@ -132,14 +135,14 @@ runs:
- name: Copy binary files
shell: bash
run: |
pkg=${{ inputs.service }}
pkg=${{ inputs.package }}
bin=${{ inputs.crate }}
cp -p ./bin/$bin packaging/deb/$pkg/usr/bin/

- name: Build packages
shell: bash
run: |
dpkg-deb --build --root-owner-group packaging/deb/${{ inputs.service }}
dpkg-deb --build --root-owner-group packaging/deb/${{ inputs.package }}

# Save the .deb files, delete the rest.
mv packaging/deb/*.deb .
Expand All @@ -148,12 +151,16 @@ runs:
- name: Package names
shell: bash
run: |
echo "package=${{ inputs.service }}-${{ inputs.gitref }}-${{ inputs.arch }}.deb" >> $GITHUB_ENV
echo "package=${{ inputs.package }}-${{ inputs.gitref }}-${{ inputs.arch }}.deb" >> $GITHUB_ENV

- name: Rename package files
shell: bash
run: |
mv ${{ inputs.service }}.deb ${{ env.package }}
pkg_dir=${{ inputs.packaging_dir }}
for service_file in $(ls packaging/$pkg_dir/*.service | sed "s/.*miden/miden/g"); do
svc=$(echo $service_file | sed "s/.service//g")
mv $svc.deb ${{ env.package }}
done

- name: shasum packages
shell: bash
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/publish-debian-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
gitref: ${{ env.version }}
crate_dir: node
service: miden-node
package: node
package: miden-node
packaging_dir: node
crate: miden-node
arch: ${{ matrix.arch }}

Expand All @@ -62,8 +62,8 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
gitref: ${{ env.version }}
crate_dir: remote-prover
service: miden-prover
package: prover
package: miden-prover
packaging_dir: prover
crate: miden-remote-prover
arch: ${{ matrix.arch }}

Expand All @@ -85,8 +85,8 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
gitref: ${{ env.version }}
crate_dir: remote-prover
service: miden-prover-proxy
package: prover-proxy
package: miden-prover-proxy
packaging_dir: prover-proxy
crate: miden-remote-prover
arch: ${{ matrix.arch }}

Expand All @@ -108,7 +108,7 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
gitref: ${{ env.version }}
crate_dir: network-monitor
service: miden-network-monitor
package: network-monitor
package: miden-network-monitor
packaging_dir: network-monitor
crate: miden-network-monitor
arch: ${{ matrix.arch }}
10 changes: 5 additions & 5 deletions .github/workflows/publish-debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Publish Debian Package
on:
workflow_dispatch:
inputs:
service:
description: "Name of service to publish"
package:
description: "Name of package to publish"
required: true
type: choice
options:
Expand All @@ -20,7 +20,7 @@ on:
- network-monitor
- node
- remote-prover
package:
packaging_dir:
required: true
description: "Name of packaging directory"
type: choice
Expand Down Expand Up @@ -48,7 +48,7 @@ permissions:

jobs:
publish:
name: Publish ${{ inputs.service }} ${{ matrix.arch }} Debian
name: Publish ${{ inputs.package }} ${{ matrix.arch }} Debian
strategy:
matrix:
arch: [amd64, arm64]
Expand All @@ -69,7 +69,7 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
gitref: ${{ inputs.version }}
crate_dir: ${{ inputs.crate_dir }}
service: ${{ inputs.service }}
package: ${{ inputs.package }}
packaging_dir: ${{ inputs.packaging_dir }}
crate: ${{ inputs.crate }}
arch: ${{ matrix.arch }}
16 changes: 16 additions & 0 deletions packaging/node/miden-validator.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Unit]
Description=Miden validator
Wants=network-online.target

[Install]
WantedBy=multi-user.target

[Service]
Type=exec
Environment="OTEL_SERVICE_NAME=miden-validator"
EnvironmentFile=/lib/systemd/system/miden-validator.env
ExecStart=/usr/bin/miden-node validator start
WorkingDirectory=/opt/miden-node

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bit of a meta question, but we should probably distinguish this from the node? In case both node + validator run on the same instance.

Suggested change
WorkingDirectory=/opt/miden-node
WorkingDirectory=/opt/miden-validator

A different way of doing things is to have common /opt/miden/ directory and then each service gets its own /opt/miden/<service> folder in there. But that gets dodgy..? Or maybe not.

Essentially, I think I recall that each "org" should have its own /opt directory. But I could be mistaken. I think part of the problem would then be that we probably need a miden user group to own the /opt/miden directory, which would then let the miden-node, miden-validator users act within that group. Or we just have a single miden user which handles all miden services.

Probably I'm overthinking things :)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable but would opt to add validator in the current scheme we have and do a migration for all existing packages/services separately to this work

User=miden-validator
RestartSec=5
Restart=always
Loading