sys-cluster/swift: multiple improvements

systemd units
tmpfiles
logrotate
rsyslog
removed optional dependencies

Signed-off-by: Alessandro Barbieri <lssndrbarbieri@gmail.com>
This commit is contained in:
Alessandro Barbieri
2022-04-19 01:51:48 +02:00
parent 244b95d23f
commit ec27499184
32 changed files with 358 additions and 26 deletions

View File

@@ -0,0 +1,11 @@
[Unit]
Description=OpenStack Object Storage (swift) - Account Auditor instance %I
After=syslog.target network.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-account-auditor /etc/swift/account-server/%i.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,12 @@
# After network.target just because.
[Unit]
Description=OpenStack Object Storage (swift) - Account Auditor
After=syslog.target network.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-account-auditor /etc/swift/account-server.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,11 @@
[Unit]
Description=OpenStack Object Storage (swift) - Account Reaper instance %I
After=syslog.target network.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-account-reaper /etc/swift/account-server/%i.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,11 @@
[Unit]
Description=OpenStack Object Storage (swift) - Account Reaper
After=syslog.target network.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-account-reaper /etc/swift/account-server.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,11 @@
[Unit]
Description=OpenStack Object Storage (swift) - Account Replicator instance %I
After=syslog.target network.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-account-replicator /etc/swift/account-server/%i.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,12 @@
# After network.target just so replicator can talk to other nodes.
[Unit]
Description=OpenStack Object Storage (swift) - Account Replicator
After=syslog.target network.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-account-replicator /etc/swift/account-server.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,12 @@
[Unit]
Description=OpenStack Object Storage (swift) - Account Server instance %I
Wants=network-online.target
After=syslog.target network-online.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-account-server /etc/swift/account-server/%i.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,12 @@
[Unit]
Description=OpenStack Object Storage (swift) - Account Server
Wants=network-online.target
After=syslog.target network-online.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-account-server /etc/swift/account-server.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,11 @@
[Unit]
Description=OpenStack Object Storage (swift) - Container Auditor instance %I
After=syslog.target network.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-container-auditor /etc/swift/container-server/%i.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,11 @@
[Unit]
Description=OpenStack Object Storage (swift) - Container Auditor
After=syslog.target network.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-container-auditor /etc/swift/container-server.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,11 @@
[Unit]
Description=OpenStack Object Storage (swift) - Container Reconciler
After=syslog.target network.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-container-reconciler /etc/swift/container-reconciler.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,11 @@
[Unit]
Description=OpenStack Object Storage (swift) - Container Replicator instance %I
After=syslog.target network.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-container-replicator /etc/swift/container-server/%i.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,12 @@
# After network.target just so replicator can talk to other nodes.
[Unit]
Description=OpenStack Object Storage (swift) - Container Replicator
After=syslog.target network.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-container-replicator /etc/swift/container-server.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,11 @@
[Unit]
Description=OpenStack Object Storage (swift) - Container Updater instance %I
After=syslog.target network.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-container-updater /etc/swift/container-server/%i.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,11 @@
[Unit]
Description=OpenStack Object Storage (swift) - Container Updater
After=syslog.target network.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-container-updater /etc/swift/container-server.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,12 @@
[Unit]
Description=OpenStack Object Storage (swift) - Container Server instance %I
Wants=network-online.target
After=syslog.target network-online.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-container-server /etc/swift/container-server/%i.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,12 @@
[Unit]
Description=OpenStack Object Storage (swift) - Container Server
Wants=network-online.target
After=syslog.target network-online.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-container-server /etc/swift/container-server.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,11 @@
[Unit]
Description=OpenStack Object Storage (swift) - Object Auditor instance %I
After=syslog.target network.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-object-auditor /etc/swift/object-server/%i.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,12 @@
# After network.target just because.
[Unit]
Description=OpenStack Object Storage (swift) - Object Auditor
After=syslog.target network.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-object-auditor /etc/swift/object-server.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,11 @@
[Unit]
Description=OpenStack Object Storage (swift) - Object Expirer
After=syslog.target network.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-object-expirer /etc/swift/object-expirer.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,11 @@
[Unit]
Description=OpenStack Object Storage (swift) - Object Replicator instance %I
After=syslog.target network.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-object-replicator /etc/swift/object-server/%i.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,12 @@
# After network.target just so replicator can talk to other nodes.
[Unit]
Description=OpenStack Object Storage (swift) - Object Replicator
After=syslog.target network.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-object-replicator /etc/swift/object-server.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,11 @@
[Unit]
Description=OpenStack Object Storage (swift) - Object Updater instance %I
After=syslog.target network.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-object-updater /etc/swift/object-server/%i.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,11 @@
[Unit]
Description=OpenStack Object Storage (swift) - Object Updater
After=syslog.target network.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-object-updater /etc/swift/object-server.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,12 @@
[Unit]
Description=OpenStack Object Storage (swift) - Object Server instance %I
Wants=network-online.target
After=syslog.target network-online.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-object-server /etc/swift/object-server/%i.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,12 @@
[Unit]
Description=OpenStack Object Storage (swift) - Object Server
Wants=network-online.target
After=syslog.target network-online.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-object-server /etc/swift/object-server.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,12 @@
[Unit]
Description=OpenStack Object Storage (swift) - Proxy Server
Wants=network-online.target
After=syslog.target network-online.target
[Service]
Type=simple
User=swift
ExecStart=/usr/bin/swift-proxy-server /etc/swift/proxy-server.conf
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,6 @@
/var/log/swift/swift.log
{
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2>/dev/null` 2>/dev/null || true
endscript
}

View File

@@ -0,0 +1,5 @@
# LOCAL0 is the upstream default. LOCAL1, LOCAL2 are configured in
# RHOS and RDO if installed with Packstack (also, mentioned in docs).
# The breakout action prevents logging into /var/log/messages, bz#997983.
local0.*;local1.*;local2.* /var/log/swift/swift.log
& ~

View File

@@ -0,0 +1,6 @@
# swift needs a couple of directories in /var/run
d /var/run/swift 0755 swift root
d /var/run/swift/account-server 0755 swift root
d /var/run/swift/container-server 0755 swift root
d /var/run/swift/object-server 0755 swift root
d /var/run/swift/proxy-server 0755 swift root

View File

@@ -7,11 +7,7 @@
<name>Alessandro Barbieri</name>
</maintainer>
<use>
<flag name="account">adds swift account support</flag>
<flag name="container">adds swift container support</flag>
<flag name="memcached">adds memcached support</flag>
<flag name="object">adds swift object support</flag>
<flag name="proxy">adds swift proxy support</flag>
</use>
<upstream>
<remote-id type="launchpad">swift</remote-id>

View File

@@ -5,19 +5,20 @@ EAPI=8
PYTHON_COMPAT=( python3_{8..9} )
inherit distutils-r1 linux-info
inherit distutils-r1 linux-info optfeature systemd tmpfiles
DESCRIPTION="A highly available, distributed, and eventually consistent object/blob store"
HOMEPAGE="
https://github.com/openstack/swift
https://launchpad.net/swift
https://opendev.org/openstack/swift
"
SRC_URI="https://tarballs.openstack.org/${PN}/${P}.tar.gz"
KEYWORDS="~amd64"
LICENSE="Apache-2.0"
SLOT="0"
IUSE="account container doc +memcached +object proxy"
IUSE="doc +memcached"
RDEPEND="
>=dev-python/eventlet-0.25.0[${PYTHON_USEDEP}]
@@ -55,7 +56,6 @@ BDEPEND="
)
"
REQUIRED_USE="|| ( proxy account container object )"
RESTRICT="test" # tests run forever
distutils_enable_tests nose
@@ -89,26 +89,30 @@ python_install_all() {
newins "etc/drive-audit.conf-sample" "drive-audit.conf-sample"
newins "etc/dispersion.conf-sample" "dispersion.conf-sample"
if use proxy; then
newinitd "${FILESDIR}/swift-proxy.initd" "swift-proxy"
newins "etc/proxy-server.conf-sample" "proxy-server.conf"
if use memcached; then
sed -i '/depend/a\ need memcached' "${D}/etc/init.d/swift-proxy"
fi
fi
if use account; then
newinitd "${FILESDIR}/swift-account.initd" "swift-account"
newins "etc/account-server.conf-sample" "account-server.conf"
fi
if use container; then
newinitd "${FILESDIR}/swift-container.initd" "swift-container"
newins "etc/container-server.conf-sample" "container-server.conf"
fi
if use object; then
newinitd "${FILESDIR}/swift-object.initd" "swift-object"
newins "etc/object-server.conf-sample" "object-server.conf"
newins "etc/object-expirer.conf-sample" "object-expirer.conf"
newinitd "${FILESDIR}/swift-proxy.initd" "swift-proxy"
newins "etc/proxy-server.conf-sample" "proxy-server.conf"
if use memcached; then
sed -i '/depend/a\ need memcached' "${D}/etc/init.d/swift-proxy"
fi
newinitd "${FILESDIR}/swift-account.initd" "swift-account"
newins "etc/account-server.conf-sample" "account-server.conf"
newinitd "${FILESDIR}/swift-container.initd" "swift-container"
newins "etc/container-server.conf-sample" "container-server.conf"
newinitd "${FILESDIR}/swift-object.initd" "swift-object"
newins "etc/object-server.conf-sample" "object-server.conf"
newins "etc/object-expirer.conf-sample" "object-expirer.conf"
for i in "${FILESDIR}"/openstack-swift*.service ; do
systemd_dounit "${i/.AT/@}"
done
insinto /etc/logrotate.d
newins "${FILESDIR}/openstack-swift.logrotate" swift
newtmpfiles "${FILESDIR}/openstack-swift.tmpfs" swift.conf
insinto /etc/rsyslog.d/
newins "${FILESDIR}/openstack-swift.rsyslog" openstack-swift.conf
if use doc; then
doman doc/manpages/*
@@ -120,9 +124,15 @@ python_install_all() {
}
pkg_postinst() {
tmpfiles_process swift.conf
elog "Openstack swift will default to using insecure http unless a"
elog "certificate is created in /etc/swift/cert.crt and the associated key"
elog "in /etc/swift/cert.key. These can be created with the following:"
elog " * cd /etc/swift"
elog " * openssl req -new -x509 -nodes -out cert.crt -keyout cert.key"
optfeature "kms_keymaster" >=dev-python/oslo.config-4.0.0 >=dev-python/castellan-0.13.0
#optfeature "kmip_keymaster" >=dev-python/pykmip-0.7.0
optfeature "keystone" >=dev-python/keystonemiddleware-4.17.0
}