gaseous-project / gaseous-server

A game ROM manager, with a built in web based emulator using multiple sources to identify and provide metadata
GNU Affero General Public License v3.0
336 stars 12 forks source link

How to run in an LXC container #71

Closed kbekus closed 1 year ago

kbekus commented 1 year ago

hi there, great application thank you.

I'd prefer to run it in an LXC container rather than in Docker - so I've created a Debian 11 container on my Proxmox server, installed dotNet 7.0 and MySQL 8.0 all fine. Cloned this git repo and emulating the Dockerfile I copied everything into /App and compiled the application. All went fine. Manually created the empty db in SQL. When I run cd into /App and run gaseous-server it starts up and correctly creates the db and reads my config file, however it only listens on localhost:5000.

Can you tell me please how I can change the behaviour to make it listen on the external interface and a port of my choosing? I've tried to get around the localhost issue by running an Apache reverse proxy - I can get to the gaseous server this way and access the web interface, even upload some roms but it won't launch the emulator... I can stuff around with the reverse proxy config but it'd be better just to fix the core issue if possible please?

michael-j-green commented 1 year ago

Thanks for your feedback!

If you're starting it manually, you can cd into the /App directory and run: dotnet gaseous-server.dll --urls http://0.0.0.0:8080 (changing the port to that of your choosing).

That should allow the server to start on any port you like.

I'm going to add this as a change request though to specify it in the config file, as I think it's going to be a super useful change.

kbekus commented 1 year ago

sorry mate, using your recommended launch method is great and I can get rid of the Apache proxy now and access the server direct... but when I try to launch a ROM I just get the blurred background and no activity in the browser window. Nothing is coming up in the logging on the server either.

michael-j-green commented 1 year ago

I’ve not used LXC containers before, so I might need to do some testing. Having said that, I think I know what’s wrong…

If /App/wwwroot/emulators/EmulatorJS is empty, it should be a simple fix.

The emulator code is added as a git submodule during the build process. Sadly it’s not automatically pulled as part of a git clone.

If you change to the repo root and run git submodule update --recursive, it should resolve the issue.

kbekus commented 1 year ago

Thank you, the EmulatorJS folder was indeed empty. I tried the command you mentioned but it didn't do anything so I just navigated to wwwroot/emulators, deleted the EmulatorJS folder then did a git clone EmulatorJS on the specified branch. Works great, thank you for your help.

michael-j-green commented 1 year ago

No worries :) I'll update the docs to indicate that for users not using the Docker image that this is a required step.

michael-j-green commented 1 year ago

Updated the documentation to include more details instructions on how to deploy from source. See https://github.com/gaseous-project/gaseous-server/blob/71-how-to-run-in-an-lxc-container/README.MD

@kbekus: Would you be able to take a look and see what you think?

kbekus commented 1 year ago

Looks great, nice job.

For point 1 - have you tried it with MariaDB? I tried it with 10.11 on Debian 12 and it didn't work I didn't make note of the error message but can grab it if you'd like?... I ended up just going MySQL 8.

For point 7 - I know this is the command you recommended I try to fix my previous issue however it didn't actually pull down the EmulatorJS repo.. I had to cd into gaseous-server/wwwroot/emulatorjs and git clone direct. Might just be me doing something wrong...

otherwise, ace!

michael-j-green commented 1 year ago

Funny you should mention MariaDB ;)

So when I initially chose MySQL it was more out of habit than anything else (been using it in various projects for 20+ years now). I normally default to MariaDB, but this time...

Anyways a few weeks into the build I wanted to try Maria and got the same errors you probably got regarding collation.

When I built the db initially, I built it on the server and then dumped it and used that as the build script, not realising that MySQL had included collations that Maria doesn't support. Face palm time, but something for the back burner.

Fast forward to last night and I was making db changes for the next version and I've now removed those collations. I haven't had a chance to properly build it against Maria, but I can't see any reason why it won't work (famous last words right? 🤣).

So that's a long winded way of saying Maria support is coming. I hope to also offer an option of SQLite, but having never used it, I don't know how different it will be.

As for the pull command, I'll be trying to do a full build this evening sometime to make sure the code works on my Ubuntu host (seemed to work fine building on my Mac), just wanted to check if that guide covered what you were looking for in a non-docker deployment.

kbekus commented 1 year ago

yeah it's awesome. I particularly like the additional notes covering upgrades too... they're often omitted.

michael-j-green commented 1 year ago

Just tested it on my Ubuntu host, got this response (I've only scrubbed host names):

administrator@#####:~$ git clone https://github.com/gaseous-project/gaseous-server.git
Cloning into 'gaseous-server'...
remote: Enumerating objects: 1610, done.
remote: Counting objects: 100% (590/590), done.
remote: Compressing objects: 100% (253/253), done.
remote: Total 1610 (delta 422), reused 440 (delta 317), pack-reused 1020
Receiving objects: 100% (1610/1610), 31.54 MiB | 19.52 MiB/s, done.
Resolving deltas: 100% (946/946), done.
administrator@#####:~$ cd gaseous-server/
administrator@#####:~/gaseous-server$ git checkout v1.5.0
Note: switching to 'v1.5.0'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 129fd6d Fix broken xml file (#81)
administrator@#####:~/gaseous-server$ git submodule update --init --recursive
Submodule 'gaseous-server/wwwroot/emulators/EmulatorJS' (https://github.com/EmulatorJS/EmulatorJS.git) registered for path 'gaseous-server/wwwroot/emulators/EmulatorJS'
Cloning into '/home/administrator/gaseous-server/gaseous-server/wwwroot/emulators/EmulatorJS'...
Submodule path 'gaseous-server/wwwroot/emulators/EmulatorJS': checked out '049d0e73caa736ffb7f656ece1bdcd6e329da9c7'
administrator@#####:~/gaseous-server$ ls ./gaseous-server/wwwroot/emulators/EmulatorJS/
ads.txt  CHANGES.md  CODE_OF_CONDUCT.md  data  docs  index.html  LICENSE  package.json  README.md
administrator@#####:~/gaseous-server$ 

Since you're running Debian, it's possible you're running an older version of git? I'm running git version 2.34.1

michael-j-green commented 1 year ago

yeah it's awesome. I particularly like the additional notes covering upgrades too... they're often omitted.

I try my best to be as concise, but informative as I can be - I have a terrible memory, and so need them so I know what I've done 🤣

michael-j-green commented 1 year ago

Meant to include this link to SO that talks about submodule cloning and updates, and points out the differences in git versions around the submodule feature: https://stackoverflow.com/questions/1030169/pull-latest-changes-for-all-git-submodules

michael-j-green commented 1 year ago

Resolved in #95