fleet/docs/infrastructure/systemd.md
Zachary Wasserman 545bc6fccb
Add LimitNOFILE to example systemd file (#1958)
This mitigates a common issue for systemd users.

Closes #1955
2018-11-20 17:19:44 -08:00

48 lines
1.3 KiB
Markdown

## Running with systemd
Once you've verified that you can run fleet in your shell, you'll likely want to keep fleet running in the background and after the server reboots. To do that we recommend using [systemd](https://coreos.com/os/docs/latest/getting-started-with-systemd.html).
Below is a sample unit file.
```
[Unit]
Description=Kolide Fleet
After=network.target
[Service]
LimitNOFILE=8192
ExecStart=/usr/local/bin/fleet serve \
--mysql_address=127.0.0.1:3306 \
--mysql_database=kolide \
--mysql_username=root \
--mysql_password=toor \
--redis_address=127.0.0.1:6379 \
--server_cert=/tmp/server.cert \
--server_key=/tmp/server.key \
--auth_jwt_key=this_string_is_not_secure_replace_it \
--logging_json
[Install]
WantedBy=multi-user.target
```
Once you created the file, you need to move it to `/etc/systemd/system/fleet.service` and start the service.
```
sudo mv fleet.service /etc/systemd/system/fleet.service
sudo systemctl start fleet.service
sudo systemctl status fleet.service
sudo journalctl -u fleet.service -f
```
## Making changes
Sometimes you'll need to update the systemd unit file defining the service. To do that, first open /etc/systemd/system/fleet.service in a text editor, and make your modifications.
Then, run
```
sudo systemctl daemon-reload
sudo systemctl restart fleet.service
```