Commit Graph

519 Commits

Author SHA1 Message Date
DaneEveritt
e3ab241d7f
Track file upload activity 2022-07-24 17:12:47 -04:00
DaneEveritt
8cee18a92b
Save activity in a background routine to speed things along; cap query time at 3 seconds 2022-07-24 16:27:25 -04:00
DaneEveritt
8a867ccc44
Switch to gorm for activity logging 2022-07-24 11:43:48 -04:00
DaneEveritt
61baccb1a3
Push draft of sftp reconcilation details 2022-07-24 10:28:42 -04:00
DaneEveritt
7bd11c1c28
Switch to SQLite for activity tracking 2022-07-10 16:51:11 -04:00
DaneEveritt
f28e06267c
Better tracking of SFTP events 2022-07-10 14:30:32 -04:00
DaneEveritt
59fbd2bcea
Add initial niaeve implementation of SFTP logging
This will end up flooding the activity logs due to the way SFTP works, we'll need to have an intermediate step in Wings that batches events every 10 seconds or so and submits them as a single "event" for activity.
2022-07-09 19:37:42 -04:00
DaneEveritt
dda7d10d37
Use the natural panel event names 2022-07-09 17:52:59 -04:00
DaneEveritt
ed330fa6be
Squashed commit of the following:
commit f5baab4e88
Author: DaneEveritt <dane@daneeveritt.com>
Date:   Sat Jul 9 17:50:53 2022 -0400

    Finalize activity event sending logic and cron config

commit 9830387f21
Author: DaneEveritt <dane@daneeveritt.com>
Date:   Sat Jul 9 16:26:13 2022 -0400

    Send power events in a more usable format

commit 49f3a61d16
Author: DaneEveritt <dane@daneeveritt.com>
Date:   Sat Jul 9 15:47:24 2022 -0400

    Configure cron to actually send to endpoint

commit 28137c4c14
Author: DaneEveritt <dane@daneeveritt.com>
Date:   Sat Jul 9 15:42:29 2022 -0400

    Copy the body buffer otherwise subsequent backoff attempts will not have a buffer to send

commit 20e44bdc55
Author: DaneEveritt <dane@daneeveritt.com>
Date:   Sat Jul 9 14:38:41 2022 -0400

    Add internal logic to process activity events and send them to the panel

commit 0380488cd2
Author: DaneEveritt <dane@daneeveritt.com>
Date:   Mon Jul 4 17:55:17 2022 -0400

    Track power events

commit 9eab08b92f
Author: DaneEveritt <dane@daneeveritt.com>
Date:   Mon Jul 4 17:36:03 2022 -0400

    Initial logic to support logging activity on Wings to send back to the panel
2022-07-09 17:51:19 -04:00
DaneEveritt
b1be2081eb
Better archive detection logic; try to use reflection as last ditch effort if unmatched
closes pterodactyl/panel#4101
2022-05-30 18:42:31 -04:00
DaneEveritt
f390784973
Include error in log output if one occurs during move 2022-05-21 17:01:12 -04:00
DaneEveritt
37e4d57cdf
Don't include files and folders with identical name prefixes when archiving; closes pterodactyl/panel#3946 2022-05-12 18:00:55 -04:00
DaneEveritt
1d197714df
Fix faulty handling of named pipes; closes pterodactyl/panel#4059 2022-05-07 15:53:08 -04:00
Matthew Penner
3a738e44d6
run gofumpt 2022-02-23 15:02:19 -07:00
Dane Everitt
f85509a0c7 Support a custom tmp directory location 2022-02-13 11:59:53 -05:00
Dane Everitt
5d1d3cc9e6 Fix panic conditions 2022-02-05 12:11:00 -05:00
Dane Everitt
9f985ae044 Check for error before prefix; fixes abandoned routine; closes pterodactyl/panel#3911
Due to the order of the previous logic in ScanReader, an error not caused by EOF would effectively get ignored since an error will always be returned with `isPrefix` equal to false, thus triggering the first break, and error checking is not performed beyond that point.

Thus, canceling an installation process for a server while this process was running would hang the routine and cause the loop to run endlessly, even with a canceled context.
2022-02-05 11:56:17 -05:00
Dane Everitt
879dcd8df5 Don't trigger a panic condition decoding event stats; closes pterodactyl/panel#3941 2022-02-05 11:06:11 -05:00
Dane Everitt
72476c61ec Simplify the event bus system; address pterodactyl/panel#3903
If my debugging is correct, this should address pterodactyl/panel#3903 in its entirety by addressing a few areas where it was possible for a channel to lock up and cause everything to block
2022-02-02 21:03:53 -05:00
Dane Everitt
0f2e9fcc0b Move the sink pool to be a shared tool 2022-02-02 19:16:34 -05:00
Dane Everitt
7051feee01 Add additional debug points to server start process 2022-01-31 19:30:07 -05:00
Dane Everitt
cd67e5fdb9 Fix logic for context based environment stopping
Uses dual contexts to handle stopping using a timed context, and also terminating the entire process loop if the parent context gets canceled.
2022-01-31 19:09:08 -05:00
Dane Everitt
84bbefdadc Pass a context through to the start/stop/terminate actions 2022-01-31 18:40:15 -05:00
Dane Everitt
2b2b5200eb Rewrite console throttling logic; drop complex timer usage and use a very simple throttle
This also removes server process termination logic when a server is breaching the output limits. It simply continues to efficiently throttle the console output.
2022-01-30 19:31:04 -05:00
Dane Everitt
c4ee82c4dc Code cleanup, providing better commentary to decisions 2022-01-30 12:56:25 -05:00
Dane Everitt
0ec0fffa4d Handle future scenarios where we forgot to add a listener 2022-01-30 11:58:53 -05:00
Dane Everitt
57daf0889a Cleanup logic for updating stats to avoid calling mutex outside of file 2022-01-30 11:55:59 -05:00
Dane Everitt
d7c7155802 Make the powerlocker logic a little more idiomatic 2022-01-30 11:46:27 -05:00
Dane Everitt
11ae5e69ed Improve performance of console output watcher; work directly with bytes rather than string conversions 2022-01-30 11:28:06 -05:00
Dane Everitt
fab88a380e Use buffered channels and ring-buffer logic when processing console data
This change fixes pterodactyl/panel#3921 by implementing logic to drop the oldest message in a channel and push the newest message onto the channel when the channel buffer is full.

