mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-07-01 07:37:24 +00:00
Merge pull request #4491 from addievo/fix-certbot-startup-time
fix: optimize certbot ownership script to reduce container startup time
This commit is contained in:
@ -23,6 +23,19 @@ chown -R "$PUID:$PGID" /etc/nginx/nginx
|
|||||||
chown -R "$PUID:$PGID" /etc/nginx/nginx.conf
|
chown -R "$PUID:$PGID" /etc/nginx/nginx.conf
|
||||||
chown -R "$PUID:$PGID" /etc/nginx/conf.d
|
chown -R "$PUID:$PGID" /etc/nginx/conf.d
|
||||||
|
|
||||||
# Prevents errors when installing python certbot plugins when non-root
|
# Certbot directories - optimized approach
|
||||||
chown "$PUID:$PGID" /opt/certbot /opt/certbot/bin
|
CERT_INIT_FLAG="/opt/certbot/.ownership_initialized"
|
||||||
find /opt/certbot/lib/python*/site-packages -not -user "$PUID" -execdir chown "$PUID:$PGID" {} \+
|
|
||||||
|
if [ ! -f "$CERT_INIT_FLAG" ]; then
|
||||||
|
# Prevents errors when installing python certbot plugins when non-root
|
||||||
|
chown "$PUID:$PGID" /opt/certbot /opt/certbot/bin
|
||||||
|
|
||||||
|
# Handle all site-packages directories efficiently
|
||||||
|
find /opt/certbot/lib -type d -name "site-packages" | while read -r SITE_PACKAGES_DIR; do
|
||||||
|
chown -R "$PUID:$PGID" "$SITE_PACKAGES_DIR"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Create a flag file to skip this step on subsequent runs
|
||||||
|
touch "$CERT_INIT_FLAG"
|
||||||
|
chown "$PUID:$PGID" "$CERT_INIT_FLAG"
|
||||||
|
fi
|
Reference in New Issue
Block a user