AdrianCassar / Xenia-WebServices

Xenia Web Services is a REST API designed to support the Xenia Xbox 360 emulator in providing online and multiplayer functionality.
MIT License
28 stars 15 forks source link

Make self-hosting easier by distributing executables and simplifying database setup #25

Open Calinou opened 3 months ago

Calinou commented 3 months ago

I've been fiddling with this repository to play GoldenEye XBLA and it works great. However, setup is a bit convoluted for users not well-versed with web development. (For context, this game requires players to be on the same virtual LAN and one of the players must be hosting Xenia Web Services themselves.)

With Single executable applications in Node 21 or pkg for older Node versions, it should be possible to package this app into a single executable (and distribute it on GitHub Releases). However, users would still need to set up MongoDB, which can be nontrivial. There's a Windows installer provided on its website, but it still needs administrator privileges, setting up a Windows service so it runs in the background and so on.

Would it be possible to offer some kind of file-based backend for data persistence such as SQLite, so that no database server is required? I doubt the data volume managed by Xenia Web Services really requires client-server databases in the first place.

AdrianCassar commented 3 months ago

I agree for the average user it can be a challenge to host the server locally. I have taken a Docker approach, but have not updated the readme instructions yet. You can find a list of docker scripts in package.json

npm run docker:compose will automatically compile the project and setup MongoDB, however --net=host isn't supported on Windows it's currently in development as a beta feature. To work around this a reverse proxy such as Nginx is required running on the host i've provided a config here. Using Docker does increase the system requirements but is useful for automating and replicating the environment.

I have considered packing the project into a single executable, but haven't looked into it but would like to try it out. The quality of service (QoS) data would still need temporary storing and somehow providing the .env would still be required to point to a MongoDB server. Adding support for SQLite would be a significant task it's not something i would implement at the moment.

A client-server database allows for scaling up quite well with the possibility of hosting several servers pointing to the same database e.g. load balancing.

Considering GoldenEye XBLA uses systemlink which shouldn't depend on a server in the first place, the net-code in xenia canary netplay should be improved to better support systemlink.

AdrianCassar commented 2 months ago

@Calinou Latest version of netplay can now run some systemlink games without requiring a server. GoldenEye XBLA can now be played without a server over Radmin VPN by selecting the interface in Netplay->Network Interfaces->Radmin VPN.