Skip to content

Commit

Permalink
add systemd service
Browse files Browse the repository at this point in the history
viktorerlingsson committed Oct 29, 2024
1 parent 5b3c4e9 commit dba2d4c
Showing 2 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -19,10 +19,12 @@ RUN mkdir -p pkg/usr/bin
RUN curl -L ${download_url}/${etcd_version}/etcd-${etcd_version}-${TARGETOS}-${arch}.tar.gz -o tmp/etcd-${etcd_version}-${TARGETOS}-${arch}.tar.gz
RUN tar xzvf tmp/etcd-${etcd_version}-${TARGETOS}-${arch}.tar.gz -C tmp/etcd/ --strip-components=1
RUN cp tmp/etcd/etcd* pkg/usr/bin/
COPY etcd.service pkg/etc/systemd/system/
# create deb package
RUN fpm -s dir -t deb -n etcd -v ${etcd_version} --iteration ${pkg_revision} -a ${arch} \
--url https://etcd.io --maintainer "84codes <contact@84codes.com>" \
--description "A distributed, reliable key-value store" \
--deb-systemd etcd.service \
--license "Apache 2.0" --chdir pkg .

# ARM64
@@ -33,10 +35,12 @@ RUN rm -rf pkg/usr/bin/*
RUN curl -L ${download_url}/${etcd_version}/etcd-${etcd_version}-${TARGETOS}-${arch}.tar.gz -o tmp/etcd-${etcd_version}-${TARGETOS}-${arch}.tar.gz
RUN tar xzvf tmp/etcd-${etcd_version}-${TARGETOS}-${arch}.tar.gz -C tmp/etcd/ --strip-components=1
RUN cp tmp/etcd/etcd* pkg/usr/bin/
COPY etcd.service pkg/etc/systemd/system/
# create deb package
RUN fpm -s dir -t deb -n etcd -v ${etcd_version} --iteration ${pkg_revision} -a ${arch} \
--url https://etcd.io --maintainer "84codes <contact@84codes.com>" \
--description "A distributed, reliable key-value store" \
--deb-systemd etcd.service \
--license "Apache 2.0" --chdir pkg .

# put .deb files in a scratch image for exporting
17 changes: 17 additions & 0 deletions etcd.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[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]
Type=notify
Environment=ETCD_DATA_DIR=/var/lib/etcd
Environment=ETCD_NAME=%m
ExecStart=/usr/bin/etcd --config-file /etc/etcd/etcd.conf.yml
Restart=always
RestartSec=10s
LimitNOFILE=40000

[Install]
WantedBy=multi-user.target

0 comments on commit dba2d4c

Please sign in to comment.