Files
rustfs/deploy/build/rustfs-zh.service
houseme b3ec2325ed improve docker comprose config file and remove docs dir (#174)
* refactor(config): Unify S3 API and Console ports

This commit streamlines the server configuration by unifying the S3 API and the WebUI (Console) to serve on a single port.

Previously, the console was managed by separate configuration options (`RUSTFS_CONSOLE_ENABLE` and `RUSTFS_CONSOLE_ADDRESS`), requiring a distinct port. This added complexity to deployment and configuration.

With this change:
- The `RUSTFS_CONSOLE_ADDRESS` and `RUSTFS_CONSOLE_FS_ENDPOINT` environment variables are removed.
- The WebUI is now always available and served directly from the main application port defined by `RUSTFS_ADDRESS`.
- This simplifies setup, reduces the number of exposed ports, and makes the application easier to manage and deploy, especially in containerized environments.

Users should update their startup scripts and remove the deprecated `RUSTFS_CONSOLE_*` variables.

* improve docker comprose config file and remove docs dir
2025-07-11 16:55:24 +08:00

102 lines
4.3 KiB
Desktop File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
[Unit]
Description=RustFS Object Storage Server
# 定义服务的描述,说明这是一个 RustFS 对象存储服务器,显示在 systemctl status 中。
Documentation=https://rustfs.com/docs/
# 提供服务的官方文档链接,方便管理员查阅,占位符需替换为实际 URL。
After=network-online.target
# 指定服务在 network-online.target网络就绪之后启动确保网络可用。
Wants=network-online.target
# 表示服务希望依赖 network-online.target但不是强依赖即使网络未就绪也尝试启动。
# If you're using a database, you'll need to add the corresponding dependencies
# 如果服务依赖数据库,可以添加数据库相关的依赖项(当前为注释,未启用)。
# After=postgresql.service
# 示例:若依赖 PostgreSQL则在 PostgreSQL 服务后启动(当前未启用)。
# Requires=postgresql.service
# 示例:若强制依赖 PostgreSQL则要求其启动成功当前未启用
[Service]
Type=notify
# 服务类型为 notify表示服务通过 sd_notify 通知 systemd 其状态(如就绪)。
NotifyAccess=main
# 指定只有主进程可以发送通知给 systemd避免子进程干扰。
User=rustfs
# 以 rustfs 用户身份运行服务,需预先创建此用户,提升安全性。
Group=rustfs
# 以 rustfs 组身份运行服务,与 User 配合使用。
# working directory
WorkingDirectory=/opt/rustfs
# 设置服务的工作目录为 /opt/rustfs影响相对路径的解析。
# 定义环境变量配置,用于传递给服务程序。
Environment=RUSTFS_ACCESS_KEY=rustfsadmin
# 设置访问密钥为 rustfsadmin用于 RustFS 的认证。
Environment=RUSTFS_SECRET_KEY=rustfsadmin
# 设置秘密密钥为 rustfsadmin与访问密钥配套使用。
ExecStart=/usr/local/bin/rustfs \
--address 0.0.0.0:9000 \
--volumes /data/rustfs/vol1,/data/rustfs/vol2 \
--console-enable
# 定义启动命令,运行 /usr/local/bin/rustfs带参数
# --address 0.0.0.0:9000服务监听所有接口的 9000 端口。
# --volumes指定存储卷路径为 /data/rustfs/vol1 和 /data/rustfs/vol2。
# --console-enable启用控制台功能。
# 定义环境变量配置,用于传递给服务程序,推荐使用且简洁
# rustfs 示例文件 详见: `../config/rustfs-zh.env`
EnvironmentFile=-/etc/default/rustfs
ExecStart=/usr/local/bin/rustfs $RUSTFS_VOLUMES $RUSTFS_OPTS
# standard output and error log configuration
StandardOutput=append:/data/deploy/rust/logs/rustfs.log
StandardError=append:/data/deploy/rust/logs/rustfs-err.log
# resource constraints
LimitNOFILE=1048576
# 设置文件描述符上限为 1048576支持高并发连接。
LimitNPROC=32768
# 设置进程数上限为 32768限制子进程数量。
TasksMax=infinity
# 允许服务创建无限数量的线程(谨慎使用,可能耗尽资源)。
# restart the policy
Restart=always
# 服务异常退出时总是重启,提高可用性。
RestartSec=10s
# 重启前等待 10 秒,避免频繁重启导致资源浪费。
# graceful exit configuration
TimeoutStartSec=30s
# 启动超时时间为 30 秒,若超时则认为启动失败。
TimeoutStopSec=30s
# 停止超时时间为 30 秒,若超时则强制停止。
# security settings
NoNewPrivileges=true
# 禁止服务提升权限,增强安全性。
ProtectSystem=full
# 保护系统目录(如 /usr、/boot、/etc为只读防止服务修改。
ProtectHome=true
# 保护用户主目录(如 /home、/root禁止服务访问。
PrivateTmp=true
# 为服务提供私有 /tmp 目录,隔离临时文件。
PrivateDevices=true
# 禁止服务访问硬件设备(如 /dev提升安全性。
ProtectClock=true
# 保护系统时钟,禁止服务修改时间。
ProtectKernelTunables=true
# 保护内核参数(/proc/sys禁止服务修改。
ProtectKernelModules=true
# 禁止服务加载或卸载内核模块。
ProtectControlGroups=true
# 保护控制组cgroups禁止服务修改。
RestrictSUIDSGID=true
# 禁止服务使用 SUID/SGID 文件,提升安全性。
RestrictRealtime=true
# 禁止服务使用实时调度,防止资源滥用。
ReadWritePaths=/data/rustfs
# 允许服务对 /data/rustfs 目录读写,限制其他路径访问。
[Install]
WantedBy=multi-user.target
# systemctl enable 使