3
3
namespace App \Jobs ;
4
4
5
5
use App \Models \Server ;
6
- use App \Notifications \Server \HighDiskUsage ;
7
6
use Illuminate \Bus \Queueable ;
8
7
use Illuminate \Contracts \Queue \ShouldBeEncrypted ;
9
8
use Illuminate \Contracts \Queue \ShouldQueue ;
@@ -44,7 +43,6 @@ public function handle()
44
43
}
45
44
try {
46
45
if ($ this ->server ->isFunctional ()) {
47
- $ this ->cleanup ();
48
46
$ this ->remove_unnecessary_coolify_yaml ();
49
47
if ($ this ->server ->isSentinelEnabled ()) {
50
48
$ this ->server ->checkSentinel ();
@@ -56,45 +54,7 @@ public function handle()
56
54
57
55
return handleError ($ e );
58
56
}
59
- try {
60
- // $this->check_docker_engine();
61
- } catch (\Throwable $ e ) {
62
- // Do nothing
63
- }
64
- }
65
-
66
- private function check_docker_engine ()
67
- {
68
- $ version = instant_remote_process ([
69
- 'docker info ' ,
70
- ], $ this ->server , false );
71
- if (is_null ($ version )) {
72
- $ os = instant_remote_process ([
73
- 'cat /etc/os-release | grep ^ID= ' ,
74
- ], $ this ->server , false );
75
- $ os = str ($ os )->after ('ID= ' )->trim ();
76
- if ($ os === 'ubuntu ' ) {
77
- try {
78
- instant_remote_process ([
79
- 'systemctl start docker ' ,
80
- ], $ this ->server );
81
- } catch (\Throwable $ e ) {
82
- ray ($ e ->getMessage ());
83
57
84
- return handleError ($ e );
85
- }
86
- } else {
87
- try {
88
- instant_remote_process ([
89
- 'service docker start ' ,
90
- ], $ this ->server );
91
- } catch (\Throwable $ e ) {
92
- ray ($ e ->getMessage ());
93
-
94
- return handleError ($ e );
95
- }
96
- }
97
- }
98
58
}
99
59
100
60
private function remove_unnecessary_coolify_yaml ()
@@ -108,29 +68,4 @@ private function remove_unnecessary_coolify_yaml()
108
68
], $ this ->server , false );
109
69
}
110
70
}
111
-
112
- public function cleanup (): void
113
- {
114
- if ($ this ->server ->settings ->is_force_cleanup_enabled ) {
115
- DockerCleanupJob::dispatch ($ this ->server );
116
-
117
- return ;
118
- }
119
- $ this ->disk_usage = $ this ->server ->getDiskUsage ();
120
- if ($ this ->disk_usage >= $ this ->server ->settings ->cleanup_after_percentage ) {
121
- DockerCleanupJob::dispatch ($ this ->server );
122
- if ($ this ->server ->high_disk_usage_notification_sent ) {
123
- ray ('high disk usage notification already sent ' );
124
-
125
- return ;
126
- } else {
127
- $ this ->server ->high_disk_usage_notification_sent = true ;
128
- $ this ->server ->save ();
129
- $ this ->server ->team ?->notify(new HighDiskUsage ($ this ->server , $ this ->disk_usage , $ this ->server ->settings ->cleanup_after_percentage ));
130
- }
131
- } else {
132
- $ this ->server ->high_disk_usage_notification_sent = false ;
133
- $ this ->server ->save ();
134
- }
135
- }
136
71
}
0 commit comments