diff --git a/rootfs/usr/local/bin/entrypoint.sh b/rootfs/usr/local/bin/entrypoint.sh index 76fb8db..c32995d 100755 --- a/rootfs/usr/local/bin/entrypoint.sh +++ b/rootfs/usr/local/bin/entrypoint.sh @@ -85,13 +85,14 @@ __run_message() { # rewrite variables ENV_PORTS="${ENV_PORTS//,/ }" ENV_PORTS="${ENV_PORTS//\/*/}" +SERVER_PORTS="${SERVER_PORTS//,/ }" WEB_SERVER_PORTS="${SERVICE_PORT//\/*/}" HEALTH_ENDPOINTS="${HEALTH_ENDPOINTS//,/ }" WEB_SERVER_PORTS="${WEB_SERVER_PORTS//\/*/}" WEB_SERVER_PORTS="${SERVICE_PORT//,/ } ${WEB_SERVER_PORTS//,/ }" ENV_PORTS="$(echo "$ENV_PORTS" | tr ' ' '\n' | sort -u | grep -v '^$' | tr '\n' ' ' | grep '^' || false)" WEB_SERVER_PORTS="$(echo "$WEB_SERVER_PORTS" | tr ' ' '\n' | sort -u | grep -v '^$' | tr '\n' ' ' | grep '^' || false)" -ENV_PORTS="$(echo "$WEB_SERVER_PORTS $ENV_PORTS $SERVER_PORTS" | tr ' ' '\n' | sort -u | grep -v '^$' | tr '\n' ' ' | grep '^' || false)" +ENV_PORTS="$(echo "$SERVER_PORTS" "$WEB_SERVER_PORTS" "$ENV_PORTS" "$SERVER_PORTS" | tr ' ' '\n' | sort -u | grep -v '^$' | tr '\n' ' ' | grep '^' || false)" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # variables based on env/files [ "$SERVICE_PORT" = "443" ] && SSL_ENABLED="true" @@ -112,21 +113,21 @@ DEFAULT_TEMPLATE_DIR="${DEFAULT_TEMPLATE_DIR:-/usr/local/share/template-files/de mkdir -p "/run" mkdir -p "/tmp" mkdir -p "/root" -mkdir -p "/var/log" +mkdir -p "/data/logs" mkdir -p "/run/init.d" mkdir -p "/config/secure" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # create required files -touch "/var/log/entrypoint.log" +touch "/data/logs/entrypoint.log" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # fix permissions chmod -f 777 "/run" chmod -f 777 "/tmp" chmod -f 700 "/root" -chmod -f 777 "/var/log" +chmod -f 777 "/data/logs" chmod -f 777 "/run/init.d" chmod -f 777 "/config/secure" -chmod -f 777 "/var/log/entrypoint.log" +chmod -f 777 "/data/logs/entrypoint.log" ################## END OF CONFIGURATION ##################### # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Create the backup dir diff --git a/rootfs/usr/local/etc/docker/functions/entrypoint.sh b/rootfs/usr/local/etc/docker/functions/entrypoint.sh index d92021b..14f2993 100644 --- a/rootfs/usr/local/etc/docker/functions/entrypoint.sh +++ b/rootfs/usr/local/etc/docker/functions/entrypoint.sh @@ -202,7 +202,7 @@ __cron() { eval "$command" sleep $interval [ -f "/run/cron/$cmd" ] || break - done |& tee /var/log/entrypoint.log + done |& tee /data/logs/entrypoint.log } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - __replace() { diff --git a/rootfs/usr/local/etc/docker/init.d/00-aria2c.sh b/rootfs/usr/local/etc/docker/init.d/00-aria2c.sh index cca9f38..e433dc3 100755 --- a/rootfs/usr/local/etc/docker/init.d/00-aria2c.sh +++ b/rootfs/usr/local/etc/docker/init.d/00-aria2c.sh @@ -43,9 +43,9 @@ __update_conf_files() { local port="${SERVICE_PORT:-${ARIA2RPCPORT:-8000}}" [ -d "$etc_dir" ] || mkdir -p "$etc_dir" [ -d "$data_dir" ] || mkdir -p "$data_dir" - [ -d "/var/log/aria2" ] || mkdir -p "/var/log/aria2" + [ -d "/data/logs/aria2" ] || mkdir -p "/data/logs/aria2" cp -Rf "$conf_dir/." "$etc_dir/" - ln -sf "/dev/stdout" "/var/log/aria2/aria2.log" + ln -sf "/dev/stdout" "/data/logs/aria2/aria2.log" ln -sf "$conf_dir/aria2.session" "$etc_dir/aria2.session" if [ -f "$etc_dir/aria-ng.config.js" ]; then rm -Rf "$get_config" diff --git a/rootfs/usr/local/etc/docker/init.d/zz-nginx.sh b/rootfs/usr/local/etc/docker/init.d/zz-nginx.sh index b2f7e64..7ae770c 100755 --- a/rootfs/usr/local/etc/docker/init.d/zz-nginx.sh +++ b/rootfs/usr/local/etc/docker/init.d/zz-nginx.sh @@ -45,7 +45,7 @@ __update_conf_files() { [ -d "$etc_dir" ] || mkdir -p "$etc_dir" [ -d "$conf_dir" ] && cp -Rf "$conf_dir/." "$etc_dir/" ln -sf "/dev/stderr" "var/log/nginx/nginx.log" - ln -sf "/dev/stdout" "/var/log/nginx/access.log" + ln -sf "/dev/stdout" "/data/logs/nginx/access.log" if [ "$SSL_ENABLED" = "true" ]; then __file_copy "$conf_dir/nginx.ssl.conf" "$etc_dir/nginx.conf" __file_copy "$conf_dir/vhosts.d/default.ssl.conf" "$etc_dir/vhosts.d/default.conf" diff --git a/rootfs/usr/local/share/template-files/config/aria2/aria2.conf b/rootfs/usr/local/share/template-files/config/aria2/aria2.conf index 306bb81..6afcdd7 100644 --- a/rootfs/usr/local/share/template-files/config/aria2/aria2.conf +++ b/rootfs/usr/local/share/template-files/config/aria2/aria2.conf @@ -1,6 +1,6 @@ # Default configuration for aria2 dir=/data/downloads/aria2 -log=/var/log/aria2/aria2.log +log=/data/logs/aria2/aria2.log input-file=/config/aria2/aria2.session save-session=/config/aria2/aria2.session enable-rpc=true diff --git a/rootfs/usr/local/share/template-files/config/nginx/nginx.conf b/rootfs/usr/local/share/template-files/config/nginx/nginx.conf index 4379ee3..369ab43 100644 --- a/rootfs/usr/local/share/template-files/config/nginx/nginx.conf +++ b/rootfs/usr/local/share/template-files/config/nginx/nginx.conf @@ -3,7 +3,7 @@ user root; worker_processes auto; daemon off; -error_log /var/log/nginx/nginx.log error; +error_log /data/logs/nginx/nginx.log error; pid /var/run/nginx.pid; events { @@ -16,7 +16,7 @@ http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; - access_log /var/log/nginx/access.log main; + access_log /data/logs/nginx/access.log main; sendfile on; keepalive_timeout 65; gzip on;