Files
Raj Chaudhuri e2db8a25bd Added documentation website content, and a workflow to publish it to GitHub Pages
* Copied, rearranged and modified the contents of the old site directory for Jekyll static site generator, into the website directory
* Added some Jekyll-specific things for looks, including:
  * _config.yaml, Gemfile.* and 404.html files
  * _data, _layouts and assets directories and their content
* Added .github/workflows/github-pages-publish.yml workflow
2024-03-18 20:37:53 +05:30

71 lines
2.8 KiB
Markdown

---
title: Using Weave with Systemd
menu_order: 40
search_type: Documentation
---
Having installed Weave Net as per [Installing Weave]({{ '/install/installing-weave' | relative_url }}), you might find it convenient to configure the
init daemon to start Weave on boot. Most recent Linux distribution releases ship with [systemd](http://www.freedesktop.org/wiki/Software/systemd/). The information below provides you with some initial guidance on getting a Weave Net service configured on a systemd-based OS.
## Weave Net Service Unit and Configuration
A regular service unit definition for Weave Net is shown below. This file is
normally placed in `/etc/systemd/system/weave.service`.
[Unit]
Description=Weave Network
Documentation=http://docs.weave.works/weave/latest_release/
Requires=docker.service
After=docker.service
[Service]
EnvironmentFile=-/etc/sysconfig/weave
ExecStartPre=/usr/local/bin/weave launch --no-restart $PEERS
ExecStart=/usr/bin/docker attach weave
ExecStop=/usr/local/bin/weave stop
[Install]
WantedBy=multi-user.target
To specify the addresses or names of other Weave hosts to join the network,
create the `/etc/sysconfig/weave` environment file using the following format:
PEERS="HOST1 HOST2 .. HOSTn"
You can also use the [`weave connect`]({{ '/tasks/manage/finding-adding-hosts-dynamically' | relative_url }}) command to add participating hosts dynamically.
Additionally, if you want to enable [encryption]({{ '/tasks/manage/security-untrusted-networks' | relative_url }}) specify a
password using `WEAVE_PASSWORD="wfvAwt7sj"` in the `/etc/sysconfig/weave` environment file, and it will get picked up by
Weave Net on launch. Recommendations for choosing a suitably strong password can be found [here]({{ '/tasks/manage/security-untrusted-networks' | relative_url }}).
You can now launch Weave Net using
sudo systemctl start weave
To ensure Weave Net launches after reboot, run:
sudo systemctl enable weave
For more information on systemd, please refer to the documentation supplied
with your distribution of Linux.
## SELinux Tweaks
If your OS has SELinux enabled and you want to run Weave Net as a systemd unit,
then follow the instructions below. These instructions apply to
CentOS and RHEL as of 7.0. On Fedora 21, there is no need to do this.
Once `weave` is installed in `/usr/local/bin`, set its execution
context with the commands shown below. You will need to have the
`policycoreutils-python` package installed.
sudo semanage fcontext -a -t unconfined_exec_t -f f /usr/local/bin/weave
sudo restorecon /usr/local/bin/weave
**See Also**
* [Launching Weave Net]({{ '/install/using-weave' | relative_url }})
* [Tutorials](https://www.weave.works/docs/tutorials/)
* [Features]({{ '/overview/features' | relative_url }})
* [Troubleshooting]({{ '/troubleshooting' | relative_url }})