feat: add multi-distro RPM packaging for CentOS 7 and Rocky Linux 8/9/10
- Create RPM maintainer scripts (post, preun, postun) - Add Docker build stages for each target distribution (el7, el8, el9, el10) - Update architecture.yml with supported RPM distributions - Update build.sh to extract distro-specific RPM packages Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# logcorrelator - Dockerfile de packaging unifié (DEB + RPM avec fpm)
|
# logcorrelator - Dockerfile de packaging unifié (DEB + RPM multi-distros)
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
@ -31,9 +31,9 @@ RUN mkdir -p dist && \
|
|||||||
./cmd/logcorrelator
|
./cmd/logcorrelator
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# Stage 2: Package builder - fpm pour DEB et RPM
|
# Stage 2: DEB Package builder
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
FROM ruby:3.2-bookworm AS package-builder
|
FROM ruby:3.2-bookworm AS deb-package-builder
|
||||||
|
|
||||||
WORKDIR /package
|
WORKDIR /package
|
||||||
|
|
||||||
@ -49,13 +49,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
COPY --from=builder /build/dist/logcorrelator /tmp/pkgroot/usr/bin/logcorrelator
|
COPY --from=builder /build/dist/logcorrelator /tmp/pkgroot/usr/bin/logcorrelator
|
||||||
COPY --from=builder /build/config.example.yml /tmp/pkgroot/etc/logcorrelator/logcorrelator.yml
|
COPY --from=builder /build/config.example.yml /tmp/pkgroot/etc/logcorrelator/logcorrelator.yml
|
||||||
COPY --from=builder /build/config.example.yml /tmp/pkgroot/usr/share/logcorrelator/logcorrelator.yml.example
|
COPY --from=builder /build/config.example.yml /tmp/pkgroot/usr/share/logcorrelator/logcorrelator.yml.example
|
||||||
|
COPY --from=builder /build/logcorrelator.service /tmp/pkgroot/etc/systemd/system/logcorrelator.service
|
||||||
|
|
||||||
# Create directories and set permissions
|
# Create directories and set permissions
|
||||||
RUN mkdir -p /tmp/pkgroot/var/log/logcorrelator && \
|
RUN mkdir -p /tmp/pkgroot/var/log/logcorrelator && \
|
||||||
mkdir -p /tmp/pkgroot/var/run/logcorrelator && \
|
mkdir -p /tmp/pkgroot/var/run/logcorrelator && \
|
||||||
|
mkdir -p /tmp/pkgroot/var/lib/logcorrelator && \
|
||||||
chmod 755 /tmp/pkgroot/usr/bin/logcorrelator && \
|
chmod 755 /tmp/pkgroot/usr/bin/logcorrelator && \
|
||||||
chmod 640 /tmp/pkgroot/etc/logcorrelator/logcorrelator.yml && \
|
chmod 640 /tmp/pkgroot/etc/logcorrelator/logcorrelator.yml && \
|
||||||
chmod 640 /tmp/pkgroot/usr/share/logcorrelator/logcorrelator.yml.example && \
|
chmod 640 /tmp/pkgroot/usr/share/logcorrelator/logcorrelator.yml.example && \
|
||||||
|
chmod 644 /tmp/pkgroot/etc/systemd/system/logcorrelator.service && \
|
||||||
chmod 755 /tmp/pkgroot/var/log/logcorrelator && \
|
chmod 755 /tmp/pkgroot/var/log/logcorrelator && \
|
||||||
chmod 755 /tmp/pkgroot/var/run/logcorrelator
|
chmod 755 /tmp/pkgroot/var/run/logcorrelator
|
||||||
|
|
||||||
@ -88,38 +91,259 @@ RUN mkdir -p /packages/deb && \
|
|||||||
etc/logcorrelator/logcorrelator.yml \
|
etc/logcorrelator/logcorrelator.yml \
|
||||||
usr/share/logcorrelator/logcorrelator.yml.example \
|
usr/share/logcorrelator/logcorrelator.yml.example \
|
||||||
var/log/logcorrelator \
|
var/log/logcorrelator \
|
||||||
var/run/logcorrelator
|
var/run/logcorrelator \
|
||||||
|
etc/systemd/system/logcorrelator.service
|
||||||
|
|
||||||
# Build RPM package
|
# =============================================================================
|
||||||
ARG DIST=el8
|
# Stage 3: RPM Package builder for CentOS 7
|
||||||
RUN mkdir -p /packages/rpm && \
|
# =============================================================================
|
||||||
|
FROM centos:7 AS rpm-centos7-builder
|
||||||
|
|
||||||
|
WORKDIR /package
|
||||||
|
|
||||||
|
# Install RPM build tools and fpm
|
||||||
|
RUN yum install -y epel-release && \
|
||||||
|
yum install -y ruby rubygems ruby-devel rpm-build gcc make && \
|
||||||
|
gem install fpm -v 1.16.0 --no-document && \
|
||||||
|
yum clean all
|
||||||
|
|
||||||
|
# Copy binary from builder
|
||||||
|
COPY --from=builder /build/dist/logcorrelator /tmp/pkgroot/usr/bin/logcorrelator
|
||||||
|
COPY --from=builder /build/config.example.yml /tmp/pkgroot/etc/logcorrelator/logcorrelator.yml
|
||||||
|
COPY --from=builder /build/config.example.yml /tmp/pkgroot/usr/share/logcorrelator/logcorrelator.yml.example
|
||||||
|
COPY --from=builder /build/logcorrelator.service /tmp/pkgroot/etc/systemd/system/logcorrelator.service
|
||||||
|
COPY packaging/rpm/post /tmp/scripts/post
|
||||||
|
COPY packaging/rpm/preun /tmp/scripts/preun
|
||||||
|
COPY packaging/rpm/postun /tmp/scripts/postun
|
||||||
|
|
||||||
|
# Create directories and set permissions
|
||||||
|
RUN mkdir -p /tmp/pkgroot/var/log/logcorrelator && \
|
||||||
|
mkdir -p /tmp/pkgroot/var/run/logcorrelator && \
|
||||||
|
mkdir -p /tmp/pkgroot/var/lib/logcorrelator && \
|
||||||
|
chmod 755 /tmp/pkgroot/usr/bin/logcorrelator && \
|
||||||
|
chmod 640 /tmp/pkgroot/etc/logcorrelator/logcorrelator.yml && \
|
||||||
|
chmod 640 /tmp/pkgroot/usr/share/logcorrelator/logcorrelator.yml.example && \
|
||||||
|
chmod 644 /tmp/pkgroot/etc/systemd/system/logcorrelator.service && \
|
||||||
|
chmod 755 /tmp/scripts/* && \
|
||||||
|
chmod 755 /tmp/pkgroot/var/log/logcorrelator && \
|
||||||
|
chmod 755 /tmp/pkgroot/var/run/logcorrelator
|
||||||
|
|
||||||
|
# Build RPM for CentOS 7
|
||||||
|
ARG VERSION=1.0.0
|
||||||
|
RUN mkdir -p /packages/rpm/centos7 && \
|
||||||
fpm -s dir -t rpm \
|
fpm -s dir -t rpm \
|
||||||
-n logcorrelator \
|
-n logcorrelator \
|
||||||
-v "${VERSION}" \
|
-v "${VERSION}" \
|
||||||
-C /tmp/pkgroot \
|
-C /tmp/pkgroot \
|
||||||
--architecture "x86_64" \
|
--architecture "x86_64" \
|
||||||
|
--rpm-os linux \
|
||||||
--description "Log correlation service for HTTP and network events" \
|
--description "Log correlation service for HTTP and network events" \
|
||||||
--url "https://github.com/logcorrelator/logcorrelator" \
|
--url "https://github.com/logcorrelator/logcorrelator" \
|
||||||
--license "MIT" \
|
--license "MIT" \
|
||||||
--vendor "logcorrelator <dev@example.com>" \
|
--vendor "logcorrelator <dev@example.com>" \
|
||||||
|
--rpm-dist el7 \
|
||||||
--depends "systemd" \
|
--depends "systemd" \
|
||||||
--after-install /tmp/scripts/postinst \
|
--after-install /tmp/scripts/post \
|
||||||
--before-remove /tmp/scripts/prerm \
|
--before-remove /tmp/scripts/preun \
|
||||||
--after-remove /tmp/scripts/postrm \
|
--after-remove /tmp/scripts/postun \
|
||||||
-p /packages/rpm/logcorrelator-${VERSION}-1.x86_64.rpm \
|
-p /packages/rpm/centos7/logcorrelator-${VERSION}-1.el7.x86_64.rpm \
|
||||||
usr/bin/logcorrelator \
|
usr/bin/logcorrelator \
|
||||||
etc/logcorrelator/logcorrelator.yml \
|
etc/logcorrelator/logcorrelator.yml \
|
||||||
usr/share/logcorrelator/logcorrelator.yml.example \
|
usr/share/logcorrelator/logcorrelator.yml.example \
|
||||||
var/log/logcorrelator \
|
var/log/logcorrelator \
|
||||||
var/run/logcorrelator
|
var/run/logcorrelator \
|
||||||
|
etc/systemd/system/logcorrelator.service
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# Stage 3: Output - Image finale avec les packages
|
# Stage 4: RPM Package builder for Rocky Linux 8
|
||||||
|
# =============================================================================
|
||||||
|
FROM rockylinux:8 AS rpm-rocky8-builder
|
||||||
|
|
||||||
|
WORKDIR /package
|
||||||
|
|
||||||
|
# Install RPM build tools and fpm
|
||||||
|
RUN dnf install -y epel-release && \
|
||||||
|
dnf install -y ruby rubygems ruby-devel rpm-build gcc make && \
|
||||||
|
gem install fpm -v 1.16.0 --no-document && \
|
||||||
|
dnf clean all
|
||||||
|
|
||||||
|
# Copy binary from builder
|
||||||
|
COPY --from=builder /build/dist/logcorrelator /tmp/pkgroot/usr/bin/logcorrelator
|
||||||
|
COPY --from=builder /build/config.example.yml /tmp/pkgroot/etc/logcorrelator/logcorrelator.yml
|
||||||
|
COPY --from=builder /build/config.example.yml /tmp/pkgroot/usr/share/logcorrelator/logcorrelator.yml.example
|
||||||
|
COPY --from=builder /build/logcorrelator.service /tmp/pkgroot/etc/systemd/system/logcorrelator.service
|
||||||
|
COPY packaging/rpm/post /tmp/scripts/post
|
||||||
|
COPY packaging/rpm/preun /tmp/scripts/preun
|
||||||
|
COPY packaging/rpm/postun /tmp/scripts/postun
|
||||||
|
|
||||||
|
# Create directories and set permissions
|
||||||
|
RUN mkdir -p /tmp/pkgroot/var/log/logcorrelator && \
|
||||||
|
mkdir -p /tmp/pkgroot/var/run/logcorrelator && \
|
||||||
|
mkdir -p /tmp/pkgroot/var/lib/logcorrelator && \
|
||||||
|
chmod 755 /tmp/pkgroot/usr/bin/logcorrelator && \
|
||||||
|
chmod 640 /tmp/pkgroot/etc/logcorrelator/logcorrelator.yml && \
|
||||||
|
chmod 640 /tmp/pkgroot/usr/share/logcorrelator/logcorrelator.yml.example && \
|
||||||
|
chmod 644 /tmp/pkgroot/etc/systemd/system/logcorrelator.service && \
|
||||||
|
chmod 755 /tmp/scripts/* && \
|
||||||
|
chmod 755 /tmp/pkgroot/var/log/logcorrelator && \
|
||||||
|
chmod 755 /tmp/pkgroot/var/run/logcorrelator
|
||||||
|
|
||||||
|
# Build RPM for Rocky Linux 8
|
||||||
|
ARG VERSION=1.0.0
|
||||||
|
RUN mkdir -p /packages/rpm/rocky8 && \
|
||||||
|
fpm -s dir -t rpm \
|
||||||
|
-n logcorrelator \
|
||||||
|
-v "${VERSION}" \
|
||||||
|
-C /tmp/pkgroot \
|
||||||
|
--architecture "x86_64" \
|
||||||
|
--rpm-os linux \
|
||||||
|
--description "Log correlation service for HTTP and network events" \
|
||||||
|
--url "https://github.com/logcorrelator/logcorrelator" \
|
||||||
|
--license "MIT" \
|
||||||
|
--vendor "logcorrelator <dev@example.com>" \
|
||||||
|
--rpm-dist el8 \
|
||||||
|
--depends "systemd" \
|
||||||
|
--after-install /tmp/scripts/post \
|
||||||
|
--before-remove /tmp/scripts/preun \
|
||||||
|
--after-remove /tmp/scripts/postun \
|
||||||
|
-p /packages/rpm/rocky8/logcorrelator-${VERSION}-1.el8.x86_64.rpm \
|
||||||
|
usr/bin/logcorrelator \
|
||||||
|
etc/logcorrelator/logcorrelator.yml \
|
||||||
|
usr/share/logcorrelator/logcorrelator.yml.example \
|
||||||
|
var/log/logcorrelator \
|
||||||
|
var/run/logcorrelator \
|
||||||
|
etc/systemd/system/logcorrelator.service
|
||||||
|
|
||||||
|
# =============================================================================
|
||||||
|
# Stage 5: RPM Package builder for Rocky Linux 9
|
||||||
|
# =============================================================================
|
||||||
|
FROM rockylinux:9 AS rpm-rocky9-builder
|
||||||
|
|
||||||
|
WORKDIR /package
|
||||||
|
|
||||||
|
# Install RPM build tools and fpm
|
||||||
|
RUN dnf install -y epel-release && \
|
||||||
|
dnf install -y ruby rubygems ruby-devel rpm-build gcc make && \
|
||||||
|
gem install fpm -v 1.16.0 --no-document && \
|
||||||
|
dnf clean all
|
||||||
|
|
||||||
|
# Copy binary from builder
|
||||||
|
COPY --from=builder /build/dist/logcorrelator /tmp/pkgroot/usr/bin/logcorrelator
|
||||||
|
COPY --from=builder /build/config.example.yml /tmp/pkgroot/etc/logcorrelator/logcorrelator.yml
|
||||||
|
COPY --from=builder /build/config.example.yml /tmp/pkgroot/usr/share/logcorrelator/logcorrelator.yml.example
|
||||||
|
COPY --from=builder /build/logcorrelator.service /tmp/pkgroot/etc/systemd/system/logcorrelator.service
|
||||||
|
COPY packaging/rpm/post /tmp/scripts/post
|
||||||
|
COPY packaging/rpm/preun /tmp/scripts/preun
|
||||||
|
COPY packaging/rpm/postun /tmp/scripts/postun
|
||||||
|
|
||||||
|
# Create directories and set permissions
|
||||||
|
RUN mkdir -p /tmp/pkgroot/var/log/logcorrelator && \
|
||||||
|
mkdir -p /tmp/pkgroot/var/run/logcorrelator && \
|
||||||
|
mkdir -p /tmp/pkgroot/var/lib/logcorrelator && \
|
||||||
|
chmod 755 /tmp/pkgroot/usr/bin/logcorrelator && \
|
||||||
|
chmod 640 /tmp/pkgroot/etc/logcorrelator/logcorrelator.yml && \
|
||||||
|
chmod 640 /tmp/pkgroot/usr/share/logcorrelator/logcorrelator.yml.example && \
|
||||||
|
chmod 644 /tmp/pkgroot/etc/systemd/system/logcorrelator.service && \
|
||||||
|
chmod 755 /tmp/scripts/* && \
|
||||||
|
chmod 755 /tmp/pkgroot/var/log/logcorrelator && \
|
||||||
|
chmod 755 /tmp/pkgroot/var/run/logcorrelator
|
||||||
|
|
||||||
|
# Build RPM for Rocky Linux 9
|
||||||
|
ARG VERSION=1.0.0
|
||||||
|
RUN mkdir -p /packages/rpm/rocky9 && \
|
||||||
|
fpm -s dir -t rpm \
|
||||||
|
-n logcorrelator \
|
||||||
|
-v "${VERSION}" \
|
||||||
|
-C /tmp/pkgroot \
|
||||||
|
--architecture "x86_64" \
|
||||||
|
--rpm-os linux \
|
||||||
|
--description "Log correlation service for HTTP and network events" \
|
||||||
|
--url "https://github.com/logcorrelator/logcorrelator" \
|
||||||
|
--license "MIT" \
|
||||||
|
--vendor "logcorrelator <dev@example.com>" \
|
||||||
|
--rpm-dist el9 \
|
||||||
|
--depends "systemd" \
|
||||||
|
--after-install /tmp/scripts/post \
|
||||||
|
--before-remove /tmp/scripts/preun \
|
||||||
|
--after-remove /tmp/scripts/postun \
|
||||||
|
-p /packages/rpm/rocky9/logcorrelator-${VERSION}-1.el9.x86_64.rpm \
|
||||||
|
usr/bin/logcorrelator \
|
||||||
|
etc/logcorrelator/logcorrelator.yml \
|
||||||
|
usr/share/logcorrelator/logcorrelator.yml.example \
|
||||||
|
var/log/logcorrelator \
|
||||||
|
var/run/logcorrelator \
|
||||||
|
etc/systemd/system/logcorrelator.service
|
||||||
|
|
||||||
|
# =============================================================================
|
||||||
|
# Stage 6: RPM Package builder for Rocky Linux 10
|
||||||
|
# =============================================================================
|
||||||
|
FROM rockylinux:10 AS rpm-rocky10-builder
|
||||||
|
|
||||||
|
WORKDIR /package
|
||||||
|
|
||||||
|
# Install RPM build tools and fpm
|
||||||
|
RUN dnf install -y epel-release && \
|
||||||
|
dnf install -y ruby rubygems ruby-devel rpm-build gcc make && \
|
||||||
|
gem install fpm -v 1.16.0 --no-document && \
|
||||||
|
dnf clean all
|
||||||
|
|
||||||
|
# Copy binary from builder
|
||||||
|
COPY --from=builder /build/dist/logcorrelator /tmp/pkgroot/usr/bin/logcorrelator
|
||||||
|
COPY --from=builder /build/config.example.yml /tmp/pkgroot/etc/logcorrelator/logcorrelator.yml
|
||||||
|
COPY --from=builder /build/config.example.yml /tmp/pkgroot/usr/share/logcorrelator/logcorrelator.yml.example
|
||||||
|
COPY --from=builder /build/logcorrelator.service /tmp/pkgroot/etc/systemd/system/logcorrelator.service
|
||||||
|
COPY packaging/rpm/post /tmp/scripts/post
|
||||||
|
COPY packaging/rpm/preun /tmp/scripts/preun
|
||||||
|
COPY packaging/rpm/postun /tmp/scripts/postun
|
||||||
|
|
||||||
|
# Create directories and set permissions
|
||||||
|
RUN mkdir -p /tmp/pkgroot/var/log/logcorrelator && \
|
||||||
|
mkdir -p /tmp/pkgroot/var/run/logcorrelator && \
|
||||||
|
mkdir -p /tmp/pkgroot/var/lib/logcorrelator && \
|
||||||
|
chmod 755 /tmp/pkgroot/usr/bin/logcorrelator && \
|
||||||
|
chmod 640 /tmp/pkgroot/etc/logcorrelator/logcorrelator.yml && \
|
||||||
|
chmod 640 /tmp/pkgroot/usr/share/logcorrelator/logcorrelator.yml.example && \
|
||||||
|
chmod 644 /tmp/pkgroot/etc/systemd/system/logcorrelator.service && \
|
||||||
|
chmod 755 /tmp/scripts/* && \
|
||||||
|
chmod 755 /tmp/pkgroot/var/log/logcorrelator && \
|
||||||
|
chmod 755 /tmp/pkgroot/var/run/logcorrelator
|
||||||
|
|
||||||
|
# Build RPM for Rocky Linux 10
|
||||||
|
ARG VERSION=1.0.0
|
||||||
|
RUN mkdir -p /packages/rpm/rocky10 && \
|
||||||
|
fpm -s dir -t rpm \
|
||||||
|
-n logcorrelator \
|
||||||
|
-v "${VERSION}" \
|
||||||
|
-C /tmp/pkgroot \
|
||||||
|
--architecture "x86_64" \
|
||||||
|
--rpm-os linux \
|
||||||
|
--description "Log correlation service for HTTP and network events" \
|
||||||
|
--url "https://github.com/logcorrelator/logcorrelator" \
|
||||||
|
--license "MIT" \
|
||||||
|
--vendor "logcorrelator <dev@example.com>" \
|
||||||
|
--rpm-dist el10 \
|
||||||
|
--depends "systemd" \
|
||||||
|
--after-install /tmp/scripts/post \
|
||||||
|
--before-remove /tmp/scripts/preun \
|
||||||
|
--after-remove /tmp/scripts/postun \
|
||||||
|
-p /packages/rpm/rocky10/logcorrelator-${VERSION}-1.el10.x86_64.rpm \
|
||||||
|
usr/bin/logcorrelator \
|
||||||
|
etc/logcorrelator/logcorrelator.yml \
|
||||||
|
usr/share/logcorrelator/logcorrelator.yml.example \
|
||||||
|
var/log/logcorrelator \
|
||||||
|
var/run/logcorrelator \
|
||||||
|
etc/systemd/system/logcorrelator.service
|
||||||
|
|
||||||
|
# =============================================================================
|
||||||
|
# Stage 7: Output - Image finale avec tous les packages
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
FROM alpine:latest AS output
|
FROM alpine:latest AS output
|
||||||
|
|
||||||
WORKDIR /packages
|
WORKDIR /packages
|
||||||
COPY --from=package-builder /packages/deb/*.deb /packages/deb/
|
COPY --from=deb-package-builder /packages/deb/*.deb /packages/deb/
|
||||||
COPY --from=package-builder /packages/rpm/*.rpm /packages/rpm/
|
COPY --from=rpm-centos7-builder /packages/rpm/centos7/*.rpm /packages/rpm/centos7/
|
||||||
|
COPY --from=rpm-rocky8-builder /packages/rpm/rocky8/*.rpm /packages/rpm/rocky8/
|
||||||
|
COPY --from=rpm-rocky9-builder /packages/rpm/rocky9/*.rpm /packages/rpm/rocky9/
|
||||||
|
COPY --from=rpm-rocky10-builder /packages/rpm/rocky10/*.rpm /packages/rpm/rocky10/
|
||||||
|
|
||||||
CMD ["sh", "-c", "echo '=== DEB Packages ===' && ls -la /packages/deb/ && echo '' && echo '=== RPM Packages ===' && ls -la /packages/rpm/"]
|
CMD ["sh", "-c", "echo '=== DEB Packages ===' && ls -la /packages/deb/ && echo '' && echo '=== RPM CentOS 7 ===' && ls -la /packages/rpm/centos7/ && echo '' && echo '=== RPM Rocky Linux 8 ===' && ls -la /packages/rpm/rocky8/ && echo '' && echo '=== RPM Rocky Linux 9 ===' && ls -la /packages/rpm/rocky9/ && echo '' && echo '=== RPM Rocky Linux 10 ===' && ls -la /packages/rpm/rocky10/"]
|
||||||
|
|||||||
@ -23,7 +23,7 @@ runtime:
|
|||||||
logcorrelator est livré sous forme de binaire autonome, exécuté comme un
|
logcorrelator est livré sous forme de binaire autonome, exécuté comme un
|
||||||
service systemd. L'unité systemd assure le démarrage automatique au boot,
|
service systemd. L'unité systemd assure le démarrage automatique au boot,
|
||||||
le redémarrage en cas de crash, et une intégration standard dans l'écosystème
|
le redémarrage en cas de crash, et une intégration standard dans l'écosystème
|
||||||
Linux (notamment sur Rocky Linux 8+).
|
Linux (notamment sur CentOS 7 et Rocky Linux 8+).
|
||||||
binary_path: /usr/bin/logcorrelator
|
binary_path: /usr/bin/logcorrelator
|
||||||
config_path: /etc/logcorrelator/logcorrelator.yml
|
config_path: /etc/logcorrelator/logcorrelator.yml
|
||||||
user: logcorrelator
|
user: logcorrelator
|
||||||
@ -48,8 +48,10 @@ runtime:
|
|||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
os:
|
os:
|
||||||
supported:
|
supported:
|
||||||
|
- centos-7
|
||||||
- rocky-linux-8+
|
- rocky-linux-8+
|
||||||
- rocky-linux-9+
|
- rocky-linux-9+
|
||||||
|
- rocky-linux-10+
|
||||||
- autres-linux-recentes
|
- autres-linux-recentes
|
||||||
logs:
|
logs:
|
||||||
stdout_stderr: journald
|
stdout_stderr: journald
|
||||||
@ -471,7 +473,7 @@ docker:
|
|||||||
packaging:
|
packaging:
|
||||||
description: >
|
description: >
|
||||||
logcorrelator est distribué sous forme de packages .deb (Debian/Ubuntu) et
|
logcorrelator est distribué sous forme de packages .deb (Debian/Ubuntu) et
|
||||||
.rpm (Rocky Linux/RHEL/CentOS), construits intégralement dans Docker avec fpm.
|
.rpm (CentOS 7, Rocky Linux/RHEL 8, 9, 10), construits intégralement dans Docker avec fpm.
|
||||||
formats:
|
formats:
|
||||||
- deb
|
- deb
|
||||||
- rpm
|
- rpm
|
||||||
@ -480,10 +482,14 @@ packaging:
|
|||||||
- debian-12+
|
- debian-12+
|
||||||
- ubuntu-22.04+
|
- ubuntu-22.04+
|
||||||
rpm:
|
rpm:
|
||||||
|
- centos-7
|
||||||
- rocky-linux-8+
|
- rocky-linux-8+
|
||||||
- rocky-linux-9+
|
- rocky-linux-9+
|
||||||
|
- rocky-linux-10+
|
||||||
|
- rhel-7+
|
||||||
- rhel-8+
|
- rhel-8+
|
||||||
- rhel-9+
|
- rhel-9+
|
||||||
|
- rhel-10+
|
||||||
tool: fpm
|
tool: fpm
|
||||||
build_pipeline:
|
build_pipeline:
|
||||||
dockerfile: Dockerfile.package
|
dockerfile: Dockerfile.package
|
||||||
@ -492,13 +498,25 @@ packaging:
|
|||||||
description: >
|
description: >
|
||||||
Compilation du binaire Go avec CGO_ENABLED=0 pour un binaire statique.
|
Compilation du binaire Go avec CGO_ENABLED=0 pour un binaire statique.
|
||||||
GOOS=linux GOARCH=amd64.
|
GOOS=linux GOARCH=amd64.
|
||||||
- name: package_builder
|
- name: deb_package_builder
|
||||||
description: >
|
description: >
|
||||||
Installation de fpm, rpm, dpkg-dev. Création de l'arborescence
|
Construction du package DEB pour Debian/Ubuntu avec fpm.
|
||||||
et exécution de fpm pour générer DEB et RPM.
|
- name: rpm_centos7_builder
|
||||||
|
description: >
|
||||||
|
Construction du package RPM pour CentOS 7 (el7) avec fpm.
|
||||||
|
- name: rpm_rocky8_builder
|
||||||
|
description: >
|
||||||
|
Construction du package RPM pour Rocky Linux 8 (el8) avec fpm.
|
||||||
|
- name: rpm_rocky9_builder
|
||||||
|
description: >
|
||||||
|
Construction du package RPM pour Rocky Linux 9 (el9) avec fpm.
|
||||||
|
- name: rpm_rocky10_builder
|
||||||
|
description: >
|
||||||
|
Construction du package RPM pour Rocky Linux 10 (el10) avec fpm.
|
||||||
- name: output
|
- name: output
|
||||||
description: >
|
description: >
|
||||||
Image Alpine minimale contenant les packages dans /packages/deb et /packages/rpm.
|
Image Alpine minimale contenant les packages dans /packages/deb et
|
||||||
|
/packages/rpm/{centos7,rocky8,rocky9,rocky10}.
|
||||||
files:
|
files:
|
||||||
binary:
|
binary:
|
||||||
source: dist/logcorrelator
|
source: dist/logcorrelator
|
||||||
@ -525,9 +543,9 @@ packaging:
|
|||||||
prerm: packaging/deb/prerm
|
prerm: packaging/deb/prerm
|
||||||
postrm: packaging/deb/postrm
|
postrm: packaging/deb/postrm
|
||||||
rpm:
|
rpm:
|
||||||
post: packaging/deb/postinst
|
post: packaging/rpm/post
|
||||||
preun: packaging/deb/prerm
|
preun: packaging/rpm/preun
|
||||||
postun: packaging/deb/postrm
|
postun: packaging/rpm/postun
|
||||||
dependencies:
|
dependencies:
|
||||||
deb:
|
deb:
|
||||||
- systemd
|
- systemd
|
||||||
@ -537,7 +555,14 @@ packaging:
|
|||||||
deb:
|
deb:
|
||||||
command: docker run --rm -v $(pwd)/dist/deb:/packages debian:latest sh -c "apt-get update && apt-get install -y /packages/*.deb"
|
command: docker run --rm -v $(pwd)/dist/deb:/packages debian:latest sh -c "apt-get update && apt-get install -y /packages/*.deb"
|
||||||
rpm:
|
rpm:
|
||||||
command: docker run --rm -v $(pwd)/dist/rpm:/packages rockylinux:8 sh -c "dnf install -y /packages/*.rpm"
|
centos7:
|
||||||
|
command: docker run --rm -v $(pwd)/dist/rpm/centos7:/packages centos:7 sh -c "yum install -y /packages/*.rpm"
|
||||||
|
rocky8:
|
||||||
|
command: docker run --rm -v $(pwd)/dist/rpm/rocky8:/packages rockylinux:8 sh -c "dnf install -y /packages/*.rpm"
|
||||||
|
rocky9:
|
||||||
|
command: docker run --rm -v $(pwd)/dist/rpm/rocky9:/packages rockylinux:9 sh -c "dnf install -y /packages/*.rpm"
|
||||||
|
rocky10:
|
||||||
|
command: docker run --rm -v $(pwd)/dist/rpm/rocky10:/packages rockylinux:10 sh -c "dnf install -y /packages/*.rpm"
|
||||||
|
|
||||||
non_functional:
|
non_functional:
|
||||||
performance:
|
performance:
|
||||||
|
|||||||
22
build.sh
22
build.sh
@ -41,9 +41,9 @@ docker build \
|
|||||||
|
|
||||||
# Extract packages from builder container
|
# Extract packages from builder container
|
||||||
echo "[4/4] Extracting packages..."
|
echo "[4/4] Extracting packages..."
|
||||||
mkdir -p "${OUTPUT_DIR}/deb" "${OUTPUT_DIR}/rpm"
|
mkdir -p "${OUTPUT_DIR}/deb" "${OUTPUT_DIR}/rpm/centos7" "${OUTPUT_DIR}/rpm/rocky8" "${OUTPUT_DIR}/rpm/rocky9" "${OUTPUT_DIR}/rpm/rocky10"
|
||||||
docker run --rm -v "${OUTPUT_DIR}:/output" logcorrelator-packager:latest \
|
docker run --rm -v "${OUTPUT_DIR}:/output" logcorrelator-packager:latest \
|
||||||
sh -c 'cp -r /packages/deb /output/ && cp -r /packages/rpm /output/'
|
sh -c 'cp -r /packages/deb /output/ && cp -r /packages/rpm/centos7 /output/rpm/ && cp -r /packages/rpm/rocky8 /output/rpm/ && cp -r /packages/rpm/rocky9 /output/rpm/ && cp -r /packages/rpm/rocky10 /output/rpm/'
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "=============================================="
|
echo "=============================================="
|
||||||
@ -53,14 +53,17 @@ echo ""
|
|||||||
echo "Artifacts:"
|
echo "Artifacts:"
|
||||||
echo " - Runtime image: logcorrelator:${VERSION}"
|
echo " - Runtime image: logcorrelator:${VERSION}"
|
||||||
echo " - DEB package: ${OUTPUT_DIR}/deb/logcorrelator_${VERSION}_amd64.deb"
|
echo " - DEB package: ${OUTPUT_DIR}/deb/logcorrelator_${VERSION}_amd64.deb"
|
||||||
echo " - RPM package: ${OUTPUT_DIR}/rpm/logcorrelator-${VERSION}-1.x86_64.rpm"
|
echo " - RPM CentOS 7: ${OUTPUT_DIR}/rpm/centos7/logcorrelator-${VERSION}-1.el7.x86_64.rpm"
|
||||||
|
echo " - RPM Rocky 8: ${OUTPUT_DIR}/rpm/rocky8/logcorrelator-${VERSION}-1.el8.x86_64.rpm"
|
||||||
|
echo " - RPM Rocky 9: ${OUTPUT_DIR}/rpm/rocky9/logcorrelator-${VERSION}-1.el9.x86_64.rpm"
|
||||||
|
echo " - RPM Rocky 10: ${OUTPUT_DIR}/rpm/rocky10/logcorrelator-${VERSION}-1.el10.x86_64.rpm"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Usage:"
|
echo "Usage:"
|
||||||
echo " # Run with Docker:"
|
echo " # Run with Docker:"
|
||||||
echo " docker run -d --name logcorrelator \\"
|
echo " docker run -d --name logcorrelator \\"
|
||||||
echo " -v /var/run/logcorrelator:/var/run/logcorrelator \\"
|
echo " -v /var/run/logcorrelator:/var/run/logcorrelator \\"
|
||||||
echo " -v /var/log/logcorrelator:/var/log/logcorrelator \\"
|
echo " -v /var/log/logcorrelator:/var/log/logcorrelator \\"
|
||||||
echo " -v ./config.conf:/etc/logcorrelator/logcorrelator.conf \\"
|
echo " -v ./config.yml:/etc/logcorrelator/logcorrelator.yml \\"
|
||||||
echo " logcorrelator:latest"
|
echo " logcorrelator:latest"
|
||||||
echo ""
|
echo ""
|
||||||
echo " # Install DEB on Debian/Ubuntu:"
|
echo " # Install DEB on Debian/Ubuntu:"
|
||||||
@ -68,8 +71,15 @@ echo " sudo dpkg -i ${OUTPUT_DIR}/deb/logcorrelator_${VERSION}_amd64.deb"
|
|||||||
echo " sudo systemctl enable logcorrelator"
|
echo " sudo systemctl enable logcorrelator"
|
||||||
echo " sudo systemctl start logcorrelator"
|
echo " sudo systemctl start logcorrelator"
|
||||||
echo ""
|
echo ""
|
||||||
echo " # Install RPM on Rocky Linux:"
|
echo " # Install RPM on CentOS 7:"
|
||||||
echo " sudo rpm -ivh ${OUTPUT_DIR}/rpm/logcorrelator-${VERSION}-1.x86_64.rpm"
|
echo " sudo yum install -y ${OUTPUT_DIR}/rpm/centos7/logcorrelator-${VERSION}-1.el7.x86_64.rpm"
|
||||||
|
echo " sudo systemctl enable logcorrelator"
|
||||||
|
echo " sudo systemctl start logcorrelator"
|
||||||
|
echo ""
|
||||||
|
echo " # Install RPM on Rocky Linux 8/9/10:"
|
||||||
|
echo " sudo dnf install -y ${OUTPUT_DIR}/rpm/rocky8/logcorrelator-${VERSION}-1.el8.x86_64.rpm"
|
||||||
|
echo " sudo dnf install -y ${OUTPUT_DIR}/rpm/rocky9/logcorrelator-${VERSION}-1.el9.x86_64.rpm"
|
||||||
|
echo " sudo dnf install -y ${OUTPUT_DIR}/rpm/rocky10/logcorrelator-${VERSION}-1.el10.x86_64.rpm"
|
||||||
echo " sudo systemctl enable logcorrelator"
|
echo " sudo systemctl enable logcorrelator"
|
||||||
echo " sudo systemctl start logcorrelator"
|
echo " sudo systemctl start logcorrelator"
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
116
packaging/rpm/logcorrelator.spec
Normal file
116
packaging/rpm/logcorrelator.spec
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
# logcorrelator RPM spec file
|
||||||
|
# Compatible with CentOS 7, Rocky Linux 8, 9, 10
|
||||||
|
|
||||||
|
Name: logcorrelator
|
||||||
|
Version: 1.0.0
|
||||||
|
Release: 1%{?dist}
|
||||||
|
Summary: Log correlation service for HTTP and network events
|
||||||
|
|
||||||
|
License: MIT
|
||||||
|
URL: https://github.com/logcorrelator/logcorrelator
|
||||||
|
Vendor: logcorrelator <dev@example.com>
|
||||||
|
Packager: logcorrelator <dev@example.com>
|
||||||
|
|
||||||
|
# CentOS 7 compatibility
|
||||||
|
BuildArch: x86_64
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
|
Requires: systemd
|
||||||
|
Requires(post): systemd
|
||||||
|
Requires(preun): systemd
|
||||||
|
Requires(postun): systemd
|
||||||
|
|
||||||
|
%description
|
||||||
|
logcorrelator est un service système écrit en Go qui reçoit deux flux de logs JSON
|
||||||
|
via des sockets Unix, corrèle les événements HTTP applicatifs avec des événements
|
||||||
|
réseau, et produit des logs corrélés en temps réel vers ClickHouse et/ou fichier local.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
# No source extraction needed - binary is pre-built
|
||||||
|
|
||||||
|
%install
|
||||||
|
mkdir -p %{buildroot}/usr/bin
|
||||||
|
mkdir -p %{buildroot}/etc/logcorrelator
|
||||||
|
mkdir -p %{buildroot}/usr/share/logcorrelator
|
||||||
|
mkdir -p %{buildroot}/var/log/logcorrelator
|
||||||
|
mkdir -p %{buildroot}/var/run/logcorrelator
|
||||||
|
mkdir -p %{buildroot}/etc/systemd/system
|
||||||
|
|
||||||
|
# Install binary
|
||||||
|
install -m 0755 %{_sourcedir}/logcorrelator %{buildroot}/usr/bin/logcorrelator
|
||||||
|
|
||||||
|
# Install config
|
||||||
|
install -m 0640 %{_sourcedir}/logcorrelator.yml %{buildroot}/etc/logcorrelator/logcorrelator.yml
|
||||||
|
install -m 0640 %{_sourcedir}/logcorrelator.yml %{buildroot}/usr/share/logcorrelator/logcorrelator.yml.example
|
||||||
|
|
||||||
|
# Install systemd service
|
||||||
|
install -m 0644 %{_sourcedir}/logcorrelator.service %{buildroot}/etc/systemd/system/logcorrelator.service
|
||||||
|
|
||||||
|
%post
|
||||||
|
# Create logcorrelator user and group
|
||||||
|
if ! getent group logcorrelator >/dev/null 2>&1; then
|
||||||
|
groupadd --system logcorrelator
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! getent passwd logcorrelator >/dev/null 2>&1; then
|
||||||
|
useradd --system \
|
||||||
|
--gid logcorrelator \
|
||||||
|
--home-dir /var/lib/logcorrelator \
|
||||||
|
--no-create-home \
|
||||||
|
--shell /usr/sbin/nologin \
|
||||||
|
logcorrelator
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create directories
|
||||||
|
mkdir -p /var/lib/logcorrelator
|
||||||
|
mkdir -p /var/log/logcorrelator
|
||||||
|
mkdir -p /var/run/logcorrelator
|
||||||
|
|
||||||
|
# Set ownership
|
||||||
|
chown -R logcorrelator:logcorrelator /var/lib/logcorrelator
|
||||||
|
chown -R logcorrelator:logcorrelator /var/log/logcorrelator
|
||||||
|
chown -R logcorrelator:logcorrelator /var/run/logcorrelator
|
||||||
|
chown -R logcorrelator:logcorrelator /etc/logcorrelator
|
||||||
|
|
||||||
|
# Set permissions
|
||||||
|
chmod 750 /var/lib/logcorrelator
|
||||||
|
chmod 750 /var/log/logcorrelator
|
||||||
|
chmod 750 /etc/logcorrelator
|
||||||
|
|
||||||
|
# Copy default config if not exists
|
||||||
|
if [ ! -f /etc/logcorrelator/logcorrelator.yml ]; then
|
||||||
|
cp /usr/share/logcorrelator/logcorrelator.yml.example /etc/logcorrelator/logcorrelator.yml
|
||||||
|
chown logcorrelator:logcorrelator /etc/logcorrelator/logcorrelator.yml
|
||||||
|
chmod 640 /etc/logcorrelator/logcorrelator.yml
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Reload systemd
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl enable logcorrelator.service
|
||||||
|
|
||||||
|
%preun
|
||||||
|
if [ $1 -eq 0 ]; then
|
||||||
|
# Package removal, not upgrade
|
||||||
|
systemctl stop logcorrelator.service
|
||||||
|
systemctl disable logcorrelator.service
|
||||||
|
fi
|
||||||
|
|
||||||
|
%postun
|
||||||
|
systemctl daemon-reload
|
||||||
|
if [ $1 -ge 1 ]; then
|
||||||
|
# Package upgrade, restart service
|
||||||
|
systemctl try-restart logcorrelator.service
|
||||||
|
fi
|
||||||
|
|
||||||
|
%files
|
||||||
|
/usr/bin/logcorrelator
|
||||||
|
/etc/logcorrelator/logcorrelator.yml
|
||||||
|
%config(noreplace) /etc/logcorrelator/logcorrelator.yml
|
||||||
|
/usr/share/logcorrelator/logcorrelator.yml.example
|
||||||
|
/var/log/logcorrelator
|
||||||
|
/var/run/logcorrelator
|
||||||
|
/etc/systemd/system/logcorrelator.service
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Sat Feb 28 2026 logcorrelator <dev@example.com> - 1.0.0-1
|
||||||
|
- Initial package for CentOS 7, Rocky Linux 8, 9, 10
|
||||||
50
packaging/rpm/post
Normal file
50
packaging/rpm/post
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# post script for logcorrelator RPM package
|
||||||
|
# Compatible with CentOS 7, Rocky Linux 8, 9, 10
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Create logcorrelator user and group
|
||||||
|
if ! getent group logcorrelator >/dev/null 2>&1; then
|
||||||
|
groupadd --system logcorrelator
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! getent passwd logcorrelator >/dev/null 2>&1; then
|
||||||
|
useradd --system \
|
||||||
|
--gid logcorrelator \
|
||||||
|
--home-dir /var/lib/logcorrelator \
|
||||||
|
--no-create-home \
|
||||||
|
--shell /usr/sbin/nologin \
|
||||||
|
logcorrelator
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create directories
|
||||||
|
mkdir -p /var/lib/logcorrelator
|
||||||
|
mkdir -p /var/log/logcorrelator
|
||||||
|
mkdir -p /var/run/logcorrelator
|
||||||
|
|
||||||
|
# Set ownership
|
||||||
|
chown -R logcorrelator:logcorrelator /var/lib/logcorrelator
|
||||||
|
chown -R logcorrelator:logcorrelator /var/log/logcorrelator
|
||||||
|
chown -R logcorrelator:logcorrelator /var/run/logcorrelator
|
||||||
|
chown -R logcorrelator:logcorrelator /etc/logcorrelator
|
||||||
|
|
||||||
|
# Set permissions
|
||||||
|
chmod 750 /var/lib/logcorrelator
|
||||||
|
chmod 750 /var/log/logcorrelator
|
||||||
|
chmod 750 /etc/logcorrelator
|
||||||
|
|
||||||
|
# Copy default config if not exists
|
||||||
|
if [ ! -f /etc/logcorrelator/logcorrelator.yml ]; then
|
||||||
|
cp /usr/share/logcorrelator/logcorrelator.yml.example /etc/logcorrelator/logcorrelator.yml
|
||||||
|
chown logcorrelator:logcorrelator /etc/logcorrelator/logcorrelator.yml
|
||||||
|
chmod 640 /etc/logcorrelator/logcorrelator.yml
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Reload systemd
|
||||||
|
if [ -x /bin/systemctl ]; then
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl enable logcorrelator.service
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
17
packaging/rpm/postun
Normal file
17
packaging/rpm/postun
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# postun script for logcorrelator RPM package
|
||||||
|
# Compatible with CentOS 7, Rocky Linux 8, 9, 10
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# $1 = 0: package is being removed
|
||||||
|
# $1 = 1: package is being upgraded
|
||||||
|
if [ -x /bin/systemctl ]; then
|
||||||
|
systemctl daemon-reload
|
||||||
|
if [ "$1" -ge 1 ]; then
|
||||||
|
# Package upgrade, restart service
|
||||||
|
systemctl try-restart logcorrelator.service
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
17
packaging/rpm/preun
Normal file
17
packaging/rpm/preun
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# preun script for logcorrelator RPM package
|
||||||
|
# Compatible with CentOS 7, Rocky Linux 8, 9, 10
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# $1 = 0: package is being removed
|
||||||
|
# $1 = 1: package is being upgraded
|
||||||
|
if [ "$1" -eq 0 ]; then
|
||||||
|
# Package removal, stop and disable service
|
||||||
|
if [ -x /bin/systemctl ]; then
|
||||||
|
systemctl stop logcorrelator.service
|
||||||
|
systemctl disable logcorrelator.service
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
Reference in New Issue
Block a user