Fix NGINX configuration to use writable directories
This commit is contained in:
parent
47cfcfaf24
commit
acadfc5af4
42
start.sh
42
start.sh
@ -3,7 +3,7 @@
|
|||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
# Create necessary directories
|
# Create necessary directories
|
||||||
mkdir -p /app/data/config /app/data/storage
|
mkdir -p /app/data/config /app/data/storage /app/data/nginx
|
||||||
|
|
||||||
echo "==> DEBUG: Full repository structure at /app/code"
|
echo "==> DEBUG: Full repository structure at /app/code"
|
||||||
find /app/code -type d -maxdepth 3 -not -path "*/node_modules/*" -not -path "*/\.*" | sort
|
find /app/code -type d -maxdepth 3 -not -path "*/node_modules/*" -not -path "*/\.*" | sort
|
||||||
@ -115,11 +115,25 @@ fi
|
|||||||
# Set up NGINX to serve the web apps and proxy to the Museum server
|
# Set up NGINX to serve the web apps and proxy to the Museum server
|
||||||
echo "==> Setting up NGINX for web apps and API"
|
echo "==> Setting up NGINX for web apps and API"
|
||||||
|
|
||||||
# Create NGINX configuration
|
# Create a custom NGINX configuration in the writable data directory
|
||||||
mkdir -p /etc/nginx/sites-available /etc/nginx/sites-enabled
|
cat > /app/data/nginx/ente.conf <<EOT
|
||||||
|
worker_processes 1;
|
||||||
|
error_log stderr;
|
||||||
|
daemon off;
|
||||||
|
pid /app/data/nginx/nginx.pid;
|
||||||
|
|
||||||
cat > /etc/nginx/sites-available/ente <<EOT
|
events {
|
||||||
server {
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
access_log /dev/stdout combined;
|
||||||
|
sendfile on;
|
||||||
|
keepalive_timeout 65;
|
||||||
|
|
||||||
|
server {
|
||||||
listen 8080;
|
listen 8080;
|
||||||
|
|
||||||
# Photos app - root path
|
# Photos app - root path
|
||||||
@ -155,19 +169,11 @@ server {
|
|||||||
proxy_set_header Host \$host;
|
proxy_set_header Host \$host;
|
||||||
proxy_cache_bypass \$http_upgrade;
|
proxy_cache_bypass \$http_upgrade;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
# Enable the site
|
echo "==> Custom NGINX configuration created at /app/data/nginx/ente.conf"
|
||||||
ln -sf /etc/nginx/sites-available/ente /etc/nginx/sites-enabled/ente
|
|
||||||
|
|
||||||
# Start NGINX
|
|
||||||
echo "==> Starting NGINX"
|
|
||||||
if command -v service &> /dev/null; then
|
|
||||||
service nginx restart || echo "Failed to restart nginx with service command"
|
|
||||||
else
|
|
||||||
/usr/sbin/nginx -s reload || /usr/sbin/nginx || echo "Failed to start nginx"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Looking for Museum (Go server component)
|
# Looking for Museum (Go server component)
|
||||||
echo "==> Looking for Museum (Go server component)"
|
echo "==> Looking for Museum (Go server component)"
|
||||||
@ -345,6 +351,6 @@ EOT
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Serve the static web apps in the foreground
|
# Serve the static web apps in the foreground using our custom nginx config
|
||||||
echo "==> Running NGINX in the foreground"
|
echo "==> Running NGINX in the foreground with custom configuration"
|
||||||
exec nginx -g "daemon off;"
|
exec nginx -c /app/data/nginx/ente.conf
|
Loading…
x
Reference in New Issue
Block a user