Compare commits

...

1 Commits

Author SHA1 Message Date
hector e0b548fff0 fix(docker): switch docker-compose-simple.yml to single-disk mode and /health/ready (#9848)
* fix(docker): switch docker-compose-simple.yml to single-disk mode and /health/ready

- Use single-node single-disk layout (RUSTFS_VOLUMES=/data with a single rustfs_data volume) so docker compose up works out of the box without triggering same-device strict disk topology errors
- Switch healthcheck to /health/ready on port 9000 with --connect-timeout 3 --max-time 5 (decoupled from console toggle)
- Pin volume-permission-helper to alpine:3.24 with network_mode: none and skip redundant recursive chown -R when ownership is already 10001:10001
- Allow overriding S3/Console host ports and credentials via env vars, and configure ulimits.nofile=65535

Signed-off-by: xiaomage <jhma@rustfs.com>

* fix(docker): align RUSTFS_OBS_LOG_DIRECTORY to /logs in docker-compose-simple.yml

Signed-off-by: xiaomage <jhma@rustfs.com>

---------

Signed-off-by: xiaomage <jhma@rustfs.com>
2026-12-02 11:21:56 +08:00
+32 -36
View File
@@ -13,7 +13,7 @@
# limitations under the License.
services:
# RustFS main service
# RustFS single-node single-disk (SNSD) service
rustfs:
image: rustfs/rustfs:latest
container_name: rustfs-server
@@ -23,31 +23,29 @@ services:
security_opt:
- "no-new-privileges:true"
ports:
- "9000:9000" # S3 API port
- "9001:9001" # Console port
- "${RUSTFS_S3_PORT:-9000}:9000" # S3 API port
- "${RUSTFS_CONSOLE_PORT:-9001}:9001" # Console port
environment:
- RUSTFS_VOLUMES=/data/rustfs{0...3}
- RUSTFS_VOLUMES=/data
- RUSTFS_ADDRESS=0.0.0.0:9000
- RUSTFS_CONSOLE_ADDRESS=0.0.0.0:9001
- RUSTFS_CONSOLE_ENABLE=true
- RUSTFS_CONSOLE_CORS_ALLOWED_ORIGINS=*
- RUSTFS_ACCESS_KEY=rustfsadmin # CHANGEME
- RUSTFS_SECRET_KEY=rustfsadmin # CHANGEME
- RUSTFS_ACCESS_KEY=${RUSTFS_ACCESS_KEY:-rustfsadmin} # CHANGEME
- RUSTFS_SECRET_KEY=${RUSTFS_SECRET_KEY:-rustfsadmin} # CHANGEME
- RUSTFS_OBS_LOGGER_LEVEL=info
- RUSTFS_OBS_LOG_DIRECTORY=/app/logs
- RUSTFS_OBS_LOG_DIRECTORY=/logs
# Optional TLS:
# - mount your cert directory to /opt/tls
# - set RUSTFS_TLS_PATH=/opt/tls
# - when TLS is enabled, health checks automatically switch to HTTPS
# Keep strict disk topology checks enabled by default.
# For local testing only, set `RUSTFS_UNSAFE_BYPASS_DISK_CHECK=true` explicitly.
- RUSTFS_UNSAFE_BYPASS_DISK_CHECK=${RUSTFS_UNSAFE_BYPASS_DISK_CHECK:-false}
volumes:
- rustfs_data_0:/data/rustfs0
- rustfs_data_1:/data/rustfs1
- rustfs_data_2:/data/rustfs2
- rustfs_data_3:/data/rustfs3
- logs:/app/logs
- rustfs_data:/data
- logs:/logs
ulimits:
nofile:
soft: 65535
hard: 65535
networks:
- rustfs-network
restart: unless-stopped
@@ -63,21 +61,21 @@ services:
test:
[
"CMD",
"sh", "-ec",
"host=\"$${RUSTFS_HEALTHCHECK_HOST:-127.0.0.1}\"; scheme=\"http\"; set -- -fsS; \
"sh",
"-ec",
"host=\"$${RUSTFS_HEALTHCHECK_HOST:-127.0.0.1}\"; scheme=\"http\"; set -- -fsS --connect-timeout 3 --max-time 5; \
if [ -n \"$${RUSTFS_TLS_PATH:-}\" ]; then \
scheme=\"https\"; \
ca_path=\"$${RUSTFS_HEALTHCHECK_CA:-}\"; \
if [ -z \"$${ca_path}\" ] && [ -f /opt/tls/ca.crt ]; then ca_path=/opt/tls/ca.crt; fi; \
case \"$${host}\" in 127.0.0.1|localhost) strict_host=false ;; *) strict_host=true ;; esac; \
if [ \"$${strict_host}\" = true ] && [ -n \"$${ca_path}\" ]; then \
set -- \"$${@}\" --cacert \"$${ca_path}\" --resolve \"$${host}:9000:127.0.0.1\" --resolve \"$${host}:9001:127.0.0.1\"; \
set -- \"$${@}\" --cacert \"$${ca_path}\" --resolve \"$${host}:9000:127.0.0.1\"; \
else \
set -- \"$${@}\" -k; \
fi; \
fi; \
curl \"$${@}\" \"$${scheme}://$${host}:9000/health\" && \
curl \"$${@}\" \"$${scheme}://$${host}:9001/rustfs/console/health\""
curl \"$${@}\" \"$${scheme}://$${host}:9000/health/ready\""
]
interval: 30s
timeout: 10s
@@ -86,30 +84,28 @@ services:
# RustFS volume permissions fixer service
volume-permission-helper:
image: alpine
image: alpine:3.24
network_mode: none
volumes:
- rustfs_data_0:/data/rustfs0
- rustfs_data_1:/data/rustfs1
- rustfs_data_2:/data/rustfs2
- rustfs_data_3:/data/rustfs3
- logs:/app/logs
- rustfs_data:/data
- logs:/logs
command: >
sh -c "
chown -R 10001:10001 /data/rustfs0 /data/rustfs1 /data/rustfs2 /data/rustfs3 /app/logs &&
echo 'Volume Permissions fixed' &&
exit 0
"
sh -ec '
for dir in /data /logs; do
if [ "$$(stat -c %u:%g "$$dir")" != "10001:10001" ]; then
chown -R 10001:10001 "$$dir"
fi
done
echo "Volume permissions ready"
'
# Permission baseline:
# - default RustFS runtime user is 10001:10001
# - alternatively, run rustfs service with host-matched `user: \"<uid>:<gid>\"`
# - alternatively, run rustfs service with host-matched `user: "<uid>:<gid>"`
restart: "no"
networks:
rustfs-network:
volumes:
rustfs_data_0:
rustfs_data_1:
rustfs_data_2:
rustfs_data_3:
rustfs_data:
logs: