louislam / uptime-kuma

A fancy self-hosted monitoring tool
https://uptime.kuma.pet
MIT License
57.48k stars 5.19k forks source link

How to change port 3001 to some other port WITHOUT docker #4125

Closed gl-yziquel closed 10 months ago

gl-yziquel commented 10 months ago

⚠️ Please verify that this bug has NOT been raised before.

πŸ›‘οΈ Security Policy

πŸ“ Describe your problem

My problem is simple. 1. I checked out the repo with git/gix. 2. I did pnpm install. 3. I did npm run dev 4. As I have many services running on my computer, port 3001 is busy and server can't start up.

2023-11-30T12:01:24+01:00 [SERVER] DEBUG: Init the server
2023-11-30T12:01:24+01:00 [SERVER] ERROR: Cannot listen: listen EADDRINUSE: address already in use :::3001
2023-11-30T12:01:24+01:00 [SERVER] INFO: Shutdown requested

I did not see instruction to change the port in the doc, and I'm not on docker, but running it on metal. Ideally, I'd like npm run dev to work with alternate ports.

Where do I set such a configuration for uptime-kuma ?

πŸ“ Error Message(s) or Log

No response

🐻 Uptime-Kuma Version

1708b67949ca183b2ee86ef70e9e51c5f721a73e

πŸ’» Operating System and Arch

Ubuntu

🌐 Browser

None. elinks most of the time. Falkon. Anyhow, not applicable here.

πŸ‹ Docker Version

Not applicable here.

🟩 NodeJS Version

v20.5.1

gl-yziquel commented 10 months ago

Ah...

Hard-coded in server/server.js:

const port = [ args.port, process.env.UPTIME_KUMA_PORT, process.env.PORT, 3001 ]

OK. I'll try this environment variable or argument.

louislam commented 10 months ago

Ah...

Hard-coded in server/server.js:

const port = [ args.port, process.env.UPTIME_KUMA_PORT, process.env.PORT, 3001 ]

OK. I'll try this environment variable or argument.

If you can change the port by the environment variable or argument, then logically it is not hard-coded.

Close as you find the answer by yourself.

gl-yziquel commented 10 months ago

ok. sorry.

Though having more thorough configuration docs would be welcome. That is the goal of this ticket.

louislam commented 10 months ago

You could check this: https://github.com/louislam/uptime-kuma/wiki/Environment-Variables

gl-yziquel commented 10 months ago

Thank you so much !