neoloc/etcd #24

Merged
unkinben merged 2 commits from neoloc/etcd into master 2025-01-26 14:52:49 +11:00
21 changed files with 135 additions and 16 deletions

View File

@ -9,7 +9,7 @@ jobs:
build-8:
runs-on: almalinux-8
container:
image: git.query.consul/unkin/almalinux8-runnerdnd:latest
image: git.query.consul/unkin/almalinux8-actionsdind:latest
options: --privileged
steps:
@ -33,7 +33,7 @@ jobs:
build-9:
runs-on: almalinux-8
container:
image: git.query.consul/unkin/almalinux9-runnerdnd:latest
image: git.query.consul/unkin/almalinux9-actionsdind:latest
options: --privileged
steps:

View File

@ -10,7 +10,7 @@ jobs:
deploy-8:
runs-on: almalinux-8
container:
image: git.query.consul/unkin/almalinux8-runnerdnd:latest
image: git.query.consul/unkin/almalinux8-actionsdind:latest
options: --privileged
steps:
@ -39,7 +39,7 @@ jobs:
deploy-9:
runs-on: almalinux-8
container:
image: git.query.consul/unkin/almalinux9-runnerdnd:latest
image: git.query.consul/unkin/almalinux9-actionsdind:latest
options: --privileged
steps:

View File

@ -4,14 +4,17 @@ RPMS_DIR := $(ROOT_DIR)/rpms
REPO_OPTIONS := --disablerepo=* --enablerepo=unkin
# Automatically find all package/version directories
PACKAGES := $(shell find $(RPMS_DIR) -mindepth 2 -maxdepth 2 -type d | sed "s|$(RPMS_DIR)/||" | grep -v "/scripts")
PACKAGES := $(shell find $(RPMS_DIR) -mindepth 2 -maxdepth 2 -type d | sed "s|$(RPMS_DIR)/||" | grep -Ev '(scripts|/resources)')
# Default target to build all packages and versions
.PHONY: all list cache build clean
all: cache $(PACKAGES)
list:
@echo "$(PACKAGES)"
@echo "Builds:"
@for package in $(PACKAGES); do \
echo " '$$package'"; \
done
cache:
echo "Refreshing DNF cache..." && \

View File

@ -1,5 +1,5 @@
# Start with the AlmaLinux 8.10 base image
FROM git.query.consul/unkin/almalinux8-buildagent:latest
FROM git.query.consul/unkin/almalinux8-rpmbuilder:latest
# Create output directory for RPMs
RUN mkdir -p /app/dist

View File

@ -1,5 +1,5 @@
# Start with the AlmaLinux 8.10 base image
FROM git.query.consul/unkin/almalinux8-buildagent:latest
FROM git.query.consul/unkin/almalinux8-rpmbuilder:latest
# Create output directory for RPMs
RUN mkdir -p /app/dist

1
rpms/etcd/3.5.18/release Normal file
View File

@ -0,0 +1 @@
1

25
rpms/etcd/Dockerfile Normal file
View File

