mirror of
https://github.com/flatcar/scripts.git
synced 2026-05-04 11:51:14 +02:00
move bootstrap fully into ami
This commit is contained in:
parent
5715f652bb
commit
b21389fc42
@ -33,3 +33,20 @@ coreos:
|
||||
Type=oneshot
|
||||
RemainAfterExit=no
|
||||
ExecStart=/usr/share/oem/usr/bin/coreos-c10n
|
||||
- name: etcd.service
|
||||
runtime: yes
|
||||
content: |
|
||||
[Unit]
|
||||
Description=etcd with ec2 auto-bootstrap
|
||||
Requires=ec2-c10n.service
|
||||
After=ec2-c10n.service
|
||||
|
||||
[Service]
|
||||
User=etcd
|
||||
PermissionsStartOnly=true
|
||||
ExecStart=/usr/share/oem/usr/bin/etcd-bootstrap
|
||||
Restart=always
|
||||
RestartSec=10s
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
@ -3,16 +3,10 @@
|
||||
#TODO: Generating a config file rather than args so etcd-bootstrap can run as a
|
||||
# completely separate unit from etcd
|
||||
|
||||
VIRT=$(coreos-detect-virt)
|
||||
STATE=/var/lib/etcd
|
||||
ARGS="-f -data-dir $STATE -bind-addr 0.0.0.0"
|
||||
|
||||
if [ "${VIRT}" != "ec2" ]; then
|
||||
echo "Detected environment \"${VIRT}\", just starting solo master..."
|
||||
exec /usr/bin/etcd ${ARGS} -n ${HOSTNAME}
|
||||
else
|
||||
ARGS="${ARGS} -peer-election-timeout 1200"
|
||||
fi
|
||||
ARGS="${ARGS} -peer-election-timeout 1200"
|
||||
|
||||
BOOTSTRAP_PEERS="/var/run/etcd/bootstrap.config"
|
||||
BOOTSTRAP_DISCO="/var/run/etcd/bootstrap.disco"
|
||||
@ -20,6 +20,7 @@ src_install() {
|
||||
dobin ${FILESDIR}/ec2-ssh-key
|
||||
dobin ${FILESDIR}/coreos-setup-environment
|
||||
dobin ${FILESDIR}/coreos-c10n
|
||||
dobin ${FILESDIR}/etcd-bootstrap
|
||||
|
||||
insinto "/"
|
||||
doins ${FILESDIR}/cloud-config.yml
|
||||
|
||||
@ -29,8 +29,6 @@ src_compile() {
|
||||
|
||||
src_install() {
|
||||
dobin ${S}/bin/${PN}
|
||||
dobin ${FILESDIR}/etcd-bootstrap
|
||||
dobin ${FILESDIR}/etcd-pre-exec
|
||||
|
||||
systemd_dounit "${FILESDIR}"/${PN}.service
|
||||
systemd_enable_service multi-user.target ${PN}.service
|
||||
@ -28,8 +28,6 @@ src_compile() {
|
||||
|
||||
src_install() {
|
||||
dobin ${S}/bin/${PN}
|
||||
dobin ${FILESDIR}/etcd-bootstrap
|
||||
dobin ${FILESDIR}/etcd-pre-exec
|
||||
|
||||
systemd_dounit "${FILESDIR}"/${PN}.service
|
||||
systemd_enable_service multi-user.target ${PN}.service
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
# Fixup the old state directory
|
||||
OLD_STATE=/media/state/etcd
|
||||
STATE=/var/lib/etcd
|
||||
|
||||
if [ -d /media/state/etcd ]; then
|
||||
cp -R ${OLD_STATE}/. ${STATE}
|
||||
rm -R ${OLD_STATE}
|
||||
chown -R etcd:etcd ${STATE}
|
||||
fi
|
||||
@ -1,13 +1,14 @@
|
||||
[Unit]
|
||||
Description=etcd
|
||||
Requires=coreos-c10n.service
|
||||
After=coreos-c10n.service
|
||||
RequiresMountsFor=/usr/share/oem
|
||||
# oem will setup etcd for auto bootstrapping
|
||||
ConditionPathExists=!/usr/share/oem/cloud-config.yml
|
||||
|
||||
[Service]
|
||||
User=etcd
|
||||
PermissionsStartOnly=true
|
||||
ExecStartPre=/usr/bin/etcd-pre-exec
|
||||
ExecStart=/usr/bin/etcd-bootstrap
|
||||
# Default, this will be overwritten with a cloud-config
|
||||
ExecStart=/usr/bin/etcd -f -data-dir /var/lib/etcd -bind-addr 0.0.0.0
|
||||
|
||||
Restart=always
|
||||
# Set a longish timeout in case this machine isn't behaving
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user