mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-26 05:56:50 +00:00
improve code for dockerfile
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
[observability]
|
[observability]
|
||||||
endpoint = "http://localhost:4317" # Default is "http://localhost:4317" if not specified
|
endpoint = "http://localhost:4317" # Default is "http://localhost:4317" if not specified
|
||||||
use_stdout = true
|
use_stdout = false # Output with stdout, true output, false no output
|
||||||
sample_ratio = 2.0
|
sample_ratio = 2.0
|
||||||
meter_interval = 30
|
meter_interval = 30
|
||||||
service_name = "rustfs"
|
service_name = "rustfs"
|
||||||
service_version = "0.1.0"
|
service_version = "0.1.0"
|
||||||
environments = "develop"
|
environments = "production"
|
||||||
logger_level = "info"
|
logger_level = "info"
|
||||||
|
|
||||||
[sinks]
|
[sinks]
|
||||||
@@ -25,7 +25,7 @@ batch_timeout_ms = 1000 # Default is 100ms if not specified
|
|||||||
|
|
||||||
[sinks.file]
|
[sinks.file]
|
||||||
enabled = true
|
enabled = true
|
||||||
path = "/Users/qun/Documents/rust/rustfs/s3-rustfs/logs/app.log"
|
path = "/root/data/logs/app.log"
|
||||||
batch_size = 10
|
batch_size = 10
|
||||||
batch_timeout_ms = 1000 # Default is 8192 bytes if not specified
|
batch_timeout_ms = 1000 # Default is 8192 bytes if not specified
|
||||||
|
|
||||||
|
|||||||
+1
-3
@@ -3,12 +3,10 @@ FROM alpine:latest
|
|||||||
# RUN apk add --no-cache <package-name>
|
# RUN apk add --no-cache <package-name>
|
||||||
# 如果 rustfs 有依赖,可以在这里添加,例如:
|
# 如果 rustfs 有依赖,可以在这里添加,例如:
|
||||||
# RUN apk add --no-cache openssl
|
# RUN apk add --no-cache openssl
|
||||||
|
# RUN apk add --no-cache bash # 安装 Bash
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# 创建与 RUSTFS_VOLUMES 一致的目录
|
|
||||||
# RUN mkdir -p /root/data/target/volume/test1 /root/data/target/volume/test2 /root/data/target/volume/test3 /root/data/target/volume/test4
|
|
||||||
|
|
||||||
COPY ./target/x86_64-unknown-linux-musl/release/rustfs /app/rustfs
|
COPY ./target/x86_64-unknown-linux-musl/release/rustfs /app/rustfs
|
||||||
|
|
||||||
RUN chmod +x /app/rustfs
|
RUN chmod +x /app/rustfs
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ services:
|
|||||||
dockerfile: Dockerfile.obs
|
dockerfile: Dockerfile.obs
|
||||||
container_name: node1
|
container_name: node1
|
||||||
environment:
|
environment:
|
||||||
- RUSTFS_VOLUMES=http://node{1...4}:9000/root/data/target/volume/test{1...4}
|
- RUSTFS_VOLUMES=/root/data/target/volume/test{1...4}
|
||||||
- RUSTFS_ADDRESS=0.0.0.0:9000
|
- RUSTFS_ADDRESS=0.0.0.0:9000
|
||||||
- RUSTFS_CONSOLE_ENABLE=true
|
- RUSTFS_CONSOLE_ENABLE=true
|
||||||
- RUSTFS_CONSOLE_ADDRESS=0.0.0.0:9002
|
- RUSTFS_CONSOLE_ADDRESS=0.0.0.0:9002
|
||||||
@@ -83,7 +83,7 @@ services:
|
|||||||
dockerfile: Dockerfile.obs
|
dockerfile: Dockerfile.obs
|
||||||
container_name: node2
|
container_name: node2
|
||||||
environment:
|
environment:
|
||||||
- RUSTFS_VOLUMES=http://node{1...4}:9000/root/data/target/volume/test{1...4}
|
- RUSTFS_VOLUMES=/root/data/target/volume/test{1...4}
|
||||||
- RUSTFS_ADDRESS=0.0.0.0:9000
|
- RUSTFS_ADDRESS=0.0.0.0:9000
|
||||||
- RUSTFS_CONSOLE_ENABLE=true
|
- RUSTFS_CONSOLE_ENABLE=true
|
||||||
- RUSTFS_CONSOLE_ADDRESS=0.0.0.0:9002
|
- RUSTFS_CONSOLE_ADDRESS=0.0.0.0:9002
|
||||||
@@ -104,7 +104,7 @@ services:
|
|||||||
dockerfile: Dockerfile.obs
|
dockerfile: Dockerfile.obs
|
||||||
container_name: node3
|
container_name: node3
|
||||||
environment:
|
environment:
|
||||||
- RUSTFS_VOLUMES=http://node{1...4}:9000/root/data/target/volume/test{1...4}
|
- RUSTFS_VOLUMES=/root/data/target/volume/test{1...4}
|
||||||
- RUSTFS_ADDRESS=0.0.0.0:9000
|
- RUSTFS_ADDRESS=0.0.0.0:9000
|
||||||
- RUSTFS_CONSOLE_ENABLE=true
|
- RUSTFS_CONSOLE_ENABLE=true
|
||||||
- RUSTFS_CONSOLE_ADDRESS=0.0.0.0:9002
|
- RUSTFS_CONSOLE_ADDRESS=0.0.0.0:9002
|
||||||
@@ -125,7 +125,7 @@ services:
|
|||||||
dockerfile: Dockerfile.obs
|
dockerfile: Dockerfile.obs
|
||||||
container_name: node4
|
container_name: node4
|
||||||
environment:
|
environment:
|
||||||
- RUSTFS_VOLUMES=http://node{1...4}:9000/root/data/target/volume/test{1...4}
|
- RUSTFS_VOLUMES=/root/data/target/volume/test{1...4}
|
||||||
- RUSTFS_ADDRESS=0.0.0.0:9000
|
- RUSTFS_ADDRESS=0.0.0.0:9000
|
||||||
- RUSTFS_CONSOLE_ENABLE=true
|
- RUSTFS_CONSOLE_ENABLE=true
|
||||||
- RUSTFS_CONSOLE_ADDRESS=0.0.0.0:9002
|
- RUSTFS_CONSOLE_ADDRESS=0.0.0.0:9002
|
||||||
|
|||||||
@@ -608,7 +608,7 @@ impl ECStore {
|
|||||||
|
|
||||||
let mut ress = Vec::new();
|
let mut ress = Vec::new();
|
||||||
|
|
||||||
// join_all结果跟输入顺序一致
|
// join_all 结果跟输入顺序一致
|
||||||
for (i, res) in results.into_iter().enumerate() {
|
for (i, res) in results.into_iter().enumerate() {
|
||||||
let index = i;
|
let index = i;
|
||||||
|
|
||||||
@@ -1010,7 +1010,7 @@ pub async fn all_local_disk() -> Vec<DiskStore> {
|
|||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
// init_local_disks 初始化本地磁盘,server启动前必须初始化成功
|
// init_local_disks 初始化本地磁盘,server 启动前必须初始化成功
|
||||||
pub async fn init_local_disks(endpoint_pools: EndpointServerPools) -> Result<()> {
|
pub async fn init_local_disks(endpoint_pools: EndpointServerPools) -> Result<()> {
|
||||||
let opt = &DiskOption {
|
let opt = &DiskOption {
|
||||||
cleanup: true,
|
cleanup: true,
|
||||||
@@ -1279,7 +1279,7 @@ impl StorageAPI for ECStore {
|
|||||||
|
|
||||||
// TODO: replication opts.srdelete_op
|
// TODO: replication opts.srdelete_op
|
||||||
|
|
||||||
// 删除meta
|
// 删除 meta
|
||||||
self.delete_all(RUSTFS_META_BUCKET, format!("{}/{}", BUCKET_META_PREFIX, bucket).as_str())
|
self.delete_all(RUSTFS_META_BUCKET, format!("{}/{}", BUCKET_META_PREFIX, bucket).as_str())
|
||||||
.await?;
|
.await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -1483,7 +1483,7 @@ impl StorageAPI for ECStore {
|
|||||||
// results.push(jh.await.unwrap());
|
// results.push(jh.await.unwrap());
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// 记录pool Index 对应的objects pool_idx -> objects idx
|
// 记录 pool Index 对应的 objects pool_idx -> objects idx
|
||||||
let mut pool_obj_idx_map = HashMap::new();
|
let mut pool_obj_idx_map = HashMap::new();
|
||||||
let mut orig_index_map = HashMap::new();
|
let mut orig_index_map = HashMap::new();
|
||||||
|
|
||||||
@@ -1533,9 +1533,9 @@ impl StorageAPI for ECStore {
|
|||||||
|
|
||||||
if !pool_obj_idx_map.is_empty() {
|
if !pool_obj_idx_map.is_empty() {
|
||||||
for (i, sets) in self.pools.iter().enumerate() {
|
for (i, sets) in self.pools.iter().enumerate() {
|
||||||
// 取pool idx 对应的 objects index
|
// 取 pool idx 对应的 objects index
|
||||||
if let Some(objs) = pool_obj_idx_map.get(&i) {
|
if let Some(objs) = pool_obj_idx_map.get(&i) {
|
||||||
// 取对应obj,理论上不会none
|
// 取对应 obj,理论上不会 none
|
||||||
// let objs: Vec<ObjectToDelete> = obj_idxs.iter().filter_map(|&idx| objects.get(idx).cloned()).collect();
|
// let objs: Vec<ObjectToDelete> = obj_idxs.iter().filter_map(|&idx| objects.get(idx).cloned()).collect();
|
||||||
|
|
||||||
if objs.is_empty() {
|
if objs.is_empty() {
|
||||||
@@ -1544,10 +1544,10 @@ impl StorageAPI for ECStore {
|
|||||||
|
|
||||||
let (pdel_objs, perrs) = sets.delete_objects(bucket, objs.clone(), opts.clone()).await?;
|
let (pdel_objs, perrs) = sets.delete_objects(bucket, objs.clone(), opts.clone()).await?;
|
||||||
|
|
||||||
// 同时存入不可能为none
|
// 同时存入不可能为 none
|
||||||
let org_indexes = orig_index_map.get(&i).unwrap();
|
let org_indexes = orig_index_map.get(&i).unwrap();
|
||||||
|
|
||||||
// perrs的顺序理论上跟obj_idxs顺序一致
|
// perrs 的顺序理论上跟 obj_idxs 顺序一致
|
||||||
for (i, err) in perrs.into_iter().enumerate() {
|
for (i, err) in perrs.into_iter().enumerate() {
|
||||||
let obj_idx = org_indexes[i];
|
let obj_idx = org_indexes[i];
|
||||||
|
|
||||||
@@ -1580,7 +1580,7 @@ impl StorageAPI for ECStore {
|
|||||||
let object = utils::path::encode_dir_object(object);
|
let object = utils::path::encode_dir_object(object);
|
||||||
let object = object.as_str();
|
let object = object.as_str();
|
||||||
|
|
||||||
// 查询在哪个pool
|
// 查询在哪个 pool
|
||||||
let (mut pinfo, errs) = self
|
let (mut pinfo, errs) = self
|
||||||
.get_pool_info_existing_with_opts(bucket, object, &opts)
|
.get_pool_info_existing_with_opts(bucket, object, &opts)
|
||||||
.await
|
.await
|
||||||
|
|||||||
Reference in New Issue
Block a user