diff --git a/CHANGELOG.md b/CHANGELOG.md index 66d2be50ef2..0f74885a938 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ * [BUGFIX] KV store: Fix false-positive `status_code="500"` metrics for HA tracker CAS operations when using memberlist. #7408 * [BUGFIX] Memberlist: Skip nil values delivered by `WatchPrefix` when a key is deleted, preventing a panic in the HA tracker caused by a failed type assertion on a nil interface value. #7429 * [BUGFIX] Tenant Federation: Fix `unsupported character` error when `tenant-federation.regex-matcher-enabled` is enabled and the input regex matches 0 or 1 existing tenant. #7424 +* [BUGFIX] Packaging: Fix RPM and deb packages to install the binary to `/usr/bin`, install the systemd unit to the correct system path (`/usr/lib/systemd/system` for RPM, `/lib/systemd/system` for deb), and mark the sysconfig/default env file as a config file so it is not overwritten on upgrade. ## 1.21.0 in progress diff --git a/Makefile b/Makefile index 9c85ae5ddc1..c0bc02d2dbd 100644 --- a/Makefile +++ b/Makefile @@ -362,20 +362,22 @@ dist/$(UPTODATE)-packages: dist $(wildcard packaging/deb/**) $(wildcard packagin --architecture $$deb_arch \ --after-install packaging/deb/control/postinst \ --before-remove packaging/deb/control/prerm \ + --config-files /etc/default/cortex \ --package dist/cortex-$(VERSION)_$$arch.deb \ - dist/cortex-linux-$$arch=/usr/local/bin/cortex \ + dist/cortex-linux-$$arch=/usr/bin/cortex \ docs/configuration/single-process-config-blocks.yaml=/etc/cortex/single-process-config.yaml \ packaging/deb/default/cortex=/etc/default/cortex \ - packaging/deb/systemd/cortex.service=/etc/systemd/system/cortex.service; \ + packaging/deb/systemd/cortex.service=/lib/systemd/system/cortex.service; \ $(FPM_OPTS) -t rpm \ --architecture $$rpm_arch \ --after-install packaging/rpm/control/post \ --before-remove packaging/rpm/control/preun \ + --config-files /etc/sysconfig/cortex \ --package dist/cortex-$(VERSION)_$$arch.rpm \ - dist/cortex-linux-$$arch=/usr/local/bin/cortex \ + dist/cortex-linux-$$arch=/usr/bin/cortex \ docs/configuration/single-process-config-blocks.yaml=/etc/cortex/single-process-config.yaml \ packaging/rpm/sysconfig/cortex=/etc/sysconfig/cortex \ - packaging/rpm/systemd/cortex.service=/etc/systemd/system/cortex.service; \ + packaging/rpm/systemd/cortex.service=/usr/lib/systemd/system/cortex.service; \ done for pkg in dist/*.deb dist/*.rpm; do \ sha256sum $$pkg | cut -d ' ' -f 1 > $${pkg}-sha-256; \ diff --git a/packaging/deb/systemd/cortex.service b/packaging/deb/systemd/cortex.service index e695f117e87..f54f2772a26 100644 --- a/packaging/deb/systemd/cortex.service +++ b/packaging/deb/systemd/cortex.service @@ -8,7 +8,7 @@ After=network-online.target Restart=always User=cortex EnvironmentFile=/etc/default/cortex -ExecStart=/usr/local/bin/cortex --config.file $CONFIG_FILE --log.level $LOG_LEVEL $CUSTOM_ARGS +ExecStart=/usr/bin/cortex --config.file $CONFIG_FILE --log.level $LOG_LEVEL $CUSTOM_ARGS ExecReload=/bin/kill -HUP $MAINPID TimeoutStopSec=20s SendSIGKILL=no diff --git a/packaging/fpm/Dockerfile b/packaging/fpm/Dockerfile index 2b32eea23d4..273d2d3e601 100644 --- a/packaging/fpm/Dockerfile +++ b/packaging/fpm/Dockerfile @@ -3,7 +3,6 @@ FROM alpine:3.23 RUN apk add --no-cache \ ruby \ ruby-dev \ - ruby-etc \ gcc \ git \ libc-dev \ diff --git a/packaging/rpm/systemd/cortex.service b/packaging/rpm/systemd/cortex.service index 63b9fb2f7c4..c49ddb95371 100644 --- a/packaging/rpm/systemd/cortex.service +++ b/packaging/rpm/systemd/cortex.service @@ -8,7 +8,7 @@ After=network-online.target Restart=always User=cortex EnvironmentFile=/etc/sysconfig/cortex -ExecStart=/usr/local/bin/cortex --config.file $CONFIG_FILE --log.level $LOG_LEVEL $CUSTOM_ARGS +ExecStart=/usr/bin/cortex --config.file $CONFIG_FILE --log.level $LOG_LEVEL $CUSTOM_ARGS ExecReload=/bin/kill -HUP $MAINPID TimeoutStopSec=20s SendSIGKILL=no