From b00321f5011f7101662156ba19d9bb91d0685cc6 Mon Sep 17 00:00:00 2001 From: ser3n1ty <36878537+cgnetsec@users.noreply.github.com> Date: Thu, 9 May 2024 00:51:44 -0700 Subject: [PATCH 1/5] Update README.md --- README.md | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 102 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8cbd26b..ef4608c 100644 --- a/README.md +++ b/README.md @@ -1 +1,102 @@ -# rogueserver \ No newline at end of file +# rogueserver + +# Hosting in Docker +It is advised that you host this in a docker container as it will be much easier to manage. +There is a sample docker-compose file for setting up a docker container to setup this server. + +# Self Hosting outside of Docker: +Recommended Tools: +If using Windows: [Chocolatey](https://chocolatey.org/install) + +## Required Tools: +- Golang +- Node: **18.3.0** +- npm: [how to install](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) + +## Installation: + +Once you have all the prerequisites you will need to setup a database. +There are tons of database services you can choose from: +- mysql - [getting started](https://dev.mysql.com/doc/mysql-getting-started/en/) +- mariadb - [getting started](https://mariadb.com/get-started-with-mariadb/) +- etc + +I went with MySQL. Once the database is setup, make sure that you can authenticate to the database. +After being able to login to the database, create a database/schema called pokeroguedb. +Select it as the default database and then run the sql queries from sqlqueries.sql. You should now be able to see all of the empty tables. + +Edit the following files: +### rogueserver.go:34 +Change the 'false' after "debug" to 'true'. This will resolve CORS issues that many users have been having while trying to spin up their own servers. + +### rogueserver.go:37 +Change the default port if you need to, I set it to 8001. As of another pull request, this should _NOT_ be necessary. + +### rogueserver.go:41-43 +You can choose to specify a different dbaddr, dbproto, or dbname if you so choose, instead of passing a flag during execution. +It is advised that you do not store hardcoded credential sets, but rather pass them in as flags during execution like in the commands below. + +### src/utils.ts:224-225 (in pokerogue) +Replace both URLs (one on each line) with the local API server address from rogueserver.go (0.0.0.0:8001) (or whatever port you picked) + +# If you are on Windows + +Now that all of the files are configured: start up powershell as administrator: +``` +powershell -ep bypass +cd C:\api\server\location\ +go run . -dbuser [usernamehere] -dbpass [passhere] +``` + +Then in another run this the first time then run `npm run start` from the rogueserver location from then on: +``` +powershell -ep bypass +cd C:\rogue\server\location\ +npm install +npm run start +``` +You will need to allow the port youre running the API (8001) on and port 8000 to accept inbound connections through the [Windows Advanced Firewall](https://www.youtube.com/watch?v=9llH5_CON-Y). + +# If you are on Linux +In whatever shell you prefer, run the following: +``` +cd /api/server/location/ +go run . -dbuser [usernamehere] -dbpass [passhere] & +cd /rogue/server/location/ +npm run start & +``` +If you have a firewall running such as ufw on your linux machine, make sure to allow inbound connections on the ports youre running the API and the pokerogue server (8000,8001). +An example to allow incoming connections using UFW: +``` +sudo ufw allow 8000,8001/tcp +``` + +This should allow you to reach the game from other computers on the same network. + +## Tying to a Domain + +If you want to tie it to a domain like I did and make it publicly accessible, there is some extra work to be done. + +I setup caddy and would recommend using it as a reverse proxy. +[caddy installation](https://caddyserver.com/docs/install) +once its installed setup a config file for caddy: + +``` +pokerogue.exampledomain.com { + reverse_proxy localhost:8000 +} +pokeapi.exampledomain.com { + reverse_proxy localhost:8001 +} +``` +Preferably set up caddy as a service from [here.](https://caddyserver.com/docs/running) + +Once this is good to go, take your API url (https://pokeapi.exampledomain.com) and paste it on +### src/utils.ts:224-225 +in place of the previous 0.0.0.0:8001 address + +Make sure that both 8000 and 8001 are portforwarded on your router. + +Test that the server's game and game authentication works from other machines both in and outside of the network. Once this is complete, enjoy! + + From d5e7b438f3d4b4683bd67602fd1f5637663a8b02 Mon Sep 17 00:00:00 2001 From: ser3n1ty <36878537+cgnetsec@users.noreply.github.com> Date: Thu, 9 May 2024 00:57:07 -0700 Subject: [PATCH 2/5] Update README.md added updated information for the docker compose container that is being implemented --- README.md | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/README.md b/README.md index ef4608c..95becf0 100644 --- a/README.md +++ b/README.md @@ -14,16 +14,7 @@ If using Windows: [Chocolatey](https://chocolatey.org/install) - npm: [how to install](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) ## Installation: - -Once you have all the prerequisites you will need to setup a database. -There are tons of database services you can choose from: -- mysql - [getting started](https://dev.mysql.com/doc/mysql-getting-started/en/) -- mariadb - [getting started](https://mariadb.com/get-started-with-mariadb/) -- etc - -I went with MySQL. Once the database is setup, make sure that you can authenticate to the database. -After being able to login to the database, create a database/schema called pokeroguedb. -Select it as the default database and then run the sql queries from sqlqueries.sql. You should now be able to see all of the empty tables. +The docker compose file should automatically implement a container with mariadb with an empty database and the default user and password combo of pokerogue:pokerogue Edit the following files: ### rogueserver.go:34 From e01364e1a6c6284f05ad44b68016ae04d23010f0 Mon Sep 17 00:00:00 2001 From: ser3n1ty <36878537+cgnetsec@users.noreply.github.com> Date: Thu, 9 May 2024 01:44:04 -0700 Subject: [PATCH 3/5] Update README.md --- README.md | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 95becf0..3c97821 100644 --- a/README.md +++ b/README.md @@ -16,17 +16,6 @@ If using Windows: [Chocolatey](https://chocolatey.org/install) ## Installation: The docker compose file should automatically implement a container with mariadb with an empty database and the default user and password combo of pokerogue:pokerogue -Edit the following files: -### rogueserver.go:34 -Change the 'false' after "debug" to 'true'. This will resolve CORS issues that many users have been having while trying to spin up their own servers. - -### rogueserver.go:37 -Change the default port if you need to, I set it to 8001. As of another pull request, this should _NOT_ be necessary. - -### rogueserver.go:41-43 -You can choose to specify a different dbaddr, dbproto, or dbname if you so choose, instead of passing a flag during execution. -It is advised that you do not store hardcoded credential sets, but rather pass them in as flags during execution like in the commands below. - ### src/utils.ts:224-225 (in pokerogue) Replace both URLs (one on each line) with the local API server address from rogueserver.go (0.0.0.0:8001) (or whatever port you picked) @@ -36,13 +25,15 @@ Now that all of the files are configured: start up powershell as administrator: ``` powershell -ep bypass cd C:\api\server\location\ -go run . -dbuser [usernamehere] -dbpass [passhere] +go build . +.\rogueserver.exe --debug --dbuser yourusername --dbpass yourpassword ``` +The other available flags are located in rogueserver.go:34-43. Then in another run this the first time then run `npm run start` from the rogueserver location from then on: ``` powershell -ep bypass -cd C:\rogue\server\location\ +cd C:\server\location\ npm install npm run start ``` @@ -52,10 +43,13 @@ You will need to allow the port youre running the API (8001) on and port 8000 to In whatever shell you prefer, run the following: ``` cd /api/server/location/ -go run . -dbuser [usernamehere] -dbpass [passhere] & -cd /rogue/server/location/ +go build . +./rogueserver --debug --dbuser yourusername --dbpass yourpassword & + +cd /server/location/ npm run start & ``` + If you have a firewall running such as ufw on your linux machine, make sure to allow inbound connections on the ports youre running the API and the pokerogue server (8000,8001). An example to allow incoming connections using UFW: ``` From 1cec1d313d3872c3c805c7ff344ab0aeee7104a9 Mon Sep 17 00:00:00 2001 From: ser3n1ty <36878537+cgnetsec@users.noreply.github.com> Date: Fri, 10 May 2024 20:36:03 -0700 Subject: [PATCH 4/5] Update README.md --- README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index 3c97821..c896a2d 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,6 @@ It is advised that you host this in a docker container as it will be much easier There is a sample docker-compose file for setting up a docker container to setup this server. # Self Hosting outside of Docker: -Recommended Tools: -If using Windows: [Chocolatey](https://chocolatey.org/install) - ## Required Tools: - Golang - Node: **18.3.0** @@ -47,7 +44,7 @@ go build . ./rogueserver --debug --dbuser yourusername --dbpass yourpassword & cd /server/location/ -npm run start & +npm run start ``` If you have a firewall running such as ufw on your linux machine, make sure to allow inbound connections on the ports youre running the API and the pokerogue server (8000,8001). From 8c209163db64162fa7627f8a8ae17b370fb59eb0 Mon Sep 17 00:00:00 2001 From: ser3n1ty <36878537+cgnetsec@users.noreply.github.com> Date: Fri, 10 May 2024 20:38:28 -0700 Subject: [PATCH 5/5] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index c896a2d..2040c8e 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,6 @@ Replace both URLs (one on each line) with the local API server address from rogu Now that all of the files are configured: start up powershell as administrator: ``` -powershell -ep bypass cd C:\api\server\location\ go build . .\rogueserver.exe --debug --dbuser yourusername --dbpass yourpassword