mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-24 05:06:28 +00:00
enhancement logs output for container deployment (#1090)
This commit is contained in:
+2
-3
@@ -81,12 +81,11 @@ ENV RUSTFS_ADDRESS=":9000" \
|
|||||||
RUSTFS_CORS_ALLOWED_ORIGINS="*" \
|
RUSTFS_CORS_ALLOWED_ORIGINS="*" \
|
||||||
RUSTFS_CONSOLE_CORS_ALLOWED_ORIGINS="*" \
|
RUSTFS_CONSOLE_CORS_ALLOWED_ORIGINS="*" \
|
||||||
RUSTFS_VOLUMES="/data" \
|
RUSTFS_VOLUMES="/data" \
|
||||||
RUST_LOG="warn" \
|
RUST_LOG="warn"
|
||||||
RUSTFS_OBS_LOG_DIRECTORY="/logs"
|
|
||||||
|
|
||||||
EXPOSE 9000 9001
|
EXPOSE 9000 9001
|
||||||
|
|
||||||
VOLUME ["/data", "/logs"]
|
VOLUME ["/data"]
|
||||||
|
|
||||||
USER rustfs
|
USER rustfs
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -166,14 +166,13 @@ ENV RUSTFS_ADDRESS=":9000" \
|
|||||||
RUSTFS_CONSOLE_ENABLE="true" \
|
RUSTFS_CONSOLE_ENABLE="true" \
|
||||||
RUSTFS_VOLUMES="/data" \
|
RUSTFS_VOLUMES="/data" \
|
||||||
RUST_LOG="warn" \
|
RUST_LOG="warn" \
|
||||||
RUSTFS_OBS_LOG_DIRECTORY="/logs" \
|
|
||||||
RUSTFS_USERNAME="rustfs" \
|
RUSTFS_USERNAME="rustfs" \
|
||||||
RUSTFS_GROUPNAME="rustfs" \
|
RUSTFS_GROUPNAME="rustfs" \
|
||||||
RUSTFS_UID="1000" \
|
RUSTFS_UID="1000" \
|
||||||
RUSTFS_GID="1000"
|
RUSTFS_GID="1000"
|
||||||
|
|
||||||
EXPOSE 9000
|
EXPOSE 9000
|
||||||
VOLUME ["/data", "/logs"]
|
VOLUME ["/data"]
|
||||||
|
|
||||||
# Keep root here; entrypoint will drop privileges using chroot --userspec
|
# Keep root here; entrypoint will drop privileges using chroot --userspec
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|||||||
+1
-16
@@ -85,6 +85,7 @@ services:
|
|||||||
- RUSTFS_ACCESS_KEY=devadmin
|
- RUSTFS_ACCESS_KEY=devadmin
|
||||||
- RUSTFS_SECRET_KEY=devadmin
|
- RUSTFS_SECRET_KEY=devadmin
|
||||||
- RUSTFS_OBS_LOGGER_LEVEL=debug
|
- RUSTFS_OBS_LOGGER_LEVEL=debug
|
||||||
|
- RUSTFS_OBS_LOG_DIRECTORY=/logs
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app # Mount source code to /app for development
|
- .:/app # Mount source code to /app for development
|
||||||
- deploy/data/dev:/data
|
- deploy/data/dev:/data
|
||||||
@@ -180,20 +181,6 @@ services:
|
|||||||
profiles:
|
profiles:
|
||||||
- observability
|
- observability
|
||||||
|
|
||||||
# Redis for caching (optional)
|
|
||||||
redis:
|
|
||||||
image: redis:7-alpine
|
|
||||||
container_name: redis
|
|
||||||
ports:
|
|
||||||
- "6379:6379"
|
|
||||||
volumes:
|
|
||||||
- redis_data:/data
|
|
||||||
networks:
|
|
||||||
- rustfs-network
|
|
||||||
restart: unless-stopped
|
|
||||||
profiles:
|
|
||||||
- cache
|
|
||||||
|
|
||||||
# NGINX reverse proxy (optional)
|
# NGINX reverse proxy (optional)
|
||||||
nginx:
|
nginx:
|
||||||
security_opt:
|
security_opt:
|
||||||
@@ -241,7 +228,5 @@ volumes:
|
|||||||
driver: local
|
driver: local
|
||||||
grafana_data:
|
grafana_data:
|
||||||
driver: local
|
driver: local
|
||||||
redis_data:
|
|
||||||
driver: local
|
|
||||||
logs:
|
logs:
|
||||||
driver: local
|
driver: local
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ x-node-template: &node-template
|
|||||||
- RUSTFS_ACCESS_KEY=rustfsadmin
|
- RUSTFS_ACCESS_KEY=rustfsadmin
|
||||||
- RUSTFS_SECRET_KEY=rustfsadmin
|
- RUSTFS_SECRET_KEY=rustfsadmin
|
||||||
- RUSTFS_CMD=rustfs
|
- RUSTFS_CMD=rustfs
|
||||||
|
- RUSTFS_OBS_LOG_DIRECTORY=/logs
|
||||||
command: [ "sh", "-c", "sleep 3 && rustfs" ]
|
command: [ "sh", "-c", "sleep 3 && rustfs" ]
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test:
|
test:
|
||||||
|
|||||||
+14
-1
@@ -55,7 +55,20 @@ process_data_volumes() {
|
|||||||
|
|
||||||
# 3) Process log directory (separate from data volumes)
|
# 3) Process log directory (separate from data volumes)
|
||||||
process_log_directory() {
|
process_log_directory() {
|
||||||
LOG_DIR="${RUSTFS_OBS_LOG_DIRECTORY:-/logs}"
|
# Output logs to stdout
|
||||||
|
if [ -z "$RUSTFS_OBS_LOG_DIRECTORY" ]; then
|
||||||
|
echo "OBS log directory not configured and logs outputs to stdout"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Output logs to remote endpoint
|
||||||
|
if [ "${RUSTFS_OBS_LOG_DIRECTORY}" != "${RUSTFS_OBS_LOG_DIRECTORY#*://}" ]; then
|
||||||
|
echo "Output logs to remote endpoint"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Outputs logs to local directory
|
||||||
|
LOG_DIR="${RUSTFS_OBS_LOG_DIRECTORY}"
|
||||||
|
|
||||||
echo "Initializing log directory: $LOG_DIR"
|
echo "Initializing log directory: $LOG_DIR"
|
||||||
if [ ! -d "$LOG_DIR" ]; then
|
if [ ! -d "$LOG_DIR" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user