Kaetram / Kaetram-Open

Kaetram is an open-source 2D HTML5 MMORPG. It is an extended version of BrowserQuest (BQ).
https://kaetram.com
Mozilla Public License 2.0
526 stars 112 forks source link

please make clear how to run at port 443 with ssl and how to run the server forever via ssh #293

Closed YukiTrace closed 4 months ago

YukiTrace commented 11 months ago

I am facing 2 problem right now. 1. typing in port :9000 at the end of the url is not elegant. And I'm not smart enough to make port 443 work. There is some answer here https://github.com/Kaetram/Kaetram-Open/issues/217 but as a non-dev in was very difficult to parse.

I am now running the server in production via the command. npm run dev -- --port 80 I could not get it working with port 443 with this approach. Though. note I'm not using yarn start because it always starts on port 9000 and you have to type that in to the url. I wish I could just change the port in the config file.

Problem 2 I am sshed into the server running npm run dev -- --port 80 to start the server. If I close my ssh window the server to my knowledge stop.

This server was not hard for an somewhat beginner like me. Except for these two pain points. Also the node version is tricky too but that isn't on you.

Veradictus commented 11 months ago

For SSH window use tmux or screen libraries. Tmux is by far the easiest, you can run an instance in a tmux screen and just CTRL-B + D to detach and have it run constantly.

Running via SSL is not recommended since you're running in a development environment. To run a proper instance you'll have to run yarn build and use the dist files in the client to host on your own webserver (such as nginx). You can then reverse proxy websocket connections into the server (which is now running via yarn start and the built files), and then use CloudFlare to properly achieve SSL.

octoshrimpy commented 11 months ago

although recommended would be to run the server behind a reverse-proxy like caddy or nginx proxy manager. that will give you the SSL certs in a much easier way, and you don't have to change ports.