@ -0,0 +1,25 @@
# Start with the AlmaLinux 8.10 base image
FROM git.query.consul/unkin/almalinux8-rpmbuilder:latest
# Create output directory for RPMs
RUN mkdir -p /app/dist
# Set working directory
WORKDIR /app
ARG PACKAGE_RELEASE
ENV PACKAGE_RELEASE=${PACKAGE_RELEASE}
ARG PACKAGE_VERSION
ENV PACKAGE_VERSION=${PACKAGE_VERSION}
# Copy nfpm.yaml from the context into the container
COPY nfpm.yaml /app/nfpm.yaml
COPY resources /app/resources
# Download the required files
RUN wget -O /app/etcd-v${PACKAGE_VERSION}-linux-amd64.tar.gz https://github.com/etcd-io/etcd/releases/download/v${PACKAGE_VERSION}/etcd-v${PACKAGE_VERSION}-linux-amd64.tar.gz && \
tar xf /app/etcd-v${PACKAGE_VERSION}-linux-amd64.tar.gz && \
mv /app/etcd-v${PACKAGE_VERSION}-linux-amd64/* /app/
# Default command to build RPMs
CMD nfpm pkg --config /app/nfpm.yaml --target /app/dist --packager rpm

60
rpms/etcd/nfpm.yaml Normal file
View File

@ -0,0 +1,60 @@
# nfpm.yaml
name: etcd
version: ${PACKAGE_VERSION}
release: ${PACKAGE_RELEASE}
arch: amd64
platform: linux
section: default
priority: extra
description: "A distributed, reliable key-value store for the most critical data of a distributed system."
maintainer: https://etcd.io/
homepage: https://etcd.io/
license: Apache-2.0
disable_globbing: false
replaces:
- etcd
- etcdctl
- etcdutl
provides:
- etcd
- etcdctl
- etcdutl
# Files to include in the package
contents:
- src: /app/etcd
dst: /usr/bin/etcd
file_info:
mode: 0755
owner: root
group: root
- src: /app/etcdctl
dst: /usr/bin/etcdctl
file_info:
mode: 0755
owner: root
group: root
- src: /app/etcdutl
dst: /usr/bin/etcdutl
file_info:
mode: 0755
owner: root
group: root
- src: /app/resources/etcd.service
dst: /usr/lib/systemd/system/etcd.service
file_info:
mode: 0644
owner: root
group: root
# Scripts to run during installation/removal (optional)
scripts:
preinstall: ./resources/scripts/preinstall.sh
postinstall: ./resources/scripts/postinstall.sh
preremove: ./resources/scripts/preremove.sh
postremove: ./resources/scripts/postremove.sh

View File

@ -0,0 +1,18 @@
[Unit]
Description=etcd key-value store
Documentation=https://github.com/etcd-io/etcd
After=network-online.target local-fs.target remote-fs.target time-sync.target
Wants=network-online.target local-fs.target remote-fs.target time-sync.target
[Service]
User=etcd
Type=notify
Environment=ETCD_DATA_DIR=/var/lib/etcd
Environment=ETCD_NAME=%m
ExecStart=/usr/bin/etcd
Restart=always
RestartSec=10s
LimitNOFILE=40000
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,2 @@
#!/usr/bin/env bash
systemctl daemon-reload

View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
rm -f /usr/lib/systemd/system/etcd.service
systemctl daemon-reload

View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
groupadd --system etcd
useradd --system --shell /sbin/nologin --no-create-home --home-dir /var/lib/etcd --gid etcd etcd
mkdir -p /var/lib/etcd
chown etcd:etcd /var/lib/etcd

View File

@ -0,0 +1,2 @@
#!/usr/bin/env bash
systemctl stop etcd.service

View File

@ -1,5 +1,5 @@
# Start with the AlmaLinux 8.10 base image
FROM git.query.consul/unkin/almalinux8-buildagent:latest
FROM git.query.consul/unkin/almalinux8-rpmbuilder:latest
# Create output directory for RPMs
RUN mkdir -p /app/dist

View File

@ -1,5 +1,5 @@
# Start with the AlmaLinux 8.10 base image
FROM git.query.consul/unkin/almalinux8-buildagent:latest
FROM git.query.consul/unkin/almalinux8-rpmbuilder:latest
# Create output directory for RPMs
RUN mkdir -p /app/dist

View File

@ -1,5 +1,5 @@
# Start with the AlmaLinux 8.10 base image
FROM git.query.consul/unkin/almalinux8-buildagent:latest
FROM git.query.consul/unkin/almalinux8-rpmbuilder:latest
# Create output directory for RPMs
RUN mkdir -p /app/dist

View File

@ -1,5 +1,5 @@
# Start with the AlmaLinux 8.10 base image
FROM git.query.consul/unkin/almalinux8-buildagent:latest
FROM git.query.consul/unkin/almalinux8-rpmbuilder:latest
# Create output directory for RPMs
RUN mkdir -p /app/dist

View File

@ -1,5 +1,5 @@
# Start with the AlmaLinux 8.10 base image
FROM git.query.consul/unkin/almalinux8-buildagent:latest
FROM git.query.consul/unkin/almalinux8-rpmbuilder:latest
# Create output directory for RPMs
RUN mkdir -p /app/dist

View File

@ -1,5 +1,5 @@
# Start with the AlmaLinux 8.10 base image
FROM git.query.consul/unkin/almalinux8-buildagent:latest
FROM git.query.consul/unkin/almalinux8-rpmbuilder:latest
# Create output directory for RPMs
RUN mkdir -p /app/dist

View File

@ -1,5 +1,5 @@
# Start with the AlmaLinux 8.10 base image
FROM git.query.consul/unkin/almalinux8-buildagent:latest
FROM git.query.consul/unkin/almalinux8-rpmbuilder:latest
# Create output directory for RPMs
RUN mkdir -p /app/dist

View File

@ -1,5 +1,5 @@
# Start with the AlmaLinux 8.10 base image
FROM git.query.consul/unkin/almalinux8-buildagent:latest
FROM git.query.consul/unkin/almalinux8-rpmbuilder:latest
# Create output directory for RPMs
RUN mkdir -p /app/dist