warlock-manager 2.1.2__tar.gz → 2.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/PKG-INFO +58 -172
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/README.md +53 -168
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/pyproject.toml +16 -4
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/tests/test_version.py +1 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/libs/app.py +309 -35
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/libs/app_runner.py +66 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/libs/tui.py +35 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/mods/base_mod.py +90 -9
- warlock_manager-2.2.0/warlock_manager/mods/warlock_nexus_mod.py +66 -0
- warlock_manager-2.2.0/warlock_manager/nexus/nexus.py +320 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/services/base_service.py +161 -5
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager.egg-info/PKG-INFO +58 -172
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager.egg-info/SOURCES.txt +2 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager.egg-info/requires.txt +4 -3
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/LICENSE +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/setup.cfg +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/tests/test_app.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/tests/test_base_config.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/tests/test_base_service.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/tests/test_cli_config.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/tests/test_cli_formatter.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/tests/test_cmd.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/tests/test_config_key.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/tests/test_ini_config.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/tests/test_sensitive_data_filter.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/tests/test_socket_service.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/tests/test_unreal_config.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/tests/test_unreal_config_ark_spawn_entities.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/tests/test_unreal_save.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/__init__.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/apps/__init__.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/apps/base_app.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/apps/manual_app.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/apps/steam_app.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/config/__init__.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/config/base_config.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/config/cli_config.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/config/config_key.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/config/ini_config.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/config/json_config.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/config/properties_config.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/config/unreal_config.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/formatters/__init__.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/formatters/cli_formatter.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/libs/__init__.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/libs/cache.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/libs/cmd.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/libs/download.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/libs/firewall.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/libs/get_wan_ip.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/libs/java.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/libs/meta.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/libs/ports.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/libs/sensitive_data_filter.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/libs/utils.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/libs/version.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/mods/__init__.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/services/__init__.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/services/http_service.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/services/rcon_service.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager/services/socket_service.py +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager.egg-info/dependency_links.txt +0 -0
- {warlock_manager-2.1.2 → warlock_manager-2.2.0}/warlock_manager.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: warlock-manager
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: Dependency library for game-server management applications.
|
|
5
5
|
Author-email: Charlie Powell <cdp1337@bitsnbytes.dev>
|
|
6
6
|
Maintainer-email: Charlie Powell <cdp1337@bitsnbytes.dev>
|
|
@@ -23,19 +23,20 @@ Classifier: Topic :: System :: Systems Administration
|
|
|
23
23
|
Requires-Python: >=3.10
|
|
24
24
|
Description-Content-Type: text/markdown
|
|
25
25
|
License-File: LICENSE
|
|
26
|
-
Requires-Dist: requests>=2.
|
|
26
|
+
Requires-Dist: requests>=2.33.1
|
|
27
27
|
Requires-Dist: pyyaml>=6.0
|
|
28
28
|
Requires-Dist: typer>=0.24.1
|
|
29
29
|
Requires-Dist: rcon>=2.4.9
|
|
30
|
-
Requires-Dist: typing_extensions>=4.
|
|
30
|
+
Requires-Dist: typing_extensions>=4.15.0
|
|
31
31
|
Requires-Dist: systemdunitparser>=0.4
|
|
32
|
-
Requires-Dist: packaging>=
|
|
32
|
+
Requires-Dist: packaging>=26.1
|
|
33
33
|
Requires-Dist: psutil>=7.2.0
|
|
34
34
|
Provides-Extra: dev
|
|
35
35
|
Requires-Dist: pytest>=9; extra == "dev"
|
|
36
36
|
Requires-Dist: flake8>=7.3.0; extra == "dev"
|
|
37
37
|
Requires-Dist: pre-commit>=4.5.1; extra == "dev"
|
|
38
38
|
Requires-Dist: pytest-cov>=7.0; extra == "dev"
|
|
39
|
+
Requires-Dist: pydoc-markdown>=4.8.0; extra == "dev"
|
|
39
40
|
Dynamic: license-file
|
|
40
41
|
|
|
41
42
|
# Warlock Manager
|
|
@@ -44,7 +45,8 @@ Dynamic: license-file
|
|
|
44
45
|

