Merge branch 'rpm-building' into 'main'

Rpm building

See merge request veilid/veilid!42
This commit is contained in:
TC Johnson 2023-07-03 02:59:50 +00:00
commit 7d4d83b6ac
5 changed files with 127 additions and 2 deletions

View File

@ -118,7 +118,7 @@ unit-tests-linux-arm64:
RUN cargo test --target aarch64-unknown-linux-gnu --release -p veilid-server -p veilid-cli -p veilid-tools -p veilid-core RUN cargo test --target aarch64-unknown-linux-gnu --release -p veilid-server -p veilid-cli -p veilid-tools -p veilid-core
# Package # Package
package-linux-amd64: package-linux-amd64-deb:
FROM +build-linux-amd64 FROM +build-linux-amd64
################################# #################################
### DEBIAN DPKG .DEB FILES ### DEBIAN DPKG .DEB FILES
@ -131,8 +131,27 @@ package-linux-amd64:
RUN /veilid/package/debian/earthly_make_veilid_cli_deb.sh amd64 x86_64-unknown-linux-gnu RUN /veilid/package/debian/earthly_make_veilid_cli_deb.sh amd64 x86_64-unknown-linux-gnu
# save artifacts # save artifacts
SAVE ARTIFACT --keep-ts /dpkg/out/*.deb AS LOCAL ./target/packages/ SAVE ARTIFACT --keep-ts /dpkg/out/*.deb AS LOCAL ./target/packages/
package-linux-amd64-rpm:
FROM --platform amd64 rockylinux:8
RUN yum install -y createrepo rpm-build rpm-sign yum-utils rpmdevtools
RUN rpmdev-setuptree
#################################
### RPMBUILD .RPM FILES
#################################
RUN mkdir -p /veilid/target
COPY --dir .cargo external files scripts veilid-cli veilid-core veilid-server veilid-tools veilid-flutter veilid-wasm Cargo.lock Cargo.toml package /veilid
COPY +build-linux-amd64/x86_64-unknown-linux-gnu /veilid/target/x86_64-unknown-linux-gnu
RUN mkdir -p /rpm-work-dir/veilid-server
# veilid-server
RUN veilid/package/rpm/veilid-server/earthly_make_veilid_server_rpm.sh x86_64 x86_64-unknown-linux-gnu
#SAVE ARTIFACT --keep-ts /root/rpmbuild/RPMS/x86_64/*.rpm AS LOCAL ./target/packages/
# veilid-cli
RUN veilid/package/rpm/veilid-cli/earthly_make_veilid_cli_rpm.sh x86_64 x86_64-unknown-linux-gnu
# save artifacts
SAVE ARTIFACT --keep-ts /root/rpmbuild/RPMS/x86_64/*.rpm AS LOCAL ./target/packages/
package-linux-arm64: package-linux-arm64-deb:
FROM +build-linux-arm64 FROM +build-linux-arm64
################################# #################################
### DEBIAN DPKG .DEB FILES ### DEBIAN DPKG .DEB FILES

View File

@ -0,0 +1,13 @@
#!/bin/bash
ARCH=$1
CARGO_ARCH=$2
CARGO_VERSION="$(/veilid/package/cargo_version.sh /veilid/veilid-cli/Cargo.toml)"
# veilid-cli spec file
cp -rf /veilid/package/rpm/veilid-cli/veilid-cli.spec /root/rpmbuild/SPECS/
/veilid/package/replace_variable.sh /root/rpmbuild/SPECS/veilid-cli.spec CARGO_VERSION $CARGO_VERSION
/veilid/package/replace_variable.sh /root/rpmbuild/SPECS/veilid-cli.spec ARCH $ARCH
/veilid/package/replace_variable.sh /root/rpmbuild/SPECS/veilid-cli.spec CARGO_ARCH $CARGO_ARCH
# build the rpm
rpmbuild --target "x86_64" -bb /root/rpmbuild/SPECS/veilid-cli.spec

View File

@ -0,0 +1,28 @@
Summary: Veilid Server Command Line Interface
Name: veilid-cli
Version: $CARGO_VERSION
Release: 1
URL: https://veilid.com
Group: System
License: MPL 2.0
Packager: Veilid Foundation, Inc.
Requires: glibc-common >= 2.23
BuildRoot: /rpm-work-dir/veilid-cli
BuildArch: $ARCH
%description
Veilid Server Command Line Interface
%install
mkdir -p %{buildroot}/usr/bin/
cp /veilid/target/$CARGO_ARCH/release/veilid-cli %{buildroot}/usr/bin/veilid-cli
%files
/usr/bin/veilid-cli
%post
chmod 755 /usr/bin/veilid-cli
%changelog
* Sun Jul 2 2023 TC <tc@veilid.org>
- experimental RPM building

View File

@ -0,0 +1,13 @@
#!/bin/bash
ARCH=$1
CARGO_ARCH=$2
CARGO_VERSION="$(/veilid/package/cargo_version.sh /veilid/veilid-server/Cargo.toml)"
# veilid-server spec file
cp -rf /veilid/package/rpm/veilid-server/veilid-server.spec /root/rpmbuild/SPECS/
/veilid/package/replace_variable.sh /root/rpmbuild/SPECS/veilid-server.spec CARGO_VERSION $CARGO_VERSION
/veilid/package/replace_variable.sh /root/rpmbuild/SPECS/veilid-server.spec ARCH $ARCH
/veilid/package/replace_variable.sh /root/rpmbuild/SPECS/veilid-server.spec CARGO_ARCH $CARGO_ARCH
# build the rpm
rpmbuild --target "x86_64" -bb /root/rpmbuild/SPECS/veilid-server.spec

View File

@ -0,0 +1,52 @@
Summary: Install a server grade, headless Veilid node
Name: veilid-server
Version: $CARGO_VERSION
Release: 1
URL: https://veilid.com
Group: System
License: MPL 2.0
Packager: Veilid Foundation, Inc.
Requires: glibc-common >= 2.23
BuildRoot: /rpm-work-dir/veilid-server
BuildArch: $ARCH
%description
A server grade, headless Veilid node
%install
mkdir -p %{buildroot}/usr/bin/
cp /veilid/target/$CARGO_ARCH/release/veilid-server %{buildroot}/usr/bin/veilid-server
mkdir -p %{buildroot}/etc/systemd/system
cp /veilid/package/systemd/veilid-server.service %{buildroot}/etc/systemd/system/veilid-server.service
mkdir -p %{buildroot}/etc/veilid-server
cp /veilid/package/linux/veilid-server.conf %{buildroot}/etc/veilid-server/veilid-server.conf
%files
/usr/bin/veilid-server
/etc/systemd/system/veilid-server.service
/etc/veilid-server/veilid-server.conf
%post
adduser --system -U veilid &>/dev/null || true
mkdir -p /var/db/veilid-server/protected_store
mkdir -p /var/db/veilid-server/table_store
mkdir -p /var/db/veilid-server/block_store
chown -R veilid:veilid /var/db/veilid-server
chmod 0750 /var/db/veilid-server/protected_store
chmod 0750 /var/db/veilid-server/table_store
chmod 0750 /var/db/veilid-server/block_store
chmod 0750 /var/db/veilid-server
chmod 755 /usr/bin/veilid-server
systemctl daemon-reload
echo "Congratulations! To start your Veilid node and set it to start at boot, run the command systemctl enable --now veilid-server"
%postun
systemctl daemon-reload
%changelog
* Sun Jul 2 2023 TC <tc@veilid.org>
- experimental RPM building