Skip to content
This repository was archived by the owner on Dec 15, 2024. It is now read-only.

docs: demonstrate with example using systemd to run donutdns #5

Merged
merged 1 commit into from
Aug 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,31 @@ Use the environment variables described above to configure things.
$ DONUT_DNS_PORT=5533 DONUT_DNS_NO_DEBUG=1 donutdns
```

#### as a systemd unit

The [donutdns.service](donutdns.service) file provides an example Systemd Service Unit file for running
donutdns via systemd.

```
# A minimal unit file, see donutdns.service for more.

[Unit]
Description=Block ads, trackers, and malicioius sites using DonutDNS.

[Service]
ExecStart=/opt/bin/donutdns
Environment=DONUT_DNS_PORT=53

[Install]
WantedBy=multi-user.target
```

Typically this file would be created at `/etc/systemd/system/donutdns.service`.

Register the new unit with `sudo systemctl daemon-reload`
Start the sevice with `sudo systemctl start donutdns`
Check the service with `sudo systemctl status donutdns`

#### as a docker container

`donutdns` is available from [Docker Hub](https://hub.docker.com/repository/docker/shoenig/donutdns/general)
Expand Down
34 changes: 34 additions & 0 deletions donutdns.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This is an example systemd service file for running donutdns.
#
# It assumes the donutdns executable exists at /opt/bin/donutdns
#
# To use this service file:
# - Copy to /etc/systemd/system/donutdns.service
# - Run sudo systemctl daemon-reload
# - sudo systemctl start donutdns
#
# Check the status of the donutdns systemd service with
# - systemctl status donutdns
#
# If you have large block-lists you may need to tweak MemoryMax.
# If donutdns is being used at scale you may want to set CPUWeight
# to something higher than 100 (the default for systemd services).
#
# Environment variables can be configured as normal for systemd units.

[Unit]
Description=Block ads, trackers, and malicioius sites using DonutDNS.

[Service]
Type=simple
ExecStart=/opt/bin/donutdns

MemoryMax=42M
CPUWeight=90

Environment=DONUT_DNS_PORT=53
Environment=DONUT_DNS_ALLOW=
Environment=DONUT_DNS_BLOCK=

[Install]
WantedBy=multi-user.target