Feat: dfdaemon is started using systemd (#648)

Signed-off-by: zhaoxinxin <1186037180@qq.com>
This commit is contained in:
Zhaoxinxin 2024-08-05 18:42:44 +08:00 committed by GitHub
parent 50fa71e4c9
commit b150ba3364
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 69 additions and 20 deletions

25
ci/dfdaemon.service Normal file
View File

@ -0,0 +1,25 @@
[Unit]
Description=dfdaemon is a high performance P2P download daemon
Documentation=https://github.com/dragonflyoss/client
After=network-online.target
After=network.target
[Service]
ExecStart=/usr/bin/dfdaemon --config /etc/dragonfly/dfdaemon.yaml --verbose
Type=simple
Environment=HOME=/root
Restart=on-success
# Limit CPU usage to 1 CPU core.
CPUQuota=100%
# Limiting CPU Consumption of a Unit.
CPUWeight=400
# Limit Memory usage to 8G, beyond that the process will be OOM killed.
MemoryMax=8G
[Install]
WantedBy=multi-user.target

View File

@ -104,27 +104,32 @@ section = "rust"
assets = [
[
"../target/x86_64-unknown-linux-gnu/release/dfget",
"/usr/bin/dfget",
"usr/bin/dfget",
"755",
],
[
"../target/x86_64-unknown-linux-gnu/release/dfdaemon",
"/usr/bin/dfdaemon",
"usr/bin/dfdaemon",
"755",
],
[
"../target/x86_64-unknown-linux-gnu/release/dfcache",
"/usr/bin/dfcache",
"usr/bin/dfcache",
"755",
],
[
"../target/x86_64-unknown-linux-gnu/release/dfstore",
"/usr/bin/dfstore",
"usr/bin/dfstore",
"755",
],
[
"../ci/dfdaemon.service",
"lib/systemd/system/dfdaemon.service",
"644",
],
[
"../ci/dfdaemon.yaml",
"/etc/dragonfly/dfdaemon.yaml",
"etc/dragonfly/dfdaemon.yaml",
"644",
],
[
@ -151,27 +156,32 @@ priority = "optional"
assets = [
[
"../target/x86_64-unknown-linux-musl/release/dfget",
"/usr/bin/dfget",
"usr/bin/dfget",
"755",
],
[
"../target/x86_64-unknown-linux-musl/release/dfdaemon",
"/usr/bin/dfdaemon",
"usr/bin/dfdaemon",
"755",
],
[
"../target/x86_64-unknown-linux-musl/release/dfcache",
"/usr/bin/dfcache",
"usr/bin/dfcache",
"755",
],
[
"../target/x86_64-unknown-linux-musl/release/dfstore",
"/usr/bin/dfstore",
"usr/bin/dfstore",
"755",
],
[
"../ci/dfdaemon.service",
"lib/systemd/system/dfdaemon.service",
"644",
],
[
"../ci/dfdaemon.yaml",
"/etc/dragonfly/dfdaemon.yaml",
"etc/dragonfly/dfdaemon.yaml",
"644",
],
[
@ -198,27 +208,32 @@ section = "rust"
assets = [
[
"../target/aarch64-unknown-linux-gnu/release/dfget",
"/usr/bin/dfget",
"usr/bin/dfget",
"755",
],
[
"../target/aarch64-unknown-linux-gnu/release/dfdaemon",
"/usr/bin/dfdaemon",
"usr/bin/dfdaemon",
"755",
],
[
"../target/aarch64-unknown-linux-gnu/release/dfcache",
"/usr/bin/dfcache",
"usr/bin/dfcache",
"755",
],
[
"../target/aarch64-unknown-linux-gnu/release/dfstore",
"/usr/bin/dfstore",
"usr/bin/dfstore",
"755",
],
[
"../ci/dfdaemon.service",
"lib/systemd/system/dfdaemon.service",
"644",
],
[
"../ci/dfdaemon.yaml",
"/etc/dragonfly/dfdaemon.yaml",
"etc/dragonfly/dfdaemon.yaml",
"644",
],
[
@ -245,27 +260,32 @@ section = "rust"
assets = [
[
"../target/aarch64-unknown-linux-musl/release/dfget",
"/usr/bin/dfget",
"usr/bin/dfget",
"755",
],
[
"../target/aarch64-unknown-linux-musl/release/dfdaemon",
"/usr/bin/dfdaemon",
"usr/bin/dfdaemon",
"755",
],
[
"../target/aarch64-unknown-linux-musl/release/dfcache",
"/usr/bin/dfcache",
"usr/bin/dfcache",
"755",
],
[
"../target/aarch64-unknown-linux-musl/release/dfstore",
"/usr/bin/dfstore",
"usr/bin/dfstore",
"755",
],
[
"../ci/dfdaemon.service",
"lib/systemd/system/dfdaemon.service",
"644",
],
[
"../ci/dfdaemon.yaml",
"/etc/dragonfly/dfdaemon.yaml",
"etc/dragonfly/dfdaemon.yaml",
"644",
],
[
@ -291,6 +311,7 @@ assets = [
{source = "../target/x86_64-unknown-linux-gnu/release/dfdaemon", dest = "/usr/bin/dfdaemon", mode = "755"},
{source = "../target/x86_64-unknown-linux-gnu/release/dfcache", dest = "/usr/bin/dfcache", mode = "755"},
{source = "../target/x86_64-unknown-linux-gnu/release/dfstore", dest = "/usr/bin/dfstore", mode = "755"},
{source = "../ci/dfdaemon.service", dest = "/lib/systemd/system/dfdaemon.service", config = true, mode = "644" },
{source = "../ci/dfdaemon.yaml", dest = "/etc/dragonfly/dfdaemon.yaml", mode = "644", config = true },
{source = "../CONTRIBUTING.md", dest = "/usr/share/doc/client/CONTRIBUTING.md", mode = "644", doc = true},
{source = "../LICENSE", dest = "/usr/share/doc/client/LICENSE.md", mode = "644", doc = true},
@ -303,6 +324,7 @@ assets = [
{source = "../target/x86_64-unknown-linux-musl/release/dfdaemon", dest = "/usr/bin/dfdaemon", mode = "755"},
{source = "../target/x86_64-unknown-linux-musl/release/dfcache", dest = "/usr/bin/dfcache", mode = "755"},
{source = "../target/x86_64-unknown-linux-musl/release/dfstore", dest = "/usr/bin/dfstore", mode = "755"},
{source = "../ci/dfdaemon.service", dest = "/lib/systemd/system/dfdaemon.service", config = true, mode = "644" },
{source = "../ci/dfdaemon.yaml", dest = "/etc/dragonfly/dfdaemon.yaml", mode = "644", config = true },
{source = "../CONTRIBUTING.md", dest = "/usr/share/doc/client/CONTRIBUTING.md", mode = "644", doc = true},
{source = "../LICENSE", dest = "/usr/share/doc/client/LICENSE.md", mode = "644", doc = true},
@ -315,6 +337,7 @@ assets = [
{source = "../target/aarch64-unknown-linux-gnu/release/dfdaemon", dest = "/usr/bin/dfdaemon", mode = "755"},
{source = "../target/aarch64-unknown-linux-gnu/release/dfcache", dest = "/usr/bin/dfcache", mode = "755"},
{source = "../target/aarch64-unknown-linux-gnu/release/dfstore", dest = "/usr/bin/dfstore", mode = "755"},
{source = "../ci/dfdaemon.service", dest = "/lib/systemd/system/dfdaemon.service", config = true, mode = "644" },
{source = "../ci/dfdaemon.yaml", dest = "/etc/dragonfly/dfdaemon.yaml", mode = "644", config = true },
{source = "../CONTRIBUTING.md", dest = "/usr/share/doc/client/CONTRIBUTING.md", mode = "644", doc = true},
{source = "../LICENSE", dest = "/usr/share/doc/client/LICENSE.md", mode = "644", doc = true},
@ -327,6 +350,7 @@ assets = [
{source = "../target/aarch64-unknown-linux-musl/release/dfdaemon", dest = "/usr/bin/dfdaemon", mode = "755"},
{source = "../target/aarch64-unknown-linux-musl/release/dfcache", dest = "/usr/bin/dfcache", mode = "755"},
{source = "../target/aarch64-unknown-linux-musl/release/dfstore", dest = "/usr/bin/dfstore", mode = "755"},
{source = "../ci/dfdaemon.service", dest = "/lib/systemd/system/dfdaemon.service", config = true, mode = "644" },
{source = "../ci/dfdaemon.yaml", dest = "/etc/dragonfly/dfdaemon.yaml", mode = "644", config = true },
{source = "../CONTRIBUTING.md", dest = "/usr/share/doc/client/CONTRIBUTING.md", mode = "644", doc = true},
{source = "../LICENSE", dest = "/usr/share/doc/client/LICENSE.md", mode = "644", doc = true},