mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
fixed crash detection / auto start checkboxes - found huge issue with crash detection. putting on bug list for later
This commit is contained in:
parent
568e1e8f41
commit
d7fabb3da8
@ -235,6 +235,7 @@ class Server:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
running = psutil.pid_exists(self.PID)
|
running = psutil.pid_exists(self.PID)
|
||||||
|
logger.info("Checking if PID: {} is running".format(self.PID))
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Unable to find if server PID exists: {}".format(self.PID))
|
logger.error("Unable to find if server PID exists: {}".format(self.PID))
|
||||||
|
@ -113,10 +113,10 @@ class PanelHandler(BaseHandler):
|
|||||||
executable = self.get_argument('executable', None)
|
executable = self.get_argument('executable', None)
|
||||||
execution_command = self.get_argument('execution_command', None)
|
execution_command = self.get_argument('execution_command', None)
|
||||||
stop_command = self.get_argument('stop_command', None)
|
stop_command = self.get_argument('stop_command', None)
|
||||||
auto_start_delay = self.get_argument('auto_start_delay', None)
|
auto_start_delay = self.get_argument('auto_start_delay', '10')
|
||||||
server_port = self.get_argument('server_port', None)
|
server_port = self.get_argument('server_port', None)
|
||||||
auto_start = self.get_argument('auto_start', '0')
|
auto_start = int(float(self.get_argument('auto_start', '0')))
|
||||||
crash_detection = self.get_argument('crash_detection', '0')
|
crash_detection = int(float(self.get_argument('crash_detection', '0')))
|
||||||
subpage = self.get_argument('subpage', None)
|
subpage = self.get_argument('subpage', None)
|
||||||
|
|
||||||
if server_id is None:
|
if server_id is None:
|
||||||
@ -143,4 +143,11 @@ class PanelHandler(BaseHandler):
|
|||||||
Servers.crash_detection: crash_detection,
|
Servers.crash_detection: crash_detection,
|
||||||
}).where(Servers.server_id == server_id).execute()
|
}).where(Servers.server_id == server_id).execute()
|
||||||
|
|
||||||
|
user_data = json.loads(self.get_secure_cookie("user_data"))
|
||||||
|
|
||||||
|
db_helper.add_to_audit_log(user_data['user_id'],
|
||||||
|
"Edited server {} named {}".format(server_id, server_name),
|
||||||
|
server_id,
|
||||||
|
self.get_remote_ip())
|
||||||
|
|
||||||
self.redirect("/panel/server_detail?id={}&subpage=config".format(server_id))
|
self.redirect("/panel/server_detail?id={}&subpage=config".format(server_id))
|
||||||
|
@ -62,109 +62,118 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6 col-sm-12">
|
<div class="col-md-6 col-sm-12">
|
||||||
<form class="forms-sample" method="post" action="/panel/server_detail">
|
<form class="forms-sample" method="post" action="/panel/server_detail">
|
||||||
{% raw xsrf_form_html() %}
|
{% raw xsrf_form_html() %}
|
||||||
<input type="hidden" name="id" value="{{ data['server_stats'][0]['server_id']['server_id'] }}">
|
<input type="hidden" name="id" value="{{ data['server_stats'][0]['server_id']['server_id'] }}">
|
||||||
<input type="hidden" name="subpage" value="config">
|
<input type="hidden" name="subpage" value="config">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="server_name">Server Name <small class="text-muted ml-1"> - What you wish to call this server</small> </label>
|
<label for="server_name">Server Name <small class="text-muted ml-1"> - What you wish to call this server</small> </label>
|
||||||
<input type="text" class="form-control" name="server_name" id="server_name" value="{{ data['server_stats'][0]['server_id']['server_name'] }}" placeholder="Server Name" >
|
<input type="text" class="form-control" name="server_name" id="server_name" value="{{ data['server_stats'][0]['server_id']['server_name'] }}" placeholder="Server Name" >
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="server_path">Server Path <small class="text-muted ml-1"> - Absolute full path (not including executable)</small> </label>
|
<label for="server_path">Server Path <small class="text-muted ml-1"> - Absolute full path (not including executable)</small> </label>
|
||||||
<input type="text" class="form-control" name="server_path" id="server_path" value="{{ data['server_stats'][0]['server_id']['path'] }}" placeholder="Server Path" >
|
<input type="text" class="form-control" name="server_path" id="server_path" value="{{ data['server_stats'][0]['server_id']['path'] }}" placeholder="Server Path" >
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="log_path">Server Log Location <small class="text-muted ml-1"> - Absolute full path to the log file</small> </label>
|
<label for="log_path">Server Log Location <small class="text-muted ml-1"> - Absolute full path to the log file</small> </label>
|
||||||
<input type="text" class="form-control" name="log_path" id="log_path" value="{{ data['server_stats'][0]['server_id']['log_path'] }}" placeholder="Server Log" >
|
<input type="text" class="form-control" name="log_path" id="log_path" value="{{ data['server_stats'][0]['server_id']['log_path'] }}" placeholder="Server Log" >
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="executable">Server Executable <small class="text-muted ml-1"> - Just the executable file</small> </label>
|
<label for="executable">Server Executable <small class="text-muted ml-1"> - Just the executable file</small> </label>
|
||||||
<input type="text" class="form-control" name="executable" id="executable" value="{{ data['server_stats'][0]['server_id']['executable'] }}" placeholder="Server Executable" >
|
<input type="text" class="form-control" name="executable" id="executable" value="{{ data['server_stats'][0]['server_id']['executable'] }}" placeholder="Server Executable" >
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="execution_command">Server Execution Command <small class="text-muted ml-1"> - What will be launched in a hidden terminal</small> </label>
|
<label for="execution_command">Server Execution Command <small class="text-muted ml-1"> - What will be launched in a hidden terminal</small> </label>
|
||||||
<input type="text" class="form-control" name="execution_command" id="execution_command" value="{{ data['server_stats'][0]['server_id']['execution_command'] }}" placeholder="Server Execution Command" >
|
<input type="text" class="form-control" name="execution_command" id="execution_command" value="{{ data['server_stats'][0]['server_id']['execution_command'] }}" placeholder="Server Execution Command" >
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="stop_command">Server Stop Command <small class="text-muted ml-1"> - Command to send the program to stop it</small> </label>
|
<label for="stop_command">Server Stop Command <small class="text-muted ml-1"> - Command to send the program to stop it</small> </label>
|
||||||
<input type="text" class="form-control" name="stop_command" id="stop_command" value="{{ data['server_stats'][0]['server_id']['stop_command'] }}" placeholder="Server Stop Command" >
|
<input type="text" class="form-control" name="stop_command" id="stop_command" value="{{ data['server_stats'][0]['server_id']['stop_command'] }}" placeholder="Server Stop Command" >
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="auto_start_delay">Server Autostart Delay <small class="text-muted ml-1"> - Delay before auto starting (if enabled below)</small> </label>
|
<label for="auto_start_delay">Server Autostart Delay <small class="text-muted ml-1"> - Delay before auto starting (if enabled below)</small> </label>
|
||||||
<input type="number" class="form-control" name="auto_start_delay" id="auto_start_delay" value="{{ data['server_stats'][0]['server_id']['auto_start_delay'] }}" step="1" max="999" min="10" >
|
<input type="number" class="form-control" name="auto_start_delay" id="auto_start_delay" value="{{ data['server_stats'][0]['server_id']['auto_start_delay'] }}" step="1" max="999" min="10" >
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="server_port">Server Port <small class="text-muted ml-1"> - Port crafty should connect to for stats</small> </label>
|
<label for="server_port">Server Port <small class="text-muted ml-1"> - Port crafty should connect to for stats</small> </label>
|
||||||
<input type="number" class="form-control" name="server_port" id="server_port" value="{{ data['server_stats'][0]['server_id']['server_port'] }}" step="1" max="65566" min="1" >
|
<input type="number" class="form-control" name="server_port" id="server_port" value="{{ data['server_stats'][0]['server_id']['server_port'] }}" step="1" max="65566" min="1" >
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-check-flat">
|
<div class="form-check-flat">
|
||||||
<label for="auto_start" class="form-check-label ml-4 mb-4">
|
<label for="auto_start" class="form-check-label ml-4 mb-4">
|
||||||
{% if data['server_stats'][0]['server_id']['auto_start'] %}
|
{% if data['server_stats'][0]['server_id']['auto_start'] %}
|
||||||
<input type="checkbox" class="form-check-input" id="auto_start" name="auto_start" checked="" >Server Auto Start
|
<input type="checkbox" class="form-check-input" id="auto_start" name="auto_start" checked="" value="1">Server Auto Start
|
||||||
{% else %}
|
{% else %}
|
||||||
<input type="checkbox" class="form-check-input" id="auto_start" name="auto_start" >Server Auto Start
|
<input type="checkbox" class="form-check-input" id="auto_start" name="auto_start" value="1">Server Auto Start
|
||||||
{% end %}
|
{% end %}
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label for="crash_detection" class="form-check-label ml-4 mb-4">
|
<label for="crash_detection" class="form-check-label ml-4 mb-4">
|
||||||
{% if data['server_stats'][0]['server_id']['auto_start'] %}
|
{% if data['server_stats'][0]['server_id']['crash_detection'] %}
|
||||||
<input type="checkbox" class="form-check-input" id="crash_detection" name="crash_detection" checked="" >Server Crash Detection
|
<input type="checkbox" class="form-check-input" id="crash_detection" name="crash_detection" checked="" value="1">Server Crash Detection
|
||||||
{% else %}
|
{% else %}
|
||||||
<input type="checkbox" class="form-check-input" id="crash_detection" name="crash_detection" >Server Crash Detection
|
<input type="checkbox" class="form-check-input" id="crash_detection" name="crash_detection" value="1" >Server Crash Detection
|
||||||
{% end %}
|
{% end %}
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="submit" class="btn btn-success mr-2">Submit</button>
|
<button type="submit" class="btn btn-success mr-2">Save</button>
|
||||||
<button type="reset" class="btn btn-light">Cancel</button>
|
<button type="reset" class="btn btn-light">Cancel</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-6 col-sm-12">
|
<div class="col-md-6 col-sm-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h4 class="card-title">Server Config Area</h4>
|
<h4 class="card-title">Server Config Area</h4>
|
||||||
<p class="card-description"> Here is where you can change the configuration of your server</p>
|
<p class="card-description"> Here is where you can change the configuration of your server</p>
|
||||||
<blockquote class="blockquote">
|
<blockquote class="blockquote">
|
||||||
<p class="mb-0">
|
<p class="mb-0">
|
||||||
It is recommended to <code>NOT</code> change the paths of a server managed by Crafty.
|
It is recommended to <code>NOT</code> change the paths of a server managed by Crafty.
|
||||||
Changing paths <code>CAN</code> break things, especially on Linux type operating systems where
|
Changing paths <code>CAN</code> break things, especially on Linux type operating systems where
|
||||||
file permissions are more locked down.
|
file permissions are more locked down.
|
||||||
<br /><br/>
|
<br /><br/>
|
||||||
If you feel you have to change a where a server is located
|
If you feel you have to change a where a server is located
|
||||||
you may do so as long as you give the "Crafty" user permission to read / write to the server path.
|
you may do so as long as you give the "Crafty" user permission to read / write to the server path.
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
On Linux this is best done by executing the following:<br />
|
On Linux this is best done by executing the following:<br />
|
||||||
<code>
|
<code>
|
||||||
sudo chown crafty:crafty /path/to/your/server -R<br />
|
sudo chown crafty:crafty /path/to/your/server -R<br />
|
||||||
sudo chmod 2775 /path/to/your/server -R<br />
|
sudo chmod 2775 /path/to/your/server -R<br />
|
||||||
</code>
|
</code>
|
||||||
|
</p>
|
||||||
</p>
|
</blockquote>
|
||||||
</blockquote>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="text-center">
|
||||||
|
{% if data['server_stats'][0]['running'] %}
|
||||||
|
<a href="/panel/command" class="btn btn-sm btn-danger disabled">Delete Server</a><br />
|
||||||
|
<small>Please stop the server before deleting it</small>
|
||||||
|
{% else %}
|
||||||
|
<a class="btn btn-sm btn-danger">Delete Server</a>
|
||||||
|
{% end %}
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- content-wrapper ends -->
|
<!-- content-wrapper ends -->
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
"cookie_secret": "random",
|
"cookie_secret": "random",
|
||||||
"show_errors": true,
|
"show_errors": true,
|
||||||
"history_max_age": 7,
|
"history_max_age": 7,
|
||||||
"stats_update_frequency": 60,
|
"stats_update_frequency": 30,
|
||||||
"max_stats_count": 1000,
|
"max_stats_count": 1000,
|
||||||
"delete_default_json": false,
|
"delete_default_json": false,
|
||||||
"show_contribute_link": true,
|
"show_contribute_link": true,
|
||||||
|
Loading…
Reference in New Issue
Block a user