Commit acadfc5a authored by Andreas Düren's avatar Andreas Düren
Browse files

Fix NGINX configuration to use writable directories

parent 47cfcfaf
Loading
Loading
Loading
Loading
+57 −51
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
set -eu

# 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"
find /app/code -type d -maxdepth 3 -not -path "*/node_modules/*" -not -path "*/\.*" | sort
@@ -115,10 +115,24 @@ fi
# Set up NGINX to serve the web apps and proxy to the Museum server
echo "==> Setting up NGINX for web apps and API"

# Create NGINX configuration
mkdir -p /etc/nginx/sites-available /etc/nginx/sites-enabled
# Create a custom NGINX configuration in the writable data directory
cat > /app/data/nginx/ente.conf <<EOT
worker_processes 1;
error_log stderr;
daemon off;
pid /app/data/nginx/nginx.pid;

events {
    worker_connections 1024;
}

http {
    include /etc/nginx/mime.types;
    default_type application/octet-stream;
    access_log /dev/stdout combined;
    sendfile on;
    keepalive_timeout 65;
    
cat > /etc/nginx/sites-available/ente <<EOT
    server {
        listen 8080;
        
@@ -156,18 +170,10 @@ server {
            proxy_cache_bypass \$http_upgrade;
        }
    }
}
EOT

# Enable the site
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
echo "==> Custom NGINX configuration created at /app/data/nginx/ente.conf"

# Looking for Museum (Go server component)
echo "==> Looking for Museum (Go server component)"
@@ -345,6 +351,6 @@ EOT
    fi
fi

# Serve the static web apps in the foreground
echo "==> Running NGINX in the foreground"
exec nginx -g "daemon off;" 
 No newline at end of file
# Serve the static web apps in the foreground using our custom nginx config
echo "==> Running NGINX in the foreground with custom configuration"
exec nginx -c /app/data/nginx/ente.conf 
 No newline at end of file