fix: resolve EADDRINUSE port conflict — Node.js now listens on internal port 4000
Nginx listens publicly on 2087/2083 and reverse-proxies to 127.0.0.1:4000. Previously both Nginx and Node.js were trying to bind port 2087 causing the nixpanel service to crash-loop. HOST changed to 127.0.0.1 so the API is not directly reachable from outside. Bumps version to 0.3.1.
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nixpanel/server",
|
||||
"version": "0.3.0",
|
||||
"version": "0.3.1",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ export async function buildApp() {
|
||||
|
||||
fastify.get('/api/health', async () => ({
|
||||
status: 'ok',
|
||||
version: '0.3.0',
|
||||
version: '0.3.1',
|
||||
timestamp: new Date().toISOString(),
|
||||
}))
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ export const config = {
|
||||
|
||||
server: {
|
||||
host: optional('HOST', '0.0.0.0'),
|
||||
nixserverPort: parseInt(optional('NIXSERVER_PORT', '2087'), 10),
|
||||
nixclientPort: parseInt(optional('NIXCLIENT_PORT', '2083'), 10),
|
||||
nixserverPort: parseInt(optional('NIXSERVER_PORT', '4000'), 10),
|
||||
nixclientPort: parseInt(optional('NIXCLIENT_PORT', '4001'), 10),
|
||||
},
|
||||
|
||||
db: {
|
||||
|
||||
+4
-3
@@ -13,10 +13,11 @@ async function start() {
|
||||
|
||||
app = await buildApp()
|
||||
|
||||
// NixServer on port 2087
|
||||
// Node.js listens on internal port (Nginx proxies public 2087/2083 → here)
|
||||
await app.listen({ port: config.server.nixserverPort, host: config.server.host })
|
||||
console.log(`NixServer running on port ${config.server.nixserverPort}`)
|
||||
console.log(`NixClient API running on port ${config.server.nixserverPort} (/api/cpanel)`)
|
||||
console.log(`NixPanel API running on ${config.server.host}:${config.server.nixserverPort}`)
|
||||
console.log(`NixServer admin → http://127.0.0.1:${config.server.nixserverPort}/api/`)
|
||||
console.log(`NixClient user → http://127.0.0.1:${config.server.nixserverPort}/api/cpanel/`)
|
||||
|
||||
} catch (err) {
|
||||
console.error('Failed to start server:', err)
|
||||
|
||||
Reference in New Issue
Block a user