This is distinctly different than the previous implementation which just dropped the newest messages, leading to confusing behavior on the client side when a large amount of data was sent over the connection.

Up to 10ms per channel is allowed for blocking before falling back to the drop logic.
2022-01-30 10:55:45 -05:00
Dane Everitt
34c0db9dff Replace encoding/json with goccy/go-json for cpu and memory usage improvement
This new package has significant better resource usage, and we do a _lot_ of JSON parsing in this application, so any amount of improvement becomes significant
2022-01-23 15:17:40 -05:00
Dane Everitt
4c8f5c21a3
Improve power lock logic (#118) 2022-01-23 09:49:35 -08:00
Dane Everitt
c52db4eec0 Add test coverage for sinks; prevent panic on nil channels 2022-01-23 10:41:12 -05:00
Dane Everitt
a4904365c9 Sink pool cleanup and organization; better future support when we add more sinks 2022-01-23 09:57:25 -05:00
Matthew Penner
4ba5fe2866
events: don't explode when destroying a bus
Only attempt to close channels once, rather than per topic
they are subscribed to.
2022-01-20 09:48:18 -07:00
Matthew Penner
649dc9663e
Server Event Optimizations (#116) 2022-01-17 20:23:29 -07:00
Matthew Penner
04b9ef69a1
run gofumpt 2021-11-15 10:37:56 -07:00
Matthew Penner
d8df353ce8
replace deprecated ioutil function calls 2021-11-15 10:24:52 -07:00
Dane Everitt
023d7ec1ec Close websocket connections and allow the client to re-connect on send errors; ref pterodactyl/panel#3596 2021-10-24 16:14:00 -07:00
Dane Everitt
d9ebf693e0 Make uptime available in the stat output for a container 2021-10-03 12:59:03 -07:00
Matthew Penner
e79694d6d2
config: add ability to enable/disable server crash detection
fixes https://github.com/pterodactyl/panel/issues/3617

Co-authored-by: Alex <admin@softwarenoob.com>
2021-09-13 15:04:28 -06:00
Dane Everitt
09e1ba6f34 Use the request context for cancelation, not a background context
This also fixes an improperly written server deletion listener to look at the correct context cancelation.

Theoretically this should help address the issues in pterodactyl/panel#3596 but I'm not really sure how that happens, and theres no steps for reproduction.
2021-09-12 11:14:00 -07:00
Dane Everitt
ee91224eb6 add context timeouts to avoid hanging wings boot process if docker has a hiccup; closes pterodactyl/panel#3358 2021-09-11 14:13:19 -07:00
Matthew Penner
5cd43dd4c9
archive: keep timestamps when extracting 2021-09-01 09:54:41 -06:00
Dane Everitt
3b5e042ccc Simplify logic when creating a new installer; no longer requires an entire server object be passed. 2021-08-29 14:08:01 -07:00
Dane Everitt
5764894a5e
Cleanup server sync logic to work in a single consistent format (#101)
* Cleanup server sync logic to work in a single consistent format

Previously we had a mess of a function trying to update server details from a patch request. This change just centralizes everything to a single Sync() call when a server needs to update itself.

We can also eventually update the panel (in V2) to not hit the patch endpoint, rather it can just be a generic endpoint that is hit after a server is updated on the Panel that tells Wings to re-sync the data to get the environment changes on the fly.

The changes I made to the patch function currently act like that, with a slightly fragile 2 second wait to let the panel persist the changes since I don't want this to be a breaking change on that end.

* Remove legacy server patch endpoint; replace with simpler sync endpoint
2021-08-29 13:37:18 -07:00
Dane Everitt
c279d28c5d Correctly set the egg values to avoid allowing blocked files to be edited; closes pterodactyl/panel#3536 2021-08-15 17:53:54 -07:00
Dane Everitt
f7c8571f46 Fix race condition when setting app name in console output 2021-08-15 16:46:55 -07:00
Matthew Penner
25f3cb60cb server: actually use StartOnCompletion and CrashDetectionEnabled 2021-08-03 16:26:25 -06:00
Dane Everitt
a33ac304ca Perhaps don't break _everything_ on people. 2021-08-02 20:02:27 -07:00