Developer Guides ‐ Miscellaneous - MarechJ/hll_rcon_tool GitHub Wiki
🧭 You are here : Wiki home / Developer Guides / Miscellaneous
[!WARNING]
This page has not been updated since major CRCON and game server releases.
Some of the informations mentioned here are probably no longer valid.
Known Issues and Limitations
- After a sometime without being used, the API will lose the connection to the game server. When you open the GUI the first time you may see an error stating it
can't fetch the list of players
. However this will recover on its own just refresh or wait until the next auto refresh. - The game server in rare case fails to return the SteamID of a player.
- When logs are completely empty, the game server will fail to respond to the request, causing an error to show in the API/GUI.
- (Not true anymore as in v16 of the game server)
The RCON API server truncates the name of players to a maximum of 20 characters even though, up to 32 characters are displayed in game. Bottom line : you don't always see the full name.
USAGE of the CLI with docker
Build the image
$ docker build . -t rcon
Set your server info as environement variables and run the cli
$ docker run -it -e HLL_HOST=1.1.1.1 -e HLL_PORT=20300 -e HLL_PASSWORD=mypassword rcon python -m rcon.cli
Usage: cli.py [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
Commands:
get_admin_ids
get_autobalance_threshold
get_logs
get_map
get_map_rotation
get_name
get_permabans
get_players
get_team_switch_cooldown
get_temp_bans
set_broadcast
set_map
set_welcome_message
...
$ docker run -it -e HLL_HOST=1.1.1.1 -e HLL_PORT=20300 -e HLL_PASSWORD=mypassword rcon python -m rcon.cli get_maps
[2020-05-03 17:15:00,508][DEBUG] rcon.commands commands.py:_request:90 | get mapsforrotation
['foy_warfare', 'stmariedumont_warfare', 'hurtgenforest_warfare', 'utahbeach_warfare', 'omahabeach_offensive_us', 'stmereeglise_warfare', 'stmereeglise_offensive_ger', 'foy_offensive_ger', 'purpleheartlane_warfare', 'purpleheartlane_offensive_us', 'hill400_warfare', 'hill400_offensive_US']
Development environment
[!CAUTION] This is legacy and not applicable anymore.
Use the new Development environment procedure.
First a quick overview of how the software is structured:
The backbone of the application is HLLConnection + ServerCtl it is what binds the HLL Server rcon commands to the application.
The Rcon
and RecordedRcon
provide some wrapping around the raw results of the game server. And expose some new commands that are a combination of basic commands.
The Rcon
class also adds a caching layer using Redis (or falling back to in-memory) in order to go easy on the server.
The RecordedRcon
is an additional wrapping where all the commands that should be saved, or use the Database should go.
I made the choice of separating the ServerCtl
, Rcon
and RecorededRcon
into serparated layers to leave the possiblity to choose the right level of abstraction for what you need.
The API in django is a very thin layer that basically loops over all the methods available in RecorededRcon
(and therefore all those of ServerCtl
and Rcon
) and binds them to a route see /rconweb/api/views.py.
This is a bit hackish, but it saved me a lot of time a the begining, it also removes a lot of boilerplate, but it should probably change at some point to provide a cleaner set of endpoints.
Start a development instance
First boot up the dependancies. I use docker for that but you can also install Redis and Postgres natively if you prefer
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d redis postgres
This will make redis and postgres available on you localhost with their default ports. If you need different port bindings refer to the docker-compose-dev.yml
file
Then run an API using Django's development server:
Note: remember that you need to define some environment variables:
export HLL_PASSWORD=<fill in yours>
export HLL_PORT=<fill in yours>
export HLL_HOST=<fill in yours>
export HLL_DB_PASSWORD=developmentpassword
export DJANGO_DEBUG=True
export DB_URL=postgres://rcon:developmentpassword@localhost:5432
export REDIS_URL=redis://localhost:6379/0
Run a server
# from the root of the repo
pip install -r requirements.txt
PYTHONPATH=$PWD DJANGO_DEBUG=true ./rconweb/manage.py runserver
This will run a development server on http://127.0.0.1:8000/ it auto refreshes on code changes If you change the port rember that you will also need to change it in rcongui/.env for the frontend to know where to talk to the API
Hitting http://127.0.0.1:8000/api/ with Django DEBUG set to true will show you all the available endpoints. They are basically named after the methods of the Rcon
class
All endpoints accept GET querystring parameters OR (not both at the same time) a json payload. The parameters are the same as the parameter names of the Rcon
methodds (all that is auto generated remember).
It is not best practice to have endpoints that do write operations accept a GET with query string parameters but it was just easier that way.
Now start the frontend:
# from the root of the repo
cd rcongui/
npm install
npm start
The GUI should now be available on http://localhost:3000/ it auto refreshes on code changes
To test your changes will work with the prod setup, start the whole stack
docker-compose -f docker-compose.yml -f docker-compose.dev.yml build
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d
Now test on http://localhost:8010
General notes:
If you have problems with dependancies or versions of python or nodejs please refer to the respective Dockerfile that can act as a guide on how to setup a development environment. If you need a refresher on which process needs what variables have a look at the docker-