mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-25 12:59:06 +01:00
Remove obsolete package build rule
In case of cc-backend it is recommended to setup by hand or use the prebuild binary.
This commit is contained in:
parent
bcd7f47409
commit
0c7f55ff8d
87
Makefile
87
Makefile
@ -76,90 +76,3 @@ config.json:
|
|||||||
$(SVELTE_TARGETS): $(SVELTE_SRC)
|
$(SVELTE_TARGETS): $(SVELTE_SRC)
|
||||||
$(info ===> BUILD frontend)
|
$(info ===> BUILD frontend)
|
||||||
cd web/frontend && npm install && npm run build
|
cd web/frontend && npm install && npm run build
|
||||||
|
|
||||||
install: $(TARGET)
|
|
||||||
@WORKSPACE=$(PREFIX)
|
|
||||||
@if [ -z "$${WORKSPACE}" ]; then exit 1; fi
|
|
||||||
@mkdir --parents --verbose $${WORKSPACE}/usr/$(BINDIR)
|
|
||||||
@install -Dpm 755 $(TARGET) $${WORKSPACE}/usr/$(BINDIR)/$(TARGET)
|
|
||||||
@install -Dpm 600 configs/config.json $${WORKSPACE}/etc/$(TARGET)/$(TARGET).json
|
|
||||||
|
|
||||||
.ONESHELL:
|
|
||||||
.PHONY: RPM
|
|
||||||
RPM: build/package/cc-backend.spec
|
|
||||||
@WORKSPACE="$${PWD}"
|
|
||||||
@SPECFILE="$${WORKSPACE}/build/package/cc-backend.spec"
|
|
||||||
# Setup RPM build tree
|
|
||||||
@eval $$(rpm --eval "ARCH='%{_arch}' RPMDIR='%{_rpmdir}' SOURCEDIR='%{_sourcedir}' SPECDIR='%{_specdir}' SRPMDIR='%{_srcrpmdir}' BUILDDIR='%{_builddir}'")
|
|
||||||
@mkdir --parents --verbose "$${RPMDIR}" "$${SOURCEDIR}" "$${SPECDIR}" "$${SRPMDIR}" "$${BUILDDIR}"
|
|
||||||
# Create source tarball
|
|
||||||
@COMMITISH="HEAD"
|
|
||||||
@VERS=$$(git describe --tags $${COMMITISH})
|
|
||||||
@VERS=$${VERS#v}
|
|
||||||
@VERS=$$(echo $$VERS | sed -e s+'-'+'_'+g)
|
|
||||||
@if [ "$${VERS}" = "" ]; then VERS="$(VERSION)"; fi
|
|
||||||
@eval $$(rpmspec --query --queryformat "NAME='%{name}' VERSION='%{version}' RELEASE='%{release}' NVR='%{NVR}' NVRA='%{NVRA}'" --define="VERS $${VERS}" "$${SPECFILE}")
|
|
||||||
@PREFIX="$${NAME}-$${VERSION}"
|
|
||||||
@FORMAT="tar.gz"
|
|
||||||
@SRCFILE="$${SOURCEDIR}/$${PREFIX}.$${FORMAT}"
|
|
||||||
@git archive --verbose --format "$${FORMAT}" --prefix="$${PREFIX}/" --output="$${SRCFILE}" $${COMMITISH}
|
|
||||||
# Build RPM and SRPM
|
|
||||||
@rpmbuild -ba --define="VERS $${VERS}" --rmsource --clean "$${SPECFILE}"
|
|
||||||
# Report RPMs and SRPMs when in GitHub Workflow
|
|
||||||
@if [ "$${GITHUB_ACTIONS}" = true ]; then
|
|
||||||
@ RPMFILE="$${RPMDIR}/$${ARCH}/$${NVRA}.rpm"
|
|
||||||
@ SRPMFILE="$${SRPMDIR}/$${NVR}.src.rpm"
|
|
||||||
@ echo "RPM: $${RPMFILE}"
|
|
||||||
@ echo "SRPM: $${SRPMFILE}"
|
|
||||||
@ echo "::set-output name=SRPM::$${SRPMFILE}"
|
|
||||||
@ echo "::set-output name=RPM::$${RPMFILE}"
|
|
||||||
@fi
|
|
||||||
|
|
||||||
.ONESHELL:
|
|
||||||
.PHONY: DEB
|
|
||||||
DEB: build/package/cc-backend.deb.control
|
|
||||||
@BASEDIR=$${PWD}
|
|
||||||
@WORKSPACE=$${PWD}/.dpkgbuild
|
|
||||||
@DEBIANDIR=$${WORKSPACE}/debian
|
|
||||||
@DEBIANBINDIR=$${WORKSPACE}/DEBIAN
|
|
||||||
@mkdir --parents --verbose $$WORKSPACE $$DEBIANBINDIR
|
|
||||||
#@mkdir --parents --verbose $$DEBIANDIR
|
|
||||||
@CONTROLFILE="$${BASEDIR}/build/package/cc-backend.deb.control"
|
|
||||||
@COMMITISH="HEAD"
|
|
||||||
@VERS=$$(git describe --tags --abbrev=0 $${COMMITISH})
|
|
||||||
@VERS=$${VERS#v}
|
|
||||||
@VERS=$$(echo $$VERS | sed -e s+'-'+'_'+g)
|
|
||||||
@if [ "$${VERS}" = "" ]; then VERS="$(VERSION)"; fi
|
|
||||||
@ARCH=$$(uname -m)
|
|
||||||
@ARCH=$$(echo $$ARCH | sed -e s+'_'+'-'+g)
|
|
||||||
@if [ "$${ARCH}" = "x86-64" ]; then ARCH=amd64; fi
|
|
||||||
@PREFIX="$${NAME}-$${VERSION}_$${ARCH}"
|
|
||||||
@SIZE_BYTES=$$(du -bcs --exclude=.dpkgbuild "$${WORKSPACE}"/ | awk '{print $$1}' | head -1 | sed -e 's/^0\+//')
|
|
||||||
@SIZE="$$(awk -v size="$$SIZE_BYTES" 'BEGIN {print (size/1024)+1}' | awk '{print int($$0)}')"
|
|
||||||
#@sed -e s+"{VERSION}"+"$$VERS"+g -e s+"{INSTALLED_SIZE}"+"$$SIZE"+g -e s+"{ARCH}"+"$$ARCH"+g $$CONTROLFILE > $${DEBIANDIR}/control
|
|
||||||
@sed -e s+"{VERSION}"+"$$VERS"+g -e s+"{INSTALLED_SIZE}"+"$$SIZE"+g -e s+"{ARCH}"+"$$ARCH"+g $$CONTROLFILE > $${DEBIANBINDIR}/control
|
|
||||||
@mkdir --parents --verbose "$${WORKSPACE}"/$(VAR)
|
|
||||||
@touch "$${WORKSPACE}"/$(VAR)/job.db
|
|
||||||
@cd web/frontend && yarn install && yarn build && cd -
|
|
||||||
@go build -ldflags=${LD_FLAGS} ./cmd/cc-backend
|
|
||||||
@mkdir --parents --verbose $${WORKSPACE}/usr/$(BINDIR)
|
|
||||||
@cp $(TARGET) $${WORKSPACE}/usr/$(BINDIR)/$(TARGET)
|
|
||||||
@chmod 0755 $${WORKSPACE}/usr/$(BINDIR)/$(TARGET)
|
|
||||||
@mkdir --parents --verbose $${WORKSPACE}/etc/$(TARGET)
|
|
||||||
@cp configs/config.json $${WORKSPACE}/etc/$(TARGET)/$(TARGET).json
|
|
||||||
@chmod 0600 $${WORKSPACE}/etc/$(TARGET)/$(TARGET).json
|
|
||||||
@mkdir --parents --verbose $${WORKSPACE}/usr/lib/systemd/system
|
|
||||||
@cp build/package/$(TARGET).service $${WORKSPACE}/usr/lib/systemd/system/$(TARGET).service
|
|
||||||
@chmod 0644 $${WORKSPACE}/usr/lib/systemd/system/$(TARGET).service
|
|
||||||
@mkdir --parents --verbose $${WORKSPACE}/etc/default
|
|
||||||
@cp build/package/$(TARGET).config $${WORKSPACE}/etc/default/$(TARGET)
|
|
||||||
@chmod 0600 $${WORKSPACE}/etc/default/$(TARGET)
|
|
||||||
@mkdir --parents --verbose $${WORKSPACE}/usr/lib/sysusers.d
|
|
||||||
@cp build/package/$(TARGET).sysusers $${WORKSPACE}/usr/lib/sysusers.d/$(TARGET).conf
|
|
||||||
@chmod 0644 $${WORKSPACE}/usr/lib/sysusers.d/$(TARGET).conf
|
|
||||||
@DEB_FILE="cc-metric-store_$${VERS}_$${ARCH}.deb"
|
|
||||||
@dpkg-deb -b $${WORKSPACE} "$$DEB_FILE"
|
|
||||||
@rm -r "$${WORKSPACE}"
|
|
||||||
@if [ "$${GITHUB_ACTIONS}" = "true" ]; then
|
|
||||||
@ echo "::set-output name=DEB::$${DEB_FILE}"
|
|
||||||
@fi
|
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
CC_USER=clustercockpit
|
|
||||||
|
|
||||||
CC_GROUP=clustercockpit
|
|
||||||
|
|
||||||
CC_HOME=/tmp
|
|
||||||
|
|
||||||
LOG_DIR=/var/log
|
|
||||||
|
|
||||||
DATA_DIR=/var/run/cc-backend
|
|
||||||
|
|
||||||
MAX_OPEN_FILES=10000
|
|
||||||
|
|
||||||
CONF_DIR=/etc/cc-backend
|
|
||||||
|
|
||||||
CONF_FILE=/etc/cc-backend/cc-backend.json
|
|
||||||
|
|
||||||
RESTART_ON_UPGRADE=true
|
|
@ -1,12 +0,0 @@
|
|||||||
Package: cc-backend
|
|
||||||
Version: {VERSION}
|
|
||||||
Installed-Size: {INSTALLED_SIZE}
|
|
||||||
Architecture: {ARCH}
|
|
||||||
Maintainer: thomas.gruber@fau.de
|
|
||||||
Depends: libc6 (>= 2.2.1)
|
|
||||||
Build-Depends: debhelper-compat (= 13), git, golang-go, npm, yarn
|
|
||||||
Description: ClusterCockpit backend and web frontend
|
|
||||||
Homepage: https://github.com/ClusterCockpit/cc-backend
|
|
||||||
Source: cc-backend
|
|
||||||
Rules-Requires-Root: no
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=ClusterCockpit backend and web frontend (cc-backend)
|
|
||||||
Documentation=https://github.com/ClusterCockpit/cc-backend
|
|
||||||
Wants=network-online.target
|
|
||||||
After=network-online.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
EnvironmentFile=/etc/default/cc-backend
|
|
||||||
Type=simple
|
|
||||||
User=clustercockpit
|
|
||||||
Group=clustercockpit
|
|
||||||
Restart=on-failure
|
|
||||||
TimeoutStopSec=100
|
|
||||||
LimitNOFILE=infinity
|
|
||||||
ExecStart=/usr/bin/cc-backend --config ${CONF_FILE}
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
@ -1,70 +0,0 @@
|
|||||||
Name: cc-backend
|
|
||||||
Version: %{VERS}
|
|
||||||
Release: 1%{?dist}
|
|
||||||
Summary: ClusterCockpit backend and web frontend
|
|
||||||
|
|
||||||
License: MIT
|
|
||||||
Source0: %{name}-%{version}.tar.gz
|
|
||||||
|
|
||||||
#BuildRequires: go-toolset
|
|
||||||
#BuildRequires: systemd-rpm-macros
|
|
||||||
#BuildRequires: npm
|
|
||||||
|
|
||||||
Provides: %{name} = %{version}
|
|
||||||
|
|
||||||
%description
|
|
||||||
ClusterCockpit backend and web frontend
|
|
||||||
|
|
||||||
%global debug_package %{nil}
|
|
||||||
|
|
||||||
%prep
|
|
||||||
%autosetup
|
|
||||||
|
|
||||||
|
|
||||||
%build
|
|
||||||
#CURRENT_TIME=$(date +%Y-%m-%d:T%H:%M:\%S)
|
|
||||||
#LD_FLAGS="-s -X main.buildTime=${CURRENT_TIME} -X main.version=%{VERS}"
|
|
||||||
mkdir ./var
|
|
||||||
touch ./var/job.db
|
|
||||||
cd web/frontend && yarn install && yarn build && cd -
|
|
||||||
go build -ldflags="-s -X main.version=%{VERS}" ./cmd/cc-backend
|
|
||||||
|
|
||||||
|
|
||||||
%install
|
|
||||||
# Install cc-backend
|
|
||||||
#make PREFIX=%{buildroot} install
|
|
||||||
install -Dpm 755 cc-backend %{buildroot}/%{_bindir}/%{name}
|
|
||||||
install -Dpm 0600 configs/config.json %{buildroot}%{_sysconfdir}/%{name}/%{name}.json
|
|
||||||
# Integrate into system
|
|
||||||
install -Dpm 0644 build/package/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
|
|
||||||
install -Dpm 0600 build/package/%{name}.config %{buildroot}%{_sysconfdir}/default/%{name}
|
|
||||||
install -Dpm 0644 build/package/%{name}.sysusers %{buildroot}%{_sysusersdir}/%{name}.conf
|
|
||||||
|
|
||||||
|
|
||||||
%check
|
|
||||||
# go test should be here... :)
|
|
||||||
|
|
||||||
%pre
|
|
||||||
%sysusers_create_package scripts/%{name}.sysusers
|
|
||||||
|
|
||||||
%post
|
|
||||||
%systemd_post %{name}.service
|
|
||||||
|
|
||||||
%preun
|
|
||||||
%systemd_preun %{name}.service
|
|
||||||
|
|
||||||
%files
|
|
||||||
# Binary
|
|
||||||
%attr(-,clustercockpit,clustercockpit) %{_bindir}/%{name}
|
|
||||||
# Config
|
|
||||||
%dir %{_sysconfdir}/%{name}
|
|
||||||
%attr(0600,clustercockpit,clustercockpit) %config(noreplace) %{_sysconfdir}/%{name}/%{name}.json
|
|
||||||
# Systemd
|
|
||||||
%{_unitdir}/%{name}.service
|
|
||||||
%{_sysconfdir}/default/%{name}
|
|
||||||
%{_sysusersdir}/%{name}.conf
|
|
||||||
|
|
||||||
%changelog
|
|
||||||
* Mon Mar 07 2022 Thomas Gruber - 0.1
|
|
||||||
- Initial metric store implementation
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
|||||||
#Type Name ID GECOS Home directory Shell
|
|
||||||
u clustercockpit - "User for ClusterCockpit" /run/cc-backend /sbin/nologin
|
|
Loading…
Reference in New Issue
Block a user