mirror of
https://github.com/rustfs/rustfs.git
synced 2026-01-16 17:20:33 +00:00
improve systemd relation config
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -9,6 +9,6 @@
|
|||||||
rustfs/static/*
|
rustfs/static/*
|
||||||
vendor
|
vendor
|
||||||
cli/rustfs-gui/embedded-rustfs/rustfs
|
cli/rustfs-gui/embedded-rustfs/rustfs
|
||||||
config/obs.toml
|
deploy/config/obs.toml
|
||||||
*.log
|
*.log
|
||||||
config/certs/*
|
deploy/certs/*
|
||||||
|
|||||||
35
deploy/README.md
Normal file
35
deploy/README.md
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# RustFS Deploy
|
||||||
|
|
||||||
|
This directory contains the deployment scripts and configurations for the project.
|
||||||
|
The deployment process is divided into two main parts: the RustFS binary and the RustFS console. The RustFS binary is
|
||||||
|
responsible for the core functionality of the system, while the RustFS console provides a web-based interface for
|
||||||
|
managing and monitoring the system.
|
||||||
|
|
||||||
|
# Directory Structure
|
||||||
|
|
||||||
|
```text
|
||||||
|
|--data // data directory
|
||||||
|
| |--vol1 // volume 1 not created
|
||||||
|
| |--vol2 // volume 2 not created
|
||||||
|
| |--vol3 // volume 3 not created
|
||||||
|
| |--vol4 // volume 4 not created
|
||||||
|
| |--README.md // data directory readme
|
||||||
|
|--logs // log directory
|
||||||
|
| |--rustfs.log // RustFS log
|
||||||
|
| |--README.md // logs directory readme
|
||||||
|
|--build
|
||||||
|
| |--rustfs.run.md // deployment script for RustFS
|
||||||
|
| |--rustfs.run-zh.md // deployment script for RustFS in Chinese
|
||||||
|
| |--rustfs.service // systemd service file
|
||||||
|
| |--rustfs-zh.service.md // systemd service file in Chinese
|
||||||
|
|--certs
|
||||||
|
| |--README.md // certs readme
|
||||||
|
| |--rustfs_tls_cert.pem // API cert.pem
|
||||||
|
| |--rustfs_tls_key.pem // API key.pem
|
||||||
|
| |--rustfs_console_tls_cert.pem // console cert.pem
|
||||||
|
| |--rustfs_console_tls_key.pem // console key.pem
|
||||||
|
|--config
|
||||||
|
| |--obs.example.yaml // example config
|
||||||
|
| |--rustfs.env // env config
|
||||||
|
| |--rustfs-zh.env // env config in Chinese
|
||||||
|
```
|
||||||
@@ -24,20 +24,15 @@ User=rustfs
|
|||||||
Group=rustfs
|
Group=rustfs
|
||||||
# 以 rustfs 组身份运行服务,与 User 配合使用。
|
# 以 rustfs 组身份运行服务,与 User 配合使用。
|
||||||
|
|
||||||
# environment variable configuration
|
|
||||||
# 定义环境变量配置,用于传递给服务程序。
|
|
||||||
Environment=RUST_LOG=info
|
|
||||||
# 设置日志级别为 info,控制服务日志输出(需服务支持此变量)。
|
|
||||||
Environment=RUSTFS_ACCESS_KEY=rustfsadmin
|
|
||||||
# 设置访问密钥为 rustfsadmin,用于 RustFS 的认证。
|
|
||||||
Environment=RUSTFS_SECRET_KEY=rustfsadmin
|
|
||||||
# 设置秘密密钥为 rustfsadmin,与访问密钥配套使用。
|
|
||||||
|
|
||||||
# working directory
|
# working directory
|
||||||
WorkingDirectory=/opt/rustfs
|
WorkingDirectory=/opt/rustfs
|
||||||
# 设置服务的工作目录为 /opt/rustfs,影响相对路径的解析。
|
# 设置服务的工作目录为 /opt/rustfs,影响相对路径的解析。
|
||||||
|
|
||||||
# main program
|
# 定义环境变量配置,用于传递给服务程序。
|
||||||
|
Environment=RUSTFS_ACCESS_KEY=rustfsadmin
|
||||||
|
# 设置访问密钥为 rustfsadmin,用于 RustFS 的认证。
|
||||||
|
Environment=RUSTFS_SECRET_KEY=rustfsadmin
|
||||||
|
# 设置秘密密钥为 rustfsadmin,与访问密钥配套使用。
|
||||||
ExecStart=/usr/local/bin/rustfs \
|
ExecStart=/usr/local/bin/rustfs \
|
||||||
--address 0.0.0.0:9000 \
|
--address 0.0.0.0:9000 \
|
||||||
--volumes /data/rustfs/vol1,/data/rustfs/vol2 \
|
--volumes /data/rustfs/vol1,/data/rustfs/vol2 \
|
||||||
@@ -51,6 +46,10 @@ ExecStart=/usr/local/bin/rustfs \
|
|||||||
# --console-enable:启用控制台功能。
|
# --console-enable:启用控制台功能。
|
||||||
# --console-address 0.0.0.0:9002:控制台监听所有接口的 9002 端口。
|
# --console-address 0.0.0.0:9002:控制台监听所有接口的 9002 端口。
|
||||||
|
|
||||||
|
# 定义环境变量配置,用于传递给服务程序,推荐使用且简洁
|
||||||
|
EnvironmentFile=-/etc/default/rustfs
|
||||||
|
ExecStart=/usr/local/bin/rustfs $RUSTFS_VOLUMES $RUSTFS_OPTS
|
||||||
|
|
||||||
# resource constraints
|
# resource constraints
|
||||||
LimitNOFILE=1048576
|
LimitNOFILE=1048576
|
||||||
# 设置文件描述符上限为 1048576,支持高并发连接。
|
# 设置文件描述符上限为 1048576,支持高并发连接。
|
||||||
@@ -13,15 +13,12 @@ NotifyAccess=main
|
|||||||
User=rustfs
|
User=rustfs
|
||||||
Group=rustfs
|
Group=rustfs
|
||||||
|
|
||||||
# environment variable configuration
|
|
||||||
Environment=RUST_LOG=info
|
|
||||||
Environment=RUSTFS_ACCESS_KEY=rustfsadmin
|
|
||||||
Environment=RUSTFS_SECRET_KEY=rustfsadmin
|
|
||||||
|
|
||||||
# working directory
|
# working directory
|
||||||
WorkingDirectory=/opt/rustfs
|
WorkingDirectory=/opt/rustfs
|
||||||
|
|
||||||
# main program
|
# environment variable configuration and main program (Option 1: Directly specify arguments)
|
||||||
|
Environment=RUSTFS_ACCESS_KEY=rustfsadmin
|
||||||
|
Environment=RUSTFS_SECRET_KEY=rustfsadmin
|
||||||
ExecStart=/usr/local/bin/rustfs \
|
ExecStart=/usr/local/bin/rustfs \
|
||||||
--address 0.0.0.0:9000 \
|
--address 0.0.0.0:9000 \
|
||||||
--volumes /data/rustfs/vol1,/data/rustfs/vol2 \
|
--volumes /data/rustfs/vol1,/data/rustfs/vol2 \
|
||||||
@@ -29,6 +26,10 @@ ExecStart=/usr/local/bin/rustfs \
|
|||||||
--console-enable \
|
--console-enable \
|
||||||
--console-address 0.0.0.0:9002
|
--console-address 0.0.0.0:9002
|
||||||
|
|
||||||
|
# environment variable configuration (Option 2: Use environment variables)
|
||||||
|
EnvironmentFile=-/etc/default/rustfs
|
||||||
|
ExecStart=/usr/local/bin/rustfs $RUSTFS_VOLUMES $RUSTFS_OPTS
|
||||||
|
|
||||||
# resource constraints
|
# resource constraints
|
||||||
LimitNOFILE=1048576
|
LimitNOFILE=1048576
|
||||||
LimitNPROC=32768
|
LimitNPROC=32768
|
||||||
33
deploy/config/obs-zh.example.toml
Normal file
33
deploy/config/obs-zh.example.toml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
[observability]
|
||||||
|
endpoint = "http://localhost:4317" # 可观测性数据上报的终端地址,默认为"http://localhost:4317"
|
||||||
|
use_stdout = true # 是否将日志输出到标准输出
|
||||||
|
sample_ratio = 2.0 # 采样率,表示每 2 条数据采样 1 条
|
||||||
|
meter_interval = 30 # 指标收集间隔,单位为秒
|
||||||
|
service_name = "rustfs" # 服务名称,用于标识当前服务
|
||||||
|
service_version = "0.1.0" # 服务版本号
|
||||||
|
environments = "develop" # 运行环境,如开发环境 (develop)
|
||||||
|
logger_level = "debug" # 日志级别,可选 debug/info/warn/error 等
|
||||||
|
|
||||||
|
[sinks]
|
||||||
|
[sinks.kafka] # Kafka 接收器配置
|
||||||
|
enabled = false # 是否启用 Kafka 接收器,默认禁用
|
||||||
|
bootstrap_servers = "localhost:9092" # Kafka 服务器地址
|
||||||
|
topic = "logs" # Kafka 主题名称
|
||||||
|
batch_size = 100 # 批处理大小,每次发送的消息数量
|
||||||
|
batch_timeout_ms = 1000 # 批处理超时时间,单位为毫秒
|
||||||
|
|
||||||
|
[sinks.webhook] # Webhook 接收器配置
|
||||||
|
enabled = false # 是否启用 Webhook 接收器
|
||||||
|
endpoint = "http://localhost:8080/webhook" # Webhook 接收地址
|
||||||
|
auth_token = "" # 认证令牌
|
||||||
|
batch_size = 100 # 批处理大小
|
||||||
|
batch_timeout_ms = 1000 # 批处理超时时间,单位为毫秒
|
||||||
|
|
||||||
|
[sinks.file] # 文件接收器配置
|
||||||
|
enabled = true # 是否启用文件接收器
|
||||||
|
path = "/Users/qun/Documents/rust/rustfs/s3-rustfs/logs/app.log" # 日志文件路径
|
||||||
|
batch_size = 10 # 批处理大小
|
||||||
|
batch_timeout_ms = 1000 # 批处理超时时间,单位为毫秒
|
||||||
|
|
||||||
|
[logger] # 日志器配置
|
||||||
|
queue_capacity = 10 # 日志队列容量,表示可以缓存的日志条数
|
||||||
26
deploy/config/rustfs-zh.env
Normal file
26
deploy/config/rustfs-zh.env
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# RustFS 管理员用户名
|
||||||
|
RUSTFS_ROOT_USER=rustfsadmin
|
||||||
|
# RustFS 管理员密码
|
||||||
|
RUSTFS_ROOT_PASSWORD=rustfsadmin
|
||||||
|
|
||||||
|
# 数据卷配置示例路径:deploy/data/rustfs.env
|
||||||
|
# RustFS 数据卷存储路径,支持多卷配置,vol1 到 vol4
|
||||||
|
RUSTFS_VOLUMES="./deploy/deploy/vol{1...4}"
|
||||||
|
# RustFS 服务启动参数,指定监听地址和端口
|
||||||
|
RUSTFS_OPTS="--address 0.0.0.0:9000"
|
||||||
|
# RustFS 服务监听地址和端口
|
||||||
|
RUSTFS_ADDRESS="0.0.0.0:9000"
|
||||||
|
# 是否启用 RustFS 控制台功能
|
||||||
|
RUSTFS_CONSOLE_ENABLE=true
|
||||||
|
# RustFS 控制台监听地址和端口
|
||||||
|
RUSTFS_CONSOLE_ADDRESS="0.0.0.0:9002"
|
||||||
|
# RustFS 服务端点地址,用于客户端访问
|
||||||
|
RUSTFS_SERVER_ENDPOINT="http://127.0.0.1:9000"
|
||||||
|
# RustFS 服务域名配置
|
||||||
|
RUSTFS_SERVER_DOMAINS=127.0.0.1:9002
|
||||||
|
# RustFS 许可证内容
|
||||||
|
RUSTFS_LICENSE="license content"
|
||||||
|
# 可观测性配置文件路径:deploy/config/obs.example.toml
|
||||||
|
RUSTFS_OBS_CONFIG=/etc/default/obs.toml
|
||||||
|
# TLS 证书目录路径:deploy/certs
|
||||||
|
RUSTFS_TLS_PATH=/etc/default/tls
|
||||||
26
deploy/config/rustfs.env
Normal file
26
deploy/config/rustfs.env
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# RustFS administrator username
|
||||||
|
RUSTFS_ROOT_USER=rustfsadmin
|
||||||
|
# RustFS administrator password
|
||||||
|
RUSTFS_ROOT_PASSWORD=rustfsadmin
|
||||||
|
|
||||||
|
# Data volume configuration example path: deploy/data/rustfs.env
|
||||||
|
# RustFS data volume storage paths, supports multiple volumes from vol1 to vol4
|
||||||
|
RUSTFS_VOLUMES="./deploy/deploy/vol{1...4}"
|
||||||
|
# RustFS service startup parameters, specifying listen address and port
|
||||||
|
RUSTFS_OPTS="--address 0.0.0.0:9000"
|
||||||
|
# RustFS service listen address and port
|
||||||
|
RUSTFS_ADDRESS="0.0.0.0:9000"
|
||||||
|
# Enable RustFS console functionality
|
||||||
|
RUSTFS_CONSOLE_ENABLE=true
|
||||||
|
# RustFS console listen address and port
|
||||||
|
RUSTFS_CONSOLE_ADDRESS="0.0.0.0:9002"
|
||||||
|
# RustFS service endpoint for client access
|
||||||
|
RUSTFS_SERVER_ENDPOINT="http://127.0.0.1:9000"
|
||||||
|
# RustFS service domain configuration
|
||||||
|
RUSTFS_SERVER_DOMAINS=127.0.0.1:9002
|
||||||
|
# RustFS license content
|
||||||
|
RUSTFS_LICENSE="license content"
|
||||||
|
# Observability configuration file path: deploy/config/obs.example.toml
|
||||||
|
RUSTFS_OBS_CONFIG=/etc/default/obs.toml
|
||||||
|
# TLS certificates directory path: deploy/certs
|
||||||
|
RUSTFS_TLS_PATH=/etc/default/tls
|
||||||
1
deploy/data/README.md
Normal file
1
deploy/data/README.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# Data Volumes
|
||||||
1
deploy/logs/README.md
Normal file
1
deploy/logs/README.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# RustFS Logs
|
||||||
30
rustfs/README.md
Normal file
30
rustfs/README.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
rustfs/
|
||||||
|
├── Cargo.toml
|
||||||
|
├── src/
|
||||||
|
│ ├── main.rs # 主入口
|
||||||
|
│ ├── admin/
|
||||||
|
│ │ └── mod.rs # 管理接口
|
||||||
|
│ ├── auth/
|
||||||
|
│ │ └── mod.rs # 认证模块
|
||||||
|
│ ├── config/
|
||||||
|
│ │ ├── mod.rs # 配置模块
|
||||||
|
│ │ └── options.rs # 命令行参数
|
||||||
|
│ ├── console/
|
||||||
|
│ │ ├── mod.rs # 控制台模块
|
||||||
|
│ │ └── server.rs # 控制台服务器
|
||||||
|
│ ├── grpc/
|
||||||
|
│ │ └── mod.rs # gRPC 服务
|
||||||
|
│ ├── license/
|
||||||
|
│ │ └── mod.rs # 许可证管理
|
||||||
|
│ ├── logging/
|
||||||
|
│ │ └── mod.rs # 日志管理
|
||||||
|
│ ├── server/
|
||||||
|
│ │ ├── mod.rs # 服务器实现
|
||||||
|
│ │ ├── connection.rs # 连接处理
|
||||||
|
│ │ ├── service.rs # 服务实现
|
||||||
|
│ │ └── state.rs # 状态管理
|
||||||
|
│ ├── storage/
|
||||||
|
│ │ ├── mod.rs # 存储模块
|
||||||
|
│ │ └── fs.rs # 文件系统实现
|
||||||
|
│ └── utils/
|
||||||
|
│ └── mod.rs # 工具函数
|
||||||
Reference in New Issue
Block a user