Dane Everitt
59c30c2842
Fix use of atomics in codebase
2020-12-25 17:04:18 -08:00
Dane Everitt
31d4c1d34f
Close the file when done
2020-12-25 14:01:25 -08:00
Dane Everitt
0cdfdc725c
Cleanup ignored file reader
2020-12-25 14:00:01 -08:00
Dane Everitt
bb132243ed
Merge branch 'develop' of https://github.com/pterodactyl/wings into develop
2020-12-25 13:57:33 -08:00
Dane Everitt
d96115325a
Add file helper
2020-12-25 13:57:26 -08:00
Matthew Penner
a450abc080
Don't read directories either, add completion log for transfers
2020-12-25 14:46:33 -07:00
Matthew Penner
e05c601325
Lets not read an entire file into memory
2020-12-25 14:40:53 -07:00
Matthew Penner
5c78cb9ab3
Add transfer logging output ( #77 )
...
Co-authored-by: Dane Everitt <dane@daneeveritt.com>
2020-12-25 13:32:41 -08:00
Matthew Penner
901ab1157d
Rework archiving logic to be more consistent and less impactful on disk IO ( #79 )
...
Co-authored-by: Dane Everitt <dane@daneeveritt.com>
2020-12-25 11:52:57 -08:00
Dane Everitt
c0523df696
Add a server context that gets canceled when a server is deleted
2020-12-25 11:21:09 -08:00
Dane Everitt
f8282c56cb
Avoid race conditions from mismatched use of atomic & sync.Mutex
2020-12-20 13:13:10 -08:00
Dane Everitt
c718da20e3
Check disk space before trying a write from the downloader; don't make empty directories if we can't even write the file
2020-12-20 11:17:53 -08:00
Dane Everitt
9c53436470
Check disk before even trying to run the download
2020-12-20 11:08:01 -08:00
Dane Everitt
3495fb1c76
Less racey logic for resource usage
2020-12-16 22:03:35 -08:00
Dane Everitt
16118874cf
Don't obliterate the lock
2020-12-16 20:21:22 -08:00
Dane Everitt
59a111de39
Invite our lord and savior emperror back to the table
2020-12-15 21:56:53 -08:00
Dane Everitt
3a26a5d39d
Convert all filesystem error types into the same Error struct
2020-12-15 20:51:13 -08:00
Matthew Penner
8e29ffed50
Add configurable disk write speed limit for backups ( #74 )
...
* Add configurable disk write speed limit for backups
2020-12-08 09:13:48 -07:00
Dane Everitt
a18f60bd05
Merge branch 'develop' of https://github.com/pterodactyl/wings into develop
2020-12-06 15:35:04 -08:00
Dane Everitt
deea5babbc
Publish message when error occurs during crash handling
2020-12-06 15:34:58 -08:00
Matthew Penner
b52c3fb61e
Cleanup backup/backup_s3.go
2020-12-06 15:25:11 -07:00
Matthew Penner
ee08829a28
s3 backups: handle CompleteMultipartUpload and AbortMultipartUpload on the panel
2020-12-06 13:56:17 -07:00
Matthew Penner
ba0a1a651e
Only use the permission bits for ModeBits
2020-11-29 16:13:07 -07:00
Matthew Penner
068f41393d
Return mode_bits when listing files in a directory
2020-11-29 14:20:24 -07:00
Matthew Penner
f62f714863
Add chmod endpoint to server files
2020-11-29 13:07:45 -07:00
Matthew Penner
de51fd1c51
Error handling improvements ( #71 )
...
* Remove `emperror.dev/errors`, remove all `errors#Wrap` and `errors#WithStack` calls
* Improve logging in `server/backup.go`
2020-11-28 16:57:10 -07:00
Matthew Penner
40c70673cd
Use registry authentication when pulling install image, fixes https://github.com/pterodactyl/panel/issues/2589
2020-11-20 14:36:29 -07:00
Matthew Penner
73b221d022
Switch old Server#GetState() calls over to Server#Environment#State()
2020-11-20 14:35:29 -07:00
Matthew Penner
287b286940
Oh, that's why it was done like that
2020-11-18 18:44:25 -07:00
Matthew Penner
1d0e85cf55
Attempt to fix 'archive/tar: write too long' error when creating a backup
2020-11-18 16:30:34 -07:00
Dane Everitt
8081c83de4
Allow disabling disk checking with 0 value for check interval
2020-11-12 20:50:03 -08:00
Matthew Penner
2197d82957
Clean paths from AllowedMounts to ensure consistency
2020-11-09 16:58:01 -07:00
Dane Everitt
de0c67d066
Re-enable disabled tests
2020-11-08 15:17:47 -08:00
Dane Everitt
68bdcb3cbc
Fix error handling and get tests back to working
2020-11-08 15:15:39 -08:00
Dane Everitt
ef999a039c
Perhaps better error stacks for backups/archives; ref #2418
2020-11-08 14:07:26 -08:00
Dane Everitt
be9d1a3986
Replace error handling package with emperror; add better reporting for errors escaping server root
2020-11-08 13:52:20 -08:00
Dane Everitt
4b17ac4f1c
Fix atomic string handling for JSON output
2020-11-06 22:22:33 -08:00
Dane Everitt
944d381778
Improve server state logical handling; allow setting state directly on the environment
2020-11-06 21:53:00 -08:00
Dane Everitt
13c253780a
Use 60 seconds, not 15
2020-11-01 17:26:45 -08:00
Dane Everitt
fe572beada
Stop servers when exceeding their disk limits; closes pterodactyl/panel#2638
2020-11-01 17:20:42 -08:00
Matthew Penner
05cfb59e18
Add better logging for s3 backup uploads
2020-11-01 15:36:16 -07:00
Matthew Penner
5475cb02c1
Cleanup s3 backup uploads, add request timeouts
2020-11-01 15:23:46 -07:00
Matthew Penner
1239b1c0ca
Switch to s3 multipart uploads for backups
2020-11-01 15:23:46 -07:00
Dane Everitt
ca3becfb55
Correctly handle server responses and instantiation
2020-10-31 11:13:40 -07:00
Dane Everitt
41a67933eb
Use a paginated loop to fetch servers from the Panel rather than a single massive request
2020-10-31 11:05:53 -07:00
Dane Everitt
334b3e8d10
Refactor HTTP endpoints to be less complicated and follow better standards
2020-10-31 10:04:20 -07:00
Matthew Penner
56789196d4
Disable flaky test so I can test cross-platform building
2020-10-17 15:47:30 -06:00
Matthew Penner
70804dd20f
Remoe stat_arm.go, make stat_linux.go with with both 32 and 64 bit systems
2020-10-17 15:45:14 -06:00
Matthew Penner
19d821aab5
Fix arm build
2020-10-17 15:41:13 -06:00
Matthew Penner
4ce35d3d17
Fix race in filesystem_test.go
2020-10-17 15:31:40 -06:00
Dane Everitt
c031d37b91
Use single call to create/return the docker client
2020-10-17 14:04:56 -07:00
Dane Everitt
19051c99ef
Support arm builds
2020-10-17 13:52:38 -07:00
Jakob
e185f597ba
add version negotiation to server install docker client
2020-10-17 21:41:01 +02:00
Dane Everitt
947279a07c
Don't abort entire boot process due to one bad server egg; closes pterodactyl/panel#2448
2020-10-17 12:06:47 -07:00
Dane Everitt
80387bc294
Use more easily configurable timezone, remove /etc/timezone mounts from containers; closes pterodactyl/panel#2513
...
If this does not completely solve the issue in containers then we need to evaluate the image being used to determine what changes need to happen to the image itself to support the timezone.
ref pterodactyl/panel#2239
ref pterodactyl/panel#2329
ref pterodactyl/panel#2389
2020-10-17 11:35:20 -07:00
Dane Everitt
e29789114c
Fix server disk usage not being reported properly; closes pterodactyl/panel#2445
2020-10-11 15:02:37 -07:00
Dane Everitt
37e59e6928
Close connected sockets when a server is deleted; closes pterodactyl/panel#2428
2020-10-03 20:46:29 -07:00
Dane Everitt
e02c197585
More archiver code cleanup; ref pterodactyl/panel#2438
2020-10-03 19:13:41 -07:00
Dane Everitt
d9109cbf5a
Correctly detect os.IsNotExist error; ref pterodactyl/panel#2438
2020-10-03 19:09:12 -07:00
Dane Everitt
6bc8b1a567
Merge branch 'dane/fs-tests' into develop
2020-10-01 21:30:39 -07:00
Dane Everitt
244640d0c1
[security] remove "SafeJoin" function
...
This function was not actually safe in theory. If an unknown stat source was passed in it would be possible for a symlinked file to not be detected as a symlink, thus skipping any safe path resolutions.
This would happen if the stat source was a regular os.Stat call and not an os.Lstat call, but since there is no way to differentiate between those two in the code, it is safer to just manually apply this logic in the positions where we _know_ for certain that we're working with the results of an Lstat call.
2020-10-01 21:28:38 -07:00
Dane Everitt
e3e89a2ecc
Cover symlink attacks with test cases
2020-10-01 21:13:42 -07:00
Dane Everitt
90ae815b1d
Return tests to passing state
2020-10-01 20:40:25 -07:00
Keyton Stanier
b92fab83c8
Removed stray .
in ./mnt/install
2020-10-01 18:00:26 -04:00
Dane Everitt
367fdfad54
Simplify copy file logic
2020-09-30 21:53:50 -07:00
Dane Everitt
ee460686d6
Make delete more synchronous
2020-09-30 21:47:42 -07:00
Dane Everitt
9b7c0fb7f3
Steal tests from other branch that is being discarded, attempt to get at least one of them to pass; WIP
2020-09-30 21:46:32 -07:00
Dane Everitt
0f7bb1a371
Refactor filesystem to not be dependent on a server struct
2020-09-27 12:24:08 -07:00
Dane Everitt
de30e2fcc9
Dont attempt to get size within archive process, will return empty; ref pterodactyl/panel#2420
...
The stat call is operating against an unflushed file if called in the archive function, so you'll just get the emtpy archive size, rather than the final size.
Plus, we only used the file stat in one place, so slight efficiency win?
2020-09-27 11:16:38 -07:00
Dane Everitt
0b9ad3de05
More file size confirmations before performing some actions; closes pterodactyl/panel#2420
2020-09-26 16:02:41 -07:00
Dane Everitt
3391d5803e
Use same values between panel and wings when calculating disk
2020-09-25 20:31:33 -07:00
Dane Everitt
fb24ad58b4
Don't allow a reinstall while server is processing a power action; closes pterodactyl/panel#2409
2020-09-25 20:03:04 -07:00
Dane Everitt
ae5005baa3
Don't log disk space errors
2020-09-25 20:02:38 -07:00
Dane Everitt
7624502ec4
Don't swap the int and cause a negative disk space... closes pterodactyl/panel#2401
2020-09-24 21:19:46 -07:00
Dane Everitt
bf1233def4
Don't ignore disk space limits when copying/archiving; closes pterodactyl/panel#2400
2020-09-24 21:18:10 -07:00
Dane Everitt
522c6c17e4
Merge branch 'develop' of https://github.com/pterodactyl/wings into develop
2020-09-22 20:41:16 -07:00
Dane Everitt
d8cd8ae36a
Don't treat certain "expected" errors from the filesystem as 500 errors; closes pterodactyl/panel#2376
2020-09-22 20:41:14 -07:00
Matthew Penner
ff597672db
Fix #2380
2020-09-20 12:51:12 -06:00
Dane Everitt
6ba49df485
Protect against zip bombs; closes pterodactyl/panel#883
2020-09-17 20:37:34 -07:00
Dane Everitt
783832fc71
Set the docker image correctly when a server is updated; closes pterodactyl/panel#2356
2020-09-17 20:20:39 -07:00
Dane Everitt
6ba1b75696
Add console throttling; closes pterodactyl/panel#2214 ( #60 )
2020-09-17 20:13:04 -07:00
Dane Everitt
ce76b9339e
better error handling for busy files; closes pterodactyl/panel#2332
2020-09-15 19:53:00 -07:00
Dane Everitt
0295603943
Speed up wings boot when restoring from cleared docker environment
...
Doesn't pull images for any server that is not supposed to be running at boot time
2020-09-12 22:08:50 -07:00
Dane Everitt
ce2659fdd7
Simplify environment creation for server
2020-09-12 21:48:04 -07:00
Dane Everitt
be49e08f4f
Show note in console when image is being pulled, show pull status to admins
2020-09-12 21:37:48 -07:00
Dane Everitt
53bd0d57ad
Replace logic with PublishJson
2020-09-12 20:13:48 -07:00
Dane Everitt
b779c98717
Fix files unarchiving to the root; closes pterodactyl/panel#2333
2020-09-12 19:25:29 -07:00
Dane Everitt
4ac19bd29d
Refactor confusing & fragile event bus logic to use callbacks and not channels; ref pterodactyl/panel#2298
2020-09-12 09:26:17 -07:00
Dane Everitt
8407ea21da
Fix state retrevial race condition
2020-09-12 09:12:30 -07:00
Dane Everitt
5a62f83ec8
Don't run pre-boot actions if the server is already running
2020-09-11 23:11:57 -07:00
Dane Everitt
b2eebcaf6d
Fix deadlocks in event listener system; closes pterodactyl/panel#2298
...
Fixes deadlocks that occurred when events were registered while other events were being unsubscribed and data was being flooded to these listeners. A complete mess, I hate this code, it is going to break again, but jesus I'm so tired.
2020-09-11 23:01:54 -07:00
Dane Everitt
57221bdd30
Make disk checking timeout configurable
2020-09-11 20:24:23 -07:00
Dane Everitt
c415abf971
Safety logic check, don't try to stop a stopped server when suspending; closes #2318
...
Couldn't actually reproduce this, but a good sanity check I guess.
2020-09-10 20:16:16 -07:00
Dane Everitt
0cd8dc2b5f
avoid deadlocks while processing tons of data over server event listeners; closes pterodactyl/panel#2298
2020-09-10 20:05:01 -07:00
Dane Everitt
001bbfad1b
avoid panic from environment; ref pterodactyl/panel#2307
2020-09-07 15:37:35 -07:00
Dane Everitt
5bead443ad
Handle port bindings correctly when using 127.0.0.1
...
closes pterodactyl/panel#2307
2020-09-07 15:33:47 -07:00
Dane Everitt
d743d8cfeb
Merge pull request #54 from cyberkitsune/fast-unlimited-disk
...
Speed up server power on for servers with unlimited size
2020-09-07 13:05:37 -07:00
Matthew Penner
a81146d730
Potential fix for console becoming unresponsive ( #55 )
...
* Potentially fix console logs not being pulled after a server has been running for a while
* Add container_id to resource polling debug logs
2020-09-07 13:04:56 -07:00
Matthew Penner
7ba32aca84
Fix some typos and run gofmt on all .go files
2020-09-05 13:08:40 -06:00
Dane Everitt
490f874128
Prevent bungee output breaking my CLI output...
...
Theres enough magic ANSI codes in here to kill a horse... this also causes logging ouput to get truncated
2020-09-03 21:18:55 -07:00
CyberKitsune
1d22e84f21
Allow a stale value on startup for disk size if the disk is unlimited.
2020-08-31 22:10:57 -07:00
Dane Everitt
481df3d543
Only create the directory structure if it is a file being renamed; closes pterodactyl/panel#2292
2020-08-31 21:02:06 -07:00
Dane Everitt
cbf914e7a1
Additional code cleanup for #53
2020-08-31 20:46:28 -07:00
CyberKitsune
d742acf308
Minimize blocking in Filesystem.getCachedDiskUsage ( #53 )
2020-08-31 20:27:41 -07:00
Dane Everitt
5f1d9ff151
Don't throw a 500 error if the backup is missing; closes pterodactyl/panel#2280
2020-08-31 20:24:07 -07:00
Dane Everitt
c69a0bb107
Don't run install scripts if disabled; closes pterodactyl/panel#2265
2020-08-30 09:41:14 -07:00
CyberKitsune
f1343c1d77
Publish console message on initial startup for disk sizing
2020-08-29 19:45:47 -07:00
Dane Everitt
7d8710824c
Fix startup variables not being properly updated on server reboot; closes pterodactyl/panel#2255
2020-08-27 21:08:33 -07:00
Dane Everitt
711ee2258c
Minimize code duplication for environment variables; ref pterodactyl/panel#2255
2020-08-27 20:28:29 -07:00
Dane Everitt
0dde54fc8f
Don't blow up if a file gets removed during the backup
2020-08-27 19:57:35 -07:00
Dane Everitt
0e474c8b24
Better error captures
2020-08-27 19:57:22 -07:00
Dane Everitt
68ab705aac
Don't push directories into the backup unless associated with a file
2020-08-27 19:55:43 -07:00
Dane Everitt
a7ca6b2e34
Correctly report backup API errors; ref pterodactyl/panel#2271
2020-08-27 19:35:57 -07:00
Dane Everitt
5f1ceeff90
Add ability for users to disable checking file permissions when starting a server; closes pterodactly/panel#2272
2020-08-27 19:02:22 -07:00
Dane Everitt
c7e732d084
2.5 minutes for lookups, not every minute
2020-08-24 20:52:05 -07:00
Dane Everitt
9eb795b1bb
Re-add disk space function
2020-08-24 20:46:19 -07:00
Dane Everitt
a1288565f0
Significant CPU and syscall performance improvements when iterating large directories
2020-08-24 20:45:54 -07:00
Dane Everitt
f82c91afbe
Merge branch 'develop' of https://github.com/pterodactyl/wings into develop
2020-08-24 19:45:25 -07:00
Dane Everitt
b35ac76720
Optimizations to the filepath walker function to reduce CPU and I/O issues
2020-08-24 19:45:24 -07:00
Matthew Penner
9f27119044
Fix log directory not being created, again..
2020-08-24 20:22:19 -06:00
Dane Everitt
7aaa51a14f
Less random temp dir locations; cleanup when done
2020-08-23 20:45:07 -07:00
Dane Everitt
3489088703
Update output from socket to use checksum
2020-08-23 18:06:17 -07:00
Dane Everitt
7287b8e198
Pass the checksum type along in the request
2020-08-23 17:52:46 -07:00
Dane Everitt
d1485d7c5f
Limit the number of threads to avoid pinning a host machine
2020-08-23 17:46:35 -07:00
Matthew Penner
08bcb31b9e
Change compression level to BestSpeed and use sha1 instead of sha256
2020-08-23 18:34:48 -06:00
Dane Everitt
09826fc7ad
Performance improvements by using a smaller buffer size
2020-08-23 17:18:40 -07:00
Dane Everitt
999947e387
Adjust sizes on the fly when files are written/decompressed
2020-08-23 15:58:56 -07:00
Dane Everitt
3b33e803e3
Handle deleting a directory
2020-08-23 14:34:42 -07:00
Dane Everitt
37fbae0fcd
closes #2241
2020-08-23 14:18:59 -07:00
Dane Everitt
ebc0e82772
Handle errors during the before install process a little better
2020-08-23 14:07:03 -07:00
Dane Everitt
1e39487240
poc: when deleting a file automatically adjust the current disk space being tracked in the cache
2020-08-22 22:56:44 -07:00
Dane Everitt
c73a53dbe3
Replace cache with single int64
2020-08-22 22:50:49 -07:00
Dane Everitt
138080d5e2
return success state of the backup from wings
2020-08-20 21:28:06 -07:00
Dane Everitt
43d8bd656a
Don't actually try to start a server that is already running
2020-08-19 19:20:46 -07:00
Dane Everitt
9d2321f357
Correctly set the server state on install; closes pterodactyl/panel#2236
2020-08-19 19:08:15 -07:00
Dane Everitt
4d3a860604
Use environment namespace for power state, don't duplicate them across server
2020-08-19 18:58:48 -07:00
Dane Everitt
b9fb922e91
Fix the race condition where the race is actually happening
2020-08-18 21:46:17 -07:00
Dane Everitt
0fc1f300f8
Use helper func
2020-08-18 21:43:39 -07:00
Dane Everitt
60212bb08e
Fix race condition when booting wings
2020-08-18 21:42:57 -07:00
Dane Everitt
5b241fdf36
Correctly send stats & proc information back for servers
2020-08-18 21:38:42 -07:00
Dane Everitt
956e87eb93
Handle restarting correctly, ensure power state propagates correctly
2020-08-18 20:43:28 -07:00
Dane Everitt
4a2a0b25bb
Run chown when starting a server
2020-08-18 20:27:42 -07:00
Dane Everitt
a24a5466e5
Remove restart from environment, handle at a server level; also fix pre-boot logic
2020-08-13 21:36:23 -07:00
Dane Everitt
63c09adaa1
Better handling of stop & restart without releasing process locks too soon
2020-08-13 21:10:33 -07:00
Dane Everitt
5fcec86e98
Allow sending a termination signal even if another power action is being processed
2020-08-13 20:37:35 -07:00
Dane Everitt
cf1c671e68
Support changing the /tmp volume size in the config
2020-08-12 20:38:02 -07:00
Dane Everitt
cc52954a2a
Refactor environment handling logic to separate a server from the environment handler itself
...
This change makes the environment handling logic execute independent of the server itself and should make it much easier for people to contribute changes and additional environment handlers down the road without polluting the server object even more.
There is still a lot of work to do on this front to make things easier to work with, and there are some questionable design decisions at play I'm sure.
Welcome to additional modifications and cleanup to make this code easier to reason about and work with.
2020-08-10 21:38:42 -07:00
Dane Everitt
919bec2f87
Dependency updates
2020-08-06 18:55:29 -07:00
Matthew Penner
ff7f92895c
Fix race condition on startup
2020-08-05 21:13:01 -06:00
Dane Everitt
642e6e6a96
Different implementation of multi-check for done
...
Co-Authored-By: Matthew Penner <me@matthewp.io>
2020-08-04 21:29:43 -07:00