diff --git a/CloudronManifest.json b/CloudronManifest.json index ad642b5..d61e6f5 100644 --- a/CloudronManifest.json +++ b/CloudronManifest.json @@ -5,7 +5,7 @@ "description": "Open-source collaborative wiki and documentation platform. A modern alternative to Confluence and Notion with real-time collaboration, diagram support, and multilingual capabilities.", "tagline": "Collaborative wiki and documentation platform", "version": "1.0.0", - "healthCheckPath": "/api/health", + "healthCheckPath": "/", "httpPort": 3000, "addons": { "postgresql": {}, diff --git a/Dockerfile b/Dockerfile index 3df0145..8884aaa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,10 +22,11 @@ RUN mkdir -p /tmp/data /app/data && \ # Copy startup scripts COPY start.sh /app/code/ +COPY healthcheck.js /app/code/ COPY nginx.conf /etc/nginx/sites-available/default # Make scripts executable -RUN chmod +x /app/code/start.sh +RUN chmod +x /app/code/start.sh /app/code/healthcheck.js # Install supervisord and netcat for process management and connectivity checks RUN apt-get update && \ diff --git a/healthcheck.js b/healthcheck.js new file mode 100644 index 0000000..864d275 --- /dev/null +++ b/healthcheck.js @@ -0,0 +1,34 @@ +#!/usr/bin/env node + +const http = require('http'); + +// Simple health check that attempts to connect to the app +const options = { + hostname: 'localhost', + port: 3001, + path: '/', + method: 'GET', + timeout: 5000 +}; + +const req = http.request(options, (res) => { + console.log(`Health check: ${res.statusCode}`); + if (res.statusCode === 200) { + process.exit(0); + } else { + process.exit(1); + } +}); + +req.on('error', (err) => { + console.error('Health check failed:', err.message); + process.exit(1); +}); + +req.on('timeout', () => { + console.error('Health check timeout'); + req.abort(); + process.exit(1); +}); + +req.end(); \ No newline at end of file diff --git a/start.sh b/start.sh index 4942753..00888ce 100644 --- a/start.sh +++ b/start.sh @@ -55,10 +55,12 @@ if [ -n "${CLOUDRON_REDIS_URL}" ]; then export REDIS_PORT="${REDIS_PORT}" export REDIS_PASSWORD="${REDIS_PASSWORD}" - # Also export the full URL in case it's needed - export REDIS_URL="redis://:${REDIS_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/0" + # Also export the full URL in case it's needed - try different formats + export REDIS_URL="redis://:${REDIS_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}" + export REDIS_DB="0" echo "=> Redis configured: host=${REDIS_HOST}, port=${REDIS_PORT}" + echo "=> Final Redis URL: ${REDIS_URL}" else echo "=> Warning: Redis URL not provided" # Set dummy Redis URL to prevent validation errors