Skip to content

Instantly share code, notes, and snippets.

@errordeveloper
Last active December 13, 2016 19:08
Show Gist options
  • Save errordeveloper/565e4d380f7c93f06984c01a315d13aa to your computer and use it in GitHub Desktop.
Save errordeveloper/565e4d380f7c93f06984c01a315d13aa to your computer and use it in GitHub Desktop.
systemd units for Weave Net
[Unit]
After=network-online.target
After=docker.service
Before=weave.service
Requires=docker.service
Requires=network-online.target
Description=Install Weave
Documentation=http://docs.weave.works/
ConditionFileNotEmpty=!/opt/bin/weave-${WEAVE_SCRIPT_VERSION}
ConditionFileIsExecutable=!/opt/bin/weave-${WEAVE_SCRIPT_VERSION}
[Service]
Type=oneshot
RemainAfterExit=yes
TimeoutStartSec=0
Environment=WEAVE_SCRIPT_VERSION=latest_release
EnvironmentFile=-/etc/weave.env
ExecStartPre=/usr/bin/curl \
--silent \
--location \
https://github.com/weaveworks/weave/releases/download/${WEAVE_SCRIPT_VERSION}/weave \
--output /opt/bin/weave-${WEAVE_SCRIPT_VERSION}
ExecStartPre=/bin/chmod +x /opt/bin/weave-${WEAVE_SCRIPT_VERSION}
ExecStartPre=/bin/ln -s -f /opt/bin/weave-${WEAVE_SCRIPT_VERSION} /opt/bin/weave
ExecStart=/opt/bin/weave setup
[Install]
WantedBy=weave-network.target
WantedBy=weave.service
[Unit]
After=docker.service
After=install-weave.service
After=weave.service
Requires=docker.service
Requires=install-weave.service
Requires=weave.service
[Service]
Type=oneshot
RemainAfterExit=yes
TimeoutStartSec=0
Environment=WEAVE_EXPOSE_FQDN=%H.weave.local
EnvironmentFile=-/etc/weave.env
ExecStart=/opt/bin/weave expose -h $WEAVE_EXPOSE_FQDN
ExecStop=/opt/bin/weave hide
[Install]
WantedBy=kube-proxy.service
[Unit]
Description=Weave Net Setup Complete
Documentation=man:systemd.special(7)
RefuseManualStart=no
After=network-online.target
After=weave.service
After=docker.service
[Install]
WantedBy=multi-user.target
[Unit]
After=docker.service
After=install-weave.service
Requires=docker.service
Requires=install-weave.service
Description=Weave Net Router
Documentation=http://docs.weave.works/
[Service]
TimeoutStartSec=0
EnvironmentFile=-/etc/weave.env
ExecStartPre=/opt/bin/weave launch-router $WEAVE_INIT_PEER_COUNT $WEAVE_KNOW_PEERS $WEAVE_ARGS
#ExecStartPre=/bin/bash -c '/opt/bin/weave connect $(find-weave-peers.sh)'
ExecStart=/usr/bin/docker attach weave
Restart=on-failure
ExecStop=/opt/bin/weave stop-router
[Install]
WantedBy=weave-network.target
[Unit]
After=docker.service
After=install-weave.service
Requires=docker.service
Requires=install-weave.service
Description=Weave Net plugin for Docker Network
Documentation=http://docs.weave.works/
[Service]
EnvironmentFile=-/etc/weave.env
ExecStartPre=/opt/bin/weave launch-plugin $WEAVEPLUGIN_ARGS
ExecStart=/usr/bin/docker attach weaveplugin
Restart=on-failure
ExecStop=/opt/bin/weave stop-plugin
[Install]
WantedBy=weave-network.target
[Unit]
After=docker.service
After=install-weave.service
Requires=docker.service
Requires=install-weave.service
Description=Weave Net proxy for Docker API
Documentation=http://docs.weave.works/
[Service]
EnvironmentFile=-/etc/weave.env
ExecStartPre=/opt/bin/weave launch-proxy $WEAVEPROXY_ARGS
ExecStart=/usr/bin/docker attach weaveproxy
Restart=on-failure
ExecStop=/opt/bin/weave stop-proxy
[Install]
WantedBy=weave-network.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment