diff --git a/ci/dfdaemon.service b/ci/dfdaemon.service new file mode 100644 index 00000000..6d2ccd92 --- /dev/null +++ b/ci/dfdaemon.service @@ -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 diff --git a/dragonfly-client/Cargo.toml b/dragonfly-client/Cargo.toml index 1963b73b..054ab000 100644 --- a/dragonfly-client/Cargo.toml +++ b/dragonfly-client/Cargo.toml @@ -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},