-
Notifications
You must be signed in to change notification settings - Fork 4
/
AstroTuxLauncher.py
616 lines (476 loc) · 26 KB
/
AstroTuxLauncher.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
#!/usr/bin/python3
import os
from os import path
import argparse
import json
import tomli, tomli_w
import dataclasses
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, config
from typing import Optional, List
from utils.misc import ExcludeIfNone, read_build_version, LAUNCHER_VERSION, CONTROL_CODES_SUPPORTED
from utils.termutils import set_window_title
from enum import Enum
from pansi import ansi
import utils.interface as interface
import logging
import sys
from queue import Queue
import shutil
from utils import steam
from utils.net import get_request
from packaging import version
import astro.playfab as playfab
from astro.dedicatedserver import AstroDedicatedServer, ServerStatus
import utils.net as net
import signal
import subprocess
import time
import traceback
"""
Code based on https://github.com/ricky-davis/AstroLauncher
"""
LOGGER = logging.getLogger("Launcher")
BANNER_LOGO = f"""{ansi.weight.bold}
{ansi.BLUE}___ __ {ansi.YELLOW}______
{ansi.BLUE}/ | _____/ /__________{ansi.YELLOW}/_ __/_ ___ __
{ansi.BLUE}/ /| | / ___/ __/ ___/ __ \\{ansi.YELLOW}/ / / / / / |/_/
{ansi.BLUE}/ ___ |(__ ) /_/ / / /_/ {ansi.YELLOW}/ / / /_/ /> <
{ansi.BLUE}/_/ |_/____/\\__/_/ \\____{ansi.YELLOW}/_/ \\__,_/_/|_| {ansi.reset}
"""
BANNER_SUBTITLE = "L a u n c h e r".center(45)
BANNER_TEXT="Unofficial Astroneer Dedicated Server Launcher for Linux"
#
# Constants
#
NAME = "AstroTuxLauncher"
HELP_COMMAND = f"""What {NAME} should do
- install: Installs the Astroneer Dedicated Server using steamcmd
- start: Starts the installed dedicated server
- update: Updates the Astroneer Dedicated Server using steamcmd
"""
DEPOTDL_PATH = "libs/depotdownloader"
DS_EXECUTABLE = "AstroServer.exe"
ASTRO_SERVER_STATS_URL = "https://astroservercheck.joejoetv.de/api/stats"
class LauncherCommand(Enum):
""" Represents the command passed to the launcher """
START = "start"
INSTALL = "install"
UPDATE = "update"
#
# Configuration classes
#
class NotificationMethod(Enum):
""" Represents, which notification method should be used """
NONE = ""
NTFY = "ntfy"
DISCORD = "discord"
@dataclass
class DiscordConfig:
webhookURL: str = None
@dataclass
class NTFYConfig:
topic: str = None
serverURL: str = "https://ntfy.sh"
@dataclass
class NotificationConfig:
method: NotificationMethod = NotificationMethod.NONE
name: str = "Astroneer Dedicated Server"
EventWhitelist: List[interface.EventType] = field(default_factory=lambda: [e for e in interface.EventType])
discord: Optional[DiscordConfig] = field(metadata=config(exclude=ExcludeIfNone), default=None)
ntfy: Optional[NTFYConfig] = field(metadata=config(exclude=ExcludeIfNone), default=None)
@dataclass
class StatusConfig:
SendStatus: bool = False # Wether to send status updates
Interval: int = 120 # Interval in which to send status updates
EndpointURL: str = "" # URL to send status updates as GET requests to
@dataclass_json
@dataclass
class LauncherConfig:
AutoUpdateServer: bool = True # Wether to automatically install/update the Astroneer DS at start if update is available
CheckNetwork: bool = True # Wether to perform a network check before starting the Astroneer DS
OverwritePublicIP: bool = False # Wether to overwrite the PublicIP DS config option with the fetched public IP
# Settings related to notifications
notifications: NotificationConfig = field(default_factory=NotificationConfig) # Configuration for notifications
# Settings related to sending status updates
status: StatusConfig = field(default_factory=StatusConfig)
LogDebugMessages: bool = False # Wether the the console and log file should include log messages with level logging.DEBUG
AstroServerPath: str = "AstroneerServer" # The path, where the Astroneer DS installation should reside
OverrideWinePath: Optional[str] = field(metadata=config(exclude=ExcludeIfNone), default=None) # Path to wine executable, only used, if set
WinePrefixPath: str = "winepfx" # The path, where the Wine prefix should be stored
LogPath: str = "logs" # The path where logs should be saved
PlayfabAPIInterval: int = 2 # Time to wait between Playfab API requests
ServerStatusInterval: float = 3 # Time to wait between Server Status checks
DisableEncryption: bool = True # Wether to disable encryption for the Astroneer DS. CURRENTLY REQUIRED TO BE "True" FOR HOSTING ON LINUX
@staticmethod
def ensure_toml_config(config_path):
"""
Reads the launcher configuration and fist creates the config file if not present, populated with the default values
"""
config = None
if path.exists(config_path):
# If config file exists, read it into a config object
if not path.isfile(config_path):
raise ValueError("Specified config path doesn't point to a file!")
with open(config_path, "rb") as tf:
toml_dict = tomli.load(tf)
# If no "launcher" section is present in the file, create it as empty
if not ("launcher" in toml_dict.keys()):
toml_dict = {"launcher": {}}
config = LauncherConfig.from_dict(toml_dict["launcher"])
else:
# If config file is not present, create directories and default config
if not path.exists(path.dirname(config_path)):
os.makedirs(path.dirname(config_path))
config = LauncherConfig()
# Write config back to file to add missing entried and remove superflous ones
# In the case of the file not existing prior, it will be created
config_dict = {"launcher": config.to_dict(encode_json=True)}
with open(config_path, "wb") as tf:
tomli_w.dump(config_dict, tf)
return config
class AstroTuxLauncher():
def __init__(self, config_path, astro_path, depotdl_exec, force_debug_log=False):
self.dedicatedserver = None
self.status_thread = None
# Setup basic logging
interface.LauncherLogging.prepare()
interface.LauncherLogging.setup_console()
try:
self.config_path = path.abspath(config_path)
LOGGER.info(f"Configuration file path: {self.config_path}")
self.config = LauncherConfig.ensure_toml_config(self.config_path)
except Exception as e:
LOGGER.error(f"Error while loading config file ({type(e).__name__}): {str(e)}")
LOGGER.error(f"Please check the config path parameter and/or config file")
self.exit()
# If cli parameter is specified, it overrides the config value
if not (astro_path is None):
self.config = dataclasses.replace(self.config, AstroServerPath=astro_path)
# If flag was passed, overrule config option
if force_debug_log:
self.config.LogDebugMessages = True
# Make sure we use absolute paths
self.config.AstroServerPath = path.abspath(self.config.AstroServerPath)
self.config.WinePrefixPath = path.abspath(self.config.WinePrefixPath)
self.config.LogPath = path.abspath(self.config.LogPath)
# Apply wine path override if possible and check that is exists
self.wineexec = shutil.which("wine")
self.wineserverexec = shutil.which("wineserver")
if self.config.OverrideWinePath is not None and path.isfile(self.config.OverrideWinePath):
self.wineexec = path.abspath(self.config.OverrideWinePath)
self.wineserverexec = path.join(path.dirname(self.wineexec), "wineserver")
if (self.wineexec is None) or (self.wineserverexec is None):
LOGGER.error("Wine (or Wineserver) executable not found!")
LOGGER.error("Make sure that you have wine installed and accessible")
LOGGER.error("or set 'OverrideWinePath' config option to the path of the wine executable")
self.exit()
# Finish setting up logging
interface.LauncherLogging.set_log_debug(self.config.LogDebugMessages)
interface.LauncherLogging.setup_logfile(self.config.LogPath)
self.launcherPath = os.getcwd()
self.depotdl_path = None
# If argument is given, file has to exist
if depotdl_exec:
# If {depotdl_exec} is a command, get full path
wpath = shutil.which(depotdl_exec)
if wpath is not None:
depotdl_exec = wpath
if path.isfile(depotdl_exec):
self.depotdl_path = path.abspath(depotdl_exec)
LOGGER.info(f"DepotDownloader path overridden: {self.depotdl_path}")
else:
LOGGER.warning("The given DepotDownloader path doesn't point to a file, using default path")
# If argument is not given, default path is used and may not exists yet, so create directories
if self.depotdl_path is None:
self.depotdl_path = path.abspath(DEPOTDL_PATH)
os.makedirs(path.dirname(self.depotdl_path), exist_ok=True)
# Log some information about loaded paths, configs, etc.
LOGGER.info(f"Working directory: {self.launcherPath}")
LOGGER.debug(f"Launcher configuration (including overrides):\n{json.dumps(self.config.to_dict(encode_json=True), indent=4)}")
# Initialize console command parser
self.console_parser = interface.ConsoleParser()
self.cmd_queue = Queue()
# Initialize Input Thread to handle console input later. Don't start thread just yet
self.input_thread = interface.KeyboardThread(self.on_input, True)
# Initialize thread for sending status updates to endpoint
self.status_thread = interface.StatusUpdaterThread(self.config.status.EndpointURL, timeout=self.config.status.Interval, status=False)
# Initialize notification objects
self.notifications = interface.NotificationManager()
self.notifications.add_handler(interface.LoggingNotificationHandler())
if self.config.notifications.method == NotificationMethod.DISCORD:
if self.config.notifications.discord.webhookURL:
self.notifications.add_handler(interface.DiscordNotificationHandler(self.config.notifications.discord.webhookURL, name=self.config.notifications.name, event_whitelist=set(self.config.notifications.EventWhitelist)))
else:
LOGGER.warning("Discord Webhook URL is not set in config, not sending Discord notifications")
elif self.config.notifications.method == NotificationMethod.NTFY:
if self.config.notifications.ntfy.topic:
self.notifications.add_handler(interface.NTFYNotificationHandler(self.config.notifications.ntfy.topic, ntfy_url=self.config.notifications.ntfy.serverURL, name=self.config.notifications.name, event_whitelist=set(self.config.notifications.EventWhitelist)))
else:
LOGGER.warning("ntfy topic is not set in config, not sending ntfy notifications")
# Create Dedicated Server object
self.dedicatedserver = AstroDedicatedServer(self)
def check_ds_executable(self):
""" Checks is Astroneer DS executable exists and is a file """
execpath = os.path.join(self.config.AstroServerPath, DS_EXECUTABLE)
return os.path.exists(execpath) and os.path.isfile(execpath)
def on_input(self, input_string):
""" Callback method to handle console input """
# Parse console input
success, result = self.console_parser.parse_input(input_string)
if success:
if result["cmd"] == interface.ConsoleParser.Command.HELP:
# If it's a help command, we don't need to add it to the command queue as there is nothing to be done
LOGGER.info(result["message"])
else:
# Add any other command to the command queue to be processed later
self.cmd_queue.put(result)
else:
# If an error occured, {result} is just a message, so log it to console
# We send event for command first, when it's processed
LOGGER.warning(result)
def update_wine_prefix(self):
"""
Creates/updated the WINE prefix
"""
LOGGER.debug("Ensuring WINE prefix is setup...")
cmd = [self.wineexec, "wineboot"]
env = os.environ.copy()
# Remove DISPLAY environment variable to stop wine from creating a window
if "DISPLAY" in env:
del env["DISPLAY"]
env["WINEPREFIX"] = self.config.WinePrefixPath
env["WINEDEBUG"] = "-all"
LOGGER.debug(f"Executing command '{' '.join(cmd)}' in WINE prefix '{self.config.WinePrefixPath}'...")
try:
wineprocess = subprocess.Popen(cmd, env=env, cwd=self.config.AstroServerPath, stderr=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)
code = wineprocess.wait(timeout=30)
except TimeoutError:
LOGGER.debug("Wine process took longer than 30 seconds, aborting")
return False
except Exception as e:
LOGGER.error(f"Error occured during updating of wine prefix: {str(e)}")
return False
return code == 0
def check_network_config(self):
if not self.dedicatedserver:
raise ValueError("Dedcated Server has to be created first")
LOGGER.info("Checking Network Configuration...")
# Check if server port is reachable from local network over UDP
server_local_reachable = net.net_test_local(self.dedicatedserver.ds_config.PublicIP, self.dedicatedserver.engine_config.Port, False)
# Check if server post is reachable from internet over UDP
server_nonlocal_reachable = net.net_test_nonlocal(self.dedicatedserver.ds_config.PublicIP, self.dedicatedserver.engine_config.Port)
test_res = (server_local_reachable, server_nonlocal_reachable)
if test_res == (True, True):
LOGGER.info("Network configuration looks good")
elif test_res == (False, True):
LOGGER.warning("The Server is not accessible from the local network")
LOGGER.warning("This usually indicates an issue with NAT Loopback")
elif test_res == (True, False):
LOGGER.warning("The server can be reached locally, but not from outside of the local network")
LOGGER.warning(f"Make sure the Server Port ({self.dedicatedserver.engine_config.Port}) is forwarded for UDP traffic")
elif test_res == (False, False):
LOGGER.warning("The Server is completely unreachable")
LOGGER.warning(f"Make sure the Server Port ({self.dedicatedserver.engine_config.Port}) is forwarded for UDP traffic and check firewall settings")
rcon_local_blocked = not net.net_test_local(self.dedicatedserver.ds_config.PublicIP, self.dedicatedserver.ds_config.ConsolePort, True)
if rcon_local_blocked:
LOGGER.info("RCON network configuration looks good")
else:
LOGGER.warning(f"SECURITY ALERT: The RCON Port ({self.dedicatedserver.ds_config.ConsolePort}) is accessible from outside")
LOGGER.warning("SECURITY ALERT: This potentially allows access to the Remote Console from outside your network")
LOGGER.warning("SECURITY ALERT: Disable this ASAP to prevent issues")
# kept from AstroLauncher
time.sleep(5)
def update_server(self):
"""
Installs/Updates the Astroneer Dedicated Server.
Also ensures that DepotDownloader is present
"""
# If DepotDownloader executable doesn't exists yet, download it
if not path.exists(self.depotdl_path):
LOGGER.info("DepotDownloader not found, downloading...")
steam.dl_depotdownloader(path.dirname(self.depotdl_path), path.basename(self.depotdl_path))
LOGGER.info("Updating Astroneer Dedicated Server app from Steam...")
success = steam.update_app(exec_path=self.depotdl_path, app="728470", os="windows", directory=self.config.AstroServerPath)
self.buildversion = read_build_version(self.config.AstroServerPath)
if success and (self.buildversion is not None):
LOGGER.info(f"Sucessfully updated Astroneer Dedicated Server to version {self.buildversion}")
else:
LOGGER.error("Error while updating Astroneer Dedicated Server")
def check_server_update(self, force_update=False):
"""
Checks if an update for the Astroneer Dedicated Server is available or if it needs to be installed.
Also performs update if set in config or {force_update} is set to True
"""
oldversion = read_build_version(self.config.AstroServerPath)
do_update = False
installed = True
if (oldversion is None) or not self.check_ds_executable():
# No version is present yet or executable not present, we need an update/installation
LOGGER.warning("Astroneer Dedicated Server is not installed yet")
do_update = True
installed = False
else:
# Get current server version from Spycibot endpoint
try:
data = json.load(get_request(ASTRO_SERVER_STATS_URL))
newversion = data["stats"]["latestVersion"]
if version.parse(newversion) > version.parse(oldversion):
LOGGER.warning(f"Astroneer Dedicated Server update available ({oldversion} -> {newversion})")
do_update = True
except Exception as e:
LOGGER.error(f"Error occured while checking for newest version: {str(e)}")
LOGGER.warning(f"Trying server update blindly...")
do_update = True
if do_update:
if self.config.AutoUpdateServer:
if installed:
LOGGER.info("Automatically updating Astroneer Dedicated Server...")
else:
LOGGER.info("Automatically installing Astroneer Dedicated Server...")
if self.config.AutoUpdateServer or force_update:
self.update_server()
else:
LOGGER.info("Not installing/updating automatically")
else:
if force_update:
LOGGER.info("Noting to do")
else:
LOGGER.info("No update available, the Astroneer Dedicated Server is on the newest version")
def start_server(self):
"""
Starts the Astroneer Dedicated Server after setting up environment
"""
# Check for and install DS update if wanted
self.check_server_update()
# If Playfab API can't be reached, we can't continue
if not playfab.check_api_health():
LOGGER.error("Playfab API is unavailable. Are you connected to the internet?")
self.exit(reason="Playfab API unavailable")
# Make sure wine prefix is ready
if not self.update_wine_prefix():
self.exit(reason="Error while updating WINE prefix")
# Check that ports are available for the Server and RCON
if not self.dedicatedserver.check_ports_free():
self.exit(reason="Port not available")
# Check netowrk configuration
if self.config.CheckNetwork:
self.check_network_config()
LOGGER.debug("Starting input thread...")
self.input_thread.start()
# Prepare and start dedicated server
try:
if not self.dedicatedserver.start():
return
except Exception as e:
LOGGER.error(f"There as an error while starting the Dedicated Server: {str(e)}")
self.exit(reason="Error while starting Dedicated Server")
LOGGER.info("Enter 'help' to get help about command usage")
self.status_thread.update_status(status=True, message="Server is running")
# If sending of status updates is enabled, start thread
if self.config.status.SendStatus:
LOGGER.info("Sending of status updates is enabled")
self.status_thread.start()
# Run Server Loop
LOGGER.debug("Starting server loop...")
self.dedicatedserver.server_loop()
def user_exit(self, signal, frame):
""" Callback for when user requests to exit the application """
self.exit(graceful=True, reason="Received SIGINT signal")
def exit(self, graceful=False, reason=None):
if graceful:
if reason:
LOGGER.info(f"Quitting gracefully... (Reason: {reason})")
else:
LOGGER.info("Quitting gracefully...")
if self.dedicatedserver and self.dedicatedserver.status in [ServerStatus.RUNNING, ServerStatus.STARTING]:
# If no RCON is connected while running or starting, simply kill server
if not self.dedicatedserver.rcon.connected:
self.dedicatedserver.kill()
return
# If server is running, simply shut it down and return to let it finish normally
LOGGER.debug("Shutting down Dedicated Server before quitting...")
self.dedicatedserver.shutdown()
return
else:
# If no server is running, exit directly
LOGGER.info("Goodbye!")
LOGGER.debug("Quitting with exit code 0...")
sys.exit(0)
else:
if reason:
LOGGER.info(f"Quitting... (Reason: {reason})")
else:
LOGGER.info("Quitting...")
# Kill server if it's running or not
if self.dedicatedserver:
self.dedicatedserver.kill()
# Give short time to send status update
if self.status_thread:
self.status_thread.update_status(status=False, message="Server was forcibly closed")
time.sleep(0.1)
sys.exit(1)
if __name__ == "__main__":
# Exit directly, if python version below 3.9 is discovered
if (sys.version_info.major < 3) or ((sys.version_info.major == 3) and (sys.version_info.minor < 9)):
print()
print("ERROR: AstroTuxLauncher needs at least Python 3.9 to run properly!")
print(f" You are currently running version {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}.")
print()
sys.exit(1)
# Parse command line arguments
parser = argparse.ArgumentParser()
parser.add_argument("command", type=LauncherCommand, action=interface.EnumStoreAction, help=HELP_COMMAND)
parser.add_argument("-c", "--config_path", help="The location of the configuration file (default: %(default)s)", type=str, dest="config_path", default="launcher.toml")
parser.add_argument("-p", "--astro_path", help="The path of the Astroneer Dedicated Server installation (default: %(default)s)", dest="astro_path", default=None)
parser.add_argument("-d", "--depotdl_exec", help="The path to anm existing depotdownloader executable (default: %(default)s)", dest="depotdl_exec", default=None)
parser.add_argument("-l", "--log_debug", help="Also log debug messages (Overrules config option)", action='store_true', dest="log_debug", default=False)
args = parser.parse_args()
# Set terminal window title
if CONTROL_CODES_SUPPORTED is None:
set_window_title(f"{NAME} - Unofficial Astroneer Dedicated Server Launcher for Linux")
# Print Banner
print(BANNER_LOGO, end="")
print(BANNER_SUBTITLE)
print("")
print(BANNER_TEXT)
print(f"v{LAUNCHER_VERSION}")
print("")
try:
launcher = AstroTuxLauncher(args.config_path, args.astro_path, args.depotdl_exec, force_debug_log=args.log_debug)
except KeyboardInterrupt:
print("Quitting... (requested by user)")
sys.exit(0)
except Exception as e:
print(f"Error while initializing launcher on line {sys.exc_info()[-1].tb_lineno}: {type(e).__name__}: {e}")
print(traceback.format_exc())
print("Quitting...")
sys.exit(1)
signal.signal(signal.SIGINT, launcher.user_exit)
if CONTROL_CODES_SUPPORTED == False:
LOGGER.debug("ANSI escape codes except color codes are disabled")
LOGGER.debug(f"CLI Command: {args.command.value}")
if args.command == LauncherCommand.INSTALL:
LOGGER.info("Installing Astroneer Dedicated Server...")
try:
launcher.update_server()
except Exception as e:
LOGGER.critical(f"Error while installing server on line {sys.exc_info()[-1].tb_lineno}: {type(e).__name__}: {e}")
LOGGER.error(traceback.format_exc())
sys.exit(1)
elif args.command == LauncherCommand.UPDATE:
LOGGER.info("Checking for available updates to the Astroneer Dedicated Server...")
try:
launcher.check_server_update(force_update=True)
except Exception as e:
LOGGER.critical(f"Error while updating server on line {sys.exc_info()[-1].tb_lineno}: {type(e).__name__}: {e}")
LOGGER.error(traceback.format_exc())
sys.exit(1)
elif args.command == LauncherCommand.START:
try:
launcher.start_server()
except Exception as e:
if launcher.dedicatedserver:
launcher.dedicatedserver.kill()
raise
LOGGER.info("Goodbye!")