[BUG] Docker setup architecture causes deployment issues on modern platforms
Hello! I've been working on deploying HeadlessX to a modern PaaS platform (Coolify) and encountered several architectural issues in the Dockerfile that make deployment difficult and unreliable.
While the application itself works great, the current container setup conflicts with platforms that use an external reverse proxy.
Here are the specific problems:
1. Redundant Internal Nginx Proxy
The Dockerfile installs, configures, and runs its own Nginx instance. This is an anti-pattern for containers that are meant to be deployed behind a platform's managed reverse proxy (like Traefik, Caddy, or Nginx Ingress).
- Problem: It creates an unnecessary layer of complexity and a point of failure. In our case, the internal
service nginx startcommand failed within the deployment environment, even though the Node.js app started correctly. - Impact: This prevents the container from becoming healthy and makes it incompatible with many standard deployment workflows.
2. Incorrect Healthcheck Target
The HEALTHCHECK command in the Dockerfile targets the internal Nginx on port 80:
CMD curl -f http://localhost/api/health || exit 1
- Problem: This checks the health of the proxy, not the actual Node.js application running on port 3000.
- Impact: If the Node.js application is running fine but the internal Nginx fails (as it did in our case), the container will be incorrectly reported as "unhealthy" and killed by the orchestrator. The healthcheck should target the application directly.
Suggested Solution
To resolve these issues and make HeadlessX much easier for the community to deploy, I recommend the following changes to the Dockerfile:
- Remove Nginx Entirely: Remove the
nginxpackage from theapt-get installcommand and delete theCOPY nginx/headlessx.conf ...line. - Update the Healthcheck: Change the
HEALTHCHECKcommand to target the Node.js application directly on its port:HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \ CMD curl -f http://localhost:3000/api/health || exit 1 - Simplify the Startup Command: Replace the complex
/start.shscript with a direct, secure command at the end of the Dockerfile:USER headlessx CMD ["node", "src/server.js"]
These changes would align the project with standard containerization practices, make it significantly more robust, and dramatically improve the deployment experience for users on a wide range of platforms.
Thanks for this great project!
Hey, thanks so much for the detailed feedback! Really appreciate you taking the time to go through all of that. You're absolutely right about the Nginx proxy being redundant and the healthcheck issue. Makes total sense that this would cause problems with Coolify and other deployment platforms. I should have thought about how this would work with standard containerization practices from the start. I'm definitely going to simplify the Dockerfile like you suggested - getting rid of that internal Nginx layer, fixing the healthcheck to point directly at the Node app, and cleaning up that messy startup command. Should make HeadlessX way easier to deploy across different platforms. Thanks again for catching all of this. I'll get these changes pushed out soon!
🎉 Fixed and merged in commit 2da51f6!
Hey @NicolasFluyoCeo! Just pushed the fix - removed the internal Nginx completely, updated the healthcheck to target the Node.js app directly on port 3000, and simplified the startup process like you suggested.
The Docker setup is now beautifully streamlined with no more Nginx complexity and clean health checks. The Dockerfile is much cleaner now and should work great with Coolify and other modern platforms.
Really appreciate you taking the time to spot this issue and provide such clear solutions. Your contribution made this so much better and is going to help a lot of people deploy more easily!
Would love to hear how it goes when you test it. Thanks for helping make the project better! 🙌✨
Marking as resolved. Happy coding! 🚀