|
|
45
46
|
[](https://pypi.org/project/warlock-manager/)
|
|
46
47
|
|
|
47
|
-
Warlock Manager is a robust, extensible Python library for building game server management applications.
|
|
48
|
+
Warlock Manager is a robust, extensible Python library for building game server management applications.
|
|
49
|
+
It provides a comprehensive foundation for managing game applications, services, configurations, and server communications.
|
|
48
50
|
|
|
49
51
|
This is meant to be used with the [Warlock Game Manager](https://warlock.nexus) ([Github Repo](https://github.com/BitsNBytes25/Warlock)),
|
|
50
52
|
but can be used independently.
|
|
@@ -66,6 +68,18 @@ Warlock Manager abstracts common game server management tasks, allowing you to b
|
|
|
66
68
|
|
|
67
69
|
### Core Components
|
|
68
70
|
|
|
71
|
+
In this system, a game is defined as an 'Application' or 'App'.
|
|
72
|
+
This management library is meant to manage one single app to allow it be extended
|
|
73
|
+
to meet the requirements of that specific game.
|
|
74
|
+
|
|
75
|
+
A map or instance of the game is defined as a 'Service'.
|
|
76
|
+
Each service runs a single instance of the game executable.
|
|
77
|
+
|
|
78
|
+
An app will have one or more services, based on the game.
|
|
79
|
+
Some games support multiple services from a single game installation,
|
|
80
|
+
some support multiple services from multiple binaries,
|
|
81
|
+
and some only support a single instance.
|
|
82
|
+
|
|
69
83
|
- **BaseApp**: Abstract base for game application managers
|
|
70
84
|
- Multi-service instance support
|
|
71
85
|
- Service lifecycle management
|
|
@@ -93,6 +107,10 @@ Warlock Manager abstracts common game server management tasks, allowing you to b
|
|
|
93
107
|
- `RconService`: RCON protocol support
|
|
94
108
|
- `SocketService`: Unix socket-based communication
|
|
95
109
|
|
|
110
|
+
- **Mod Support**:
|
|
111
|
+
- `BaseMod`: Baseline mod class for basic functionality and skeleton structure
|
|
112
|
+
- `WarlockNexusMod`: Support for pulling mod metadata from hosted [Warlock.Nexus](https://warlock.nexus)
|
|
113
|
+
|
|
96
114
|
### Utilities
|
|
97
115
|
|
|
98
116
|
- **CLI Framework**: Built on Typer for robust command-line interfaces
|
|
@@ -102,6 +120,27 @@ Warlock Manager abstracts common game server management tasks, allowing you to b
|
|
|
102
120
|
- **Port Management**: Port discovery, allocation, and validation
|
|
103
121
|
- **Data Filtering**: Sensitive data masking for safe logging
|
|
104
122
|
|
|
123
|
+
### Default Features
|
|
124
|
+
|
|
125
|
+
This library automatically provides commands for:
|
|
126
|
+
|
|
127
|
+
- Service management (start, stop, restart, status)
|
|
128
|
+
- Configuration management (get, set)
|
|
129
|
+
- Port discovery and management
|
|
130
|
+
- Metrics collection
|
|
131
|
+
- Backup and restore operations
|
|
132
|
+
- First-run setup
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
Additionally, the included TUI application as provided by app provides an interactive menu system for:
|
|
136
|
+
|
|
137
|
+
This provides an interactive menu system for:
|
|
138
|
+
- Viewing service status and metrics
|
|
139
|
+
- Managing service configurations
|
|
140
|
+
- Controlling service lifecycle
|
|
141
|
+
- Backup and data management
|
|
142
|
+
- Creating new service instances
|
|
143
|
+
|
|
105
144
|
## Installation
|
|
106
145
|
|
|
107
146
|
Install as a dependency in your project:
|
|
@@ -115,19 +154,19 @@ Or add to your `pyproject.toml`:
|
|
|
115
154
|
```toml
|
|
116
155
|
[project]
|
|
117
156
|
dependencies = [
|
|
118
|
-
"warlock-manager>=2.
|
|
157
|
+
"warlock-manager>=2.2.0",
|
|
119
158
|
]
|
|
120
159
|
```
|
|
121
160
|
|
|
122
161
|
Or to your `requirements.txt`:
|
|
123
162
|
|
|
124
163
|
```
|
|
125
|
-
warlock-manager>=2.
|
|
164
|
+
warlock-manager>=2.2.0
|
|
126
165
|
```
|
|
127
166
|
|
|
128
167
|
## Requirements
|
|
129
168
|
|
|
130
|
-
- Python 3.10+
|
|
169
|
+
- Python 3.10+ (3.11+ recommended)
|
|
131
170
|
- Dependencies:
|
|
132
171
|
- `requests>=2.28` - HTTP client library
|
|
133
172
|
- `pyyaml>=6.0` - YAML parsing
|
|
@@ -139,96 +178,11 @@ warlock-manager>=2.1.0
|
|
|
139
178
|
|
|
140
179
|
## Quick Start
|
|
141
180
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
For more detailed examples, check out the [Warlock Game Template](https://github.com/BitsNBytes25/Warlock-Game-Template)
|
|
181
|
+
For detailed examples, check out the [Warlock Game Template](https://github.com/BitsNBytes25/Warlock-Game-Template)
|
|
145
182
|
repository for a templated project you can fork and customize to quickly get started.
|
|
146
183
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
```python
|
|
150
|
-
from warlock_manager.apps import BaseApp
|
|
151
|
-
from warlock_manager.services import BaseService
|
|
152
|
-
|
|
153
|
-
class MyGameApp(BaseApp):
|
|
154
|
-
def __init__(self):
|
|
155
|
-
super().__init__()
|
|
156
|
-
self.name = 'mygame'
|
|
157
|
-
self.desc = 'My Game Server'
|
|
158
|
-
self.service_prefix = 'mygame-'
|
|
159
|
-
|
|
160
|
-
def get_app_directory(self) -> str:
|
|
161
|
-
return '/var/games/mygame'
|
|
162
|
-
|
|
163
|
-
def detect_services(self) -> list:
|
|
164
|
-
# Detect existing game services
|
|
165
|
-
return []
|
|
166
|
-
|
|
167
|
-
def create_service(self, name: str) -> BaseService:
|
|
168
|
-
# Create and return a new service instance
|
|
169
|
-
pass
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### Creating a Game Service Handler
|
|
173
|
-
|
|
174
|
-
Extend `BaseService` to implement service-specific logic:
|
|
175
|
-
|
|
176
|
-
```python
|
|
177
|
-
from warlock_manager.services import BaseService
|
|
178
|
-
from warlock_manager.config import IniConfig
|
|
179
|
-
|
|
180
|
-
class MyGameService(BaseService):
|
|
181
|
-
def __init__(self, service: str, game: BaseApp):
|
|
182
|
-
super().__init__(service, game)
|
|
183
|
-
|
|
184
|
-
# Configure configuration files
|
|
185
|
-
self.configs['game_config'] = IniConfig(
|
|
186
|
-
'/var/games/mygame/game.ini'
|
|
187
|
-
)
|
|
188
|
-
|
|
189
|
-
def get_port_definitions(self) -> list:
|
|
190
|
-
# Return list of port definitions: (port_number_or_config_key, 'tcp'/'udp', description)
|
|
191
|
-
return [
|
|
192
|
-
('game_port', 'tcp', 'Game Server Port'),
|
|
193
|
-
('query_port', 'udp', 'Query Port'),
|
|
194
|
-
]
|
|
195
|
-
|
|
196
|
-
def is_running(self) -> bool:
|
|
197
|
-
# Check if service is running
|
|
198
|
-
pass
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
### Building a CLI Application
|
|
202
|
-
|
|
203
|
-
Use the built-in CLI framework:
|
|
204
|
-
|
|
205
|
-
```python
|
|
206
|
-
from warlock_manager.libs.app_runner import app_runner
|
|
207
|
-
|
|
208
|
-
game = MyGameApp()
|
|
209
|
-
cli_app = app_runner(game)
|
|
210
|
-
|
|
211
|
-
if __name__ == '__main__':
|
|
212
|
-
cli_app()
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
This automatically provides commands for:
|
|
216
|
-
- Service management (start, stop, restart, status)
|
|
217
|
-
- Configuration management (get, set)
|
|
218
|
-
- Port discovery and management
|
|
219
|
-
- Metrics collection
|
|
220
|
-
- Backup and restore operations
|
|
221
|
-
- First-run setup
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
Additionally, the included TUI application as provided by app provides an interactive menu system for:
|
|
225
|
-
|
|
226
|
-
This provides an interactive menu system for:
|
|
227
|
-
- Viewing service status and metrics
|
|
228
|
-
- Managing service configurations
|
|
229
|
-
- Controlling service lifecycle
|
|
230
|
-
- Backup and data management
|
|
231
|
-
- Creating new service instances
|
|
184
|
+
Also check out the games listed as supported at [Warlock.Nexus](https://warlock.nexus)
|
|
185
|
+
to browse their source repos for more real-world implementations.
|
|
232
186
|
|
|
233
187
|
## Configuration
|
|
234
188
|
|
|
@@ -260,33 +214,6 @@ mygame:
|
|
|
260
214
|
group: Network
|
|
261
215
|
```
|
|
262
216
|
|
|
263
|
-
## Features System
|
|
264
|
-
|
|
265
|
-
Control available functionality through the features system:
|
|
266
|
-
|
|
267
|
-
```python
|
|
268
|
-
class MyGameApp(BaseApp):
|
|
269
|
-
def __init__(self):
|
|
270
|
-
super().__init__()
|
|
271
|
-
|
|
272
|
-
# Available features
|
|
273
|
-
self.features = {
|
|
274
|
-
'api', # Server API support
|
|
275
|
-
'cmd', # Command execution via API
|
|
276
|
-
'create_service', # Create new service instances
|
|
277
|
-
'mods', # Mod support
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
# Disable specific features
|
|
281
|
-
self.disabled_features = {'mods'}
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
Available features:
|
|
285
|
-
- `api` - Server API communication support
|
|
286
|
-
- `cmd` - Command execution capabilities
|
|
287
|
-
- `create_service` - Ability to create new service instances
|
|
288
|
-
- `mods` - Mod/plugin support
|
|
289
|
-
|
|
290
217
|
## Development
|
|
291
218
|
|
|
292
219
|
### Setting Up Development Environment
|
|
@@ -304,6 +231,14 @@ source venv/bin/activate
|
|
|
304
231
|
pip install -e ".[dev]"
|
|
305
232
|
```
|
|
306
233
|
|
|
234
|
+
### Generating Documentation
|
|
235
|
+
|
|
236
|
+
Documentation is generated using [pydoc-markdown](https://github.com/NiklasRosenstein/pydoc-markdown).
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
pydoc-markdown
|
|
240
|
+
```
|
|
241
|
+
|
|
307
242
|
### Running Tests
|
|
308
243
|
|
|
309
244
|
```bash
|
|
@@ -324,55 +259,6 @@ Run linting checks:
|
|
|
324
259
|
flake8 warlock_manager tests
|
|
325
260
|
```
|
|
326
261
|
|
|
327
|
-
## API Reference
|
|
328
|
-
|
|
329
|
-
### BaseApp
|
|
330
|
-
|
|
331
|
-
Main application class for game server management.
|
|
332
|
-
|
|
333
|
-
**Key Methods:**
|
|
334
|
-
- `detect_services()`: Discover existing service instances
|
|
335
|
-
- `create_service(name)`: Create a new service instance
|
|
336
|
-
- `get_services()`: Get list of service instances
|
|
337
|
-
- `get_options()`: Get application-level configuration options
|
|
338
|
-
- `get_option_value(key)`: Get a configuration option value
|
|
339
|
-
- `set_option(key, value)`: Set a configuration option
|
|
340
|
-
- `start_all()`: Start all service instances
|
|
341
|
-
- `stop_all()`: Stop all service instances
|
|
342
|
-
- `is_active()`: Check if any service is running
|
|
343
|
-
- `update()`: Update the application/game
|
|
344
|
-
|
|
345
|
-
### BaseService
|
|
346
|
-
|
|
347
|
-
Service instance handler for individual game servers.
|
|
348
|
-
|
|
349
|
-
**Key Methods:**
|
|
350
|
-
- `load()`: Load service configuration files
|
|
351
|
-
- `get_options()`: Get service configuration options
|
|
352
|
-
- `get_option_value(key)`: Get a configuration option
|
|
353
|
-
- `set_option(key, value)`: Set a configuration option
|
|
354
|
-
- `start()`: Start the service
|
|
355
|
-
- `stop()`: Stop the service
|
|
356
|
-
- `restart()`: Restart the service
|
|
357
|
-
- `is_running()`: Check if service is running
|
|
358
|
-
- `get_port()`: Get service's primary port
|
|
359
|
-
- `get_ports()`: Get all port definitions
|
|
360
|
-
- `is_enabled()`: Check if auto-start is enabled
|
|
361
|
-
- `cmd(command)`: Send command to service
|
|
362
|
-
- `get_player_count()`: Get current player count
|
|
363
|
-
- `get_player_max()`: Get max player capacity
|
|
364
|
-
- `backup()`: Create backup of service data
|
|
365
|
-
- `restore(backup_path)`: Restore from backup
|
|
366
|
-
|
|
367
|
-
### Configuration Classes
|
|
368
|
-
|
|
369
|
-
All configuration classes extend `BaseConfig` and provide:
|
|
370
|
-
- `load()`: Load configuration from file
|
|
371
|
-
- `save()`: Save configuration to file
|
|
372
|
-
- `get_option_value(key)`: Get option value
|
|
373
|
-
- `set_option_value(key, value)`: Set option value
|
|
374
|
-
- `exists()`: Check if configuration file exists
|
|
375
|
-
|
|
376
262
|
## License
|
|
377
263
|
|
|
378
264
|
This project is licensed under the GNU Affero General Public License v3.0 or later - see the [LICENSE](LICENSE) file for details.
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|

|
|
5
5
|
[](https://pypi.org/project/warlock-manager/)
|
|
6
6
|
|
|
7
|
-
Warlock Manager is a robust, extensible Python library for building game server management applications.
|
|
7
|
+
Warlock Manager is a robust, extensible Python library for building game server management applications.
|
|
8
|
+
It provides a comprehensive foundation for managing game applications, services, configurations, and server communications.
|
|
8
9
|
|
|
9
10
|
This is meant to be used with the [Warlock Game Manager](https://warlock.nexus) ([Github Repo](https://github.com/BitsNBytes25/Warlock)),
|
|
10
11
|
but can be used independently.
|
|
@@ -26,6 +27,18 @@ Warlock Manager abstracts common game server management tasks, allowing you to b
|
|
|
26
27
|
|
|
27
28
|
### Core Components
|
|
28
29
|
|
|
30
|
+
In this system, a game is defined as an 'Application' or 'App'.
|
|
31
|
+
This management library is meant to manage one single app to allow it be extended
|
|
32
|
+
to meet the requirements of that specific game.
|
|
33
|
+
|
|
34
|
+
A map or instance of the game is defined as a 'Service'.
|
|
35
|
+
Each service runs a single instance of the game executable.
|
|
36
|
+
|
|
37
|
+
An app will have one or more services, based on the game.
|
|
38
|
+
Some games support multiple services from a single game installation,
|
|
39
|
+
some support multiple services from multiple binaries,
|
|
40
|
+
and some only support a single instance.
|
|
41
|
+
|
|
29
42
|
- **BaseApp**: Abstract base for game application managers
|
|
30
43
|
- Multi-service instance support
|
|
31
44
|
- Service lifecycle management
|
|
@@ -53,6 +66,10 @@ Warlock Manager abstracts common game server management tasks, allowing you to b
|
|
|
53
66
|
- `RconService`: RCON protocol support
|
|
54
67
|
- `SocketService`: Unix socket-based communication
|
|
55
68
|
|
|
69
|
+
- **Mod Support**:
|
|
70
|
+
- `BaseMod`: Baseline mod class for basic functionality and skeleton structure
|
|
71
|
+
- `WarlockNexusMod`: Support for pulling mod metadata from hosted [Warlock.Nexus](https://warlock.nexus)
|
|
72
|
+
|
|
56
73
|
### Utilities
|
|
57
74
|
|
|
58
75
|
- **CLI Framework**: Built on Typer for robust command-line interfaces
|
|
@@ -62,6 +79,27 @@ Warlock Manager abstracts common game server management tasks, allowing you to b
|
|
|
62
79
|
- **Port Management**: Port discovery, allocation, and validation
|
|
63
80
|
- **Data Filtering**: Sensitive data masking for safe logging
|
|
64
81
|
|
|
82
|
+
### Default Features
|
|
83
|
+
|
|
84
|
+
This library automatically provides commands for:
|
|
85
|
+
|
|
86
|
+
- Service management (start, stop, restart, status)
|
|
87
|
+
- Configuration management (get, set)
|
|
88
|
+
- Port discovery and management
|
|
89
|
+
- Metrics collection
|
|
90
|
+
- Backup and restore operations
|
|
91
|
+
- First-run setup
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
Additionally, the included TUI application as provided by app provides an interactive menu system for:
|
|
95
|
+
|
|
96
|
+
This provides an interactive menu system for:
|
|
97
|
+
- Viewing service status and metrics
|
|
98
|
+
- Managing service configurations
|
|
99
|
+
- Controlling service lifecycle
|
|
100
|
+
- Backup and data management
|
|
101
|
+
- Creating new service instances
|
|
102
|
+
|
|
65
103
|
## Installation
|
|
66
104
|
|
|
67
105
|
Install as a dependency in your project:
|
|
@@ -75,19 +113,19 @@ Or add to your `pyproject.toml`:
|
|
|
75
113
|
```toml
|
|
76
114
|
[project]
|
|
77
115
|
dependencies = [
|
|
78
|
-
"warlock-manager>=2.
|
|
116
|
+
"warlock-manager>=2.2.0",
|
|
79
117
|
]
|
|
80
118
|
```
|
|
81
119
|
|
|
82
120
|
Or to your `requirements.txt`:
|
|
83
121
|
|
|
84
122
|
```
|
|
85
|
-
warlock-manager>=2.
|
|
123
|
+
warlock-manager>=2.2.0
|
|
86
124
|
```
|
|
87
125
|
|
|
88
126
|
## Requirements
|
|
89
127
|
|
|
90
|
-
- Python 3.10+
|
|
128
|
+
- Python 3.10+ (3.11+ recommended)
|
|
91
129
|
- Dependencies:
|
|
92
130
|
- `requests>=2.28` - HTTP client library
|
|
93
131
|
- `pyyaml>=6.0` - YAML parsing
|
|
@@ -99,96 +137,11 @@ warlock-manager>=2.1.0
|
|
|
99
137
|
|
|
100
138
|
## Quick Start
|
|
101
139
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
For more detailed examples, check out the [Warlock Game Template](https://github.com/BitsNBytes25/Warlock-Game-Template)
|
|
140
|
+
For detailed examples, check out the [Warlock Game Template](https://github.com/BitsNBytes25/Warlock-Game-Template)
|
|
105
141
|
repository for a templated project you can fork and customize to quickly get started.
|
|
106
142
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
```python
|
|
110
|
-
from warlock_manager.apps import BaseApp
|
|
111
|
-
from warlock_manager.services import BaseService
|
|
112
|
-
|
|
113
|
-
class MyGameApp(BaseApp):
|
|
114
|
-
def __init__(self):
|
|
115
|
-
super().__init__()
|
|
116
|
-
self.name = 'mygame'
|
|
117
|
-
self.desc = 'My Game Server'
|
|
118
|
-
self.service_prefix = 'mygame-'
|
|
119
|
-
|
|
120
|
-
def get_app_directory(self) -> str:
|
|
121
|
-
return '/var/games/mygame'
|
|
122
|
-
|
|
123
|
-
def detect_services(self) -> list:
|
|
124
|
-
# Detect existing game services
|
|
125
|
-
return []
|
|
126
|
-
|
|
127
|
-
def create_service(self, name: str) -> BaseService:
|
|
128
|
-
# Create and return a new service instance
|
|
129
|
-
pass
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### Creating a Game Service Handler
|
|
133
|
-
|
|
134
|
-
Extend `BaseService` to implement service-specific logic:
|
|
135
|
-
|
|
136
|
-
```python
|
|
137
|
-
from warlock_manager.services import BaseService
|
|
138
|
-
from warlock_manager.config import IniConfig
|
|
139
|
-
|
|
140
|
-
class MyGameService(BaseService):
|
|
141
|
-
def __init__(self, service: str, game: BaseApp):
|
|
142
|
-
super().__init__(service, game)
|
|
143
|
-
|
|
144
|
-
# Configure configuration files
|
|
145
|
-
self.configs['game_config'] = IniConfig(
|
|
146
|
-
'/var/games/mygame/game.ini'
|
|
147
|
-
)
|
|
148
|
-
|
|
149
|
-
def get_port_definitions(self) -> list:
|
|
150
|
-
# Return list of port definitions: (port_number_or_config_key, 'tcp'/'udp', description)
|
|
151
|
-
return [
|
|
152
|
-
('game_port', 'tcp', 'Game Server Port'),
|
|
153
|
-
('query_port', 'udp', 'Query Port'),
|
|
154
|
-
]
|
|
155
|
-
|
|
156
|
-
def is_running(self) -> bool:
|
|
157
|
-
# Check if service is running
|
|
158
|
-
pass
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
### Building a CLI Application
|
|
162
|
-
|
|
163
|
-
Use the built-in CLI framework:
|
|
164
|
-
|
|
165
|
-
```python
|
|
166
|
-
from warlock_manager.libs.app_runner import app_runner
|
|
167
|
-
|
|
168
|
-
game = MyGameApp()
|
|
169
|
-
cli_app = app_runner(game)
|
|
170
|
-
|
|
171
|
-
if __name__ == '__main__':
|
|
172
|
-
cli_app()
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
This automatically provides commands for:
|
|
176
|
-
- Service management (start, stop, restart, status)
|
|
177
|
-
- Configuration management (get, set)
|
|
178
|
-
- Port discovery and management
|
|
179
|
-
- Metrics collection
|
|
180
|
-
- Backup and restore operations
|
|
181
|
-
- First-run setup
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
Additionally, the included TUI application as provided by app provides an interactive menu system for:
|
|
185
|
-
|
|
186
|
-
This provides an interactive menu system for:
|
|
187
|
-
- Viewing service status and metrics
|
|
188
|
-
- Managing service configurations
|
|
189
|
-
- Controlling service lifecycle
|
|
190
|
-
- Backup and data management
|
|
191
|
-
- Creating new service instances
|
|
143
|
+
Also check out the games listed as supported at [Warlock.Nexus](https://warlock.nexus)
|
|
144
|
+
to browse their source repos for more real-world implementations.
|
|
192
145
|
|
|
193
146
|
## Configuration
|
|
194
147
|
|
|
@@ -220,33 +173,6 @@ mygame:
|
|
|
220
173
|
group: Network
|
|
221
174
|
```
|
|
222
175
|
|
|
223
|
-
## Features System
|
|
224
|
-
|
|
225
|
-
Control available functionality through the features system:
|
|
226
|
-
|
|
227
|
-
```python
|
|
228
|
-
class MyGameApp(BaseApp):
|
|
229
|
-
def __init__(self):
|
|
230
|
-
super().__init__()
|
|
231
|
-
|
|
232
|
-
# Available features
|
|
233
|
-
self.features = {
|
|
234
|
-
'api', # Server API support
|
|
235
|
-
'cmd', # Command execution via API
|
|
236
|
-
'create_service', # Create new service instances
|
|
237
|
-
'mods', # Mod support
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
# Disable specific features
|
|
241
|
-
self.disabled_features = {'mods'}
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
Available features:
|
|
245
|
-
- `api` - Server API communication support
|
|
246
|
-
- `cmd` - Command execution capabilities
|
|
247
|
-
- `create_service` - Ability to create new service instances
|
|
248
|
-
- `mods` - Mod/plugin support
|
|
249
|
-
|
|
250
176
|
## Development
|
|
251
177
|
|
|
252
178
|
### Setting Up Development Environment
|
|
@@ -264,6 +190,14 @@ source venv/bin/activate
|
|
|
264
190
|
pip install -e ".[dev]"
|
|
265
191
|
```
|
|
266
192
|
|
|
193
|
+
### Generating Documentation
|
|
194
|
+
|
|
195
|
+
Documentation is generated using [pydoc-markdown](https://github.com/NiklasRosenstein/pydoc-markdown).
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
pydoc-markdown
|
|
199
|
+
```
|
|
200
|
+
|
|
267
201
|
### Running Tests
|
|
268
202
|
|
|
269
203
|
```bash
|
|
@@ -284,55 +218,6 @@ Run linting checks:
|
|
|
284
218
|
flake8 warlock_manager tests
|
|
285
219
|
```
|
|
286
220
|
|
|
287
|
-
## API Reference
|
|
288
|
-
|
|
289
|
-
### BaseApp
|
|
290
|
-
|
|
291
|
-
Main application class for game server management.
|
|
292
|
-
|
|
293
|
-
**Key Methods:**
|
|
294
|
-
- `detect_services()`: Discover existing service instances
|
|
295
|
-
- `create_service(name)`: Create a new service instance
|
|
296
|
-
- `get_services()`: Get list of service instances
|
|
297
|
-
- `get_options()`: Get application-level configuration options
|
|
298
|
-
- `get_option_value(key)`: Get a configuration option value
|
|
299
|
-
- `set_option(key, value)`: Set a configuration option
|
|
300
|
-
- `start_all()`: Start all service instances
|
|
301
|
-
- `stop_all()`: Stop all service instances
|
|
302
|
-
- `is_active()`: Check if any service is running
|
|
303
|
-
- `update()`: Update the application/game
|
|
304
|
-
|
|
305
|
-
### BaseService
|
|
306
|
-
|
|
307
|
-
Service instance handler for individual game servers.
|
|
308
|
-
|
|
309
|
-
**Key Methods:**
|
|
310
|
-
- `load()`: Load service configuration files
|
|
311
|
-
- `get_options()`: Get service configuration options
|
|
312
|
-
- `get_option_value(key)`: Get a configuration option
|
|
313
|
-
- `set_option(key, value)`: Set a configuration option
|
|
314
|
-
- `start()`: Start the service
|
|
315
|
-
- `stop()`: Stop the service
|
|
316
|
-
- `restart()`: Restart the service
|
|
317
|
-
- `is_running()`: Check if service is running
|
|
318
|
-
- `get_port()`: Get service's primary port
|
|
319
|
-
- `get_ports()`: Get all port definitions
|
|
320
|
-
- `is_enabled()`: Check if auto-start is enabled
|
|
321
|
-
- `cmd(command)`: Send command to service
|
|
322
|
-
- `get_player_count()`: Get current player count
|
|
323
|
-
- `get_player_max()`: Get max player capacity
|
|
324
|
-
- `backup()`: Create backup of service data
|
|
325
|
-
- `restore(backup_path)`: Restore from backup
|
|
326
|
-
|
|
327
|
-
### Configuration Classes
|
|
328
|
-
|
|
329
|
-
All configuration classes extend `BaseConfig` and provide:
|
|
330
|
-
- `load()`: Load configuration from file
|
|
331
|
-
- `save()`: Save configuration to file
|
|
332
|
-
- `get_option_value(key)`: Get option value
|
|
333
|
-
- `set_option_value(key, value)`: Set option value
|
|
334
|
-
- `exists()`: Check if configuration file exists
|
|
335
|
-
|
|
336
221
|
## License
|
|
337
222
|
|
|
338
223
|
This project is licensed under the GNU Affero General Public License v3.0 or later - see the [LICENSE](LICENSE) file for details.
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "warlock-manager"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.2.0"
|
|
8
8
|
description = "Dependency library for game-server management applications."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -17,13 +17,13 @@ maintainers = [
|
|
|
17
17
|
]
|
|
18
18
|
keywords = ["game-server", "management"]
|
|
19
19
|
dependencies = [
|
|
20
|
-
"requests>=2.
|
|
20
|
+
"requests>=2.33.1",
|
|
21
21
|
"pyyaml>=6.0",
|
|
22
22
|
"typer>=0.24.1",
|
|
23
23
|
"rcon>=2.4.9",
|
|
24
|
-
"typing_extensions>=4.
|
|
24
|
+
"typing_extensions>=4.15.0",
|
|
25
25
|
"systemdunitparser>=0.4",
|
|
26
|
-
"packaging>=
|
|
26
|
+
"packaging>=26.1",
|
|
27
27
|
"psutil>=7.2.0",
|
|
28
28
|
]
|
|
29
29
|
classifiers = [
|
|
@@ -45,12 +45,24 @@ dev = [
|
|
|
45
45
|
"flake8>=7.3.0",
|
|
46
46
|
"pre-commit>=4.5.1",
|
|
47
47
|
"pytest-cov>=7.0",
|
|
48
|
+
"pydoc-markdown>=4.8.0"
|
|
48
49
|
]
|
|
49
50
|
|
|
50
51
|
[tool.setuptools.packages.find]
|
|
51
52
|
where = ["."]
|
|
52
53
|
include = ["warlock_manager*"]
|
|
53
54
|
|
|
55
|
+
[[tool.pydoc-markdown.loaders]]
|
|
56
|
+
type = "python"
|
|
57
|
+
search_path = ["warlock_manager"]
|
|
58
|
+
|
|
59
|
+
[tool.pydoc-markdown.renderer]
|
|
60
|
+
type = "markdown"
|
|
61
|
+
render_toc = false
|
|
62
|
+
insert_header_anchors = false
|
|
63
|
+
filename = "docs/warlock-manager.md"
|
|
64
|
+
render_module_header = false
|
|
65
|
+
|
|
54
66
|
[project.urls]
|
|
55
67
|
"Bug Tracker" = "https://github.com/BitsNBytes25/Warlock-Manager/issues"
|
|
56
68
|
"Homepage" = "https://warlock.nexus"
|
|
@@ -75,6 +75,7 @@ class TestVersionBooleanComparisons(unittest.TestCase):
|
|
|
75
75
|
self.assertFalse(is_version_newer("1.0.0", "2.0.0"))
|
|
76
76
|
self.assertTrue(is_version_newer("2.0.0", "1.0.0"))
|
|
77
77
|
self.assertFalse(is_version_newer("1.0.0", "1.0.0"))
|
|
78
|
+
self.assertFalse(is_version_newer("21.11.153", "25.1.154"))
|
|
78
79
|
|
|
79
80
|
def test_is_version_older(self):
|
|
80
81
|
self.assertFalse(is_version_older("2.0.0", "1.0.0"))
|