mirror of
https://github.com/ershisan99/coolify.git
synced 2025-12-19 12:33:11 +00:00
Compare commits
805 Commits
v4.0.0-bet
...
fix-server
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
742df4f5df | ||
|
|
2522ecf832 | ||
|
|
40f2c7a1f9 | ||
|
|
3f8324d09e | ||
|
|
eee292b02f | ||
|
|
2b4dc1f9c8 | ||
|
|
dd29827a14 | ||
|
|
dfe290b546 | ||
|
|
4eeb7ee7c6 | ||
|
|
51813463b8 | ||
|
|
da8a45391c | ||
|
|
673081ffb3 | ||
|
|
8f6c01ba49 | ||
|
|
40852995b4 | ||
|
|
e6bb1deaa9 | ||
|
|
2dc3177a7a | ||
|
|
facbd9a50d | ||
|
|
a0532afb24 | ||
|
|
a725a6eaf2 | ||
|
|
3fd3660960 | ||
|
|
5898e0ac4a | ||
|
|
4f4743cc7f | ||
|
|
3b3362daf0 | ||
|
|
cd199ed81d | ||
|
|
7e32a37729 | ||
|
|
58c3cea0c0 | ||
|
|
1c10a43321 | ||
|
|
370a0b1eec | ||
|
|
282ff4e670 | ||
|
|
af09472679 | ||
|
|
053ee63606 | ||
|
|
a8d8df7d8b | ||
|
|
283fe47f5c | ||
|
|
88367d8af1 | ||
|
|
506f733632 | ||
|
|
9f2e7851f7 | ||
|
|
8269e9d29d | ||
|
|
8803cae54c | ||
|
|
c1930e3dfc | ||
|
|
c717b6859b | ||
|
|
4624a381b1 | ||
|
|
6928b0a2c8 | ||
|
|
2da6f66e85 | ||
|
|
a1124a885d | ||
|
|
9448d0f0d2 | ||
|
|
e446354d97 | ||
|
|
c8aa09359f | ||
|
|
128d732438 | ||
|
|
3b97bb1341 | ||
|
|
a4c8f83d17 | ||
|
|
0ca9885ddf | ||
|
|
4f4453b17c | ||
|
|
d60d90de92 | ||
|
|
ce49f4806d | ||
|
|
82daf6c420 | ||
|
|
f1eb43815e | ||
|
|
be9041d592 | ||
|
|
c2c0afa0ba | ||
|
|
611f70d79f | ||
|
|
59c54b8aec | ||
|
|
f0f685b78a | ||
|
|
c54d77515b | ||
|
|
9435be7cce | ||
|
|
f2ccc4059d | ||
|
|
21c6510e9d | ||
|
|
2ca73695b3 | ||
|
|
31193a9f66 | ||
|
|
9f5257bf8a | ||
|
|
78a34dbef1 | ||
|
|
f4d650b03f | ||
|
|
97ee34f1a1 | ||
|
|
9014062b48 | ||
|
|
a8f230b5eb | ||
|
|
94ee525e0a | ||
|
|
d4ace01633 | ||
|
|
49bcd7b8e6 | ||
|
|
5f613df4e0 | ||
|
|
65aeebd9fa | ||
|
|
f26d2e1d0b | ||
|
|
a1d395ff0c | ||
|
|
4e9126887f | ||
|
|
5fa650122d | ||
|
|
ee7f8200ac | ||
|
|
d2a8f31a1c | ||
|
|
2468d0044b | ||
|
|
81b8a58415 | ||
|
|
7442d19611 | ||
|
|
8c024ddb57 | ||
|
|
d990a5691d | ||
|
|
2181ef381b | ||
|
|
c80f5be974 | ||
|
|
358f6575f8 | ||
|
|
de0f34734b | ||
|
|
33cb2d150d | ||
|
|
5f07b473e9 | ||
|
|
5bcd813792 | ||
|
|
a0bb523507 | ||
|
|
0b4fc38d6b | ||
|
|
82c834915d | ||
|
|
d637675ce3 | ||
|
|
e71c04a0c7 | ||
|
|
885b3bdea7 | ||
|
|
9d6757aeb7 | ||
|
|
d84d0a816b | ||
|
|
0da31c34b5 | ||
|
|
ccdaf59ecb | ||
|
|
3fc9cf90ab | ||
|
|
c4be720b20 | ||
|
|
aabe27efd1 | ||
|
|
a8982379c9 | ||
|
|
6dd0bd0742 | ||
|
|
1d3494a6ba | ||
|
|
ee5eb427c9 | ||
|
|
ad7b5e6e1c | ||
|
|
73bd344147 | ||
|
|
ef448280d8 | ||
|
|
5282248cb4 | ||
|
|
14c9f25c57 | ||
|
|
44b3d08d86 | ||
|
|
5da1f48ae1 | ||
|
|
2bc1b9027c | ||
|
|
1c7ca56756 | ||
|
|
d70faea845 | ||
|
|
fdb5cab875 | ||
|
|
bb6cb8edc9 | ||
|
|
a6ec2b92fb | ||
|
|
436a1d945f | ||
|
|
a6a3abc273 | ||
|
|
c4e702f096 | ||
|
|
31df222798 | ||
|
|
e91939a4ea | ||
|
|
ceccd093d2 | ||
|
|
66bb4e0fc1 | ||
|
|
dd3ff38df7 | ||
|
|
69553ec314 | ||
|
|
7bb1bf0ae3 | ||
|
|
a1a8f1336a | ||
|
|
207fe1d709 | ||
|
|
059535a676 | ||
|
|
765a74ca4f | ||
|
|
e03e4f2e91 | ||
|
|
0ab432d5e6 | ||
|
|
6f25b548c7 | ||
|
|
d55e4bf381 | ||
|
|
ec216254b5 | ||
|
|
fbb36bfe8e | ||
|
|
dd782e75f5 | ||
|
|
2be2f0ac79 | ||
|
|
97943db5f4 | ||
|
|
bbd2748ad7 | ||
|
|
a530804a71 | ||
|
|
8ca8ab82b0 | ||
|
|
024ad8e943 | ||
|
|
4d86b556a4 | ||
|
|
73e38ff951 | ||
|
|
5354561c39 | ||
|
|
223cd37031 | ||
|
|
93a0725a4e | ||
|
|
4d1d4598b6 | ||
|
|
888e96448c | ||
|
|
0eea31544e | ||
|
|
8065da9fa0 | ||
|
|
5cd81fe255 | ||
|
|
b00828d4aa | ||
|
|
5a770f9ddb | ||
|
|
903d84e0dd | ||
|
|
16ccc87fbe | ||
|
|
e4108863a8 | ||
|
|
83549965ca | ||
|
|
4d9dcfb84c | ||
|
|
4db50bd025 | ||
|
|
817bd9c35d | ||
|
|
2e10d670be | ||
|
|
cec0d7d1f7 | ||
|
|
1f45532477 | ||
|
|
bcc92e1f32 | ||
|
|
31cf3294bf | ||
|
|
26307334a4 | ||
|
|
9212f3b24c | ||
|
|
31b2196ad9 | ||
|
|
2c38af1df0 | ||
|
|
89e84c5b48 | ||
|
|
39d2fdc08b | ||
|
|
ac9f817b9f | ||
|
|
852e881805 | ||
|
|
001dec6604 | ||
|
|
cf9c62cbf0 | ||
|
|
99a4f721f1 | ||
|
|
505be9dc97 | ||
|
|
cfec5b3a70 | ||
|
|
95483f1464 | ||
|
|
987b90ead2 | ||
|
|
68f541ded3 | ||
|
|
afdf4cd5a8 | ||
|
|
11dbce1471 | ||
|
|
e1037ac031 | ||
|
|
88c2b1e841 | ||
|
|
f46fd8872a | ||
|
|
b6b4d93658 | ||
|
|
8385b7dfe8 | ||
|
|
a660117015 | ||
|
|
6fe31c26a3 | ||
|
|
cccd05f322 | ||
|
|
1b0e2e1257 | ||
|
|
795af8de52 | ||
|
|
606d46eef0 | ||
|
|
56ec0a3004 | ||
|
|
b84576ce87 | ||
|
|
019a8bfaa6 | ||
|
|
fe20480fdc | ||
|
|
71e4b0f9d6 | ||
|
|
bc46b0371d | ||
|
|
f5785b1f17 | ||
|
|
2219219906 | ||
|
|
9ec3233c0c | ||
|
|
f2a9a04461 | ||
|
|
7c269bd0bf | ||
|
|
b99474ac73 | ||
|
|
fcadb20d58 | ||
|
|
24733d0670 | ||
|
|
d3898ee320 | ||
|
|
09cd087cd0 | ||
|
|
d75e55111a | ||
|
|
8e6c7eaeda | ||
|
|
9489a0881f | ||
|
|
691f606fa0 | ||
|
|
ac60b8cb22 | ||
|
|
46ae2a4ae1 | ||
|
|
f0981078ce | ||
|
|
0816169cb6 | ||
|
|
df8c5c6bf2 | ||
|
|
ea1be05c17 | ||
|
|
eafba5d115 | ||
|
|
40eec96a1e | ||
|
|
46268f915f | ||
|
|
c237cea280 | ||
|
|
26f18e25aa | ||
|
|
8d02fb9254 | ||
|
|
c52fe571f5 | ||
|
|
4995675745 | ||
|
|
65356e9bae | ||
|
|
6726964f18 | ||
|
|
9a766aedc1 | ||
|
|
96b8ddf664 | ||
|
|
8adf4051fd | ||
|
|
dedf2cf87b | ||
|
|
72e12aaf5c | ||
|
|
6c78580f1f | ||
|
|
75c8f6c94a | ||
|
|
55847d90c0 | ||
|
|
b374addc37 | ||
|
|
5541c737b7 | ||
|
|
39015e7d6d | ||
|
|
4c3beb6715 | ||
|
|
a807016cab | ||
|
|
2c2173e773 | ||
|
|
2364fac240 | ||
|
|
68c065baa0 | ||
|
|
bfc4474815 | ||
|
|
0e31c02f9e | ||
|
|
6ee80c3ea7 | ||
|
|
b9d24913e8 | ||
|
|
9a1c9124ae | ||
|
|
306c4dcbc5 | ||
|
|
ed7e4360c8 | ||
|
|
f02db282ca | ||
|
|
3535dbb98f | ||
|
|
84b2af53d8 | ||
|
|
ba70451765 | ||
|
|
f3ec4ca4a3 | ||
|
|
174923de98 | ||
|
|
68ab8dc14c | ||
|
|
b218356f2d | ||
|
|
e83aecebc3 | ||
|
|
0bb1f57ea7 | ||
|
|
49144552b3 | ||
|
|
111e9ba3a3 | ||
|
|
d006edc485 | ||
|
|
aa28c99827 | ||
|
|
47920f1191 | ||
|
|
6bd8583eab | ||
|
|
92dbd44c8c | ||
|
|
2cf0f4facc | ||
|
|
be6caf8d76 | ||
|
|
6cf5a2802b | ||
|
|
9c756ad6c5 | ||
|
|
20de0c56a4 | ||
|
|
0058f9aa13 | ||
|
|
567bbe9d0b | ||
|
|
59d2c9748a | ||
|
|
bd2e1ad9fe | ||
|
|
43df918e43 | ||
|
|
1a8d15390d | ||
|
|
4af6caa79c | ||
|
|
dfd6fdf0a8 | ||
|
|
b0635327a1 | ||
|
|
8e91d958be | ||
|
|
17d55630d5 | ||
|
|
70dfa101ef | ||
|
|
d6b4e33db3 | ||
|
|
a9670bd6eb | ||
|
|
02165c2b9f | ||
|
|
afbdd2eb06 | ||
|
|
b0e6014e8f | ||
|
|
0f13af2eca | ||
|
|
d4d9268f12 | ||
|
|
f9dbc30812 | ||
|
|
62459f9a95 | ||
|
|
eb80a7e2f7 | ||
|
|
57d8930f9e | ||
|
|
688c27c901 | ||
|
|
480ae3de8a | ||
|
|
21a5b4ce80 | ||
|
|
12a0d71e47 | ||
|
|
5ed7ae3d3e | ||
|
|
6dd3adba4d | ||
|
|
08d58eb8f8 | ||
|
|
46a7937761 | ||
|
|
13a5536cff | ||
|
|
2381706465 | ||
|
|
7a0f054f1a | ||
|
|
00e1464185 | ||
|
|
fac4a8aaf9 | ||
|
|
2841675691 | ||
|
|
573e5c4913 | ||
|
|
6934a746f7 | ||
|
|
b570ccd7d3 | ||
|
|
68efd4b553 | ||
|
|
e00ec2f75b | ||
|
|
1bb192f3e2 | ||
|
|
e039f183da | ||
|
|
7aab44645f | ||
|
|
7c52d7ef9e | ||
|
|
83c6dcb063 | ||
|
|
6bb21da9f3 | ||
|
|
5a46ef42c8 | ||
|
|
04e504bb8b | ||
|
|
960f970822 | ||
|
|
ae62781c6a | ||
|
|
b42c15b2e5 | ||
|
|
c77cc45e0d | ||
|
|
310708f1b6 | ||
|
|
8386aaf95b | ||
|
|
6d8d91802b | ||
|
|
c0a1f15d34 | ||
|
|
0222aa137d | ||
|
|
4d36bc4742 | ||
|
|
6639379ba6 | ||
|
|
d60ff107c4 | ||
|
|
a468ce77f0 | ||
|
|
1fb0ee0db5 | ||
|
|
9281dda03f | ||
|
|
d3485cea8d | ||
|
|
92772f9132 | ||
|
|
6f8c4a4ce4 | ||
|
|
85ab772acd | ||
|
|
6336125ca2 | ||
|
|
341c7e3598 | ||
|
|
ff9b68b450 | ||
|
|
a072a00926 | ||
|
|
b84d39ba56 | ||
|
|
164a213ab1 | ||
|
|
696acb71fe | ||
|
|
ff5e445b43 | ||
|
|
4e167dc539 | ||
|
|
76655a7c7d | ||
|
|
a26c1f0052 | ||
|
|
cb4f7755c3 | ||
|
|
b7139f8af8 | ||
|
|
a5b3fef1d8 | ||
|
|
fca64d6726 | ||
|
|
b9a026b488 | ||
|
|
a4d0f1da9e | ||
|
|
eb9bbf3eda | ||
|
|
be42f15711 | ||
|
|
768b39dd25 | ||
|
|
000a348c90 | ||
|
|
56f7eb769d | ||
|
|
cc77775f20 | ||
|
|
ca21545d7b | ||
|
|
fa375e2fd8 | ||
|
|
760cf8aeb5 | ||
|
|
f9238ce263 | ||
|
|
c0898f0568 | ||
|
|
5b00b66f24 | ||
|
|
b81f9114d9 | ||
|
|
be8573c828 | ||
|
|
f1881d5c35 | ||
|
|
699e76637b | ||
|
|
dbc723089b | ||
|
|
fc6f5d82db | ||
|
|
1815c9dccf | ||
|
|
7d54fe9c18 | ||
|
|
e9fbb7d2b0 | ||
|
|
2d94ebf7f1 | ||
|
|
c874261c5b | ||
|
|
1c5fd8d668 | ||
|
|
874e04e844 | ||
|
|
c46715db3c | ||
|
|
aa0fe922ea | ||
|
|
60e9fcc202 | ||
|
|
91485b5d4d | ||
|
|
6ec1b9b3f5 | ||
|
|
240352f4b2 | ||
|
|
cfd9ae9817 | ||
|
|
f65789bdbb | ||
|
|
9518040d23 | ||
|
|
631b4e6438 | ||
|
|
d47bd047bf | ||
|
|
a65b62332b | ||
|
|
eb10bbb888 | ||
|
|
4b02debf97 | ||
|
|
430fdcf2e9 | ||
|
|
636de24b6c | ||
|
|
2e3267ee94 | ||
|
|
98e744e808 | ||
|
|
532f5e351e | ||
|
|
182087cf1b | ||
|
|
0494f9a7e5 | ||
|
|
6676c6bd64 | ||
|
|
22326ec0b4 | ||
|
|
8153e2f63b | ||
|
|
b0793c879a | ||
|
|
dce8555aa7 | ||
|
|
35857de697 | ||
|
|
cb177dae58 | ||
|
|
4e8708051d | ||
|
|
5b27eef984 | ||
|
|
d1f28b42e5 | ||
|
|
513ca6f57d | ||
|
|
5ec45d547a | ||
|
|
4aed40fb65 | ||
|
|
d2cf53578a | ||
|
|
1fa42ec82d | ||
|
|
e42c7e258c | ||
|
|
2c210abf57 | ||
|
|
98ba7ac28c | ||
|
|
5772f2c3d9 | ||
|
|
cb9c569d4b | ||
|
|
5616e588e9 | ||
|
|
40e844fab4 | ||
|
|
2e56edd939 | ||
|
|
8179a5c6a3 | ||
|
|
d0518153fb | ||
|
|
29236bf101 | ||
|
|
2d306d56ab | ||
|
|
e5768999e4 | ||
|
|
b076db2eed | ||
|
|
3534424dc8 | ||
|
|
d6f498e6bb | ||
|
|
3e0a5191b9 | ||
|
|
28cde9fd50 | ||
|
|
e415a99f71 | ||
|
|
3b6c3609c3 | ||
|
|
95a97cf9cd | ||
|
|
7b33ef705b | ||
|
|
39449584ac | ||
|
|
19458e7445 | ||
|
|
2d9c728a64 | ||
|
|
12a8e9b0e1 | ||
|
|
649cc2dac2 | ||
|
|
c169f1f64b | ||
|
|
5ecf31d1fc | ||
|
|
e937d30545 | ||
|
|
bf48b33e64 | ||
|
|
595a2414b1 | ||
|
|
07ed726c88 | ||
|
|
d373815f98 | ||
|
|
d9181bd00b | ||
|
|
d13e2c0865 | ||
|
|
42ff7b19a4 | ||
|
|
283fcc87a5 | ||
|
|
ea3501ada6 | ||
|
|
175f4b9ae1 | ||
|
|
2bc74c75e1 | ||
|
|
4ac2758d70 | ||
|
|
bdc0fc87f0 | ||
|
|
845d32c94c | ||
|
|
6a6b947fba | ||
|
|
2ec66fd146 | ||
|
|
ccbbfd8908 | ||
|
|
43895419ff | ||
|
|
1c78067386 | ||
|
|
871d09bd96 | ||
|
|
2d8bda4fa6 | ||
|
|
95070ab48d | ||
|
|
8bb8a7faa3 | ||
|
|
428c40aab5 | ||
|
|
52c4994d44 | ||
|
|
6f578855a0 | ||
|
|
8967315c49 | ||
|
|
162fb7bfc5 | ||
|
|
144508218e | ||
|
|
4bdb5c9030 | ||
|
|
a2ea8814cf | ||
|
|
cbc2f1f015 | ||
|
|
35b9b7fdf2 | ||
|
|
d92819ab60 | ||
|
|
ea877f3623 | ||
|
|
5818c9cf6b | ||
|
|
f9375f91ec | ||
|
|
86722939cd | ||
|
|
70b757df5b | ||
|
|
451272bf11 | ||
|
|
a68fbefadb | ||
|
|
b79b4015d7 | ||
|
|
0bfdc1c531 | ||
|
|
b09017ea46 | ||
|
|
95fcf38d45 | ||
|
|
54c03fae41 | ||
|
|
b2bab451d3 | ||
|
|
7b4559c5e6 | ||
|
|
ba636a95dc | ||
|
|
682b45a2b5 | ||
|
|
d44e3a1091 | ||
|
|
d2d56f136b | ||
|
|
9b48a99798 | ||
|
|
1322dc9c23 | ||
|
|
f71fb7266d | ||
|
|
35f23cfb96 | ||
|
|
0c4ce55a15 | ||
|
|
77ee80b562 | ||
|
|
2621292dc1 | ||
|
|
62a4d7055a | ||
|
|
3fd41c0a92 | ||
|
|
0e8291cd86 | ||
|
|
175b89ced2 | ||
|
|
3aee8e030e | ||
|
|
02017334e5 | ||
|
|
f9b7841572 | ||
|
|
7d39a5089c | ||
|
|
2313fed546 | ||
|
|
e1a6c3e776 | ||
|
|
b41a19d94d | ||
|
|
7037c779e2 | ||
|
|
f124a1e60d | ||
|
|
4450ee382f | ||
|
|
7ebb0a4579 | ||
|
|
4962c606bc | ||
|
|
b728d69ab0 | ||
|
|
3d6e53602c | ||
|
|
1c6450da24 | ||
|
|
15fe5bd864 | ||
|
|
08e4afbbc4 | ||
|
|
06fd7286da | ||
|
|
fce1e34fc8 | ||
|
|
0739e0f5e7 | ||
|
|
faf7ba50e6 | ||
|
|
e8179ec519 | ||
|
|
220f77e737 | ||
|
|
7948a0309f | ||
|
|
47277a68ec | ||
|
|
60f75f9deb | ||
|
|
e90d1af884 | ||
|
|
e3046698a5 | ||
|
|
bb773e1118 | ||
|
|
dcf91cc034 | ||
|
|
cddf8476de | ||
|
|
51c43e7457 | ||
|
|
7cac243589 | ||
|
|
0cfd8ed5f0 | ||
|
|
8318598cb5 | ||
|
|
2f692da1c9 | ||
|
|
ecd98bfcd5 | ||
|
|
ba860398f3 | ||
|
|
1f9af39fa7 | ||
|
|
62b995d26c | ||
|
|
b28d118609 | ||
|
|
81d0589c55 | ||
|
|
07893b432b | ||
|
|
568d47d1dd | ||
|
|
85cce4e453 | ||
|
|
888c1f7697 | ||
|
|
79c8ce7572 | ||
|
|
121afaa18c | ||
|
|
e48ad87cdb | ||
|
|
a587cae251 | ||
|
|
c04c1530f5 | ||
|
|
f4ee61fc6a | ||
|
|
b6080c2c8e | ||
|
|
1738286983 | ||
|
|
703bf51705 | ||
|
|
aa4980289d | ||
|
|
dd8a2dd3c1 | ||
|
|
3086ef1462 | ||
|
|
0b33315991 | ||
|
|
b6b9179bb3 | ||
|
|
9122983f22 | ||
|
|
b9b33c831c | ||
|
|
ccdcea665d | ||
|
|
7b5aa78557 | ||
|
|
9310af0301 | ||
|
|
e38b29d833 | ||
|
|
0d3d5f40fd | ||
|
|
c402d7f543 | ||
|
|
894f2c66d3 | ||
|
|
d4679a8be1 | ||
|
|
7ac45aa706 | ||
|
|
8862b50c98 | ||
|
|
b5a56892fd | ||
|
|
664a990c60 | ||
|
|
16e472da19 | ||
|
|
7dd0588bfe | ||
|
|
a95ebb4d56 | ||
|
|
75f266fa9f | ||
|
|
90fd0ebf12 | ||
|
|
4aeb8ff02b | ||
|
|
8bc22e185b | ||
|
|
5244ef60bd | ||
|
|
f3748fc294 | ||
|
|
03d419e591 | ||
|
|
9e90daf414 | ||
|
|
420f1df998 | ||
|
|
f672a08afb | ||
|
|
67d44713e7 | ||
|
|
0b950f444a | ||
|
|
8712af7379 | ||
|
|
35dfb1b0f8 | ||
|
|
2edcd01493 | ||
|
|
72c08e4496 | ||
|
|
baa236f934 | ||
|
|
1a40bebaae | ||
|
|
25f5060333 | ||
|
|
6e48c94c6e | ||
|
|
410b55cf03 | ||
|
|
0881d001d6 | ||
|
|
483b4f8eb7 | ||
|
|
c9a52c552b | ||
|
|
72f0118506 | ||
|
|
bc13ad6b82 | ||
|
|
b145691e1e | ||
|
|
5d476e3924 | ||
|
|
3f3bf075fa | ||
|
|
6498e5b6f0 | ||
|
|
a3caad239c | ||
|
|
117fbeb07c | ||
|
|
33e9c9b0f9 | ||
|
|
577927a20b | ||
|
|
409d5ef60e | ||
|
|
f1a1deff26 | ||
|
|
9d42a7f146 | ||
|
|
826b64d056 | ||
|
|
2c9491d81c | ||
|
|
d378bb94be | ||
|
|
d74cfd09ce | ||
|
|
91c845732e | ||
|
|
83698ac8f2 | ||
|
|
f718604ac4 | ||
|
|
3e188bf947 | ||
|
|
f70160a17c | ||
|
|
5722d1a220 | ||
|
|
bae9ea79de | ||
|
|
f3845ce30a | ||
|
|
d57c9d8aa0 | ||
|
|
c7c2924990 | ||
|
|
aa30e83f4a | ||
|
|
77455cd444 | ||
|
|
2777fbc0ec | ||
|
|
2c929b300a | ||
|
|
27ad4441ee | ||
|
|
63729c7bbf | ||
|
|
1e68444f10 | ||
|
|
f8dfe643f4 | ||
|
|
66cf6df4b3 | ||
|
|
29acc4ee25 | ||
|
|
f73983e3dd | ||
|
|
44d417c07e | ||
|
|
1d72f76072 | ||
|
|
565cb54dba | ||
|
|
c2f7e85022 | ||
|
|
9e6486fa66 | ||
|
|
28bcd0023c | ||
|
|
84093afaf6 | ||
|
|
40347744e0 | ||
|
|
060988d923 | ||
|
|
b093c9757c | ||
|
|
25976a4870 | ||
|
|
4f9e1a3e5e | ||
|
|
c8218e6901 | ||
|
|
cc10d08a7c | ||
|
|
e5a980d544 | ||
|
|
59c7f2cb56 | ||
|
|
d2a306dab9 | ||
|
|
681a745fc7 | ||
|
|
abb6655fef | ||
|
|
aa586a5677 | ||
|
|
87ee3c511c | ||
|
|
a17daf96be | ||
|
|
a419496066 | ||
|
|
c668d2d1ff | ||
|
|
4611332a8f | ||
|
|
8b3eed5895 | ||
|
|
9861ad4045 | ||
|
|
5fb560dbbf | ||
|
|
6b475cc1bf | ||
|
|
5ef2d476a4 | ||
|
|
eb5765979f | ||
|
|
fc3c69f687 | ||
|
|
08df814408 | ||
|
|
a7b78dcf41 | ||
|
|
2b5df8d2fd | ||
|
|
f4263ee022 | ||
|
|
44f3f6001e | ||
|
|
9105c1aa51 | ||
|
|
3e04a7958e | ||
|
|
505127dae5 | ||
|
|
371fe53911 | ||
|
|
9515bc6162 | ||
|
|
93a4a3e09c | ||
|
|
bbbd5cbaa1 | ||
|
|
7fe3b78d45 | ||
|
|
a29353c1ae | ||
|
|
c16e914be4 | ||
|
|
bec974dca4 | ||
|
|
b314b08f25 | ||
|
|
9a2d5be354 | ||
|
|
d94e39ccc7 | ||
|
|
d5b7e9ed83 | ||
|
|
f29bc52fa5 | ||
|
|
3d21f1a2a4 | ||
|
|
20558d438a | ||
|
|
792f6bc163 | ||
|
|
3d1c730703 | ||
|
|
c3188958b4 | ||
|
|
c24fec9c45 | ||
|
|
70043c24cf | ||
|
|
ff1e08cf8b | ||
|
|
a4d1ae1341 | ||
|
|
5944ee5524 | ||
|
|
1b0c5f8d69 | ||
|
|
dfd218ec06 | ||
|
|
843e3fb599 | ||
|
|
a97ccd206c | ||
|
|
776d41613d | ||
|
|
f857bbc437 | ||
|
|
f8226cf892 | ||
|
|
d2a0621f93 | ||
|
|
38845d7eb0 | ||
|
|
3b3bc6c33b | ||
|
|
2adac01034 | ||
|
|
b656cabb33 | ||
|
|
830c047ccf | ||
|
|
a3dd48de1d | ||
|
|
b118a627d0 | ||
|
|
bcfca40f3a | ||
|
|
76cb473db8 | ||
|
|
73dfdb83a7 | ||
|
|
bff6964d4a | ||
|
|
b807601d19 | ||
|
|
9136d7acdc | ||
|
|
da0398f35d | ||
|
|
6820fcc084 | ||
|
|
d984bec175 | ||
|
|
182af1ec18 | ||
|
|
a22e757ab7 | ||
|
|
354c74e920 | ||
|
|
62b7900855 | ||
|
|
c92659994d | ||
|
|
a2651ab3c1 | ||
|
|
1b51d46b3d | ||
|
|
141752b9ad | ||
|
|
73068aaa75 | ||
|
|
8d2a02dc3c | ||
|
|
4726676248 | ||
|
|
9040f5d2a1 | ||
|
|
ac50d8b4d8 | ||
|
|
2a581147aa | ||
|
|
7e154ba3c3 | ||
|
|
1e46b63041 | ||
|
|
71bb1f5e17 | ||
|
|
ce926afdaa | ||
|
|
2b8c9920d8 | ||
|
|
548fc21e40 | ||
|
|
c2ea8996ee | ||
|
|
5b54dc8792 | ||
|
|
b5360e5e75 | ||
|
|
840e225aa8 | ||
|
|
7d1179e7c8 | ||
|
|
16a5c601e3 | ||
|
|
c566152f37 | ||
|
|
2ca6ffb84e | ||
|
|
41be1f7666 | ||
|
|
450351921e | ||
|
|
a4bb87d13b | ||
|
|
1cfddfd529 | ||
|
|
72bcf03cbb | ||
|
|
d177e49e62 | ||
|
|
5595853379 | ||
|
|
97c2bedda2 | ||
|
|
d980c7a425 | ||
|
|
53dff4ca4f | ||
|
|
7722809c52 | ||
|
|
e67e03f73f | ||
|
|
86a087056e | ||
|
|
51071da700 | ||
|
|
70aa05bde9 | ||
|
|
0135e2b5c0 | ||
|
|
2f95349888 | ||
|
|
4d0acee95c | ||
|
|
74bea37b43 | ||
|
|
070daee28e | ||
|
|
df796dffa2 | ||
|
|
18ae29ba99 | ||
|
|
1138ec0dea | ||
|
|
21fc8efb86 |
@@ -6,13 +6,7 @@ APP_KEY=
|
|||||||
APP_URL=http://localhost
|
APP_URL=http://localhost
|
||||||
APP_PORT=8000
|
APP_PORT=8000
|
||||||
APP_DEBUG=true
|
APP_DEBUG=true
|
||||||
MUX_ENABLED=false
|
SSH_MUX_ENABLED=true
|
||||||
|
|
||||||
# Enable Laravel Telescope for debugging
|
|
||||||
TELESCOPE_ENABLED=false
|
|
||||||
|
|
||||||
# Selenium Driver URL for Dusk
|
|
||||||
DUSK_DRIVER_URL=http://selenium:4444
|
|
||||||
|
|
||||||
# PostgreSQL Database Configuration
|
# PostgreSQL Database Configuration
|
||||||
DB_DATABASE=coolify
|
DB_DATABASE=coolify
|
||||||
@@ -25,7 +19,13 @@ DB_PORT=5432
|
|||||||
# Set to true to enable Ray
|
# Set to true to enable Ray
|
||||||
RAY_ENABLED=false
|
RAY_ENABLED=false
|
||||||
# Set custom ray port
|
# Set custom ray port
|
||||||
RAY_PORT=
|
# RAY_PORT=
|
||||||
|
|
||||||
|
# Enable Laravel Telescope for debugging
|
||||||
|
TELESCOPE_ENABLED=false
|
||||||
|
|
||||||
|
# Selenium Driver URL for Dusk
|
||||||
|
DUSK_DRIVER_URL=http://selenium:4444
|
||||||
|
|
||||||
# Special Keys for Andras
|
# Special Keys for Andras
|
||||||
# For cache purging
|
# For cache purging
|
||||||
|
|||||||
65
.github/ISSUE_TEMPLATE/01_BUG_REPORT.yml
vendored
Normal file
65
.github/ISSUE_TEMPLATE/01_BUG_REPORT.yml
vendored
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
name: 🐞 Bug Report
|
||||||
|
description: "File a new bug report."
|
||||||
|
title: "[Bug]: "
|
||||||
|
labels: ["🐛 Bug", "🔍 Triage"]
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> **Please ensure you are using the latest version of Coolify before submitting an issue, as the bug may have already been fixed in a recent update.** (Of course, if you're experiencing an issue on the latest version that wasn't present in a previous version, please let us know.)
|
||||||
|
|
||||||
|
# 💎 Bounty Program (with [algora.io](https://console.algora.io/org/coollabsio/bounties/new))
|
||||||
|
- If you would like to prioritize the issue resolution, consider adding a bounty to this issue through our [Bounty Program](https://console.algora.io/org/coollabsio/bounties/new).
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Error Message and Logs
|
||||||
|
description: Provide a detailed description of the error or exception you encountered, along with any relevant log output.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Steps to Reproduce
|
||||||
|
description: Please provide a step-by-step guide to reproduce the issue. Be as detailed as possible, otherwise we may not be able to assist you.
|
||||||
|
value: |
|
||||||
|
1.
|
||||||
|
2.
|
||||||
|
3.
|
||||||
|
4.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: input
|
||||||
|
attributes:
|
||||||
|
label: Example Repository URL
|
||||||
|
description: If applicable, provide a URL to a repository demonstrating the issue.
|
||||||
|
|
||||||
|
- type: input
|
||||||
|
attributes:
|
||||||
|
label: Coolify Version
|
||||||
|
description: Please provide the Coolify version you are using. This can be found in the top left corner of your Coolify dashboard.
|
||||||
|
placeholder: "v4.0.0-beta.335"
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: dropdown
|
||||||
|
attributes:
|
||||||
|
label: Are you using Coolify Cloud?
|
||||||
|
options:
|
||||||
|
- "No (self-hosted)"
|
||||||
|
- "Yes (Coolify Cloud)"
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: input
|
||||||
|
attributes:
|
||||||
|
label: Operating System and Version (self-hosted)
|
||||||
|
description: Run `cat /etc/os-release` or `lsb_release -a` in your terminal and provide the operating system and version.
|
||||||
|
placeholder: "Ubuntu 22.04"
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Additional Information
|
||||||
|
description: Any other relevant details about the issue.
|
||||||
31
.github/ISSUE_TEMPLATE/02_ENHANCEMENT_BOUNTY.yml
vendored
Normal file
31
.github/ISSUE_TEMPLATE/02_ENHANCEMENT_BOUNTY.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
name: 💎 Enhancement Bounty
|
||||||
|
description: "Propose a new feature, service, or improvement with an attached bounty."
|
||||||
|
title: "[Enhancement]: "
|
||||||
|
labels: ["✨ Enhancement", "🔍 Triage"]
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> **This issue template is exclusively for proposing new features, services, or improvements with an attached bounty.** Enhancements without a bounty can be discussed in the appropriate category of [Github Discussions](https://github.com/coollabsio/coolify/discussions).
|
||||||
|
|
||||||
|
# 💎 Add a Bounty (with [algora.io](https://console.algora.io/org/coollabsio/bounties/new))
|
||||||
|
- [Click here to add the required bounty](https://console.algora.io/org/coollabsio/bounties/new)
|
||||||
|
|
||||||
|
- type: dropdown
|
||||||
|
attributes:
|
||||||
|
label: Request Type
|
||||||
|
description: Select the type of request you are making.
|
||||||
|
options:
|
||||||
|
- New Feature
|
||||||
|
- New Service
|
||||||
|
- Improvement
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Description
|
||||||
|
description: Provide a detailed description of the feature, improvement, or service you are proposing.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
46
.github/ISSUE_TEMPLATE/BUG_REPORT.yml
vendored
46
.github/ISSUE_TEMPLATE/BUG_REPORT.yml
vendored
@@ -1,46 +0,0 @@
|
|||||||
name: Bug report
|
|
||||||
description: "Create a new bug report."
|
|
||||||
title: "[Bug]: "
|
|
||||||
body:
|
|
||||||
- type: markdown
|
|
||||||
attributes:
|
|
||||||
value: >-
|
|
||||||
# 💎 Bounty program (with
|
|
||||||
[algora.io](https://console.algora.io/org/coollabsio/bounties/new))
|
|
||||||
|
|
||||||
|
|
||||||
If you would like to prioritize the issue resolution, you can add bounty
|
|
||||||
to this issue.
|
|
||||||
|
|
||||||
|
|
||||||
Click [here](https://console.algora.io/org/coollabsio/bounties/new) to
|
|
||||||
get started.
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Description
|
|
||||||
description: A clear and concise description of the problem
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Minimal Reproduction (if possible, example repository)
|
|
||||||
description: Please provide a step by step guide to reproduce the issue.
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Exception or Error
|
|
||||||
description: Please provide error logs if possible.
|
|
||||||
- type: input
|
|
||||||
attributes:
|
|
||||||
label: Version
|
|
||||||
description: Coolify's version (see top of your screen).
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: checkboxes
|
|
||||||
attributes:
|
|
||||||
label: Cloud?
|
|
||||||
description: "Are you using the cloud version of Coolify?"
|
|
||||||
options:
|
|
||||||
- label: 'Yes'
|
|
||||||
required: false
|
|
||||||
- label: 'No'
|
|
||||||
required: false
|
|
||||||
20
.github/ISSUE_TEMPLATE/config.yml
vendored
20
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,8 +1,18 @@
|
|||||||
blank_issues_enabled: false
|
blank_issues_enabled: false
|
||||||
|
|
||||||
contact_links:
|
contact_links:
|
||||||
- name: 🤔 Community Support (Chat)
|
- name: 🤔 Questions and Community Support
|
||||||
url: https://coollabs.io/discord
|
url: https://coollabs.io/discord
|
||||||
about: Reach out to us on Discord.
|
about: If you have any questions, reach out to us on Discord inside the "#support" channel.
|
||||||
- name: 🙋♂️ Feature Requests
|
|
||||||
url: https://github.com/coollabsio/coolify/discussions/categories/new-features
|
- name: 💡 Feature Request
|
||||||
about: All feature requests will be discussed here.
|
url: https://github.com/coollabsio/coolify/discussions/categories/feature-requests
|
||||||
|
about: Suggest a new feature for Coolify.
|
||||||
|
|
||||||
|
- name: ⚙️ Service Request
|
||||||
|
url: https://github.com/coollabsio/coolify/discussions/categories/service-requests
|
||||||
|
about: Request a new service integration for Coolify.
|
||||||
|
|
||||||
|
- name: 🔧 Improvements
|
||||||
|
url: https://github.com/coollabsio/coolify/discussions/categories/improvements
|
||||||
|
about: Suggest improvements to existing features for Coolify.
|
||||||
|
|||||||
14
.github/pull_request_template.md
vendored
14
.github/pull_request_template.md
vendored
@@ -1 +1,13 @@
|
|||||||
> Always use `next` branch as destination branch for PRs, not `main`
|
## Submit Checklist (REMOVE THIS SECTION BEFORE SUBMITTING)
|
||||||
|
- [ ] I have selected the `next` branch as the destination for my PR, not `main`.
|
||||||
|
- [ ] I have listed all changes in the `Changes` section.
|
||||||
|
- [ ] I have filled out the `Issues` section with the issue/discussion link(s) (if applicable).
|
||||||
|
- [ ] I have tested my changes.
|
||||||
|
- [ ] I have considered backwards compatibility.
|
||||||
|
- [ ] I have removed this checklist and any unused sections.
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
-
|
||||||
|
|
||||||
|
## Issues
|
||||||
|
- fix #
|
||||||
|
|||||||
5
.github/workflows/coolify-helper-next.yml
vendored
5
.github/workflows/coolify-helper-next.yml
vendored
@@ -38,6 +38,8 @@ jobs:
|
|||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}-next
|
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}-next
|
||||||
|
labels: |
|
||||||
|
coolify.managed=true
|
||||||
aarch64:
|
aarch64:
|
||||||
runs-on: [ self-hosted, arm64 ]
|
runs-on: [ self-hosted, arm64 ]
|
||||||
permissions:
|
permissions:
|
||||||
@@ -64,6 +66,8 @@ jobs:
|
|||||||
platforms: linux/aarch64
|
platforms: linux/aarch64
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}-next-aarch64
|
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}-next-aarch64
|
||||||
|
labels: |
|
||||||
|
coolify.managed=true
|
||||||
merge-manifest:
|
merge-manifest:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
@@ -94,3 +98,4 @@ jobs:
|
|||||||
if: always()
|
if: always()
|
||||||
with:
|
with:
|
||||||
webhook: ${{ secrets.DISCORD_WEBHOOK_DEV_RELEASE_CHANNEL }}
|
webhook: ${{ secrets.DISCORD_WEBHOOK_DEV_RELEASE_CHANNEL }}
|
||||||
|
|
||||||
|
|||||||
5
.github/workflows/coolify-helper.yml
vendored
5
.github/workflows/coolify-helper.yml
vendored
@@ -38,6 +38,8 @@ jobs:
|
|||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}
|
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}
|
||||||
|
labels: |
|
||||||
|
coolify.managed=true
|
||||||
aarch64:
|
aarch64:
|
||||||
runs-on: [ self-hosted, arm64 ]
|
runs-on: [ self-hosted, arm64 ]
|
||||||
permissions:
|
permissions:
|
||||||
@@ -64,6 +66,8 @@ jobs:
|
|||||||
platforms: linux/aarch64
|
platforms: linux/aarch64
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}-aarch64
|
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}-aarch64
|
||||||
|
labels: |
|
||||||
|
coolify.managed=true
|
||||||
merge-manifest:
|
merge-manifest:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
@@ -94,3 +98,4 @@ jobs:
|
|||||||
if: always()
|
if: always()
|
||||||
with:
|
with:
|
||||||
webhook: ${{ secrets.DISCORD_WEBHOOK_PROD_RELEASE_CHANNEL }}
|
webhook: ${{ secrets.DISCORD_WEBHOOK_PROD_RELEASE_CHANNEL }}
|
||||||
|
|
||||||
|
|||||||
103
.github/workflows/coolify-realtime-next.yml
vendored
Normal file
103
.github/workflows/coolify-realtime-next.yml
vendored
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
name: Coolify Realtime Development (v4)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "next" ]
|
||||||
|
paths:
|
||||||
|
- .github/workflows/coolify-realtime.yml
|
||||||
|
- docker/coolify-realtime/Dockerfile
|
||||||
|
- docker/coolify-realtime/terminal-server.js
|
||||||
|
- docker/coolify-realtime/package.json
|
||||||
|
- docker/coolify-realtime/soketi-entrypoint.sh
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
IMAGE_NAME: "coollabsio/coolify-realtime"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
amd64:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Login to ghcr.io
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Get Version
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app ghcr.io/jqlang/jq:latest '.coolify.realtime.version' versions.json)"|xargs >> $GITHUB_OUTPUT
|
||||||
|
- name: Build image and push to registry
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
no-cache: true
|
||||||
|
context: .
|
||||||
|
file: docker/coolify-realtime/Dockerfile
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}-next
|
||||||
|
labels: |
|
||||||
|
coolify.managed=true
|
||||||
|
aarch64:
|
||||||
|
runs-on: [ self-hosted, arm64 ]
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Login to ghcr.io
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Get Version
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app ghcr.io/jqlang/jq:latest '.coolify.realtime.version' versions.json)"|xargs >> $GITHUB_OUTPUT
|
||||||
|
- name: Build image and push to registry
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
no-cache: true
|
||||||
|
context: .
|
||||||
|
file: docker/coolify-realtime/Dockerfile
|
||||||
|
platforms: linux/aarch64
|
||||||
|
push: true
|
||||||
|
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}-next-aarch64
|
||||||
|
labels: |
|
||||||
|
coolify.managed=true
|
||||||
|
merge-manifest:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
needs: [ amd64, aarch64 ]
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Login to ghcr.io
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Get Version
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app ghcr.io/jqlang/jq:latest '.coolify.realtime.version' versions.json)"|xargs >> $GITHUB_OUTPUT
|
||||||
|
- name: Create & publish manifest
|
||||||
|
run: |
|
||||||
|
docker buildx imagetools create --append ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}-next-aarch64 --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}-next
|
||||||
|
- uses: sarisia/actions-status-discord@v1
|
||||||
|
if: always()
|
||||||
|
with:
|
||||||
|
webhook: ${{ secrets.DISCORD_WEBHOOK_PROD_RELEASE_CHANNEL }}
|
||||||
103
.github/workflows/coolify-realtime.yml
vendored
Normal file
103
.github/workflows/coolify-realtime.yml
vendored
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
name: Coolify Realtime (v4)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "main" ]
|
||||||
|
paths:
|
||||||
|
- .github/workflows/coolify-realtime.yml
|
||||||
|
- docker/coolify-realtime/Dockerfile
|
||||||
|
- docker/coolify-realtime/terminal-server.js
|
||||||
|
- docker/coolify-realtime/package.json
|
||||||
|
- docker/coolify-realtime/soketi-entrypoint.sh
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
IMAGE_NAME: "coollabsio/coolify-realtime"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
amd64:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Login to ghcr.io
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Get Version
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app ghcr.io/jqlang/jq:latest '.coolify.realtime.version' versions.json)"|xargs >> $GITHUB_OUTPUT
|
||||||
|
- name: Build image and push to registry
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
no-cache: true
|
||||||
|
context: .
|
||||||
|
file: docker/coolify-realtime/Dockerfile
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}
|
||||||
|
labels: |
|
||||||
|
coolify.managed=true
|
||||||
|
aarch64:
|
||||||
|
runs-on: [ self-hosted, arm64 ]
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Login to ghcr.io
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Get Version
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app ghcr.io/jqlang/jq:latest '.coolify.realtime.version' versions.json)"|xargs >> $GITHUB_OUTPUT
|
||||||
|
- name: Build image and push to registry
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
no-cache: true
|
||||||
|
context: .
|
||||||
|
file: docker/coolify-realtime/Dockerfile
|
||||||
|
platforms: linux/aarch64
|
||||||
|
push: true
|
||||||
|
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}-aarch64
|
||||||
|
labels: |
|
||||||
|
coolify.managed=true
|
||||||
|
merge-manifest:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
needs: [ amd64, aarch64 ]
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Login to ghcr.io
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Get Version
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app ghcr.io/jqlang/jq:latest '.coolify.realtime.version' versions.json)"|xargs >> $GITHUB_OUTPUT
|
||||||
|
- name: Create & publish manifest
|
||||||
|
run: |
|
||||||
|
docker buildx imagetools create --append ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}-aarch64 --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }} --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||||
|
- uses: sarisia/actions-status-discord@v1
|
||||||
|
if: always()
|
||||||
|
with:
|
||||||
|
webhook: ${{ secrets.DISCORD_WEBHOOK_PROD_RELEASE_CHANNEL }}
|
||||||
44
.github/workflows/docker-image.yml
vendored
44
.github/workflows/docker-image.yml
vendored
@@ -1,44 +0,0 @@
|
|||||||
name: Docker Image CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
# push:
|
|
||||||
# branches: [ "main" ]
|
|
||||||
# pull_request:
|
|
||||||
# branches: [ "*" ]
|
|
||||||
push:
|
|
||||||
branches: ["this-does-not-exist"]
|
|
||||||
pull_request:
|
|
||||||
branches: ["this-does-not-exist"]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Cache Docker layers
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
/usr/local/share/ca-certificates
|
|
||||||
/var/cache/apt/archives
|
|
||||||
/var/lib/apt/lists
|
|
||||||
~/.cache
|
|
||||||
key: ${{ runner.os }}-docker-${{ hashFiles('**/Dockerfile') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-docker-
|
|
||||||
- name: Build the Docker image
|
|
||||||
run: |
|
|
||||||
cp .env.example .env
|
|
||||||
docker run --rm -u "$(id -u):$(id -g)" \
|
|
||||||
-v "$(pwd):/app" \
|
|
||||||
-w /app composer:2 \
|
|
||||||
composer install --ignore-platform-reqs
|
|
||||||
./vendor/bin/spin build
|
|
||||||
- name: Start the stack
|
|
||||||
run: |
|
|
||||||
./vendor/bin/spin up -d
|
|
||||||
./vendor/bin/spin exec coolify php artisan key:generate
|
|
||||||
./vendor/bin/spin exec coolify php artisan migrate:fresh --seed
|
|
||||||
- name: Test (missing E2E tests)
|
|
||||||
run: |
|
|
||||||
./vendor/bin/spin exec coolify php artisan test
|
|
||||||
25
.github/workflows/fix-php-code-style-issues
vendored
25
.github/workflows/fix-php-code-style-issues
vendored
@@ -1,25 +0,0 @@
|
|||||||
name: Fix PHP code style issues
|
|
||||||
|
|
||||||
on: [push]
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
php-code-styling:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: 5
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ github.head_ref }}
|
|
||||||
|
|
||||||
- name: Fix PHP code style issues
|
|
||||||
uses: aglipanci/laravel-pint-action@2.4
|
|
||||||
|
|
||||||
- name: Commit changes
|
|
||||||
uses: stefanzweifel/git-auto-commit-action@v5
|
|
||||||
with:
|
|
||||||
commit_message: Fix styling
|
|
||||||
17
.github/workflows/lock-closed-issues-discussions-and-prs.yml
vendored
Normal file
17
.github/workflows/lock-closed-issues-discussions-and-prs.yml
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
name: Lock closed Issues, Discussions, and PRs
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 1 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lock-threads:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Lock threads after 30 days of inactivity
|
||||||
|
uses: dessant/lock-threads@v5
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
issue-inactive-days: '30'
|
||||||
|
pr-inactive-days: '30'
|
||||||
|
discussion-inactive-days: '30'
|
||||||
28
.github/workflows/manage-stale-issues-and-prs.yml
vendored
Normal file
28
.github/workflows/manage-stale-issues-and-prs.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
name: Manage Stale Issues and PRs
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 2 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
manage-stale:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Manage stale issues and PRs
|
||||||
|
uses: actions/stale@v9
|
||||||
|
id: stale
|
||||||
|
with:
|
||||||
|
stale-issue-message: 'This issue will be automatically closed in a few days if no response is received. Please provide an update with the requested information.'
|
||||||
|
stale-pr-message: 'This pull request will be automatically closed in a few days if no response is received. Please update your PR or comment if you would like to continue working on it.'
|
||||||
|
close-issue-message: 'This issue has been automatically closed due to inactivity.'
|
||||||
|
close-pr-message: 'This pull request has been automatically closed due to inactivity.'
|
||||||
|
days-before-stale: 14
|
||||||
|
days-before-close: 7
|
||||||
|
stale-issue-label: '⏱︎ Stale'
|
||||||
|
stale-pr-label: '⏱︎ Stale'
|
||||||
|
only-labels: '💤 Waiting for feedback'
|
||||||
|
remove-stale-when-updated: true
|
||||||
|
operations-per-run: 100
|
||||||
|
labels-to-remove-when-unstale: '⏱︎ Stale, 💤 Waiting for feedback'
|
||||||
|
close-issue-reason: 'not_planned'
|
||||||
|
exempt-all-milestones: false
|
||||||
81
.github/workflows/pr-build.yml
vendored
81
.github/workflows/pr-build.yml
vendored
@@ -1,81 +0,0 @@
|
|||||||
name: PR Build (v4)
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
branches-ignore: ["main", "v3"]
|
|
||||||
paths-ignore:
|
|
||||||
- .github/workflows/coolify-helper.yml
|
|
||||||
- docker/coolify-helper/Dockerfile
|
|
||||||
|
|
||||||
env:
|
|
||||||
REGISTRY: ghcr.io
|
|
||||||
IMAGE_NAME: "coollabsio/coolify"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
amd64:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Login to ghcr.io
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Build image and push to registry
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: docker/prod/Dockerfile
|
|
||||||
platforms: linux/amd64
|
|
||||||
push: true
|
|
||||||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.number }}
|
|
||||||
aarch64:
|
|
||||||
runs-on: [self-hosted, arm64]
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Login to ghcr.io
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Build image and push to registry
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: docker/prod/Dockerfile
|
|
||||||
platforms: linux/aarch64
|
|
||||||
push: true
|
|
||||||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.number }}-aarch64
|
|
||||||
merge-manifest:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
needs: [amd64, aarch64]
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
- name: Login to ghcr.io
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Create & publish manifest
|
|
||||||
run: |
|
|
||||||
docker buildx imagetools create --append ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.number }}-aarch64 --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.number }}
|
|
||||||
- uses: sarisia/actions-status-discord@v1
|
|
||||||
if: always()
|
|
||||||
with:
|
|
||||||
webhook: ${{ secrets.DISCORD_WEBHOOK_DEV_RELEASE_CHANNEL }}
|
|
||||||
78
.github/workflows/remove-labels-and-assignees-on-close.yml
vendored
Normal file
78
.github/workflows/remove-labels-and-assignees-on-close.yml
vendored
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
name: Remove Labels and Assignees on Issue Close
|
||||||
|
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types: [closed]
|
||||||
|
pull_request:
|
||||||
|
types: [closed]
|
||||||
|
pull_request_target:
|
||||||
|
types: [closed]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
remove-labels-and-assignees:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Remove labels and assignees
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
script: |
|
||||||
|
const { owner, repo } = context.repo;
|
||||||
|
|
||||||
|
async function processIssue(issueNumber) {
|
||||||
|
try {
|
||||||
|
const { data: currentLabels } = await github.rest.issues.listLabelsOnIssue({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
issue_number: issueNumber
|
||||||
|
});
|
||||||
|
|
||||||
|
const labelsToKeep = currentLabels
|
||||||
|
.filter(label => label.name === '⏱︎ Stale')
|
||||||
|
.map(label => label.name);
|
||||||
|
|
||||||
|
await github.rest.issues.setLabels({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
issue_number: issueNumber,
|
||||||
|
labels: labelsToKeep
|
||||||
|
});
|
||||||
|
|
||||||
|
const { data: issue } = await github.rest.issues.get({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
issue_number: issueNumber
|
||||||
|
});
|
||||||
|
|
||||||
|
if (issue.assignees && issue.assignees.length > 0) {
|
||||||
|
await github.rest.issues.removeAssignees({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
issue_number: issueNumber,
|
||||||
|
assignees: issue.assignees.map(assignee => assignee.login)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (error.status !== 404) {
|
||||||
|
console.error(`Error processing issue ${issueNumber}:`, error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context.eventName === 'issues' || context.eventName === 'pull_request' || context.eventName === 'pull_request_target') {
|
||||||
|
const issue = context.payload.issue || context.payload.pull_request;
|
||||||
|
await processIssue(issue.number);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context.eventName === 'pull_request' || context.eventName === 'pull_request_target') {
|
||||||
|
const pr = context.payload.pull_request;
|
||||||
|
if (pr.body) {
|
||||||
|
const issueReferences = pr.body.match(/#(\d+)/g);
|
||||||
|
if (issueReferences) {
|
||||||
|
for (const reference of issueReferences) {
|
||||||
|
const issueNumber = parseInt(reference.substring(1));
|
||||||
|
await processIssue(issueNumber);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
218
CONTRIBUTING.md
218
CONTRIBUTING.md
@@ -1,54 +1,72 @@
|
|||||||
# Contributing
|
# Contributing to Coolify
|
||||||
|
|
||||||
> "First, thanks for considering contributing to my project. It really means a lot!" - [@andrasbacsai](https://github.com/andrasbacsai)
|
> "First, thanks for considering contributing to my project. It really means a lot!" - [@andrasbacsai](https://github.com/andrasbacsai)
|
||||||
|
|
||||||
You can ask for guidance anytime on our [Discord server](https://coollabs.io/discord) in the `#contribute` channel.
|
You can ask for guidance anytime on our [Discord server](https://coollabs.io/discord) in the `#contribute` channel.
|
||||||
|
|
||||||
|
## Table of Contents
|
||||||
|
|
||||||
## Code Contribution
|
1. [Setup Development Environment](#1-setup-development-environment)
|
||||||
|
2. [Verify Installation](#2-verify-installation-optional)
|
||||||
|
3. [Fork and Setup Local Repository](#3-fork-and-setup-local-repository)
|
||||||
|
4. [Set up Environment Variables](#4-set-up-environment-variables)
|
||||||
|
5. [Start Coolify](#5-start-coolify)
|
||||||
|
6. [Start Development](#6-start-development)
|
||||||
|
7. [Create a Pull Request](#7-create-a-pull-request)
|
||||||
|
8. [Development Notes](#development-notes)
|
||||||
|
9. [Resetting Development Environment](#resetting-development-environment)
|
||||||
|
10. [Additional Contribution Guidelines](#additional-contribution-guidelines)
|
||||||
|
|
||||||
## 1. Setup your development environment
|
## 1. Setup Development Environment
|
||||||
|
|
||||||
Follow the steps below for your operating system:
|
Follow the steps below for your operating system:
|
||||||
|
|
||||||
### Windows
|
<details>
|
||||||
|
<summary><strong>Windows</strong></summary>
|
||||||
|
|
||||||
1. Install `docker-ce`, Docker Desktop (or similar):
|
1. Install `docker-ce`, Docker Desktop (or similar):
|
||||||
- Docker CE (recommended):
|
- Docker CE (recommended):
|
||||||
- Install Windows Subsystem for Linux v2 (WSL2) by following this guide: [Install WSL](https://learn.microsoft.com/en-us/windows/wsl/install)
|
- Install Windows Subsystem for Linux v2 (WSL2) by following this guide: [Install WSL](https://learn.microsoft.com/en-us/windows/wsl/install?ref=coolify)
|
||||||
- After installing WSL2, install Docker CE for your Linux distribution by following this guide: [Install Docker Engine](https://docs.docker.com/engine/install/)
|
- After installing WSL2, install Docker CE for your Linux distribution by following this guide: [Install Docker Engine](https://docs.docker.com/engine/install/?ref=coolify)
|
||||||
- Make sure to choose the appropriate Linux distribution (e.g., Ubuntu) when following the Docker installation guide
|
- Make sure to choose the appropriate Linux distribution (e.g., Ubuntu) when following the Docker installation guide
|
||||||
- Install Docker Desktop (easier):
|
- Install Docker Desktop (easier):
|
||||||
- Download and install [Docker Desktop for Windows](https://docs.docker.com/desktop/install/windows-install/)
|
- Download and install [Docker Desktop for Windows](https://docs.docker.com/desktop/install/windows-install/?ref=coolify)
|
||||||
- Ensure WSL2 backend is enabled in Docker Desktop settings
|
- Ensure WSL2 backend is enabled in Docker Desktop settings
|
||||||
|
|
||||||
2. Install Spin:
|
2. Install Spin:
|
||||||
- Follow the instructions to install Spin on Windows from the [Spin documentation](https://serversideup.net/open-source/spin/docs/installation/install-windows#download-and-install-spin-into-wsl2)
|
- Follow the instructions to install Spin on Windows from the [Spin documentation](https://serversideup.net/open-source/spin/docs/installation/install-windows#download-and-install-spin-into-wsl2?ref=coolify)
|
||||||
|
|
||||||
### MacOS
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><strong>MacOS</strong></summary>
|
||||||
|
|
||||||
1. Install Orbstack, Docker Desktop (or similar):
|
1. Install Orbstack, Docker Desktop (or similar):
|
||||||
- Orbstack (recommended, as it is a faster and lighter alternative to Docker Desktop):
|
- Orbstack (recommended, as it is a faster and lighter alternative to Docker Desktop):
|
||||||
- Download and install [Orbstack](https://docs.orbstack.dev/quick-start#installation)
|
- Download and install [Orbstack](https://docs.orbstack.dev/quick-start#installation?ref=coolify)
|
||||||
- Docker Desktop:
|
- Docker Desktop:
|
||||||
- Download and install [Docker Desktop for Mac](https://docs.docker.com/desktop/install/mac-install/)
|
- Download and install [Docker Desktop for Mac](https://docs.docker.com/desktop/install/mac-install/?ref=coolify)
|
||||||
|
|
||||||
2. Install Spin:
|
2. Install Spin:
|
||||||
- Follow the instructions to install Spin on MacOS from the [Spin documentation](https://serversideup.net/open-source/spin/docs/installation/install-macos/#download-and-install-spin)
|
- Follow the instructions to install Spin on MacOS from the [Spin documentation](https://serversideup.net/open-source/spin/docs/installation/install-macos/#download-and-install-spin?ref=coolify)
|
||||||
|
|
||||||
### Linux
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><strong>Linux</strong></summary>
|
||||||
|
|
||||||
1. Install Docker Engine, Docker Desktop (or similar):
|
1. Install Docker Engine, Docker Desktop (or similar):
|
||||||
- Docker Engine (recommended, as there is no VM overhead):
|
- Docker Engine (recommended, as there is no VM overhead):
|
||||||
- Follow the official [Docker Engine installation guide](https://docs.docker.com/engine/install/) for your Linux distribution
|
- Follow the official [Docker Engine installation guide](https://docs.docker.com/engine/install/?ref=coolify) for your Linux distribution
|
||||||
- Docker Desktop:
|
- Docker Desktop:
|
||||||
- If you want a GUI, you can use [Docker Desktop for Linux](https://docs.docker.com/desktop/install/linux-install/)
|
- If you want a GUI, you can use [Docker Desktop for Linux](https://docs.docker.com/desktop/install/linux-install/?ref=coolify)
|
||||||
|
|
||||||
2. Install Spin:
|
2. Install Spin:
|
||||||
- Follow the instructions to install Spin on Linux from the [Spin documentation](https://serversideup.net/open-source/spin/docs/installation/install-linux#configure-docker-permissions)
|
- Follow the instructions to install Spin on Linux from the [Spin documentation](https://serversideup.net/open-source/spin/docs/installation/install-linux#configure-docker-permissions?ref=coolify)
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
## 2. Verify installation (optional)
|
## 2. Verify Installation (Optional)
|
||||||
|
|
||||||
After installing Docker (or Orbstack) and Spin, verify the installation:
|
After installing Docker (or Orbstack) and Spin, verify the installation:
|
||||||
|
|
||||||
@@ -60,63 +78,53 @@ After installing Docker (or Orbstack) and Spin, verify the installation:
|
|||||||
```
|
```
|
||||||
You should see version information for both Docker and Spin.
|
You should see version information for both Docker and Spin.
|
||||||
|
|
||||||
|
## 3. Fork and Setup Local Repository
|
||||||
## 3. Fork the Coolify repository and setup your local repository
|
|
||||||
|
|
||||||
1. Fork the [Coolify](https://github.com/coollabsio/coolify) repository to your GitHub account.
|
1. Fork the [Coolify](https://github.com/coollabsio/coolify) repository to your GitHub account.
|
||||||
|
|
||||||
2. Install a code editor on your machine (below are some popular choices, choose one):
|
2. Install a code editor on your machine (choose one):
|
||||||
|
|
||||||
- Visual Studio Code (recommended free):
|
| Editor | Platform | Download Link |
|
||||||
- Windows/macOS/Linux: Download and install from [https://code.visualstudio.com/download](https://code.visualstudio.com/download)
|
|--------|----------|---------------|
|
||||||
|
| Visual Studio Code (recommended free) | Windows/macOS/Linux | [Download](https://code.visualstudio.com/download?ref=coolify) |
|
||||||
- Cursor (recommended but paid for getting the full benefits):
|
| Cursor (recommended but paid) | Windows/macOS/Linux | [Download](https://www.cursor.com/?ref=coolify) |
|
||||||
- Windows/macOS/Linux: Download and install from [https://www.cursor.com/](https://www.cursor.com/)
|
| Zed (very fast) | macOS/Linux | [Download](https://zed.dev/download?ref=coolify) |
|
||||||
|
|
||||||
- Zed (very fast code editor):
|
|
||||||
- macOS/Linux: Download and install from [https://zed.dev/download](https://zed.dev/download)
|
|
||||||
- Windows: Not available yet
|
|
||||||
|
|
||||||
3. Clone the Coolify Repository from your fork to your local machine
|
3. Clone the Coolify Repository from your fork to your local machine
|
||||||
- Use `git clone` in the command line
|
- Use `git clone` in the command line, or
|
||||||
- Use GitHub Desktop (recommended):
|
- Use GitHub Desktop (recommended):
|
||||||
- Download and install from [https://desktop.github.com/](https://desktop.github.com/)
|
- Download and install from [https://desktop.github.com/](https://desktop.github.com/?ref=coolify)
|
||||||
- Open GitHub Desktop and login with your GitHub account
|
- Open GitHub Desktop and login with your GitHub account
|
||||||
- Click on `File` -> `Clone Repository` select `github.com` as the repository location, then select your forked Coolify repository, choose the local path and then click `Clone`
|
- Click on `File` -> `Clone Repository` select `github.com` as the repository location, then select your forked Coolify repository, choose the local path and then click `Clone`
|
||||||
|
|
||||||
4. Open the cloned Coolify Repository in your chosen code editor.
|
4. Open the cloned Coolify Repository in your chosen code editor.
|
||||||
|
|
||||||
|
|
||||||
## 4. Set up Environment Variables
|
## 4. Set up Environment Variables
|
||||||
|
|
||||||
1. In the Code Editor, locate the `.env.development.example` file in the root directory of your local Coolify repository.
|
1. In the Code Editor, locate the `.env.development.example` file in the root directory of your local Coolify repository.
|
||||||
|
|
||||||
2. Duplicate the `.env.development.example` file and rename the copy to `.env`.
|
2. Duplicate the `.env.development.example` file and rename the copy to `.env`.
|
||||||
|
|
||||||
3. Open the new `.env` file and review its contents. Adjust any environment variables as needed for your development setup.
|
3. Open the new `.env` file and review its contents. Adjust any environment variables as needed for your development setup.
|
||||||
|
|
||||||
4. If you encounter errors during database migrations, update the database connection settings in your `.env` file. Use the IP address or hostname of your PostgreSQL database container. You can find this information by running `docker ps` after executing `spin up`.
|
4. If you encounter errors during database migrations, update the database connection settings in your `.env` file. Use the IP address or hostname of your PostgreSQL database container. You can find this information by running `docker ps` after executing `spin up`.
|
||||||
|
|
||||||
5. Save the changes to your `.env` file.
|
5. Save the changes to your `.env` file.
|
||||||
|
|
||||||
|
|
||||||
## 5. Start Coolify
|
## 5. Start Coolify
|
||||||
|
|
||||||
1. Open a terminal in the local Coolify directory.
|
1. Open a terminal in the local Coolify directory.
|
||||||
|
|
||||||
2. Run the following command in the terminal (leave that terminal open):
|
2. Run the following command in the terminal (leave that terminal open):
|
||||||
```
|
```bash
|
||||||
spin up
|
spin up
|
||||||
```
|
```
|
||||||
Note: You may see some errors, but don't worry; this is expected.
|
|
||||||
|
> [!NOTE]
|
||||||
|
> You may see some errors, but don't worry; this is expected.
|
||||||
|
|
||||||
3. If you encounter permission errors, especially on macOS, use:
|
3. If you encounter permission errors, especially on macOS, use:
|
||||||
```
|
```bash
|
||||||
sudo spin up
|
sudo spin up
|
||||||
```
|
```
|
||||||
|
|
||||||
Note: If you change environment variables afterwards or anything seems broken, press Ctrl + C to stop the process and run `spin up` again.
|
> [!NOTE]
|
||||||
|
> If you change environment variables afterwards or anything seems broken, press Ctrl + C to stop the process and run `spin up` again.
|
||||||
|
|
||||||
## 6. Start Development
|
## 6. Start Development
|
||||||
|
|
||||||
@@ -126,42 +134,19 @@ Note: If you change environment variables afterwards or anything seems broken, p
|
|||||||
- Password: `password`
|
- Password: `password`
|
||||||
|
|
||||||
2. Additional development tools:
|
2. Additional development tools:
|
||||||
- Laravel Horizon (scheduler): `http://localhost:8000/horizon`
|
| Tool | URL | Note |
|
||||||
Note: Only accessible when logged in as root user
|
|------|-----|------|
|
||||||
- Mailpit (email catcher): `http://localhost:8025`
|
| Laravel Horizon (scheduler) | `http://localhost:8000/horizon` | Only accessible when logged in as root user |
|
||||||
- Telescope (debugging tool): `http://localhost:8000/telescope`
|
| Mailpit (email catcher) | `http://localhost:8025` | |
|
||||||
Note: Disabled by default (so the database is not overloaded), enable by adding the following environment variable to your `.env` file:
|
| Telescope (debugging tool) | `http://localhost:8000/telescope` | Disabled by default |
|
||||||
```env
|
|
||||||
TELESCOPE_ENABLED=true
|
|
||||||
```
|
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> To enable Telescope, add the following to your `.env` file:
|
||||||
|
> ```env
|
||||||
|
> TELESCOPE_ENABLED=true
|
||||||
|
> ```
|
||||||
|
|
||||||
## 7. Development Notes
|
## 7. Create a Pull Request
|
||||||
|
|
||||||
When working on Coolify, keep the following in mind:
|
|
||||||
|
|
||||||
1. **Database Migrations**: After switching branches or making changes to the database structure, always run migrations:
|
|
||||||
```bash
|
|
||||||
docker exec -it coolify php artisan migrate
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Resetting Development Setup**: To reset your development setup to a clean database with default values:
|
|
||||||
```bash
|
|
||||||
docker exec -it coolify php artisan migrate:fresh --seed
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Troubleshooting**: If you encounter unexpected behavior, ensure your database is up-to-date with the latest migrations and if possible reset the development setup to eliminate any envrionement specific issues.
|
|
||||||
|
|
||||||
Remember, forgetting to migrate the database can cause problems, so make it a habit to run migrations after pulling changes or switching branches.
|
|
||||||
|
|
||||||
|
|
||||||
## 8. Contributing a New Service
|
|
||||||
|
|
||||||
To add a new service to Coolify, please refer to our documentation:
|
|
||||||
[Adding a New Service](https://coolify.io/docs/knowledge-base/add-a-service)
|
|
||||||
|
|
||||||
|
|
||||||
## 9. Create a Pull Request
|
|
||||||
|
|
||||||
1. After making changes or adding a new service:
|
1. After making changes or adding a new service:
|
||||||
- Commit your changes to your forked repository.
|
- Commit your changes to your forked repository.
|
||||||
@@ -176,14 +161,83 @@ To add a new service to Coolify, please refer to our documentation:
|
|||||||
|
|
||||||
3. Filling out the PR details:
|
3. Filling out the PR details:
|
||||||
- Give your PR a descriptive title.
|
- Give your PR a descriptive title.
|
||||||
- In the description, explain the changes you've made.
|
- Use the Pull Request Template provided and fill in the details.
|
||||||
- Reference any related issues by using keywords like "Fixes #123" or "Closes #456".
|
|
||||||
|
|
||||||
4. Important note:
|
> [!IMPORTANT]
|
||||||
Always set the base branch for your PR to the `next` branch of the Coolify repository, not the `main` branch.
|
> Always set the base branch for your PR to the `next` branch of the Coolify repository, not the `main` branch.
|
||||||
|
|
||||||
5. Submit your PR:
|
4. Submit your PR:
|
||||||
- Review your changes one last time.
|
- Review your changes one last time.
|
||||||
- Click "Create pull request" to submit.
|
- Click "Create pull request" to submit.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> Make sure your PR is out of draft mode as soon as it's ready for review. PRs that are in draft mode for a long time may be closed by maintainers.
|
||||||
|
|
||||||
After submission, maintainers will review your PR and may request changes or provide feedback.
|
After submission, maintainers will review your PR and may request changes or provide feedback.
|
||||||
|
|
||||||
|
## Development Notes
|
||||||
|
|
||||||
|
When working on Coolify, keep the following in mind:
|
||||||
|
|
||||||
|
1. **Database Migrations**: After switching branches or making changes to the database structure, always run migrations:
|
||||||
|
```bash
|
||||||
|
docker exec -it coolify php artisan migrate
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Resetting Development Setup**: To reset your development setup to a clean database with default values:
|
||||||
|
```bash
|
||||||
|
docker exec -it coolify php artisan migrate:fresh --seed
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Troubleshooting**: If you encounter unexpected behavior, ensure your database is up-to-date with the latest migrations and if possible reset the development setup to eliminate any environment-specific issues.
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> Forgetting to migrate the database can cause problems, so make it a habit to run migrations after pulling changes or switching branches.
|
||||||
|
|
||||||
|
## Resetting Development Environment
|
||||||
|
|
||||||
|
If you encounter issues or break your database or something else, follow these steps to start from a clean slate (works since `v4.0.0-beta.342`):
|
||||||
|
|
||||||
|
1. Stop all running containers `ctrl + c`.
|
||||||
|
|
||||||
|
2. Remove all Coolify containers:
|
||||||
|
```bash
|
||||||
|
docker rm coolify coolify-db coolify-redis coolify-realtime coolify-testing-host coolify-minio coolify-vite-1 coolify-mail
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Remove Coolify volumes (it is possible that the volumes have no `coolify` prefix on your machine, in that case remove the prefix from the command):
|
||||||
|
```bash
|
||||||
|
docker volume rm coolify_dev_backups_data coolify_dev_postgres_data coolify_dev_redis_data coolify_dev_coolify_data coolify_dev_minio_data
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Remove unused images:
|
||||||
|
```bash
|
||||||
|
docker image prune -a
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Start Coolify again:
|
||||||
|
```bash
|
||||||
|
spin up
|
||||||
|
```
|
||||||
|
|
||||||
|
6. Run database migrations and seeders:
|
||||||
|
```bash
|
||||||
|
docker exec -it coolify php artisan migrate:fresh --seed
|
||||||
|
```
|
||||||
|
|
||||||
|
After completing these steps, you'll have a fresh development setup.
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> Always run database migrations and seeders after switching branches or pulling updates to ensure your local database structure matches the current codebase and includes necessary seed data.
|
||||||
|
|
||||||
|
## Additional Contribution Guidelines
|
||||||
|
|
||||||
|
### Contributing a New Service
|
||||||
|
|
||||||
|
To add a new service to Coolify, please refer to our documentation:
|
||||||
|
[Adding a New Service](https://coolify.io/docs/knowledge-base/contribute/service)
|
||||||
|
|
||||||
|
### Contributing to Documentation
|
||||||
|
|
||||||
|
To contribute to the Coolify documentation, please refer to this guide:
|
||||||
|
[Contributing to the Coolify Documentation](https://github.com/coollabsio/documentation-coolify/blob/main/CONTRIBUTING.md)
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ Special thanks to our biggest sponsors!
|
|||||||
* [Latitude](https://latitude.sh/?ref=coolify.io) - A cloud computing platform offering bare metal servers and cloud instances for developers and businesses.
|
* [Latitude](https://latitude.sh/?ref=coolify.io) - A cloud computing platform offering bare metal servers and cloud instances for developers and businesses.
|
||||||
* [Brand Dev](https://brand.dev/?ref=coolify.io) - A web development agency specializing in creating custom digital experiences and brand identities.
|
* [Brand Dev](https://brand.dev/?ref=coolify.io) - A web development agency specializing in creating custom digital experiences and brand identities.
|
||||||
* [Jobscollider](https://jobscollider.com/remote-jobs?ref=coolify.io) - A job search platform connecting professionals with remote work opportunities across various industries.
|
* [Jobscollider](https://jobscollider.com/remote-jobs?ref=coolify.io) - A job search platform connecting professionals with remote work opportunities across various industries.
|
||||||
* [Hostinger](https://hostinger.com?ref=coolify.io) - A web hosting provider offering affordable hosting solutions, domain registration, and website building tools.
|
* [Hostinger](https://www.hostinger.com/vps/coolify-hosting?ref=coolify.io) - A web hosting provider offering affordable hosting solutions, domain registration, and website building tools.
|
||||||
* [Glueops](https://www.glueops.dev/?ref=coolify.io) - A DevOps consulting company providing infrastructure automation and cloud optimization services.
|
* [Glueops](https://www.glueops.dev/?ref=coolify.io) - A DevOps consulting company providing infrastructure automation and cloud optimization services.
|
||||||
* [Ubicloud](https://ubicloud.com/?ref=coolify.io) - An open-source alternative to hyperscale cloud providers, offering high-performance cloud computing services.
|
* [Ubicloud](https://ubicloud.com/?ref=coolify.io) - An open-source alternative to hyperscale cloud providers, offering high-performance cloud computing services.
|
||||||
* [Juxtdigital](https://juxtdigital.dev/?ref=coolify.io) - A digital agency offering web development, design, and digital marketing services for businesses.
|
* [Juxtdigital](https://juxtdigital.dev/?ref=coolify.io) - A digital agency offering web development, design, and digital marketing services for businesses.
|
||||||
|
|||||||
130
RELEASE.md
Normal file
130
RELEASE.md
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
# Coolify Release Guide
|
||||||
|
|
||||||
|
This guide outlines the release process for Coolify, intended for developers and those interested in understanding how releases are managed and deployed.
|
||||||
|
|
||||||
|
## Table of Contents
|
||||||
|
- [Release Process](#release-process)
|
||||||
|
- [Version Types](#version-types)
|
||||||
|
- [Stable](#stable)
|
||||||
|
- [Nightly](#nightly)
|
||||||
|
- [Beta](#beta)
|
||||||
|
- [Version Availability](#version-availability)
|
||||||
|
- [Self-Hosted](#self-hosted)
|
||||||
|
- [Cloud](#cloud)
|
||||||
|
- [Manually Update to Specific Versions](#manually-update-to-specific-versions)
|
||||||
|
|
||||||
|
## Release Process
|
||||||
|
|
||||||
|
1. **Development on `next` or Feature Branches**
|
||||||
|
- Improvements, fixes, and new features are developed on the `next` branch or separate feature branches.
|
||||||
|
|
||||||
|
2. **Merging to `main`**
|
||||||
|
- Once ready, changes are merged from the `next` branch into the `main` branch.
|
||||||
|
|
||||||
|
3. **Building the Release**
|
||||||
|
- After merging to `main`, GitHub Actions automatically builds release images for all architectures and pushes them to the GitHub Container Registry with the version tag and the `latest` tag.
|
||||||
|
|
||||||
|
4. **Creating a GitHub Release**
|
||||||
|
- A new GitHub release is manually created with details of the changes made in the version.
|
||||||
|
|
||||||
|
5. **Updating the CDN**
|
||||||
|
- To make a new version publicly available, the version information on the CDN needs to be updated: [https://cdn.coollabs.io/coolify/versions.json](https://cdn.coollabs.io/coolify/versions.json)
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> The CDN update may not occur immediately after the GitHub release. It can take hours or even days due to additional testing, stability checks, or potential hotfixes. **The update becomes available only after the CDN is updated.**
|
||||||
|
|
||||||
|
## Version Types
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><strong>Stable (coming soon)</strong></summary>
|
||||||
|
|
||||||
|
- **Stable**
|
||||||
|
- The production version suitable for stable, production environments (generally recommended).
|
||||||
|
- **Update Frequency:** Every 2 to 4 weeks, with more frequent possible hotfixes.
|
||||||
|
- **Release Size:** Larger but less frequent releases. Multiple nightly versions are consolidated into a single stable release.
|
||||||
|
- **Versioning Scheme:** Follows semantic versioning (e.g., `v4.0.0`).
|
||||||
|
- **Installation Command:**
|
||||||
|
```bash
|
||||||
|
curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><strong>Nightly</strong></summary>
|
||||||
|
|
||||||
|
- **Nightly**
|
||||||
|
- The latest development version, suitable for testing the latest changes and experimenting with new features.
|
||||||
|
- **Update Frequency:** Daily or bi-weekly updates.
|
||||||
|
- **Release Size:** Smaller, more frequent releases.
|
||||||
|
- **Versioning Scheme:** TO BE DETERMINED
|
||||||
|
- **Installation Command:**
|
||||||
|
```bash
|
||||||
|
curl -fsSL https://cdn.coollabs.io/coolify-nightly/install.sh | bash -s next
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><strong>Beta</strong></summary>
|
||||||
|
|
||||||
|
- **Beta**
|
||||||
|
- Test releases for the upcoming stable version.
|
||||||
|
- **Purpose:** Allows users to test and provide feedback on new features and changes before they become stable.
|
||||||
|
- **Update Frequency:** Available if we think beta testing is necessary.
|
||||||
|
- **Release Size:** Same size as stable release as it will become the next stabe release after some time.
|
||||||
|
- **Versioning Scheme:** Follows semantic versioning (e.g., `4.1.0-beta.1`).
|
||||||
|
- **Installation Command:**
|
||||||
|
```bash
|
||||||
|
curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> Do not use nightly/beta builds in production as there is no guarantee of stability.
|
||||||
|
|
||||||
|
## Version Availability
|
||||||
|
|
||||||
|
When a new version is released and a new GitHub release is created, it doesn't immediately become available for your instance. Here's how version availability works for different instance types.
|
||||||
|
|
||||||
|
### Self-Hosted
|
||||||
|
|
||||||
|
- **Update Frequency:** More frequent updates, especially on the nightly release channel.
|
||||||
|
- **Update Availability:** New versions are available once the CDN has been updated.
|
||||||
|
- **Update Methods:**
|
||||||
|
1. **Manual Update in Instance Settings:**
|
||||||
|
- Go to `Settings > Update Check Frequency` and click the `Check Manually` button.
|
||||||
|
- If an update is available, an upgrade button will appear on the sidebar.
|
||||||
|
2. **Automatic Update:**
|
||||||
|
- If enabled, the instance will update automatically at the time set in the settings.
|
||||||
|
3. **Re-run Installation Script:**
|
||||||
|
- Run the installation script again to upgrade to the latest version available on the CDN:
|
||||||
|
```bash
|
||||||
|
curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash
|
||||||
|
```
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> If a new release is available on GitHub but your instance hasn't updated yet or no upgrade button is shown in the UI, the CDN might not have been updated yet. This intentional delay ensures stability and allows for hotfixes before official release.
|
||||||
|
|
||||||
|
### Cloud
|
||||||
|
|
||||||
|
- **Update Frequency:** Less frequent as it's a managed service.
|
||||||
|
- **Update Availability:** New versions are available once Andras has updated the cloud version manually.
|
||||||
|
- **Update Method:**
|
||||||
|
- Updates are managed by Andras, who ensures each cloud version is thoroughly tested and stable before releasing it.
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> The cloud version of Coolify may be several versions behind the latest GitHub releases even if the CDN is updated. This is intentional to ensure stability and reliability for cloud users and Andras will manully update the cloud version when the update is ready.
|
||||||
|
|
||||||
|
## Manually Update to Specific Versions
|
||||||
|
|
||||||
|
> [!CAUTION]
|
||||||
|
> Updating to unreleased versions is not recommended and may cause issues. Use at your own risk!
|
||||||
|
|
||||||
|
To update your Coolify instance to a specific (unreleased) version, use the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash -s <version>
|
||||||
|
```
|
||||||
|
Replace `<version>` with the version you want to update to (for example `4.0.0-beta.332`).
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Actions\Application;
|
namespace App\Actions\Application;
|
||||||
|
|
||||||
|
use App\Actions\Server\CleanupDocker;
|
||||||
use App\Models\Application;
|
use App\Models\Application;
|
||||||
use Lorisleiva\Actions\Concerns\AsAction;
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
|
||||||
@@ -9,44 +10,35 @@ class StopApplication
|
|||||||
{
|
{
|
||||||
use AsAction;
|
use AsAction;
|
||||||
|
|
||||||
public function handle(Application $application, bool $previewDeployments = false)
|
public function handle(Application $application, bool $previewDeployments = false, bool $dockerCleanup = true)
|
||||||
{
|
{
|
||||||
if ($application->destination->server->isSwarm()) {
|
try {
|
||||||
instant_remote_process(["docker stack rm {$application->uuid}"], $application->destination->server);
|
$server = $application->destination->server;
|
||||||
|
if (! $server->isFunctional()) {
|
||||||
|
return 'Server is not functional';
|
||||||
|
}
|
||||||
|
ray('Stopping application: '.$application->name);
|
||||||
|
|
||||||
|
if ($server->isSwarm()) {
|
||||||
|
instant_remote_process(["docker stack rm {$application->uuid}"], $server);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$servers = collect([]);
|
$containersToStop = $application->getContainersToStop($previewDeployments);
|
||||||
$servers->push($application->destination->server);
|
$application->stopContainers($containersToStop, $server);
|
||||||
$application->additional_servers->map(function ($server) use ($servers) {
|
|
||||||
$servers->push($server);
|
|
||||||
});
|
|
||||||
foreach ($servers as $server) {
|
|
||||||
if (! $server->isFunctional()) {
|
|
||||||
return 'Server is not functional';
|
|
||||||
}
|
|
||||||
if ($previewDeployments) {
|
|
||||||
$containers = getCurrentApplicationContainerStatus($server, $application->id, includePullrequests: true);
|
|
||||||
} else {
|
|
||||||
$containers = getCurrentApplicationContainerStatus($server, $application->id, 0);
|
|
||||||
}
|
|
||||||
if ($containers->count() > 0) {
|
|
||||||
foreach ($containers as $container) {
|
|
||||||
$containerName = data_get($container, 'Names');
|
|
||||||
if ($containerName) {
|
|
||||||
instant_remote_process(command: ["docker stop --time=30 $containerName"], server: $server, throwError: false);
|
|
||||||
instant_remote_process(command: ["docker rm $containerName"], server: $server, throwError: false);
|
|
||||||
instant_remote_process(command: ["docker rm -f {$containerName}"], server: $server, throwError: false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($application->build_pack === 'dockercompose') {
|
if ($application->build_pack === 'dockercompose') {
|
||||||
// remove network
|
$application->delete_connected_networks($application->uuid);
|
||||||
$uuid = $application->uuid;
|
}
|
||||||
instant_remote_process(["docker network disconnect {$uuid} coolify-proxy"], $server, false);
|
|
||||||
instant_remote_process(["docker network rm {$uuid}"], $server, false);
|
if ($dockerCleanup) {
|
||||||
}
|
CleanupDocker::dispatch($server, true);
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
ray($e->getMessage());
|
||||||
|
|
||||||
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Actions\CoolifyTask;
|
|||||||
|
|
||||||
use App\Enums\ActivityTypes;
|
use App\Enums\ActivityTypes;
|
||||||
use App\Enums\ProcessStatus;
|
use App\Enums\ProcessStatus;
|
||||||
|
use App\Helpers\SshMultiplexingHelper;
|
||||||
use App\Jobs\ApplicationDeploymentJob;
|
use App\Jobs\ApplicationDeploymentJob;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use Illuminate\Process\ProcessResult;
|
use Illuminate\Process\ProcessResult;
|
||||||
@@ -137,7 +138,7 @@ class RunRemoteProcess
|
|||||||
$command = $this->activity->getExtraProperty('command');
|
$command = $this->activity->getExtraProperty('command');
|
||||||
$server = Server::whereUuid($server_uuid)->firstOrFail();
|
$server = Server::whereUuid($server_uuid)->firstOrFail();
|
||||||
|
|
||||||
return generateSshCommand($server, $command);
|
return SshMultiplexingHelper::generateSshCommand($server, $command);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function handleOutput(string $type, string $output)
|
protected function handleOutput(string $type, string $output)
|
||||||
|
|||||||
@@ -46,9 +46,6 @@ class StartDragonfly
|
|||||||
'networks' => [
|
'networks' => [
|
||||||
$this->database->destination->network,
|
$this->database->destination->network,
|
||||||
],
|
],
|
||||||
'ulimits' => [
|
|
||||||
'memlock' => '-1',
|
|
||||||
],
|
|
||||||
'labels' => [
|
'labels' => [
|
||||||
'coolify.managed' => 'true',
|
'coolify.managed' => 'true',
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ class StartPostgresql
|
|||||||
$this->generate_init_scripts();
|
$this->generate_init_scripts();
|
||||||
$this->add_custom_conf();
|
$this->add_custom_conf();
|
||||||
|
|
||||||
|
|
||||||
$docker_compose = [
|
$docker_compose = [
|
||||||
'services' => [
|
'services' => [
|
||||||
$container_name => [
|
$container_name => [
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Actions\Database;
|
namespace App\Actions\Database;
|
||||||
|
|
||||||
|
use App\Actions\Server\CleanupDocker;
|
||||||
use App\Models\StandaloneClickhouse;
|
use App\Models\StandaloneClickhouse;
|
||||||
use App\Models\StandaloneDragonfly;
|
use App\Models\StandaloneDragonfly;
|
||||||
use App\Models\StandaloneKeydb;
|
use App\Models\StandaloneKeydb;
|
||||||
@@ -10,25 +11,65 @@ use App\Models\StandaloneMongodb;
|
|||||||
use App\Models\StandaloneMysql;
|
use App\Models\StandaloneMysql;
|
||||||
use App\Models\StandalonePostgresql;
|
use App\Models\StandalonePostgresql;
|
||||||
use App\Models\StandaloneRedis;
|
use App\Models\StandaloneRedis;
|
||||||
|
use Illuminate\Support\Facades\Process;
|
||||||
use Lorisleiva\Actions\Concerns\AsAction;
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
|
||||||
class StopDatabase
|
class StopDatabase
|
||||||
{
|
{
|
||||||
use AsAction;
|
use AsAction;
|
||||||
|
|
||||||
public function handle(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse $database)
|
public function handle(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse $database, bool $isDeleteOperation = false, bool $dockerCleanup = true)
|
||||||
{
|
{
|
||||||
$server = $database->destination->server;
|
$server = $database->destination->server;
|
||||||
if (! $server->isFunctional()) {
|
if (! $server->isFunctional()) {
|
||||||
return 'Server is not functional';
|
return 'Server is not functional';
|
||||||
}
|
}
|
||||||
|
|
||||||
instant_remote_process(command: ["docker stop --time=30 $database->uuid"], server: $server, throwError: false);
|
$this->stopContainer($database, $database->uuid, 300);
|
||||||
instant_remote_process(command: ["docker rm $database->uuid"], server: $server, throwError: false);
|
if (! $isDeleteOperation) {
|
||||||
instant_remote_process(command: ["docker rm -f $database->uuid"], server: $server, throwError: false);
|
if ($dockerCleanup) {
|
||||||
|
CleanupDocker::dispatch($server, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($database->is_public) {
|
if ($database->is_public) {
|
||||||
StopDatabaseProxy::run($database);
|
StopDatabaseProxy::run($database);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 'Database stopped successfully';
|
||||||
|
}
|
||||||
|
|
||||||
|
private function stopContainer($database, string $containerName, int $timeout = 300): void
|
||||||
|
{
|
||||||
|
$server = $database->destination->server;
|
||||||
|
|
||||||
|
$process = Process::timeout($timeout)->start("docker stop --time=$timeout $containerName");
|
||||||
|
|
||||||
|
$startTime = time();
|
||||||
|
while ($process->running()) {
|
||||||
|
if (time() - $startTime >= $timeout) {
|
||||||
|
$this->forceStopContainer($containerName, $server);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
usleep(100000);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->removeContainer($containerName, $server);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function forceStopContainer(string $containerName, $server): void
|
||||||
|
{
|
||||||
|
instant_remote_process(command: ["docker kill $containerName"], server: $server, throwError: false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function removeContainer(string $containerName, $server): void
|
||||||
|
{
|
||||||
|
instant_remote_process(command: ["docker rm -f $containerName"], server: $server, throwError: false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function deleteConnectedNetworks($uuid, $server)
|
||||||
|
{
|
||||||
|
instant_remote_process(["docker network disconnect {$uuid} coolify-proxy"], $server, false);
|
||||||
|
instant_remote_process(["docker network rm {$uuid}"], $server, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -543,7 +543,7 @@ class GetContainersStatus
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$exitedServices = $exitedServices->unique('id');
|
$exitedServices = $exitedServices->unique('uuid');
|
||||||
foreach ($exitedServices as $exitedService) {
|
foreach ($exitedServices as $exitedService) {
|
||||||
if (str($exitedService->status)->startsWith('exited')) {
|
if (str($exitedService->status)->startsWith('exited')) {
|
||||||
continue;
|
continue;
|
||||||
@@ -651,8 +651,9 @@ class GetContainersStatus
|
|||||||
// $this->server->team?->notify(new ContainerStopped($containerName, $this->server, $url));
|
// $this->server->team?->notify(new ContainerStopped($containerName, $this->server, $url));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if proxy is running
|
if (! $this->server->proxySet() || $this->server->proxy->force_stop) {
|
||||||
$this->server->proxyType();
|
return;
|
||||||
|
}
|
||||||
$foundProxyContainer = $this->containers->filter(function ($value, $key) {
|
$foundProxyContainer = $this->containers->filter(function ($value, $key) {
|
||||||
if ($this->server->isSwarm()) {
|
if ($this->server->isSwarm()) {
|
||||||
return data_get($value, 'Spec.Name') === 'coolify-proxy_traefik';
|
return data_get($value, 'Spec.Name') === 'coolify-proxy_traefik';
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Actions\Fortify;
|
namespace App\Actions\Fortify;
|
||||||
|
|
||||||
use App\Models\InstanceSettings;
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
@@ -20,7 +19,7 @@ class CreateNewUser implements CreatesNewUsers
|
|||||||
*/
|
*/
|
||||||
public function create(array $input): User
|
public function create(array $input): User
|
||||||
{
|
{
|
||||||
$settings = InstanceSettings::get();
|
$settings = instanceSettings();
|
||||||
if (! $settings->is_registration_enabled) {
|
if (! $settings->is_registration_enabled) {
|
||||||
abort(403);
|
abort(403);
|
||||||
}
|
}
|
||||||
@@ -48,7 +47,7 @@ class CreateNewUser implements CreatesNewUsers
|
|||||||
$team = $user->teams()->first();
|
$team = $user->teams()->first();
|
||||||
|
|
||||||
// Disable registration after first user is created
|
// Disable registration after first user is created
|
||||||
$settings = InstanceSettings::get();
|
$settings = instanceSettings();
|
||||||
$settings->is_registration_enabled = false;
|
$settings->is_registration_enabled = false;
|
||||||
$settings->save();
|
$settings->save();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Actions\License;
|
namespace App\Actions\License;
|
||||||
|
|
||||||
use App\Models\InstanceSettings;
|
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
use Lorisleiva\Actions\Concerns\AsAction;
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
|
||||||
@@ -13,7 +12,7 @@ class CheckResaleLicense
|
|||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$settings = InstanceSettings::get();
|
$settings = instanceSettings();
|
||||||
if (isDev()) {
|
if (isDev()) {
|
||||||
$settings->update([
|
$settings->update([
|
||||||
'is_resale_license_active' => true,
|
'is_resale_license_active' => true,
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class CheckConfiguration
|
|||||||
];
|
];
|
||||||
$proxy_configuration = instant_remote_process($payload, $server, false);
|
$proxy_configuration = instant_remote_process($payload, $server, false);
|
||||||
if ($reset || ! $proxy_configuration || is_null($proxy_configuration)) {
|
if ($reset || ! $proxy_configuration || is_null($proxy_configuration)) {
|
||||||
$proxy_configuration = str(generate_default_proxy_configuration($server))->trim()->value;
|
$proxy_configuration = str(generate_default_proxy_configuration($server))->trim()->value();
|
||||||
}
|
}
|
||||||
if (! $proxy_configuration || is_null($proxy_configuration)) {
|
if (! $proxy_configuration || is_null($proxy_configuration)) {
|
||||||
throw new \Exception('Could not generate proxy configuration');
|
throw new \Exception('Could not generate proxy configuration');
|
||||||
|
|||||||
@@ -2,14 +2,17 @@
|
|||||||
|
|
||||||
namespace App\Actions\Proxy;
|
namespace App\Actions\Proxy;
|
||||||
|
|
||||||
|
use App\Enums\ProxyTypes;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use Lorisleiva\Actions\Concerns\AsAction;
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
use Symfony\Component\Yaml\Yaml;
|
||||||
|
|
||||||
class CheckProxy
|
class CheckProxy
|
||||||
{
|
{
|
||||||
use AsAction;
|
use AsAction;
|
||||||
|
|
||||||
public function handle(Server $server, $fromUI = false)
|
// It should return if the proxy should be started (true) or not (false)
|
||||||
|
public function handle(Server $server, $fromUI = false): bool
|
||||||
{
|
{
|
||||||
if (! $server->isFunctional()) {
|
if (! $server->isFunctional()) {
|
||||||
return false;
|
return false;
|
||||||
@@ -26,7 +29,7 @@ class CheckProxy
|
|||||||
if (is_null($proxyType) || $proxyType === 'NONE' || $server->proxy->force_stop) {
|
if (is_null($proxyType) || $proxyType === 'NONE' || $server->proxy->force_stop) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
['uptime' => $uptime, 'error' => $error] = $server->validateConnection();
|
['uptime' => $uptime, 'error' => $error] = $server->validateConnection(false);
|
||||||
if (! $uptime) {
|
if (! $uptime) {
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
}
|
}
|
||||||
@@ -62,23 +65,43 @@ class CheckProxy
|
|||||||
$ip = 'host.docker.internal';
|
$ip = 'host.docker.internal';
|
||||||
}
|
}
|
||||||
|
|
||||||
$connection80 = @fsockopen($ip, '80');
|
$portsToCheck = ['80', '443'];
|
||||||
$connection443 = @fsockopen($ip, '443');
|
|
||||||
$port80 = is_resource($connection80) && fclose($connection80);
|
try {
|
||||||
$port443 = is_resource($connection443) && fclose($connection443);
|
if ($server->proxyType() !== ProxyTypes::NONE->value) {
|
||||||
if ($port80) {
|
$proxyCompose = CheckConfiguration::run($server);
|
||||||
|
if (isset($proxyCompose)) {
|
||||||
|
$yaml = Yaml::parse($proxyCompose);
|
||||||
|
$portsToCheck = [];
|
||||||
|
if ($server->proxyType() === ProxyTypes::TRAEFIK->value) {
|
||||||
|
$ports = data_get($yaml, 'services.traefik.ports');
|
||||||
|
} elseif ($server->proxyType() === ProxyTypes::CADDY->value) {
|
||||||
|
$ports = data_get($yaml, 'services.caddy.ports');
|
||||||
|
}
|
||||||
|
if (isset($ports)) {
|
||||||
|
foreach ($ports as $port) {
|
||||||
|
$portsToCheck[] = str($port)->before(':')->value();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$portsToCheck = [];
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
ray($e->getMessage());
|
||||||
|
}
|
||||||
|
if (count($portsToCheck) === 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
foreach ($portsToCheck as $port) {
|
||||||
|
$connection = @fsockopen($ip, $port);
|
||||||
|
if (is_resource($connection) && fclose($connection)) {
|
||||||
if ($fromUI) {
|
if ($fromUI) {
|
||||||
throw new \Exception("Port 80 is in use.<br>You must stop the process using this port.<br>Docs: <a target='_blank' href='https://coolify.io/docs'>https://coolify.io/docs</a><br>Discord: <a target='_blank' href='https://coollabs.io/discord'>https://coollabs.io/discord</a>");
|
throw new \Exception("Port $port is in use.<br>You must stop the process using this port.<br>Docs: <a target='_blank' href='https://coolify.io/docs'>https://coolify.io/docs</a><br>Discord: <a target='_blank' href='https://coollabs.io/discord'>https://coollabs.io/discord</a>");
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($port443) {
|
|
||||||
if ($fromUI) {
|
|
||||||
throw new \Exception("Port 443 is in use.<br>You must stop the process using this port.<br>Docs: <a target='_blank' href='https://coolify.io/docs'>https://coolify.io/docs</a><br>Discord: <a target='_blank' href='https://coollabs.io/discord'>https://coollabs.io/discord</a>");
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class StartProxy
|
|||||||
}
|
}
|
||||||
SaveConfiguration::run($server, $configuration);
|
SaveConfiguration::run($server, $configuration);
|
||||||
$docker_compose_yml_base64 = base64_encode($configuration);
|
$docker_compose_yml_base64 = base64_encode($configuration);
|
||||||
$server->proxy->last_applied_settings = str($docker_compose_yml_base64)->pipe('md5')->value;
|
$server->proxy->last_applied_settings = str($docker_compose_yml_base64)->pipe('md5')->value();
|
||||||
$server->save();
|
$server->save();
|
||||||
if ($server->isSwarm()) {
|
if ($server->isSwarm()) {
|
||||||
$commands = $commands->merge([
|
$commands = $commands->merge([
|
||||||
@@ -35,7 +35,7 @@ class StartProxy
|
|||||||
"echo 'Creating required Docker Compose file.'",
|
"echo 'Creating required Docker Compose file.'",
|
||||||
"echo 'Starting coolify-proxy.'",
|
"echo 'Starting coolify-proxy.'",
|
||||||
'docker stack deploy -c docker-compose.yml coolify-proxy',
|
'docker stack deploy -c docker-compose.yml coolify-proxy',
|
||||||
"echo 'Proxy started successfully.'",
|
"echo 'Successfully started coolify-proxy.'",
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
$caddfile = 'import /dynamic/*.caddy';
|
$caddfile = 'import /dynamic/*.caddy';
|
||||||
@@ -46,11 +46,14 @@ class StartProxy
|
|||||||
"echo 'Creating required Docker Compose file.'",
|
"echo 'Creating required Docker Compose file.'",
|
||||||
"echo 'Pulling docker image.'",
|
"echo 'Pulling docker image.'",
|
||||||
'docker compose pull',
|
'docker compose pull',
|
||||||
"echo 'Stopping existing coolify-proxy.'",
|
'if docker ps -a --format "{{.Names}}" | grep -q "^coolify-proxy$"; then',
|
||||||
'docker compose down -v --remove-orphans > /dev/null 2>&1',
|
" echo 'Stopping and removing existing coolify-proxy.'",
|
||||||
|
' docker rm -f coolify-proxy || true',
|
||||||
|
" echo 'Successfully stopped and removed existing coolify-proxy.'",
|
||||||
|
'fi',
|
||||||
"echo 'Starting coolify-proxy.'",
|
"echo 'Starting coolify-proxy.'",
|
||||||
'docker compose up -d --remove-orphans',
|
'docker compose up -d --remove-orphans',
|
||||||
"echo 'Proxy started successfully.'",
|
"echo 'Successfully started coolify-proxy.'",
|
||||||
]);
|
]);
|
||||||
$commands = $commands->merge(connectProxyToNetworks($server));
|
$commands = $commands->merge(connectProxyToNetworks($server));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,22 +11,29 @@ class CleanupDocker
|
|||||||
|
|
||||||
public function handle(Server $server)
|
public function handle(Server $server)
|
||||||
{
|
{
|
||||||
|
$settings = instanceSettings();
|
||||||
|
$helperImageVersion = data_get($settings, 'helper_version');
|
||||||
|
$helperImage = config('coolify.helper_image');
|
||||||
|
$helperImageWithVersion = "$helperImage:$helperImageVersion";
|
||||||
|
|
||||||
$commands = $this->getCommands();
|
$commands = [
|
||||||
|
'docker container prune -f --filter "label=coolify.managed=true" --filter "label!=coolify.proxy=true"',
|
||||||
|
'docker image prune -af --filter "label!=coolify.managed=true"',
|
||||||
|
'docker builder prune -af',
|
||||||
|
"docker images --filter before=$helperImageWithVersion --filter reference=$helperImage | grep $helperImage | awk '{print $3}' | xargs -r docker rmi -f",
|
||||||
|
];
|
||||||
|
|
||||||
|
$serverSettings = $server->settings;
|
||||||
|
if ($serverSettings->delete_unused_volumes) {
|
||||||
|
$commands[] = 'docker volume prune -af';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($serverSettings->delete_unused_networks) {
|
||||||
|
$commands[] = 'docker network prune -f';
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($commands as $command) {
|
foreach ($commands as $command) {
|
||||||
instant_remote_process([$command], $server, false);
|
instant_remote_process([$command], $server, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getCommands(): array
|
|
||||||
{
|
|
||||||
$commonCommands = [
|
|
||||||
'docker container prune -f --filter "label=coolify.managed=true"',
|
|
||||||
'docker image prune -af',
|
|
||||||
'docker builder prune -af',
|
|
||||||
];
|
|
||||||
|
|
||||||
return $commonCommands;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Actions\Server;
|
namespace App\Actions\Server;
|
||||||
|
|
||||||
|
use App\Events\CloudflareTunnelConfigured;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use Lorisleiva\Actions\Concerns\AsAction;
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
use Symfony\Component\Yaml\Yaml;
|
use Symfony\Component\Yaml\Yaml;
|
||||||
@@ -40,12 +41,17 @@ class ConfigureCloudflared
|
|||||||
instant_remote_process($commands, $server);
|
instant_remote_process($commands, $server);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
ray($e);
|
ray($e);
|
||||||
|
$server->settings->is_cloudflare_tunnel = false;
|
||||||
|
$server->settings->save();
|
||||||
throw $e;
|
throw $e;
|
||||||
} finally {
|
} finally {
|
||||||
|
CloudflareTunnelConfigured::dispatch($server->team_id);
|
||||||
|
|
||||||
$commands = collect([
|
$commands = collect([
|
||||||
'rm -fr /tmp/cloudflared',
|
'rm -fr /tmp/cloudflared',
|
||||||
]);
|
]);
|
||||||
instant_remote_process($commands, $server);
|
instant_remote_process($commands, $server);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Actions\Server;
|
namespace App\Actions\Server;
|
||||||
|
|
||||||
use App\Models\InstanceSettings;
|
use App\Jobs\PullHelperImageJob;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use Lorisleiva\Actions\Concerns\AsAction;
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ class UpdateCoolify
|
|||||||
public function handle($manual_update = false)
|
public function handle($manual_update = false)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$settings = InstanceSettings::get();
|
$settings = instanceSettings();
|
||||||
$this->server = Server::find(0);
|
$this->server = Server::find(0);
|
||||||
if (! $this->server) {
|
if (! $this->server) {
|
||||||
return;
|
return;
|
||||||
@@ -55,6 +55,13 @@ class UpdateCoolify
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$all_servers = Server::all();
|
||||||
|
$servers = $all_servers->where('settings.is_usable', true)->where('settings.is_reachable', true)->where('ip', '!=', '1.2.3.4');
|
||||||
|
foreach ($servers as $server) {
|
||||||
|
PullHelperImageJob::dispatch($server);
|
||||||
|
}
|
||||||
|
|
||||||
instant_remote_process(["docker pull -q ghcr.io/coollabsio/coolify:{$this->latestVersion}"], $this->server, false);
|
instant_remote_process(["docker pull -q ghcr.io/coollabsio/coolify:{$this->latestVersion}"], $this->server, false);
|
||||||
|
|
||||||
remote_process([
|
remote_process([
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Actions\Service;
|
namespace App\Actions\Service;
|
||||||
|
|
||||||
|
use App\Actions\Server\CleanupDocker;
|
||||||
use App\Models\Service;
|
use App\Models\Service;
|
||||||
use Lorisleiva\Actions\Concerns\AsAction;
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
|
||||||
@@ -9,11 +10,11 @@ class DeleteService
|
|||||||
{
|
{
|
||||||
use AsAction;
|
use AsAction;
|
||||||
|
|
||||||
public function handle(Service $service)
|
public function handle(Service $service, bool $deleteConfigurations, bool $deleteVolumes, bool $dockerCleanup, bool $deleteConnectedNetworks)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$server = data_get($service, 'server');
|
$server = data_get($service, 'server');
|
||||||
if ($server->isFunctional()) {
|
if ($deleteVolumes && $server->isFunctional()) {
|
||||||
$storagesToDelete = collect([]);
|
$storagesToDelete = collect([]);
|
||||||
|
|
||||||
$service->environment_variables()->delete();
|
$service->environment_variables()->delete();
|
||||||
@@ -33,13 +34,29 @@ class DeleteService
|
|||||||
foreach ($storagesToDelete as $storage) {
|
foreach ($storagesToDelete as $storage) {
|
||||||
$commands[] = "docker volume rm -f $storage->name";
|
$commands[] = "docker volume rm -f $storage->name";
|
||||||
}
|
}
|
||||||
$commands[] = "docker rm -f $service->uuid";
|
|
||||||
|
|
||||||
instant_remote_process($commands, $server, false);
|
// Execute volume deletion first, this must be done first otherwise volumes will not be deleted.
|
||||||
|
if (! empty($commands)) {
|
||||||
|
foreach ($commands as $command) {
|
||||||
|
$result = instant_remote_process([$command], $server, false);
|
||||||
|
if ($result !== 0) {
|
||||||
|
ray("Failed to execute: $command");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($deleteConnectedNetworks) {
|
||||||
|
$service->delete_connected_networks($service->uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
instant_remote_process(["docker rm -f $service->uuid"], $server, throwError: false);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw new \Exception($e->getMessage());
|
throw new \Exception($e->getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
|
if ($deleteConfigurations) {
|
||||||
|
$service->delete_configurations();
|
||||||
|
}
|
||||||
foreach ($service->applications()->get() as $application) {
|
foreach ($service->applications()->get() as $application) {
|
||||||
$application->forceDelete();
|
$application->forceDelete();
|
||||||
}
|
}
|
||||||
@@ -50,6 +67,11 @@ class DeleteService
|
|||||||
$task->delete();
|
$task->delete();
|
||||||
}
|
}
|
||||||
$service->tags()->detach();
|
$service->tags()->detach();
|
||||||
|
$service->forceDelete();
|
||||||
|
|
||||||
|
if ($dockerCleanup) {
|
||||||
|
CleanupDocker::dispatch($server, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,10 @@ class StartService
|
|||||||
$service->saveComposeConfigs();
|
$service->saveComposeConfigs();
|
||||||
$commands[] = 'cd '.$service->workdir();
|
$commands[] = 'cd '.$service->workdir();
|
||||||
$commands[] = "echo 'Saved configuration files to {$service->workdir()}.'";
|
$commands[] = "echo 'Saved configuration files to {$service->workdir()}.'";
|
||||||
|
if ($service->networks()->count() > 0) {
|
||||||
$commands[] = "echo 'Creating Docker network.'";
|
$commands[] = "echo 'Creating Docker network.'";
|
||||||
$commands[] = "docker network inspect $service->uuid >/dev/null 2>&1 || docker network create --attachable $service->uuid";
|
$commands[] = "docker network inspect $service->uuid >/dev/null 2>&1 || docker network create --attachable $service->uuid";
|
||||||
|
}
|
||||||
$commands[] = 'echo Starting service.';
|
$commands[] = 'echo Starting service.';
|
||||||
$commands[] = "echo 'Pulling images.'";
|
$commands[] = "echo 'Pulling images.'";
|
||||||
$commands[] = 'docker compose pull';
|
$commands[] = 'docker compose pull';
|
||||||
@@ -29,7 +31,7 @@ class StartService
|
|||||||
$network = $service->destination->network;
|
$network = $service->destination->network;
|
||||||
$serviceNames = data_get(Yaml::parse($compose), 'services', []);
|
$serviceNames = data_get(Yaml::parse($compose), 'services', []);
|
||||||
foreach ($serviceNames as $serviceName => $serviceConfig) {
|
foreach ($serviceNames as $serviceName => $serviceConfig) {
|
||||||
$commands[] = "docker network connect --alias {$serviceName}-{$service->uuid} $network {$serviceName}-{$service->uuid} || true";
|
$commands[] = "docker network connect --alias {$serviceName}-{$service->uuid} $network {$serviceName}-{$service->uuid} >/dev/null 2>&1 || true";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$activity = remote_process($commands, $service->server, type_uuid: $service->uuid, callEventOnFinish: 'ServiceStatusChanged');
|
$activity = remote_process($commands, $service->server, type_uuid: $service->uuid, callEventOnFinish: 'ServiceStatusChanged');
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Actions\Service;
|
namespace App\Actions\Service;
|
||||||
|
|
||||||
|
use App\Actions\Server\CleanupDocker;
|
||||||
use App\Models\Service;
|
use App\Models\Service;
|
||||||
use Lorisleiva\Actions\Concerns\AsAction;
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
|
||||||
@@ -9,40 +10,27 @@ class StopService
|
|||||||
{
|
{
|
||||||
use AsAction;
|
use AsAction;
|
||||||
|
|
||||||
public function handle(Service $service)
|
public function handle(Service $service, bool $isDeleteOperation = false, bool $dockerCleanup = true)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$server = $service->destination->server;
|
$server = $service->destination->server;
|
||||||
if (! $server->isFunctional()) {
|
if (! $server->isFunctional()) {
|
||||||
return 'Server is not functional';
|
return 'Server is not functional';
|
||||||
}
|
}
|
||||||
ray('Stopping service: '.$service->name);
|
|
||||||
$applications = $service->applications()->get();
|
|
||||||
foreach ($applications as $application) {
|
|
||||||
if ($applications->count() < 6) {
|
|
||||||
instant_remote_process(command: ["docker stop --time=10 {$application->name}-{$service->uuid}"], server: $server, throwError: false);
|
|
||||||
}
|
|
||||||
instant_remote_process(command: ["docker rm {$application->name}-{$service->uuid}"], server: $server, throwError: false);
|
|
||||||
instant_remote_process(command: ["docker rm -f {$application->name}-{$service->uuid}"], server: $server, throwError: false);
|
|
||||||
$application->update(['status' => 'exited']);
|
|
||||||
}
|
|
||||||
$dbs = $service->databases()->get();
|
|
||||||
foreach ($dbs as $db) {
|
|
||||||
if ($dbs->count() < 6) {
|
|
||||||
|
|
||||||
instant_remote_process(command: ["docker stop --time=10 {$db->name}-{$service->uuid}"], server: $server, throwError: false);
|
$containersToStop = $service->getContainersToStop();
|
||||||
|
$service->stopContainers($containersToStop, $server);
|
||||||
|
|
||||||
|
if (! $isDeleteOperation) {
|
||||||
|
$service->delete_connected_networks($service->uuid);
|
||||||
|
if ($dockerCleanup) {
|
||||||
|
CleanupDocker::dispatch($server, true);
|
||||||
}
|
}
|
||||||
instant_remote_process(command: ["docker rm {$db->name}-{$service->uuid}"], server: $server, throwError: false);
|
|
||||||
instant_remote_process(command: ["docker rm -f {$db->name}-{$service->uuid}"], server: $server, throwError: false);
|
|
||||||
$db->update(['status' => 'exited']);
|
|
||||||
}
|
}
|
||||||
instant_remote_process(["docker network disconnect {$service->uuid} coolify-proxy"], $service->server);
|
|
||||||
instant_remote_process(["docker network rm {$service->uuid}"], $service->server);
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
ray($e->getMessage());
|
ray($e->getMessage());
|
||||||
|
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
50
app/Console/Commands/CheckApplicationDeploymentQueue.php
Normal file
50
app/Console/Commands/CheckApplicationDeploymentQueue.php
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Enums\ApplicationDeploymentStatus;
|
||||||
|
use App\Models\ApplicationDeploymentQueue;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
|
class CheckApplicationDeploymentQueue extends Command
|
||||||
|
{
|
||||||
|
protected $signature = 'check:deployment-queue {--force} {--seconds=3600}';
|
||||||
|
|
||||||
|
protected $description = 'Check application deployment queue.';
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$seconds = $this->option('seconds');
|
||||||
|
$deployments = ApplicationDeploymentQueue::whereIn('status', [
|
||||||
|
ApplicationDeploymentStatus::IN_PROGRESS,
|
||||||
|
ApplicationDeploymentStatus::QUEUED,
|
||||||
|
])->where('created_at', '<=', now()->subSeconds($seconds))->get();
|
||||||
|
if ($deployments->isEmpty()) {
|
||||||
|
$this->info('No deployments found in the last '.$seconds.' seconds.');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->info('Found '.$deployments->count().' deployments created in the last '.$seconds.' seconds.');
|
||||||
|
|
||||||
|
foreach ($deployments as $deployment) {
|
||||||
|
if ($this->option('force')) {
|
||||||
|
$this->info('Deployment '.$deployment->id.' created at '.$deployment->created_at.' is older than '.$seconds.' seconds. Setting status to failed.');
|
||||||
|
$this->cancelDeployment($deployment);
|
||||||
|
} else {
|
||||||
|
$this->info('Deployment '.$deployment->id.' created at '.$deployment->created_at.' is older than '.$seconds.' seconds. Setting status to failed.');
|
||||||
|
if ($this->confirm('Do you want to cancel this deployment?', true)) {
|
||||||
|
$this->cancelDeployment($deployment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function cancelDeployment(ApplicationDeploymentQueue $deployment)
|
||||||
|
{
|
||||||
|
$deployment->update(['status' => ApplicationDeploymentStatus::FAILED]);
|
||||||
|
if ($deployment->server?->isFunctional()) {
|
||||||
|
remote_process(['docker rm -f '.$deployment->deployment_uuid], $deployment->server, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,9 +7,9 @@ use Illuminate\Console\Command;
|
|||||||
|
|
||||||
class CleanupApplicationDeploymentQueue extends Command
|
class CleanupApplicationDeploymentQueue extends Command
|
||||||
{
|
{
|
||||||
protected $signature = 'cleanup:application-deployment-queue {--team-id=}';
|
protected $signature = 'cleanup:deployment-queue {--team-id=}';
|
||||||
|
|
||||||
protected $description = 'CleanupApplicationDeploymentQueue';
|
protected $description = 'Cleanup application deployment queue.';
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
|
||||||
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
use Illuminate\Support\Facades\Redis;
|
|
||||||
|
|
||||||
class CleanupQueue extends Command
|
|
||||||
{
|
|
||||||
protected $signature = 'cleanup:queue';
|
|
||||||
|
|
||||||
protected $description = 'Cleanup Queue';
|
|
||||||
|
|
||||||
public function handle()
|
|
||||||
{
|
|
||||||
echo "Running queue cleanup...\n";
|
|
||||||
$prefix = config('database.redis.options.prefix');
|
|
||||||
$keys = Redis::connection()->keys('*:laravel*');
|
|
||||||
foreach ($keys as $key) {
|
|
||||||
$keyWithoutPrefix = str_replace($prefix, '', $key);
|
|
||||||
Redis::connection()->del($keyWithoutPrefix);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
31
app/Console/Commands/CleanupRedis.php
Normal file
31
app/Console/Commands/CleanupRedis.php
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\Redis;
|
||||||
|
|
||||||
|
class CleanupRedis extends Command
|
||||||
|
{
|
||||||
|
protected $signature = 'cleanup:redis';
|
||||||
|
|
||||||
|
protected $description = 'Cleanup Redis';
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
echo "Cleanup Redis keys.\n";
|
||||||
|
$prefix = config('database.redis.options.prefix');
|
||||||
|
|
||||||
|
$keys = Redis::connection()->keys('*:laravel*');
|
||||||
|
collect($keys)->each(function ($key) use ($prefix) {
|
||||||
|
$keyWithoutPrefix = str_replace($prefix, '', $key);
|
||||||
|
Redis::connection()->del($keyWithoutPrefix);
|
||||||
|
});
|
||||||
|
|
||||||
|
$queueOverlaps = Redis::connection()->keys('*laravel-queue-overlap*');
|
||||||
|
collect($queueOverlaps)->each(function ($key) {
|
||||||
|
Redis::connection()->del($key);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,10 +2,13 @@
|
|||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Jobs\CleanupHelperContainersJob;
|
||||||
use App\Models\Application;
|
use App\Models\Application;
|
||||||
|
use App\Models\ApplicationDeploymentQueue;
|
||||||
use App\Models\ApplicationPreview;
|
use App\Models\ApplicationPreview;
|
||||||
use App\Models\ScheduledDatabaseBackup;
|
use App\Models\ScheduledDatabaseBackup;
|
||||||
use App\Models\ScheduledTask;
|
use App\Models\ScheduledTask;
|
||||||
|
use App\Models\Server;
|
||||||
use App\Models\Service;
|
use App\Models\Service;
|
||||||
use App\Models\ServiceApplication;
|
use App\Models\ServiceApplication;
|
||||||
use App\Models\ServiceDatabase;
|
use App\Models\ServiceDatabase;
|
||||||
@@ -35,6 +38,27 @@ class CleanupStuckedResources extends Command
|
|||||||
private function cleanup_stucked_resources()
|
private function cleanup_stucked_resources()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
try {
|
||||||
|
$servers = Server::all()->filter(function ($server) {
|
||||||
|
return $server->isFunctional();
|
||||||
|
});
|
||||||
|
foreach ($servers as $server) {
|
||||||
|
CleanupHelperContainersJob::dispatch($server);
|
||||||
|
}
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
echo "Error in cleaning stucked resources: {$e->getMessage()}\n";
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$applicationsDeploymentQueue = ApplicationDeploymentQueue::get();
|
||||||
|
foreach ($applicationsDeploymentQueue as $applicationDeploymentQueue) {
|
||||||
|
if (is_null($applicationDeploymentQueue->application)) {
|
||||||
|
echo "Deleting stuck application deployment queue: {$applicationDeploymentQueue->id}\n";
|
||||||
|
$applicationDeploymentQueue->delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
echo "Error in cleaning stuck application deployment queue: {$e->getMessage()}\n";
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
$applications = Application::withTrashed()->whereNotNull('deleted_at')->get();
|
$applications = Application::withTrashed()->whereNotNull('deleted_at')->get();
|
||||||
foreach ($applications as $application) {
|
foreach ($applications as $application) {
|
||||||
|
|||||||
@@ -48,6 +48,13 @@ class Dev extends Command
|
|||||||
echo "Generating APP_KEY.\n";
|
echo "Generating APP_KEY.\n";
|
||||||
Artisan::call('key:generate');
|
Artisan::call('key:generate');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Generate STORAGE link if not exists
|
||||||
|
if (! file_exists(public_path('storage'))) {
|
||||||
|
echo "Generating STORAGE link.\n";
|
||||||
|
Artisan::call('storage:link');
|
||||||
|
}
|
||||||
|
|
||||||
// Seed database if it's empty
|
// Seed database if it's empty
|
||||||
$settings = InstanceSettings::find(0);
|
$settings = InstanceSettings::find(0);
|
||||||
if (! $settings) {
|
if (! $settings) {
|
||||||
|
|||||||
@@ -5,10 +5,8 @@ namespace App\Console\Commands;
|
|||||||
use App\Actions\Server\StopSentinel;
|
use App\Actions\Server\StopSentinel;
|
||||||
use App\Enums\ActivityTypes;
|
use App\Enums\ActivityTypes;
|
||||||
use App\Enums\ApplicationDeploymentStatus;
|
use App\Enums\ApplicationDeploymentStatus;
|
||||||
use App\Jobs\CleanupHelperContainersJob;
|
|
||||||
use App\Models\ApplicationDeploymentQueue;
|
use App\Models\ApplicationDeploymentQueue;
|
||||||
use App\Models\Environment;
|
use App\Models\Environment;
|
||||||
use App\Models\InstanceSettings;
|
|
||||||
use App\Models\ScheduledDatabaseBackup;
|
use App\Models\ScheduledDatabaseBackup;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use App\Models\StandalonePostgresql;
|
use App\Models\StandalonePostgresql;
|
||||||
@@ -18,7 +16,7 @@ use Illuminate\Support\Facades\Http;
|
|||||||
|
|
||||||
class Init extends Command
|
class Init extends Command
|
||||||
{
|
{
|
||||||
protected $signature = 'app:init {--full-cleanup} {--cleanup-deployments} {--cleanup-proxy-networks}';
|
protected $signature = 'app:init {--force-cloud}';
|
||||||
|
|
||||||
protected $description = 'Cleanup instance related stuffs';
|
protected $description = 'Cleanup instance related stuffs';
|
||||||
|
|
||||||
@@ -26,9 +24,63 @@ class Init extends Command
|
|||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
if (isCloud() && ! $this->option('force-cloud')) {
|
||||||
|
echo "Skipping init as we are on cloud and --force-cloud option is not set\n";
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$this->servers = Server::all();
|
$this->servers = Server::all();
|
||||||
$this->alive();
|
if (isCloud()) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$this->send_alive_signal();
|
||||||
get_public_ips();
|
get_public_ips();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Backward compatibility
|
||||||
|
$this->disable_metrics();
|
||||||
|
$this->replace_slash_in_environment_name();
|
||||||
|
$this->restore_coolify_db_backup();
|
||||||
|
//
|
||||||
|
$this->update_traefik_labels();
|
||||||
|
if (! isCloud() || $this->option('force-cloud')) {
|
||||||
|
$this->cleanup_unused_network_from_coolify_proxy();
|
||||||
|
}
|
||||||
|
if (isCloud()) {
|
||||||
|
$this->cleanup_unnecessary_dynamic_proxy_configuration();
|
||||||
|
} else {
|
||||||
|
$this->cleanup_in_progress_application_deployments();
|
||||||
|
}
|
||||||
|
$this->call('cleanup:redis');
|
||||||
|
$this->call('cleanup:stucked-resources');
|
||||||
|
|
||||||
|
if (isCloud()) {
|
||||||
|
$response = Http::retry(3, 1000)->get(config('constants.services.official'));
|
||||||
|
if ($response->successful()) {
|
||||||
|
$services = $response->json();
|
||||||
|
File::put(base_path('templates/service-templates.json'), json_encode($services));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
$localhost = $this->servers->where('id', 0)->first();
|
||||||
|
$localhost->setupDynamicProxyConfiguration();
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
echo "Could not setup dynamic configuration: {$e->getMessage()}\n";
|
||||||
|
}
|
||||||
|
$settings = instanceSettings();
|
||||||
|
if (! is_null(env('AUTOUPDATE', null))) {
|
||||||
|
if (env('AUTOUPDATE') == true) {
|
||||||
|
$settings->update(['is_auto_update_enabled' => true]);
|
||||||
|
} else {
|
||||||
|
$settings->update(['is_auto_update_enabled' => false]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function disable_metrics()
|
||||||
|
{
|
||||||
if (version_compare('4.0.0-beta.312', config('version'), '<=')) {
|
if (version_compare('4.0.0-beta.312', config('version'), '<=')) {
|
||||||
foreach ($this->servers as $server) {
|
foreach ($this->servers as $server) {
|
||||||
if ($server->settings->is_metrics_enabled === true) {
|
if ($server->settings->is_metrics_enabled === true) {
|
||||||
@@ -39,62 +91,6 @@ class Init extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$full_cleanup = $this->option('full-cleanup');
|
|
||||||
$cleanup_deployments = $this->option('cleanup-deployments');
|
|
||||||
$cleanup_proxy_networks = $this->option('cleanup-proxy-networks');
|
|
||||||
$this->replace_slash_in_environment_name();
|
|
||||||
if ($cleanup_deployments) {
|
|
||||||
echo "Running cleanup deployments.\n";
|
|
||||||
$this->cleanup_in_progress_application_deployments();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ($cleanup_proxy_networks) {
|
|
||||||
echo "Running cleanup proxy networks.\n";
|
|
||||||
$this->cleanup_unused_network_from_coolify_proxy();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ($full_cleanup) {
|
|
||||||
// Required for falsely deleted coolify db
|
|
||||||
$this->restore_coolify_db_backup();
|
|
||||||
$this->update_traefik_labels();
|
|
||||||
$this->cleanup_unused_network_from_coolify_proxy();
|
|
||||||
$this->cleanup_unnecessary_dynamic_proxy_configuration();
|
|
||||||
$this->cleanup_in_progress_application_deployments();
|
|
||||||
$this->cleanup_stucked_helper_containers();
|
|
||||||
$this->call('cleanup:queue');
|
|
||||||
$this->call('cleanup:stucked-resources');
|
|
||||||
if (! isCloud()) {
|
|
||||||
try {
|
|
||||||
$localhost = $this->servers->where('id', 0)->first();
|
|
||||||
$localhost->setupDynamicProxyConfiguration();
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
echo "Could not setup dynamic configuration: {$e->getMessage()}\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$settings = InstanceSettings::get();
|
|
||||||
if (! is_null(env('AUTOUPDATE', null))) {
|
|
||||||
if (env('AUTOUPDATE') == true) {
|
|
||||||
$settings->update(['is_auto_update_enabled' => true]);
|
|
||||||
} else {
|
|
||||||
$settings->update(['is_auto_update_enabled' => false]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isCloud()) {
|
|
||||||
$response = Http::retry(3, 1000)->get(config('constants.services.official'));
|
|
||||||
if ($response->successful()) {
|
|
||||||
$services = $response->json();
|
|
||||||
File::put(base_path('templates/service-templates.json'), json_encode($services));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$this->cleanup_stucked_helper_containers();
|
|
||||||
$this->call('cleanup:stucked-resources');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function update_traefik_labels()
|
private function update_traefik_labels()
|
||||||
@@ -108,7 +104,6 @@ class Init extends Command
|
|||||||
|
|
||||||
private function cleanup_unnecessary_dynamic_proxy_configuration()
|
private function cleanup_unnecessary_dynamic_proxy_configuration()
|
||||||
{
|
{
|
||||||
if (isCloud()) {
|
|
||||||
foreach ($this->servers as $server) {
|
foreach ($this->servers as $server) {
|
||||||
try {
|
try {
|
||||||
if (! $server->isFunctional()) {
|
if (! $server->isFunctional()) {
|
||||||
@@ -128,13 +123,9 @@ class Init extends Command
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private function cleanup_unused_network_from_coolify_proxy()
|
private function cleanup_unused_network_from_coolify_proxy()
|
||||||
{
|
{
|
||||||
if (isCloud()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
foreach ($this->servers as $server) {
|
foreach ($this->servers as $server) {
|
||||||
if (! $server->isFunctional()) {
|
if (! $server->isFunctional()) {
|
||||||
continue;
|
continue;
|
||||||
@@ -175,6 +166,7 @@ class Init extends Command
|
|||||||
|
|
||||||
private function restore_coolify_db_backup()
|
private function restore_coolify_db_backup()
|
||||||
{
|
{
|
||||||
|
if (version_compare('4.0.0-beta.179', config('version'), '<=')) {
|
||||||
try {
|
try {
|
||||||
$database = StandalonePostgresql::withTrashed()->find(0);
|
$database = StandalonePostgresql::withTrashed()->find(0);
|
||||||
if ($database && $database->trashed()) {
|
if ($database && $database->trashed()) {
|
||||||
@@ -197,21 +189,13 @@ class Init extends Command
|
|||||||
echo "Error in restoring coolify db backup: {$e->getMessage()}\n";
|
echo "Error in restoring coolify db backup: {$e->getMessage()}\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function cleanup_stucked_helper_containers()
|
|
||||||
{
|
|
||||||
foreach ($this->servers as $server) {
|
|
||||||
if ($server->isFunctional()) {
|
|
||||||
CleanupHelperContainersJob::dispatch($server);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function alive()
|
private function send_alive_signal()
|
||||||
{
|
{
|
||||||
$id = config('app.id');
|
$id = config('app.id');
|
||||||
$version = config('version');
|
$version = config('version');
|
||||||
$settings = InstanceSettings::get();
|
$settings = instanceSettings();
|
||||||
$do_not_track = data_get($settings, 'do_not_track');
|
$do_not_track = data_get($settings, 'do_not_track');
|
||||||
if ($do_not_track == true) {
|
if ($do_not_track == true) {
|
||||||
echo "Skipping alive as do_not_track is enabled\n";
|
echo "Skipping alive as do_not_track is enabled\n";
|
||||||
@@ -225,23 +209,7 @@ class Init extends Command
|
|||||||
echo "Error in alive: {$e->getMessage()}\n";
|
echo "Error in alive: {$e->getMessage()}\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// private function cleanup_ssh()
|
|
||||||
// {
|
|
||||||
|
|
||||||
// TODO: it will cleanup id.root@host.docker.internal
|
|
||||||
// try {
|
|
||||||
// $files = Storage::allFiles('ssh/keys');
|
|
||||||
// foreach ($files as $file) {
|
|
||||||
// Storage::delete($file);
|
|
||||||
// }
|
|
||||||
// $files = Storage::allFiles('ssh/mux');
|
|
||||||
// foreach ($files as $file) {
|
|
||||||
// Storage::delete($file);
|
|
||||||
// }
|
|
||||||
// } catch (\Throwable $e) {
|
|
||||||
// echo "Error in cleaning ssh: {$e->getMessage()}\n";
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
private function cleanup_in_progress_application_deployments()
|
private function cleanup_in_progress_application_deployments()
|
||||||
{
|
{
|
||||||
// Cleanup any failed deployments
|
// Cleanup any failed deployments
|
||||||
@@ -263,6 +231,7 @@ class Init extends Command
|
|||||||
|
|
||||||
private function replace_slash_in_environment_name()
|
private function replace_slash_in_environment_name()
|
||||||
{
|
{
|
||||||
|
if (version_compare('4.0.0-beta.298', config('version'), '<=')) {
|
||||||
$environments = Environment::all();
|
$environments = Environment::all();
|
||||||
foreach ($environments as $environment) {
|
foreach ($environments as $environment) {
|
||||||
if (str_contains($environment->name, '/')) {
|
if (str_contains($environment->name, '/')) {
|
||||||
@@ -272,3 +241,4 @@ class Init extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class ServicesGenerate extends Command
|
|||||||
if ($logo->count() > 0) {
|
if ($logo->count() > 0) {
|
||||||
$logo = str($logo[0])->after('# logo:')->trim()->value();
|
$logo = str($logo[0])->after('# logo:')->trim()->value();
|
||||||
} else {
|
} else {
|
||||||
$logo = 'svgs/unknown.svg';
|
$logo = 'svgs/coolify.png';
|
||||||
}
|
}
|
||||||
$minversion = collect(preg_grep('/^# minversion:/', explode("\n", $content)))->values();
|
$minversion = collect(preg_grep('/^# minversion:/', explode("\n", $content)))->values();
|
||||||
if ($minversion->count() > 0) {
|
if ($minversion->count() > 0) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Console;
|
|||||||
|
|
||||||
use App\Jobs\CheckForUpdatesJob;
|
use App\Jobs\CheckForUpdatesJob;
|
||||||
use App\Jobs\CleanupInstanceStuffsJob;
|
use App\Jobs\CleanupInstanceStuffsJob;
|
||||||
|
use App\Jobs\CleanupStaleMultiplexedConnections;
|
||||||
use App\Jobs\DatabaseBackupJob;
|
use App\Jobs\DatabaseBackupJob;
|
||||||
use App\Jobs\DockerCleanupJob;
|
use App\Jobs\DockerCleanupJob;
|
||||||
use App\Jobs\PullHelperImageJob;
|
use App\Jobs\PullHelperImageJob;
|
||||||
@@ -11,8 +12,8 @@ use App\Jobs\PullSentinelImageJob;
|
|||||||
use App\Jobs\PullTemplatesFromCDN;
|
use App\Jobs\PullTemplatesFromCDN;
|
||||||
use App\Jobs\ScheduledTaskJob;
|
use App\Jobs\ScheduledTaskJob;
|
||||||
use App\Jobs\ServerCheckJob;
|
use App\Jobs\ServerCheckJob;
|
||||||
|
use App\Jobs\ServerStorageCheckJob;
|
||||||
use App\Jobs\UpdateCoolifyJob;
|
use App\Jobs\UpdateCoolifyJob;
|
||||||
use App\Models\InstanceSettings;
|
|
||||||
use App\Models\ScheduledDatabaseBackup;
|
use App\Models\ScheduledDatabaseBackup;
|
||||||
use App\Models\ScheduledTask;
|
use App\Models\ScheduledTask;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
@@ -27,9 +28,10 @@ class Kernel extends ConsoleKernel
|
|||||||
protected function schedule(Schedule $schedule): void
|
protected function schedule(Schedule $schedule): void
|
||||||
{
|
{
|
||||||
$this->all_servers = Server::all();
|
$this->all_servers = Server::all();
|
||||||
$settings = InstanceSettings::get();
|
$settings = instanceSettings();
|
||||||
|
|
||||||
|
$schedule->job(new CleanupStaleMultiplexedConnections)->hourly();
|
||||||
|
|
||||||
$schedule->command('telescope:prune')->daily();
|
|
||||||
if (isDev()) {
|
if (isDev()) {
|
||||||
// Instance Jobs
|
// Instance Jobs
|
||||||
$schedule->command('horizon:snapshot')->everyMinute();
|
$schedule->command('horizon:snapshot')->everyMinute();
|
||||||
@@ -39,6 +41,10 @@ class Kernel extends ConsoleKernel
|
|||||||
$this->check_resources($schedule);
|
$this->check_resources($schedule);
|
||||||
$this->check_scheduled_tasks($schedule);
|
$this->check_scheduled_tasks($schedule);
|
||||||
$schedule->command('uploads:clear')->everyTwoMinutes();
|
$schedule->command('uploads:clear')->everyTwoMinutes();
|
||||||
|
|
||||||
|
$schedule->command('telescope:prune')->daily();
|
||||||
|
|
||||||
|
$schedule->job(new PullHelperImageJob)->everyFiveMinutes()->onOneServer();
|
||||||
} else {
|
} else {
|
||||||
// Instance Jobs
|
// Instance Jobs
|
||||||
$schedule->command('horizon:snapshot')->everyFiveMinutes();
|
$schedule->command('horizon:snapshot')->everyFiveMinutes();
|
||||||
@@ -60,7 +66,7 @@ class Kernel extends ConsoleKernel
|
|||||||
|
|
||||||
private function pull_images($schedule)
|
private function pull_images($schedule)
|
||||||
{
|
{
|
||||||
$settings = InstanceSettings::get();
|
$settings = instanceSettings();
|
||||||
$servers = $this->all_servers->where('settings.is_usable', true)->where('settings.is_reachable', true)->where('ip', '!=', '1.2.3.4');
|
$servers = $this->all_servers->where('settings.is_usable', true)->where('settings.is_reachable', true)->where('ip', '!=', '1.2.3.4');
|
||||||
foreach ($servers as $server) {
|
foreach ($servers as $server) {
|
||||||
if ($server->isSentinelEnabled()) {
|
if ($server->isSentinelEnabled()) {
|
||||||
@@ -73,16 +79,16 @@ class Kernel extends ConsoleKernel
|
|||||||
}
|
}
|
||||||
})->cron($settings->update_check_frequency)->timezone($settings->instance_timezone)->onOneServer();
|
})->cron($settings->update_check_frequency)->timezone($settings->instance_timezone)->onOneServer();
|
||||||
}
|
}
|
||||||
$schedule->job(new PullHelperImageJob($server))
|
}
|
||||||
|
$schedule->job(new PullHelperImageJob)
|
||||||
->cron($settings->update_check_frequency)
|
->cron($settings->update_check_frequency)
|
||||||
->timezone($settings->instance_timezone)
|
->timezone($settings->instance_timezone)
|
||||||
->onOneServer();
|
->onOneServer();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private function schedule_updates($schedule)
|
private function schedule_updates($schedule)
|
||||||
{
|
{
|
||||||
$settings = InstanceSettings::get();
|
$settings = instanceSettings();
|
||||||
|
|
||||||
$updateCheckFrequency = $settings->update_check_frequency;
|
$updateCheckFrequency = $settings->update_check_frequency;
|
||||||
$schedule->job(new CheckForUpdatesJob)
|
$schedule->job(new CheckForUpdatesJob)
|
||||||
@@ -110,6 +116,7 @@ class Kernel extends ConsoleKernel
|
|||||||
}
|
}
|
||||||
foreach ($servers as $server) {
|
foreach ($servers as $server) {
|
||||||
$schedule->job(new ServerCheckJob($server))->everyMinute()->onOneServer();
|
$schedule->job(new ServerCheckJob($server))->everyMinute()->onOneServer();
|
||||||
|
// $schedule->job(new ServerStorageCheckJob($server))->everyMinute()->onOneServer();
|
||||||
$serverTimezone = $server->settings->server_timezone;
|
$serverTimezone = $server->settings->server_timezone;
|
||||||
if ($server->settings->force_docker_cleanup) {
|
if ($server->settings->force_docker_cleanup) {
|
||||||
$schedule->job(new DockerCleanupJob($server))->cron($server->settings->docker_cleanup_frequency)->timezone($serverTimezone)->onOneServer();
|
$schedule->job(new DockerCleanupJob($server))->cron($server->settings->docker_cleanup_frequency)->timezone($serverTimezone)->onOneServer();
|
||||||
|
|||||||
14
app/Enums/ContainerStatusTypes.php
Normal file
14
app/Enums/ContainerStatusTypes.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Enums;
|
||||||
|
|
||||||
|
enum ContainerStatusTypes: string
|
||||||
|
{
|
||||||
|
case PAUSED = 'paused';
|
||||||
|
case RESTARTING = 'restarting';
|
||||||
|
case REMOVING = 'removing';
|
||||||
|
case RUNNING = 'running';
|
||||||
|
case DEAD = 'dead';
|
||||||
|
case CREATED = 'created';
|
||||||
|
case EXITED = 'exited';
|
||||||
|
}
|
||||||
34
app/Events/CloudflareTunnelConfigured.php
Normal file
34
app/Events/CloudflareTunnelConfigured.php
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Events;
|
||||||
|
|
||||||
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
|
use Illuminate\Broadcasting\PrivateChannel;
|
||||||
|
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||||
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class CloudflareTunnelConfigured implements ShouldBroadcast
|
||||||
|
{
|
||||||
|
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||||
|
|
||||||
|
public $teamId;
|
||||||
|
|
||||||
|
public function __construct($teamId = null)
|
||||||
|
{
|
||||||
|
if (is_null($teamId)) {
|
||||||
|
$teamId = auth()->user()->currentTeam()->id ?? null;
|
||||||
|
}
|
||||||
|
if (is_null($teamId)) {
|
||||||
|
throw new \Exception('Team id is null');
|
||||||
|
}
|
||||||
|
$this->teamId = $teamId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function broadcastOn(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
new PrivateChannel("team.{$this->teamId}"),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -65,7 +65,7 @@ class Handler extends ExceptionHandler
|
|||||||
if ($e instanceof RuntimeException) {
|
if ($e instanceof RuntimeException) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->settings = \App\Models\InstanceSettings::get();
|
$this->settings = instanceSettings();
|
||||||
if ($this->settings->do_not_track) {
|
if ($this->settings->do_not_track) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
186
app/Helpers/SshMultiplexingHelper.php
Normal file
186
app/Helpers/SshMultiplexingHelper.php
Normal file
@@ -0,0 +1,186 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Helpers;
|
||||||
|
|
||||||
|
use App\Models\PrivateKey;
|
||||||
|
use App\Models\Server;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Support\Facades\Process;
|
||||||
|
|
||||||
|
class SshMultiplexingHelper
|
||||||
|
{
|
||||||
|
public static function serverSshConfiguration(Server $server)
|
||||||
|
{
|
||||||
|
$privateKey = PrivateKey::findOrFail($server->private_key_id);
|
||||||
|
$sshKeyLocation = $privateKey->getKeyLocation();
|
||||||
|
$muxFilename = '/var/www/html/storage/app/ssh/mux/mux_'.$server->uuid;
|
||||||
|
|
||||||
|
return [
|
||||||
|
'sshKeyLocation' => $sshKeyLocation,
|
||||||
|
'muxFilename' => $muxFilename,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function ensureMultiplexedConnection(Server $server)
|
||||||
|
{
|
||||||
|
if (! self::isMultiplexingEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sshConfig = self::serverSshConfiguration($server);
|
||||||
|
$muxSocket = $sshConfig['muxFilename'];
|
||||||
|
$sshKeyLocation = $sshConfig['sshKeyLocation'];
|
||||||
|
|
||||||
|
self::validateSshKey($sshKeyLocation);
|
||||||
|
|
||||||
|
$checkCommand = "ssh -O check -o ControlPath=$muxSocket ";
|
||||||
|
if (data_get($server, 'settings.is_cloudflare_tunnel')) {
|
||||||
|
$checkCommand .= '-o ProxyCommand="cloudflared access ssh --hostname %h" ';
|
||||||
|
}
|
||||||
|
$checkCommand .= "{$server->user}@{$server->ip}";
|
||||||
|
$process = Process::run($checkCommand);
|
||||||
|
|
||||||
|
if ($process->exitCode() !== 0) {
|
||||||
|
self::establishNewMultiplexedConnection($server);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function establishNewMultiplexedConnection(Server $server)
|
||||||
|
{
|
||||||
|
$sshConfig = self::serverSshConfiguration($server);
|
||||||
|
$sshKeyLocation = $sshConfig['sshKeyLocation'];
|
||||||
|
$muxSocket = $sshConfig['muxFilename'];
|
||||||
|
|
||||||
|
$connectionTimeout = config('constants.ssh.connection_timeout');
|
||||||
|
$serverInterval = config('constants.ssh.server_interval');
|
||||||
|
$muxPersistTime = config('constants.ssh.mux_persist_time');
|
||||||
|
|
||||||
|
$establishCommand = "ssh -fNM -o ControlMaster=auto -o ControlPath=$muxSocket -o ControlPersist={$muxPersistTime} ";
|
||||||
|
|
||||||
|
if (data_get($server, 'settings.is_cloudflare_tunnel')) {
|
||||||
|
$establishCommand .= ' -o ProxyCommand="cloudflared access ssh --hostname %h" ';
|
||||||
|
}
|
||||||
|
|
||||||
|
$establishCommand .= self::getCommonSshOptions($server, $sshKeyLocation, $connectionTimeout, $serverInterval);
|
||||||
|
$establishCommand .= "{$server->user}@{$server->ip}";
|
||||||
|
|
||||||
|
$establishProcess = Process::run($establishCommand);
|
||||||
|
|
||||||
|
if ($establishProcess->exitCode() !== 0) {
|
||||||
|
throw new \RuntimeException('Failed to establish multiplexed connection: '.$establishProcess->errorOutput());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function removeMuxFile(Server $server)
|
||||||
|
{
|
||||||
|
$sshConfig = self::serverSshConfiguration($server);
|
||||||
|
$muxSocket = $sshConfig['muxFilename'];
|
||||||
|
|
||||||
|
$closeCommand = "ssh -O exit -o ControlPath=$muxSocket ";
|
||||||
|
if (data_get($server, 'settings.is_cloudflare_tunnel')) {
|
||||||
|
$closeCommand .= '-o ProxyCommand="cloudflared access ssh --hostname %h" ';
|
||||||
|
}
|
||||||
|
$closeCommand .= "{$server->user}@{$server->ip}";
|
||||||
|
Process::run($closeCommand);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function generateScpCommand(Server $server, string $source, string $dest)
|
||||||
|
{
|
||||||
|
$sshConfig = self::serverSshConfiguration($server);
|
||||||
|
$sshKeyLocation = $sshConfig['sshKeyLocation'];
|
||||||
|
$muxSocket = $sshConfig['muxFilename'];
|
||||||
|
|
||||||
|
$timeout = config('constants.ssh.command_timeout');
|
||||||
|
$muxPersistTime = config('constants.ssh.mux_persist_time');
|
||||||
|
|
||||||
|
$scp_command = "timeout $timeout scp ";
|
||||||
|
if ($server->isIpv6()) {
|
||||||
|
$scp_command .= '-6 ';
|
||||||
|
}
|
||||||
|
if (self::isMultiplexingEnabled()) {
|
||||||
|
$scp_command .= "-o ControlMaster=auto -o ControlPath=$muxSocket -o ControlPersist={$muxPersistTime} ";
|
||||||
|
self::ensureMultiplexedConnection($server);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data_get($server, 'settings.is_cloudflare_tunnel')) {
|
||||||
|
$scp_command .= '-o ProxyCommand="cloudflared access ssh --hostname %h" ';
|
||||||
|
}
|
||||||
|
|
||||||
|
$scp_command .= self::getCommonSshOptions($server, $sshKeyLocation, config('constants.ssh.connection_timeout'), config('constants.ssh.server_interval'), isScp: true);
|
||||||
|
$scp_command .= "{$source} {$server->user}@{$server->ip}:{$dest}";
|
||||||
|
|
||||||
|
return $scp_command;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function generateSshCommand(Server $server, string $command)
|
||||||
|
{
|
||||||
|
if ($server->settings->force_disabled) {
|
||||||
|
throw new \RuntimeException('Server is disabled.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$sshConfig = self::serverSshConfiguration($server);
|
||||||
|
$sshKeyLocation = $sshConfig['sshKeyLocation'];
|
||||||
|
$muxSocket = $sshConfig['muxFilename'];
|
||||||
|
|
||||||
|
$timeout = config('constants.ssh.command_timeout');
|
||||||
|
$muxPersistTime = config('constants.ssh.mux_persist_time');
|
||||||
|
|
||||||
|
$ssh_command = "timeout $timeout ssh ";
|
||||||
|
|
||||||
|
if (self::isMultiplexingEnabled()) {
|
||||||
|
$ssh_command .= "-o ControlMaster=auto -o ControlPath=$muxSocket -o ControlPersist={$muxPersistTime} ";
|
||||||
|
self::ensureMultiplexedConnection($server);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data_get($server, 'settings.is_cloudflare_tunnel')) {
|
||||||
|
$ssh_command .= "-o ProxyCommand='cloudflared access ssh --hostname %h' ";
|
||||||
|
}
|
||||||
|
|
||||||
|
$ssh_command .= self::getCommonSshOptions($server, $sshKeyLocation, config('constants.ssh.connection_timeout'), config('constants.ssh.server_interval'));
|
||||||
|
|
||||||
|
$delimiter = Hash::make($command);
|
||||||
|
$delimiter = base64_encode($delimiter);
|
||||||
|
$command = str_replace($delimiter, '', $command);
|
||||||
|
|
||||||
|
$ssh_command .= "{$server->user}@{$server->ip} 'bash -se' << \\$delimiter".PHP_EOL
|
||||||
|
.$command.PHP_EOL
|
||||||
|
.$delimiter;
|
||||||
|
|
||||||
|
return $ssh_command;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function isMultiplexingEnabled(): bool
|
||||||
|
{
|
||||||
|
return config('constants.ssh.mux_enabled') && ! config('coolify.is_windows_docker_desktop');
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function validateSshKey(string $sshKeyLocation): void
|
||||||
|
{
|
||||||
|
$checkKeyCommand = "ls $sshKeyLocation 2>/dev/null";
|
||||||
|
$keyCheckProcess = Process::run($checkKeyCommand);
|
||||||
|
|
||||||
|
if ($keyCheckProcess->exitCode() !== 0) {
|
||||||
|
throw new \RuntimeException("SSH key file not accessible: $sshKeyLocation");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function getCommonSshOptions(Server $server, string $sshKeyLocation, int $connectionTimeout, int $serverInterval, bool $isScp = false): string
|
||||||
|
{
|
||||||
|
$options = "-i {$sshKeyLocation} "
|
||||||
|
.'-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null '
|
||||||
|
.'-o PasswordAuthentication=no '
|
||||||
|
."-o ConnectTimeout=$connectionTimeout "
|
||||||
|
."-o ServerAliveInterval=$serverInterval "
|
||||||
|
.'-o RequestTTY=no '
|
||||||
|
.'-o LogLevel=ERROR ';
|
||||||
|
|
||||||
|
// Bruh
|
||||||
|
if ($isScp) {
|
||||||
|
$options .= "-P {$server->port} ";
|
||||||
|
} else {
|
||||||
|
$options .= "-p {$server->port} ";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -177,6 +177,7 @@ class ApplicationsController extends Controller
|
|||||||
'docker_compose_custom_build_command' => ['type' => 'string', 'description' => 'The Docker Compose custom build command.'],
|
'docker_compose_custom_build_command' => ['type' => 'string', 'description' => 'The Docker Compose custom build command.'],
|
||||||
'docker_compose_domains' => ['type' => 'array', 'description' => 'The Docker Compose domains.'],
|
'docker_compose_domains' => ['type' => 'array', 'description' => 'The Docker Compose domains.'],
|
||||||
'watch_paths' => ['type' => 'string', 'description' => 'The watch paths.'],
|
'watch_paths' => ['type' => 'string', 'description' => 'The watch paths.'],
|
||||||
|
'use_build_server' => ['type' => 'boolean', 'nullable' => true, 'description' => 'Use build server.'],
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
]),
|
]),
|
||||||
@@ -279,6 +280,7 @@ class ApplicationsController extends Controller
|
|||||||
'docker_compose_custom_build_command' => ['type' => 'string', 'description' => 'The Docker Compose custom build command.'],
|
'docker_compose_custom_build_command' => ['type' => 'string', 'description' => 'The Docker Compose custom build command.'],
|
||||||
'docker_compose_domains' => ['type' => 'array', 'description' => 'The Docker Compose domains.'],
|
'docker_compose_domains' => ['type' => 'array', 'description' => 'The Docker Compose domains.'],
|
||||||
'watch_paths' => ['type' => 'string', 'description' => 'The watch paths.'],
|
'watch_paths' => ['type' => 'string', 'description' => 'The watch paths.'],
|
||||||
|
'use_build_server' => ['type' => 'boolean', 'nullable' => true, 'description' => 'Use build server.'],
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
]),
|
]),
|
||||||
@@ -381,6 +383,7 @@ class ApplicationsController extends Controller
|
|||||||
'docker_compose_custom_build_command' => ['type' => 'string', 'description' => 'The Docker Compose custom build command.'],
|
'docker_compose_custom_build_command' => ['type' => 'string', 'description' => 'The Docker Compose custom build command.'],
|
||||||
'docker_compose_domains' => ['type' => 'array', 'description' => 'The Docker Compose domains.'],
|
'docker_compose_domains' => ['type' => 'array', 'description' => 'The Docker Compose domains.'],
|
||||||
'watch_paths' => ['type' => 'string', 'description' => 'The watch paths.'],
|
'watch_paths' => ['type' => 'string', 'description' => 'The watch paths.'],
|
||||||
|
'use_build_server' => ['type' => 'boolean', 'nullable' => true, 'description' => 'Use build server.'],
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
]),
|
]),
|
||||||
@@ -468,6 +471,7 @@ class ApplicationsController extends Controller
|
|||||||
'manual_webhook_secret_gitea' => ['type' => 'string', 'description' => 'Manual webhook secret for Gitea.'],
|
'manual_webhook_secret_gitea' => ['type' => 'string', 'description' => 'Manual webhook secret for Gitea.'],
|
||||||
'redirect' => ['type' => 'string', 'nullable' => true, 'description' => 'How to set redirect with Traefik / Caddy. www<->non-www.', 'enum' => ['www', 'non-www', 'both']],
|
'redirect' => ['type' => 'string', 'nullable' => true, 'description' => 'How to set redirect with Traefik / Caddy. www<->non-www.', 'enum' => ['www', 'non-www', 'both']],
|
||||||
'instant_deploy' => ['type' => 'boolean', 'description' => 'The flag to indicate if the application should be deployed instantly.'],
|
'instant_deploy' => ['type' => 'boolean', 'description' => 'The flag to indicate if the application should be deployed instantly.'],
|
||||||
|
'use_build_server' => ['type' => 'boolean', 'nullable' => true, 'description' => 'Use build server.'],
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
]),
|
]),
|
||||||
@@ -552,6 +556,7 @@ class ApplicationsController extends Controller
|
|||||||
'manual_webhook_secret_gitea' => ['type' => 'string', 'description' => 'Manual webhook secret for Gitea.'],
|
'manual_webhook_secret_gitea' => ['type' => 'string', 'description' => 'Manual webhook secret for Gitea.'],
|
||||||
'redirect' => ['type' => 'string', 'nullable' => true, 'description' => 'How to set redirect with Traefik / Caddy. www<->non-www.', 'enum' => ['www', 'non-www', 'both']],
|
'redirect' => ['type' => 'string', 'nullable' => true, 'description' => 'How to set redirect with Traefik / Caddy. www<->non-www.', 'enum' => ['www', 'non-www', 'both']],
|
||||||
'instant_deploy' => ['type' => 'boolean', 'description' => 'The flag to indicate if the application should be deployed instantly.'],
|
'instant_deploy' => ['type' => 'boolean', 'description' => 'The flag to indicate if the application should be deployed instantly.'],
|
||||||
|
'use_build_server' => ['type' => 'boolean', 'nullable' => true, 'description' => 'Use build server.'],
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
]),
|
]),
|
||||||
@@ -602,6 +607,7 @@ class ApplicationsController extends Controller
|
|||||||
'name' => ['type' => 'string', 'description' => 'The application name.'],
|
'name' => ['type' => 'string', 'description' => 'The application name.'],
|
||||||
'description' => ['type' => 'string', 'description' => 'The application description.'],
|
'description' => ['type' => 'string', 'description' => 'The application description.'],
|
||||||
'instant_deploy' => ['type' => 'boolean', 'description' => 'The flag to indicate if the application should be deployed instantly.'],
|
'instant_deploy' => ['type' => 'boolean', 'description' => 'The flag to indicate if the application should be deployed instantly.'],
|
||||||
|
'use_build_server' => ['type' => 'boolean', 'nullable' => true, 'description' => 'Use build server.'],
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
]),
|
]),
|
||||||
@@ -627,7 +633,7 @@ class ApplicationsController extends Controller
|
|||||||
|
|
||||||
private function create_application(Request $request, $type)
|
private function create_application(Request $request, $type)
|
||||||
{
|
{
|
||||||
$allowedFields = ['project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'type', 'name', 'description', 'is_static', 'domains', 'git_repository', 'git_branch', 'git_commit_sha', 'private_key_uuid', 'docker_registry_image_name', 'docker_registry_image_tag', 'build_pack', 'install_command', 'build_command', 'start_command', 'ports_exposes', 'ports_mappings', 'base_directory', 'publish_directory', 'health_check_enabled', 'health_check_path', 'health_check_port', 'health_check_host', 'health_check_method', 'health_check_return_code', 'health_check_scheme', 'health_check_response_text', 'health_check_interval', 'health_check_timeout', 'health_check_retries', 'health_check_start_period', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'custom_labels', 'custom_docker_run_options', 'post_deployment_command', 'post_deployment_command_container', 'pre_deployment_command', 'pre_deployment_command_container', 'manual_webhook_secret_github', 'manual_webhook_secret_gitlab', 'manual_webhook_secret_bitbucket', 'manual_webhook_secret_gitea', 'redirect', 'github_app_uuid', 'instant_deploy', 'dockerfile', 'docker_compose_location', 'docker_compose_raw', 'docker_compose_custom_start_command', 'docker_compose_custom_build_command', 'docker_compose_domains', 'watch_paths'];
|
$allowedFields = ['project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'type', 'name', 'description', 'is_static', 'domains', 'git_repository', 'git_branch', 'git_commit_sha', 'private_key_uuid', 'docker_registry_image_name', 'docker_registry_image_tag', 'build_pack', 'install_command', 'build_command', 'start_command', 'ports_exposes', 'ports_mappings', 'base_directory', 'publish_directory', 'health_check_enabled', 'health_check_path', 'health_check_port', 'health_check_host', 'health_check_method', 'health_check_return_code', 'health_check_scheme', 'health_check_response_text', 'health_check_interval', 'health_check_timeout', 'health_check_retries', 'health_check_start_period', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'custom_labels', 'custom_docker_run_options', 'post_deployment_command', 'post_deployment_command_container', 'pre_deployment_command', 'pre_deployment_command_container', 'manual_webhook_secret_github', 'manual_webhook_secret_gitlab', 'manual_webhook_secret_bitbucket', 'manual_webhook_secret_gitea', 'redirect', 'github_app_uuid', 'instant_deploy', 'dockerfile', 'docker_compose_location', 'docker_compose_raw', 'docker_compose_custom_start_command', 'docker_compose_custom_build_command', 'docker_compose_domains', 'watch_paths', 'use_build_server'];
|
||||||
$teamId = getTeamIdFromToken();
|
$teamId = getTeamIdFromToken();
|
||||||
if (is_null($teamId)) {
|
if (is_null($teamId)) {
|
||||||
return invalidTokenResponse();
|
return invalidTokenResponse();
|
||||||
@@ -665,6 +671,7 @@ class ApplicationsController extends Controller
|
|||||||
$fqdn = $request->domains;
|
$fqdn = $request->domains;
|
||||||
$instantDeploy = $request->instant_deploy;
|
$instantDeploy = $request->instant_deploy;
|
||||||
$githubAppUuid = $request->github_app_uuid;
|
$githubAppUuid = $request->github_app_uuid;
|
||||||
|
$useBuildServer = $request->use_build_server;
|
||||||
|
|
||||||
$project = Project::whereTeamId($teamId)->whereUuid($request->project_uuid)->first();
|
$project = Project::whereTeamId($teamId)->whereUuid($request->project_uuid)->first();
|
||||||
if (! $project) {
|
if (! $project) {
|
||||||
@@ -737,6 +744,10 @@ class ApplicationsController extends Controller
|
|||||||
$application->destination_id = $destination->id;
|
$application->destination_id = $destination->id;
|
||||||
$application->destination_type = $destination->getMorphClass();
|
$application->destination_type = $destination->getMorphClass();
|
||||||
$application->environment_id = $environment->id;
|
$application->environment_id = $environment->id;
|
||||||
|
if (isset($useBuildServer)) {
|
||||||
|
$application->settings->is_build_server_enabled = $useBuildServer;
|
||||||
|
$application->settings->save();
|
||||||
|
}
|
||||||
$application->save();
|
$application->save();
|
||||||
$application->refresh();
|
$application->refresh();
|
||||||
if (! $application->settings->is_container_label_readonly_enabled) {
|
if (! $application->settings->is_container_label_readonly_enabled) {
|
||||||
@@ -833,6 +844,10 @@ class ApplicationsController extends Controller
|
|||||||
$application->environment_id = $environment->id;
|
$application->environment_id = $environment->id;
|
||||||
$application->source_type = $githubApp->getMorphClass();
|
$application->source_type = $githubApp->getMorphClass();
|
||||||
$application->source_id = $githubApp->id;
|
$application->source_id = $githubApp->id;
|
||||||
|
if (isset($useBuildServer)) {
|
||||||
|
$application->settings->is_build_server_enabled = $useBuildServer;
|
||||||
|
$application->settings->save();
|
||||||
|
}
|
||||||
$application->save();
|
$application->save();
|
||||||
$application->refresh();
|
$application->refresh();
|
||||||
if (! $application->settings->is_container_label_readonly_enabled) {
|
if (! $application->settings->is_container_label_readonly_enabled) {
|
||||||
@@ -925,6 +940,10 @@ class ApplicationsController extends Controller
|
|||||||
$application->destination_id = $destination->id;
|
$application->destination_id = $destination->id;
|
||||||
$application->destination_type = $destination->getMorphClass();
|
$application->destination_type = $destination->getMorphClass();
|
||||||
$application->environment_id = $environment->id;
|
$application->environment_id = $environment->id;
|
||||||
|
if (isset($useBuildServer)) {
|
||||||
|
$application->settings->is_build_server_enabled = $useBuildServer;
|
||||||
|
$application->settings->save();
|
||||||
|
}
|
||||||
$application->save();
|
$application->save();
|
||||||
$application->refresh();
|
$application->refresh();
|
||||||
if (! $application->settings->is_container_label_readonly_enabled) {
|
if (! $application->settings->is_container_label_readonly_enabled) {
|
||||||
@@ -1004,6 +1023,10 @@ class ApplicationsController extends Controller
|
|||||||
$application->destination_id = $destination->id;
|
$application->destination_id = $destination->id;
|
||||||
$application->destination_type = $destination->getMorphClass();
|
$application->destination_type = $destination->getMorphClass();
|
||||||
$application->environment_id = $environment->id;
|
$application->environment_id = $environment->id;
|
||||||
|
if (isset($useBuildServer)) {
|
||||||
|
$application->settings->is_build_server_enabled = $useBuildServer;
|
||||||
|
$application->settings->save();
|
||||||
|
}
|
||||||
|
|
||||||
$application->git_repository = 'coollabsio/coolify';
|
$application->git_repository = 'coollabsio/coolify';
|
||||||
$application->git_branch = 'main';
|
$application->git_branch = 'main';
|
||||||
@@ -1062,6 +1085,10 @@ class ApplicationsController extends Controller
|
|||||||
$application->destination_id = $destination->id;
|
$application->destination_id = $destination->id;
|
||||||
$application->destination_type = $destination->getMorphClass();
|
$application->destination_type = $destination->getMorphClass();
|
||||||
$application->environment_id = $environment->id;
|
$application->environment_id = $environment->id;
|
||||||
|
if (isset($useBuildServer)) {
|
||||||
|
$application->settings->is_build_server_enabled = $useBuildServer;
|
||||||
|
$application->settings->save();
|
||||||
|
}
|
||||||
|
|
||||||
$application->git_repository = 'coollabsio/coolify';
|
$application->git_repository = 'coollabsio/coolify';
|
||||||
$application->git_branch = 'main';
|
$application->git_branch = 'main';
|
||||||
@@ -1259,16 +1286,10 @@ class ApplicationsController extends Controller
|
|||||||
format: 'uuid',
|
format: 'uuid',
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
new OA\Parameter(
|
new OA\Parameter(name: 'delete_configurations', in: 'query', required: false, description: 'Delete configurations.', schema: new OA\Schema(type: 'boolean', default: true)),
|
||||||
name: 'cleanup',
|
new OA\Parameter(name: 'delete_volumes', in: 'query', required: false, description: 'Delete volumes.', schema: new OA\Schema(type: 'boolean', default: true)),
|
||||||
in: 'query',
|
new OA\Parameter(name: 'docker_cleanup', in: 'query', required: false, description: 'Run docker cleanup.', schema: new OA\Schema(type: 'boolean', default: true)),
|
||||||
description: 'Delete configurations and volumes.',
|
new OA\Parameter(name: 'delete_connected_networks', in: 'query', required: false, description: 'Delete connected networks.', schema: new OA\Schema(type: 'boolean', default: true)),
|
||||||
required: false,
|
|
||||||
schema: new OA\Schema(
|
|
||||||
type: 'boolean',
|
|
||||||
default: true,
|
|
||||||
)
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
responses: [
|
responses: [
|
||||||
new OA\Response(
|
new OA\Response(
|
||||||
@@ -1316,10 +1337,14 @@ class ApplicationsController extends Controller
|
|||||||
'message' => 'Application not found',
|
'message' => 'Application not found',
|
||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteResourceJob::dispatch(
|
DeleteResourceJob::dispatch(
|
||||||
resource: $application,
|
resource: $application,
|
||||||
deleteConfigurations: $cleanup,
|
deleteConfigurations: $request->query->get('delete_configurations', true),
|
||||||
deleteVolumes: $cleanup);
|
deleteVolumes: $request->query->get('delete_volumes', true),
|
||||||
|
dockerCleanup: $request->query->get('docker_cleanup', true),
|
||||||
|
deleteConnectedNetworks: $request->query->get('delete_connected_networks', true)
|
||||||
|
);
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'message' => 'Application deletion request queued.',
|
'message' => 'Application deletion request queued.',
|
||||||
@@ -1404,6 +1429,7 @@ class ApplicationsController extends Controller
|
|||||||
'docker_compose_custom_build_command' => ['type' => 'string', 'description' => 'The Docker Compose custom build command.'],
|
'docker_compose_custom_build_command' => ['type' => 'string', 'description' => 'The Docker Compose custom build command.'],
|
||||||
'docker_compose_domains' => ['type' => 'array', 'description' => 'The Docker Compose domains.'],
|
'docker_compose_domains' => ['type' => 'array', 'description' => 'The Docker Compose domains.'],
|
||||||
'watch_paths' => ['type' => 'string', 'description' => 'The watch paths.'],
|
'watch_paths' => ['type' => 'string', 'description' => 'The watch paths.'],
|
||||||
|
'use_build_server' => ['type' => 'boolean', 'nullable' => true, 'description' => 'Use build server.'],
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
]),
|
]),
|
||||||
@@ -1460,7 +1486,7 @@ class ApplicationsController extends Controller
|
|||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
$server = $application->destination->server;
|
$server = $application->destination->server;
|
||||||
$allowedFields = ['name', 'description', 'is_static', 'domains', 'git_repository', 'git_branch', 'git_commit_sha', 'docker_registry_image_name', 'docker_registry_image_tag', 'build_pack', 'static_image', 'install_command', 'build_command', 'start_command', 'ports_exposes', 'ports_mappings', 'base_directory', 'publish_directory', 'health_check_enabled', 'health_check_path', 'health_check_port', 'health_check_host', 'health_check_method', 'health_check_return_code', 'health_check_scheme', 'health_check_response_text', 'health_check_interval', 'health_check_timeout', 'health_check_retries', 'health_check_start_period', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'custom_labels', 'custom_docker_run_options', 'post_deployment_command', 'post_deployment_command_container', 'pre_deployment_command', 'pre_deployment_command_container', 'watch_paths', 'manual_webhook_secret_github', 'manual_webhook_secret_gitlab', 'manual_webhook_secret_bitbucket', 'manual_webhook_secret_gitea', 'docker_compose_location', 'docker_compose_raw', 'docker_compose_custom_start_command', 'docker_compose_custom_build_command', 'docker_compose_domains', 'redirect', 'instant_deploy'];
|
$allowedFields = ['name', 'description', 'is_static', 'domains', 'git_repository', 'git_branch', 'git_commit_sha', 'docker_registry_image_name', 'docker_registry_image_tag', 'build_pack', 'static_image', 'install_command', 'build_command', 'start_command', 'ports_exposes', 'ports_mappings', 'base_directory', 'publish_directory', 'health_check_enabled', 'health_check_path', 'health_check_port', 'health_check_host', 'health_check_method', 'health_check_return_code', 'health_check_scheme', 'health_check_response_text', 'health_check_interval', 'health_check_timeout', 'health_check_retries', 'health_check_start_period', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'custom_labels', 'custom_docker_run_options', 'post_deployment_command', 'post_deployment_command_container', 'pre_deployment_command', 'pre_deployment_command_container', 'watch_paths', 'manual_webhook_secret_github', 'manual_webhook_secret_gitlab', 'manual_webhook_secret_bitbucket', 'manual_webhook_secret_gitea', 'docker_compose_location', 'docker_compose_raw', 'docker_compose_custom_start_command', 'docker_compose_custom_build_command', 'docker_compose_domains', 'redirect', 'instant_deploy', 'use_build_server'];
|
||||||
|
|
||||||
$validator = customApiValidator($request->all(), [
|
$validator = customApiValidator($request->all(), [
|
||||||
sharedDataApplications(),
|
sharedDataApplications(),
|
||||||
@@ -1538,6 +1564,13 @@ class ApplicationsController extends Controller
|
|||||||
}
|
}
|
||||||
$instantDeploy = $request->instant_deploy;
|
$instantDeploy = $request->instant_deploy;
|
||||||
|
|
||||||
|
$use_build_server = $request->use_build_server;
|
||||||
|
|
||||||
|
if (isset($use_build_server)) {
|
||||||
|
$application->settings->is_build_server_enabled = $use_build_server;
|
||||||
|
$application->settings->save();
|
||||||
|
}
|
||||||
|
|
||||||
removeUnnecessaryFieldsFromRequest($request);
|
removeUnnecessaryFieldsFromRequest($request);
|
||||||
|
|
||||||
$data = $request->all();
|
$data = $request->all();
|
||||||
@@ -2529,6 +2562,131 @@ class ApplicationsController extends Controller
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[OA\Post(
|
||||||
|
summary: 'Execute Command',
|
||||||
|
description: "Execute a command on the application's current container.",
|
||||||
|
path: '/applications/{uuid}/execute',
|
||||||
|
operationId: 'execute-command-application',
|
||||||
|
security: [
|
||||||
|
['bearerAuth' => []],
|
||||||
|
],
|
||||||
|
tags: ['Applications'],
|
||||||
|
parameters: [
|
||||||
|
new OA\Parameter(
|
||||||
|
name: 'uuid',
|
||||||
|
in: 'path',
|
||||||
|
description: 'UUID of the application.',
|
||||||
|
required: true,
|
||||||
|
schema: new OA\Schema(
|
||||||
|
type: 'string',
|
||||||
|
format: 'uuid',
|
||||||
|
)
|
||||||
|
),
|
||||||
|
],
|
||||||
|
requestBody: new OA\RequestBody(
|
||||||
|
required: true,
|
||||||
|
description: 'Command to execute.',
|
||||||
|
content: new OA\MediaType(
|
||||||
|
mediaType: 'application/json',
|
||||||
|
schema: new OA\Schema(
|
||||||
|
type: 'object',
|
||||||
|
properties: [
|
||||||
|
'command' => ['type' => 'string', 'description' => 'Command to execute.'],
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
responses: [
|
||||||
|
new OA\Response(
|
||||||
|
response: 200,
|
||||||
|
description: "Execute a command on the application's current container.",
|
||||||
|
content: [
|
||||||
|
new OA\MediaType(
|
||||||
|
mediaType: 'application/json',
|
||||||
|
schema: new OA\Schema(
|
||||||
|
type: 'object',
|
||||||
|
properties: [
|
||||||
|
'message' => ['type' => 'string', 'example' => 'Command executed.'],
|
||||||
|
'response' => ['type' => 'string'],
|
||||||
|
]
|
||||||
|
)
|
||||||
|
),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
new OA\Response(
|
||||||
|
response: 401,
|
||||||
|
ref: '#/components/responses/401',
|
||||||
|
),
|
||||||
|
new OA\Response(
|
||||||
|
response: 400,
|
||||||
|
ref: '#/components/responses/400',
|
||||||
|
),
|
||||||
|
new OA\Response(
|
||||||
|
response: 404,
|
||||||
|
ref: '#/components/responses/404',
|
||||||
|
),
|
||||||
|
]
|
||||||
|
)]
|
||||||
|
public function execute_command_by_uuid(Request $request)
|
||||||
|
{
|
||||||
|
// TODO: Need to review this from security perspective, to not allow arbitrary command execution
|
||||||
|
$allowedFields = ['command'];
|
||||||
|
$teamId = getTeamIdFromToken();
|
||||||
|
if (is_null($teamId)) {
|
||||||
|
return invalidTokenResponse();
|
||||||
|
}
|
||||||
|
$uuid = $request->route('uuid');
|
||||||
|
if (! $uuid) {
|
||||||
|
return response()->json(['message' => 'UUID is required.'], 400);
|
||||||
|
}
|
||||||
|
$application = Application::ownedByCurrentTeamAPI($teamId)->where('uuid', $request->uuid)->first();
|
||||||
|
if (! $application) {
|
||||||
|
return response()->json(['message' => 'Application not found.'], 404);
|
||||||
|
}
|
||||||
|
$return = validateIncomingRequest($request);
|
||||||
|
if ($return instanceof \Illuminate\Http\JsonResponse) {
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
$validator = customApiValidator($request->all(), [
|
||||||
|
'command' => 'string|required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$extraFields = array_diff(array_keys($request->all()), $allowedFields);
|
||||||
|
if ($validator->fails() || ! empty($extraFields)) {
|
||||||
|
$errors = $validator->errors();
|
||||||
|
if (! empty($extraFields)) {
|
||||||
|
foreach ($extraFields as $field) {
|
||||||
|
$errors->add($field, 'This field is not allowed.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'Validation failed.',
|
||||||
|
'errors' => $errors,
|
||||||
|
], 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
$container = getCurrentApplicationContainerStatus($application->destination->server, $application->id)->firstOrFail();
|
||||||
|
$status = getContainerStatus($application->destination->server, $container['Names']);
|
||||||
|
|
||||||
|
if ($status !== 'running') {
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'Application is not running.',
|
||||||
|
], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$commands = collect([
|
||||||
|
executeInDocker($container['Names'], $request->command),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$res = instant_remote_process(command: $commands, server: $application->destination->server);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'Command executed.',
|
||||||
|
'response' => $res,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
private function validateDataApplications(Request $request, Server $server)
|
private function validateDataApplications(Request $request, Server $server)
|
||||||
{
|
{
|
||||||
$teamId = getTeamIdFromToken();
|
$teamId = getTeamIdFromToken();
|
||||||
|
|||||||
@@ -1541,16 +1541,10 @@ class DatabasesController extends Controller
|
|||||||
format: 'uuid',
|
format: 'uuid',
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
new OA\Parameter(
|
new OA\Parameter(name: 'delete_configurations', in: 'query', required: false, description: 'Delete configurations.', schema: new OA\Schema(type: 'boolean', default: true)),
|
||||||
name: 'cleanup',
|
new OA\Parameter(name: 'delete_volumes', in: 'query', required: false, description: 'Delete volumes.', schema: new OA\Schema(type: 'boolean', default: true)),
|
||||||
in: 'query',
|
new OA\Parameter(name: 'docker_cleanup', in: 'query', required: false, description: 'Run docker cleanup.', schema: new OA\Schema(type: 'boolean', default: true)),
|
||||||
description: 'Delete configurations and volumes.',
|
new OA\Parameter(name: 'delete_connected_networks', in: 'query', required: false, description: 'Delete connected networks.', schema: new OA\Schema(type: 'boolean', default: true)),
|
||||||
required: false,
|
|
||||||
schema: new OA\Schema(
|
|
||||||
type: 'boolean',
|
|
||||||
default: true,
|
|
||||||
)
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
responses: [
|
responses: [
|
||||||
new OA\Response(
|
new OA\Response(
|
||||||
@@ -1595,10 +1589,14 @@ class DatabasesController extends Controller
|
|||||||
if (! $database) {
|
if (! $database) {
|
||||||
return response()->json(['message' => 'Database not found.'], 404);
|
return response()->json(['message' => 'Database not found.'], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteResourceJob::dispatch(
|
DeleteResourceJob::dispatch(
|
||||||
resource: $database,
|
resource: $database,
|
||||||
deleteConfigurations: $cleanup,
|
deleteConfigurations: $request->query->get('delete_configurations', true),
|
||||||
deleteVolumes: $cleanup);
|
deleteVolumes: $request->query->get('delete_volumes', true),
|
||||||
|
dockerCleanup: $request->query->get('docker_cleanup', true),
|
||||||
|
deleteConnectedNetworks: $request->query->get('delete_connected_networks', true)
|
||||||
|
);
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'message' => 'Database deletion request queued.',
|
'message' => 'Database deletion request queued.',
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ class DeployController extends Controller
|
|||||||
],
|
],
|
||||||
tags: ['Deployments'],
|
tags: ['Deployments'],
|
||||||
parameters: [
|
parameters: [
|
||||||
new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Deployment Uuid', schema: new OA\Schema(type: 'string')),
|
new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Deployment UUID', schema: new OA\Schema(type: 'string')),
|
||||||
],
|
],
|
||||||
responses: [
|
responses: [
|
||||||
new OA\Response(
|
new OA\Response(
|
||||||
@@ -150,7 +150,7 @@ class DeployController extends Controller
|
|||||||
responses: [
|
responses: [
|
||||||
new OA\Response(
|
new OA\Response(
|
||||||
response: 200,
|
response: 200,
|
||||||
description: 'Get deployment(s) Uuid\'s',
|
description: 'Get deployment(s) UUID\'s',
|
||||||
content: [
|
content: [
|
||||||
new OA\MediaType(
|
new OA\MediaType(
|
||||||
mediaType: 'application/json',
|
mediaType: 'application/json',
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ class OtherController extends Controller
|
|||||||
if ($teamId !== '0') {
|
if ($teamId !== '0') {
|
||||||
return response()->json(['message' => 'You are not allowed to enable the API.'], 403);
|
return response()->json(['message' => 'You are not allowed to enable the API.'], 403);
|
||||||
}
|
}
|
||||||
$settings = \App\Models\InstanceSettings::get();
|
$settings = instanceSettings();
|
||||||
$settings->update(['is_api_enabled' => true]);
|
$settings->update(['is_api_enabled' => true]);
|
||||||
|
|
||||||
return response()->json(['message' => 'API enabled.'], 200);
|
return response()->json(['message' => 'API enabled.'], 200);
|
||||||
@@ -138,7 +138,7 @@ class OtherController extends Controller
|
|||||||
if ($teamId !== '0') {
|
if ($teamId !== '0') {
|
||||||
return response()->json(['message' => 'You are not allowed to disable the API.'], 403);
|
return response()->json(['message' => 'You are not allowed to disable the API.'], 403);
|
||||||
}
|
}
|
||||||
$settings = \App\Models\InstanceSettings::get();
|
$settings = instanceSettings();
|
||||||
$settings->update(['is_api_enabled' => false]);
|
$settings->update(['is_api_enabled' => false]);
|
||||||
|
|
||||||
return response()->json(['message' => 'API disabled.'], 200);
|
return response()->json(['message' => 'API disabled.'], 200);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class ProjectController extends Controller
|
|||||||
{
|
{
|
||||||
#[OA\Get(
|
#[OA\Get(
|
||||||
summary: 'List',
|
summary: 'List',
|
||||||
description: 'list projects.',
|
description: 'List projects.',
|
||||||
path: '/projects',
|
path: '/projects',
|
||||||
operationId: 'list-projects',
|
operationId: 'list-projects',
|
||||||
security: [
|
security: [
|
||||||
@@ -47,7 +47,7 @@ class ProjectController extends Controller
|
|||||||
if (is_null($teamId)) {
|
if (is_null($teamId)) {
|
||||||
return invalidTokenResponse();
|
return invalidTokenResponse();
|
||||||
}
|
}
|
||||||
$projects = Project::whereTeamId($teamId)->select('id', 'name', 'uuid')->get();
|
$projects = Project::whereTeamId($teamId)->select('id', 'name', 'description', 'uuid')->get();
|
||||||
|
|
||||||
return response()->json(serializeApiResponse($projects),
|
return response()->json(serializeApiResponse($projects),
|
||||||
);
|
);
|
||||||
@@ -55,7 +55,7 @@ class ProjectController extends Controller
|
|||||||
|
|
||||||
#[OA\Get(
|
#[OA\Get(
|
||||||
summary: 'Get',
|
summary: 'Get',
|
||||||
description: 'Get project by Uuid.',
|
description: 'Get project by UUID.',
|
||||||
path: '/projects/{uuid}',
|
path: '/projects/{uuid}',
|
||||||
operationId: 'get-project-by-uuid',
|
operationId: 'get-project-by-uuid',
|
||||||
security: [
|
security: [
|
||||||
@@ -139,7 +139,7 @@ class ProjectController extends Controller
|
|||||||
return invalidTokenResponse();
|
return invalidTokenResponse();
|
||||||
}
|
}
|
||||||
if (! $request->uuid) {
|
if (! $request->uuid) {
|
||||||
return response()->json(['message' => 'Uuid is required.'], 422);
|
return response()->json(['message' => 'UUID is required.'], 422);
|
||||||
}
|
}
|
||||||
if (! $request->environment_name) {
|
if (! $request->environment_name) {
|
||||||
return response()->json(['message' => 'Environment name is required.'], 422);
|
return response()->json(['message' => 'Environment name is required.'], 422);
|
||||||
@@ -341,7 +341,7 @@ class ProjectController extends Controller
|
|||||||
}
|
}
|
||||||
$uuid = $request->uuid;
|
$uuid = $request->uuid;
|
||||||
if (! $uuid) {
|
if (! $uuid) {
|
||||||
return response()->json(['message' => 'Uuid is required.'], 422);
|
return response()->json(['message' => 'UUID is required.'], 422);
|
||||||
}
|
}
|
||||||
|
|
||||||
$project = Project::whereTeamId($teamId)->whereUuid($uuid)->first();
|
$project = Project::whereTeamId($teamId)->whereUuid($uuid)->first();
|
||||||
@@ -417,7 +417,7 @@ class ProjectController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! $request->uuid) {
|
if (! $request->uuid) {
|
||||||
return response()->json(['message' => 'Uuid is required.'], 422);
|
return response()->json(['message' => 'UUID is required.'], 422);
|
||||||
}
|
}
|
||||||
$project = Project::whereTeamId($teamId)->whereUuid($request->uuid)->first();
|
$project = Project::whereTeamId($teamId)->whereUuid($request->uuid)->first();
|
||||||
if (! $project) {
|
if (! $project) {
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ class SecurityController extends Controller
|
|||||||
],
|
],
|
||||||
tags: ['Private Keys'],
|
tags: ['Private Keys'],
|
||||||
parameters: [
|
parameters: [
|
||||||
new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Private Key Uuid', schema: new OA\Schema(type: 'string')),
|
new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Private Key UUID', schema: new OA\Schema(type: 'string')),
|
||||||
],
|
],
|
||||||
responses: [
|
responses: [
|
||||||
new OA\Response(
|
new OA\Response(
|
||||||
@@ -323,7 +323,7 @@ class SecurityController extends Controller
|
|||||||
],
|
],
|
||||||
tags: ['Private Keys'],
|
tags: ['Private Keys'],
|
||||||
parameters: [
|
parameters: [
|
||||||
new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Private Key Uuid', schema: new OA\Schema(type: 'string')),
|
new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Private Key UUID', schema: new OA\Schema(type: 'string')),
|
||||||
],
|
],
|
||||||
responses: [
|
responses: [
|
||||||
new OA\Response(
|
new OA\Response(
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ class ServersController extends Controller
|
|||||||
],
|
],
|
||||||
tags: ['Servers'],
|
tags: ['Servers'],
|
||||||
parameters: [
|
parameters: [
|
||||||
new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Server\'s Uuid', schema: new OA\Schema(type: 'string')),
|
new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Server\'s UUID', schema: new OA\Schema(type: 'string')),
|
||||||
],
|
],
|
||||||
responses: [
|
responses: [
|
||||||
new OA\Response(
|
new OA\Response(
|
||||||
@@ -185,7 +185,7 @@ class ServersController extends Controller
|
|||||||
],
|
],
|
||||||
tags: ['Servers'],
|
tags: ['Servers'],
|
||||||
parameters: [
|
parameters: [
|
||||||
new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Server\'s Uuid', schema: new OA\Schema(type: 'string')),
|
new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Server\'s UUID', schema: new OA\Schema(type: 'string')),
|
||||||
],
|
],
|
||||||
responses: [
|
responses: [
|
||||||
new OA\Response(
|
new OA\Response(
|
||||||
@@ -263,7 +263,7 @@ class ServersController extends Controller
|
|||||||
],
|
],
|
||||||
tags: ['Servers'],
|
tags: ['Servers'],
|
||||||
parameters: [
|
parameters: [
|
||||||
new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Server\'s Uuid', schema: new OA\Schema(type: 'string')),
|
new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Server\'s UUID', schema: new OA\Schema(type: 'string')),
|
||||||
],
|
],
|
||||||
responses: [
|
responses: [
|
||||||
new OA\Response(
|
new OA\Response(
|
||||||
@@ -308,7 +308,7 @@ class ServersController extends Controller
|
|||||||
$projects = Project::where('team_id', $teamId)->get();
|
$projects = Project::where('team_id', $teamId)->get();
|
||||||
$domains = collect();
|
$domains = collect();
|
||||||
$applications = $projects->pluck('applications')->flatten();
|
$applications = $projects->pluck('applications')->flatten();
|
||||||
$settings = \App\Models\InstanceSettings::get();
|
$settings = instanceSettings();
|
||||||
if ($applications->count() > 0) {
|
if ($applications->count() > 0) {
|
||||||
foreach ($applications as $application) {
|
foreach ($applications as $application) {
|
||||||
$ip = $application->destination->server->ip;
|
$ip = $application->destination->server->ip;
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ class ServicesController extends Controller
|
|||||||
responses: [
|
responses: [
|
||||||
new OA\Response(
|
new OA\Response(
|
||||||
response: 200,
|
response: 200,
|
||||||
description: 'Get a service by Uuid.',
|
description: 'Get a service by UUID.',
|
||||||
content: [
|
content: [
|
||||||
new OA\MediaType(
|
new OA\MediaType(
|
||||||
mediaType: 'application/json',
|
mediaType: 'application/json',
|
||||||
@@ -432,11 +432,15 @@ class ServicesController extends Controller
|
|||||||
tags: ['Services'],
|
tags: ['Services'],
|
||||||
parameters: [
|
parameters: [
|
||||||
new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Service UUID', schema: new OA\Schema(type: 'string')),
|
new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Service UUID', schema: new OA\Schema(type: 'string')),
|
||||||
|
new OA\Parameter(name: 'delete_configurations', in: 'query', required: false, description: 'Delete configurations.', schema: new OA\Schema(type: 'boolean', default: true)),
|
||||||
|
new OA\Parameter(name: 'delete_volumes', in: 'query', required: false, description: 'Delete volumes.', schema: new OA\Schema(type: 'boolean', default: true)),
|
||||||
|
new OA\Parameter(name: 'docker_cleanup', in: 'query', required: false, description: 'Run docker cleanup.', schema: new OA\Schema(type: 'boolean', default: true)),
|
||||||
|
new OA\Parameter(name: 'delete_connected_networks', in: 'query', required: false, description: 'Delete connected networks.', schema: new OA\Schema(type: 'boolean', default: true)),
|
||||||
],
|
],
|
||||||
responses: [
|
responses: [
|
||||||
new OA\Response(
|
new OA\Response(
|
||||||
response: 200,
|
response: 200,
|
||||||
description: 'Delete a service by Uuid',
|
description: 'Delete a service by UUID',
|
||||||
content: [
|
content: [
|
||||||
new OA\MediaType(
|
new OA\MediaType(
|
||||||
mediaType: 'application/json',
|
mediaType: 'application/json',
|
||||||
@@ -476,7 +480,14 @@ class ServicesController extends Controller
|
|||||||
if (! $service) {
|
if (! $service) {
|
||||||
return response()->json(['message' => 'Service not found.'], 404);
|
return response()->json(['message' => 'Service not found.'], 404);
|
||||||
}
|
}
|
||||||
DeleteResourceJob::dispatch($service);
|
|
||||||
|
DeleteResourceJob::dispatch(
|
||||||
|
resource: $service,
|
||||||
|
deleteConfigurations: $request->query->get('delete_configurations', true),
|
||||||
|
deleteVolumes: $request->query->get('delete_volumes', true),
|
||||||
|
dockerCleanup: $request->query->get('docker_cleanup', true),
|
||||||
|
deleteConnectedNetworks: $request->query->get('delete_connected_networks', true)
|
||||||
|
);
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'message' => 'Service deletion request queued.',
|
'message' => 'Service deletion request queued.',
|
||||||
@@ -516,7 +527,8 @@ class ServicesController extends Controller
|
|||||||
items: new OA\Items(ref: '#/components/schemas/EnvironmentVariable')
|
items: new OA\Items(ref: '#/components/schemas/EnvironmentVariable')
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
]),
|
]
|
||||||
|
),
|
||||||
new OA\Response(
|
new OA\Response(
|
||||||
response: 401,
|
response: 401,
|
||||||
ref: '#/components/responses/401',
|
ref: '#/components/responses/401',
|
||||||
@@ -619,7 +631,8 @@ class ServicesController extends Controller
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
]),
|
]
|
||||||
|
),
|
||||||
new OA\Response(
|
new OA\Response(
|
||||||
response: 401,
|
response: 401,
|
||||||
ref: '#/components/responses/401',
|
ref: '#/components/responses/401',
|
||||||
@@ -738,7 +751,8 @@ class ServicesController extends Controller
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
]),
|
]
|
||||||
|
),
|
||||||
new OA\Response(
|
new OA\Response(
|
||||||
response: 401,
|
response: 401,
|
||||||
ref: '#/components/responses/401',
|
ref: '#/components/responses/401',
|
||||||
@@ -853,7 +867,8 @@ class ServicesController extends Controller
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
]),
|
]
|
||||||
|
),
|
||||||
new OA\Response(
|
new OA\Response(
|
||||||
response: 401,
|
response: 401,
|
||||||
ref: '#/components/responses/401',
|
ref: '#/components/responses/401',
|
||||||
@@ -953,7 +968,8 @@ class ServicesController extends Controller
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
]),
|
]
|
||||||
|
),
|
||||||
new OA\Response(
|
new OA\Response(
|
||||||
response: 401,
|
response: 401,
|
||||||
ref: '#/components/responses/401',
|
ref: '#/components/responses/401',
|
||||||
@@ -1025,9 +1041,11 @@ class ServicesController extends Controller
|
|||||||
type: 'object',
|
type: 'object',
|
||||||
properties: [
|
properties: [
|
||||||
'message' => ['type' => 'string', 'example' => 'Service starting request queued.'],
|
'message' => ['type' => 'string', 'example' => 'Service starting request queued.'],
|
||||||
])
|
]
|
||||||
|
)
|
||||||
|
),
|
||||||
|
]
|
||||||
),
|
),
|
||||||
]),
|
|
||||||
new OA\Response(
|
new OA\Response(
|
||||||
response: 401,
|
response: 401,
|
||||||
ref: '#/components/responses/401',
|
ref: '#/components/responses/401',
|
||||||
@@ -1101,9 +1119,11 @@ class ServicesController extends Controller
|
|||||||
type: 'object',
|
type: 'object',
|
||||||
properties: [
|
properties: [
|
||||||
'message' => ['type' => 'string', 'example' => 'Service stopping request queued.'],
|
'message' => ['type' => 'string', 'example' => 'Service stopping request queued.'],
|
||||||
])
|
]
|
||||||
|
)
|
||||||
|
),
|
||||||
|
]
|
||||||
),
|
),
|
||||||
]),
|
|
||||||
new OA\Response(
|
new OA\Response(
|
||||||
response: 401,
|
response: 401,
|
||||||
ref: '#/components/responses/401',
|
ref: '#/components/responses/401',
|
||||||
@@ -1177,9 +1197,11 @@ class ServicesController extends Controller
|
|||||||
type: 'object',
|
type: 'object',
|
||||||
properties: [
|
properties: [
|
||||||
'message' => ['type' => 'string', 'example' => 'Service restaring request queued.'],
|
'message' => ['type' => 'string', 'example' => 'Service restaring request queued.'],
|
||||||
])
|
]
|
||||||
|
)
|
||||||
|
),
|
||||||
|
]
|
||||||
),
|
),
|
||||||
]),
|
|
||||||
new OA\Response(
|
new OA\Response(
|
||||||
response: 401,
|
response: 401,
|
||||||
ref: '#/components/responses/401',
|
ref: '#/components/responses/401',
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Models\InstanceSettings;
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||||
@@ -22,7 +21,7 @@ class OauthController extends Controller
|
|||||||
$oauthUser = get_socialite_provider($provider)->user();
|
$oauthUser = get_socialite_provider($provider)->user();
|
||||||
$user = User::whereEmail($oauthUser->email)->first();
|
$user = User::whereEmail($oauthUser->email)->first();
|
||||||
if (! $user) {
|
if (! $user) {
|
||||||
$settings = InstanceSettings::get();
|
$settings = instanceSettings();
|
||||||
if (! $settings->is_registration_enabled) {
|
if (! $settings->is_registration_enabled) {
|
||||||
abort(403, 'Registration is disabled');
|
abort(403, 'Registration is disabled');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class ApiAllowed
|
|||||||
if (isCloud()) {
|
if (isCloud()) {
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
$settings = \App\Models\InstanceSettings::get();
|
$settings = instanceSettings();
|
||||||
if ($settings->is_api_enabled === false) {
|
if ($settings->is_api_enabled === false) {
|
||||||
return response()->json(['success' => true, 'message' => 'API is disabled.'], 403);
|
return response()->json(['success' => true, 'message' => 'API is disabled.'], 403);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ use App\Models\ApplicationPreview;
|
|||||||
use App\Models\EnvironmentVariable;
|
use App\Models\EnvironmentVariable;
|
||||||
use App\Models\GithubApp;
|
use App\Models\GithubApp;
|
||||||
use App\Models\GitlabApp;
|
use App\Models\GitlabApp;
|
||||||
use App\Models\InstanceSettings;
|
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use App\Models\StandaloneDocker;
|
use App\Models\StandaloneDocker;
|
||||||
use App\Models\SwarmDocker;
|
use App\Models\SwarmDocker;
|
||||||
@@ -27,6 +26,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
|
|||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Process;
|
||||||
use Illuminate\Support\Sleep;
|
use Illuminate\Support\Sleep;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
@@ -210,7 +210,6 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
}
|
}
|
||||||
ray('New container name: ', $this->container_name)->green();
|
ray('New container name: ', $this->container_name)->green();
|
||||||
|
|
||||||
savePrivateKeyToFs($this->server);
|
|
||||||
$this->saved_outputs = collect();
|
$this->saved_outputs = collect();
|
||||||
|
|
||||||
// Set preview fqdn
|
// Set preview fqdn
|
||||||
@@ -514,7 +513,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
'hidden' => true,
|
'hidden' => true,
|
||||||
'ignore_errors' => true,
|
'ignore_errors' => true,
|
||||||
], [
|
], [
|
||||||
"docker network connect {$networkId} coolify-proxy || true",
|
"docker network connect {$networkId} coolify-proxy >/dev/null 2>&1 || true",
|
||||||
'hidden' => true,
|
'hidden' => true,
|
||||||
'ignore_errors' => true,
|
'ignore_errors' => true,
|
||||||
]);
|
]);
|
||||||
@@ -919,10 +918,10 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
}
|
}
|
||||||
if ($this->application->build_pack !== 'dockercompose' || $this->application->compose_parsing_version === '1' || $this->application->compose_parsing_version === '2') {
|
if ($this->application->build_pack !== 'dockercompose' || $this->application->compose_parsing_version === '1' || $this->application->compose_parsing_version === '2') {
|
||||||
if ($this->application->environment_variables_preview->where('key', 'COOLIFY_BRANCH')->isEmpty()) {
|
if ($this->application->environment_variables_preview->where('key', 'COOLIFY_BRANCH')->isEmpty()) {
|
||||||
$envs->push("COOLIFY_BRANCH={$local_branch}");
|
$envs->push("COOLIFY_BRANCH=\"{$local_branch}\"");
|
||||||
}
|
}
|
||||||
if ($this->application->environment_variables_preview->where('key', 'COOLIFY_CONTAINER_NAME')->isEmpty()) {
|
if ($this->application->environment_variables_preview->where('key', 'COOLIFY_CONTAINER_NAME')->isEmpty()) {
|
||||||
$envs->push("COOLIFY_CONTAINER_NAME={$this->container_name}");
|
$envs->push("COOLIFY_CONTAINER_NAME=\"{$this->container_name}\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -962,7 +961,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($this->application->environment_variables->where('key', 'COOLIFY_FQDN')->isEmpty()) {
|
if ($this->application->environment_variables->where('key', 'COOLIFY_FQDN')->isEmpty()) {
|
||||||
if ($this->application->compose_parsing_version === '3') {
|
if ((int) $this->application->compose_parsing_version >= 3) {
|
||||||
$envs->push("COOLIFY_URL={$this->application->fqdn}");
|
$envs->push("COOLIFY_URL={$this->application->fqdn}");
|
||||||
} else {
|
} else {
|
||||||
$envs->push("COOLIFY_FQDN={$this->application->fqdn}");
|
$envs->push("COOLIFY_FQDN={$this->application->fqdn}");
|
||||||
@@ -970,7 +969,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
}
|
}
|
||||||
if ($this->application->environment_variables->where('key', 'COOLIFY_URL')->isEmpty()) {
|
if ($this->application->environment_variables->where('key', 'COOLIFY_URL')->isEmpty()) {
|
||||||
$url = str($this->application->fqdn)->replace('http://', '')->replace('https://', '');
|
$url = str($this->application->fqdn)->replace('http://', '')->replace('https://', '');
|
||||||
if ($this->application->compose_parsing_version === '3') {
|
if ((int) $this->application->compose_parsing_version >= 3) {
|
||||||
$envs->push("COOLIFY_FQDN={$url}");
|
$envs->push("COOLIFY_FQDN={$url}");
|
||||||
} else {
|
} else {
|
||||||
$envs->push("COOLIFY_URL={$url}");
|
$envs->push("COOLIFY_URL={$url}");
|
||||||
@@ -978,10 +977,10 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
}
|
}
|
||||||
if ($this->application->build_pack !== 'dockercompose' || $this->application->compose_parsing_version === '1' || $this->application->compose_parsing_version === '2') {
|
if ($this->application->build_pack !== 'dockercompose' || $this->application->compose_parsing_version === '1' || $this->application->compose_parsing_version === '2') {
|
||||||
if ($this->application->environment_variables->where('key', 'COOLIFY_BRANCH')->isEmpty()) {
|
if ($this->application->environment_variables->where('key', 'COOLIFY_BRANCH')->isEmpty()) {
|
||||||
$envs->push("COOLIFY_BRANCH={$local_branch}");
|
$envs->push("COOLIFY_BRANCH=\"{$local_branch}\"");
|
||||||
}
|
}
|
||||||
if ($this->application->environment_variables->where('key', 'COOLIFY_CONTAINER_NAME')->isEmpty()) {
|
if ($this->application->environment_variables->where('key', 'COOLIFY_CONTAINER_NAME')->isEmpty()) {
|
||||||
$envs->push("COOLIFY_CONTAINER_NAME={$this->container_name}");
|
$envs->push("COOLIFY_CONTAINER_NAME=\"{$this->container_name}\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1066,15 +1065,55 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
$this->environment_variables = $envs;
|
$this->environment_variables = $envs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function elixir_finetunes()
|
||||||
|
{
|
||||||
|
if ($this->pull_request_id === 0) {
|
||||||
|
$envType = 'environment_variables';
|
||||||
|
} else {
|
||||||
|
$envType = 'environment_variables_preview';
|
||||||
|
}
|
||||||
|
$mix_env = $this->application->{$envType}->where('key', 'MIX_ENV')->first();
|
||||||
|
if ($mix_env) {
|
||||||
|
if ($mix_env->is_build_time === false) {
|
||||||
|
$this->application_deployment_queue->addLogEntry('MIX_ENV environment variable is not set as build time.', type: 'error');
|
||||||
|
$this->application_deployment_queue->addLogEntry('Please set MIX_ENV environment variable to be build time variable if you facing any issues with the deployment.', type: 'error');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->application_deployment_queue->addLogEntry('MIX_ENV environment variable not found.', type: 'error');
|
||||||
|
$this->application_deployment_queue->addLogEntry('Please add MIX_ENV environment variable and set it to be build time variable if you facing any issues with the deployment.', type: 'error');
|
||||||
|
}
|
||||||
|
$secret_key_base = $this->application->{$envType}->where('key', 'SECRET_KEY_BASE')->first();
|
||||||
|
if ($secret_key_base) {
|
||||||
|
if ($secret_key_base->is_build_time === false) {
|
||||||
|
$this->application_deployment_queue->addLogEntry('SECRET_KEY_BASE environment variable is not set as build time.', type: 'error');
|
||||||
|
$this->application_deployment_queue->addLogEntry('Please set SECRET_KEY_BASE environment variable to be build time variable if you facing any issues with the deployment.', type: 'error');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->application_deployment_queue->addLogEntry('SECRET_KEY_BASE environment variable not found.', type: 'error');
|
||||||
|
$this->application_deployment_queue->addLogEntry('Please add SECRET_KEY_BASE environment variable and set it to be build time variable if you facing any issues with the deployment.', type: 'error');
|
||||||
|
}
|
||||||
|
$database_url = $this->application->{$envType}->where('key', 'DATABASE_URL')->first();
|
||||||
|
if ($database_url) {
|
||||||
|
if ($database_url->is_build_time === false) {
|
||||||
|
$this->application_deployment_queue->addLogEntry('DATABASE_URL environment variable is not set as build time.', type: 'error');
|
||||||
|
$this->application_deployment_queue->addLogEntry('Please set DATABASE_URL environment variable to be build time variable if you facing any issues with the deployment.', type: 'error');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->application_deployment_queue->addLogEntry('DATABASE_URL environment variable not found.', type: 'error');
|
||||||
|
$this->application_deployment_queue->addLogEntry('Please add DATABASE_URL environment variable and set it to be build time variable if you facing any issues with the deployment.', type: 'error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private function laravel_finetunes()
|
private function laravel_finetunes()
|
||||||
{
|
{
|
||||||
if ($this->pull_request_id === 0) {
|
if ($this->pull_request_id === 0) {
|
||||||
$nixpacks_php_fallback_path = $this->application->environment_variables->where('key', 'NIXPACKS_PHP_FALLBACK_PATH')->first();
|
$envType = 'environment_variables';
|
||||||
$nixpacks_php_root_dir = $this->application->environment_variables->where('key', 'NIXPACKS_PHP_ROOT_DIR')->first();
|
|
||||||
} else {
|
} else {
|
||||||
$nixpacks_php_fallback_path = $this->application->environment_variables_preview->where('key', 'NIXPACKS_PHP_FALLBACK_PATH')->first();
|
$envType = 'environment_variables_preview';
|
||||||
$nixpacks_php_root_dir = $this->application->environment_variables_preview->where('key', 'NIXPACKS_PHP_ROOT_DIR')->first();
|
|
||||||
}
|
}
|
||||||
|
$nixpacks_php_fallback_path = $this->application->{$envType}->where('key', 'NIXPACKS_PHP_FALLBACK_PATH')->first();
|
||||||
|
$nixpacks_php_root_dir = $this->application->{$envType}->where('key', 'NIXPACKS_PHP_ROOT_DIR')->first();
|
||||||
|
|
||||||
if (! $nixpacks_php_fallback_path) {
|
if (! $nixpacks_php_fallback_path) {
|
||||||
$nixpacks_php_fallback_path = new EnvironmentVariable;
|
$nixpacks_php_fallback_path = new EnvironmentVariable;
|
||||||
$nixpacks_php_fallback_path->key = 'NIXPACKS_PHP_FALLBACK_PATH';
|
$nixpacks_php_fallback_path->key = 'NIXPACKS_PHP_FALLBACK_PATH';
|
||||||
@@ -1294,7 +1333,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
|
|
||||||
private function prepare_builder_image()
|
private function prepare_builder_image()
|
||||||
{
|
{
|
||||||
$settings = InstanceSettings::get();
|
$settings = instanceSettings();
|
||||||
$helperImage = config('coolify.helper_image');
|
$helperImage = config('coolify.helper_image');
|
||||||
$helperImage = "{$helperImage}:{$settings->helper_version}";
|
$helperImage = "{$helperImage}:{$settings->helper_version}";
|
||||||
// Get user home directory
|
// Get user home directory
|
||||||
@@ -1416,10 +1455,10 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
executeInDocker($this->deployment_uuid, 'chmod 600 /root/.ssh/id_rsa'),
|
executeInDocker($this->deployment_uuid, 'chmod 600 /root/.ssh/id_rsa'),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
executeInDocker($this->deployment_uuid, "GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$this->customPort} -o Port={$this->customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git ls-remote {$this->fullRepoUrl} {$local_branch}"),
|
executeInDocker($this->deployment_uuid, "GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$this->customPort} -o Port={$this->customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null\" git ls-remote {$this->fullRepoUrl} {$local_branch}"),
|
||||||
'hidden' => true,
|
'hidden' => true,
|
||||||
'save' => 'git_commit_sha',
|
'save' => 'git_commit_sha',
|
||||||
],
|
]
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$this->execute_remote_command(
|
$this->execute_remote_command(
|
||||||
@@ -1533,6 +1572,9 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
data_set($parsed, 'variables.NIXPACKS_PHP_FALLBACK_PATH', $variables[0]->value);
|
data_set($parsed, 'variables.NIXPACKS_PHP_FALLBACK_PATH', $variables[0]->value);
|
||||||
data_set($parsed, 'variables.NIXPACKS_PHP_ROOT_DIR', $variables[1]->value);
|
data_set($parsed, 'variables.NIXPACKS_PHP_ROOT_DIR', $variables[1]->value);
|
||||||
}
|
}
|
||||||
|
if ($this->nixpacks_type === 'elixir') {
|
||||||
|
$this->elixir_finetunes();
|
||||||
|
}
|
||||||
$this->nixpacks_plan = json_encode($parsed, JSON_PRETTY_PRINT);
|
$this->nixpacks_plan = json_encode($parsed, JSON_PRETTY_PRINT);
|
||||||
$this->application_deployment_queue->addLogEntry("Final Nixpacks plan: {$this->nixpacks_plan}", hidden: true);
|
$this->application_deployment_queue->addLogEntry("Final Nixpacks plan: {$this->nixpacks_plan}", hidden: true);
|
||||||
if ($this->nixpacks_type === 'rust') {
|
if ($this->nixpacks_type === 'rust') {
|
||||||
@@ -2006,6 +2048,10 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
|
|||||||
executeInDocker($this->deployment_uuid, "echo '{$base64_build_command}' | base64 -d | tee /artifacts/build.sh > /dev/null"),
|
executeInDocker($this->deployment_uuid, "echo '{$base64_build_command}' | base64 -d | tee /artifacts/build.sh > /dev/null"),
|
||||||
'hidden' => true,
|
'hidden' => true,
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
executeInDocker($this->deployment_uuid, 'cat /artifacts/build.sh'),
|
||||||
|
'hidden' => true,
|
||||||
|
],
|
||||||
[
|
[
|
||||||
executeInDocker($this->deployment_uuid, 'bash /artifacts/build.sh'),
|
executeInDocker($this->deployment_uuid, 'bash /artifacts/build.sh'),
|
||||||
'hidden' => true,
|
'hidden' => true,
|
||||||
@@ -2025,6 +2071,10 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
|
|||||||
executeInDocker($this->deployment_uuid, "echo '{$base64_build_command}' | base64 -d | tee /artifacts/build.sh > /dev/null"),
|
executeInDocker($this->deployment_uuid, "echo '{$base64_build_command}' | base64 -d | tee /artifacts/build.sh > /dev/null"),
|
||||||
'hidden' => true,
|
'hidden' => true,
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
executeInDocker($this->deployment_uuid, 'cat /artifacts/build.sh'),
|
||||||
|
'hidden' => true,
|
||||||
|
],
|
||||||
[
|
[
|
||||||
executeInDocker($this->deployment_uuid, 'bash /artifacts/build.sh'),
|
executeInDocker($this->deployment_uuid, 'bash /artifacts/build.sh'),
|
||||||
'hidden' => true,
|
'hidden' => true,
|
||||||
@@ -2067,6 +2117,10 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
|
|||||||
executeInDocker($this->deployment_uuid, "echo '{$base64_build_command}' | base64 -d | tee /artifacts/build.sh > /dev/null"),
|
executeInDocker($this->deployment_uuid, "echo '{$base64_build_command}' | base64 -d | tee /artifacts/build.sh > /dev/null"),
|
||||||
'hidden' => true,
|
'hidden' => true,
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
executeInDocker($this->deployment_uuid, 'cat /artifacts/build.sh'),
|
||||||
|
'hidden' => true,
|
||||||
|
],
|
||||||
[
|
[
|
||||||
executeInDocker($this->deployment_uuid, 'bash /artifacts/build.sh'),
|
executeInDocker($this->deployment_uuid, 'bash /artifacts/build.sh'),
|
||||||
'hidden' => true,
|
'hidden' => true,
|
||||||
@@ -2086,6 +2140,10 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
|
|||||||
executeInDocker($this->deployment_uuid, "echo '{$base64_build_command}' | base64 -d | tee /artifacts/build.sh > /dev/null"),
|
executeInDocker($this->deployment_uuid, "echo '{$base64_build_command}' | base64 -d | tee /artifacts/build.sh > /dev/null"),
|
||||||
'hidden' => true,
|
'hidden' => true,
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
executeInDocker($this->deployment_uuid, 'cat /artifacts/build.sh'),
|
||||||
|
'hidden' => true,
|
||||||
|
],
|
||||||
[
|
[
|
||||||
executeInDocker($this->deployment_uuid, 'bash /artifacts/build.sh'),
|
executeInDocker($this->deployment_uuid, 'bash /artifacts/build.sh'),
|
||||||
'hidden' => true,
|
'hidden' => true,
|
||||||
@@ -2114,6 +2172,10 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
|
|||||||
executeInDocker($this->deployment_uuid, "echo '{$base64_build_command}' | base64 -d | tee /artifacts/build.sh > /dev/null"),
|
executeInDocker($this->deployment_uuid, "echo '{$base64_build_command}' | base64 -d | tee /artifacts/build.sh > /dev/null"),
|
||||||
'hidden' => true,
|
'hidden' => true,
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
executeInDocker($this->deployment_uuid, 'cat /artifacts/build.sh'),
|
||||||
|
'hidden' => true,
|
||||||
|
],
|
||||||
[
|
[
|
||||||
executeInDocker($this->deployment_uuid, 'bash /artifacts/build.sh'),
|
executeInDocker($this->deployment_uuid, 'bash /artifacts/build.sh'),
|
||||||
'hidden' => true,
|
'hidden' => true,
|
||||||
@@ -2133,6 +2195,10 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
|
|||||||
executeInDocker($this->deployment_uuid, "echo '{$base64_build_command}' | base64 -d | tee /artifacts/build.sh > /dev/null"),
|
executeInDocker($this->deployment_uuid, "echo '{$base64_build_command}' | base64 -d | tee /artifacts/build.sh > /dev/null"),
|
||||||
'hidden' => true,
|
'hidden' => true,
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
executeInDocker($this->deployment_uuid, 'cat /artifacts/build.sh'),
|
||||||
|
'hidden' => true,
|
||||||
|
],
|
||||||
[
|
[
|
||||||
executeInDocker($this->deployment_uuid, 'bash /artifacts/build.sh'),
|
executeInDocker($this->deployment_uuid, 'bash /artifacts/build.sh'),
|
||||||
'hidden' => true,
|
'hidden' => true,
|
||||||
@@ -2144,20 +2210,40 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
|
|||||||
$this->application_deployment_queue->addLogEntry('Building docker image completed.');
|
$this->application_deployment_queue->addLogEntry('Building docker image completed.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private function graceful_shutdown_container(string $containerName, int $timeout = 300)
|
||||||
* @param int $timeout in seconds
|
|
||||||
*/
|
|
||||||
private function graceful_shutdown_container(string $containerName, int $timeout = 30)
|
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
$process = Process::timeout($timeout)->start("docker stop --time=$timeout $containerName");
|
||||||
|
|
||||||
|
$startTime = time();
|
||||||
|
while ($process->running()) {
|
||||||
|
if (time() - $startTime >= $timeout) {
|
||||||
$this->execute_remote_command(
|
$this->execute_remote_command(
|
||||||
["docker stop --time=$timeout $containerName", 'hidden' => true, 'ignore_errors' => true],
|
["docker kill $containerName", 'hidden' => true, 'ignore_errors' => true]
|
||||||
["docker rm $containerName", 'hidden' => true, 'ignore_errors' => true]
|
|
||||||
);
|
);
|
||||||
} catch (\Exception $error) {
|
break;
|
||||||
// report error if needed
|
}
|
||||||
|
usleep(100000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$isRunning = $this->execute_remote_command(
|
||||||
|
["docker inspect -f '{{.State.Running}}' $containerName", 'hidden' => true, 'ignore_errors' => true]
|
||||||
|
) === 'true';
|
||||||
|
|
||||||
|
if ($isRunning) {
|
||||||
|
$this->execute_remote_command(
|
||||||
|
["docker kill $containerName", 'hidden' => true, 'ignore_errors' => true]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (\Exception $error) {
|
||||||
|
$this->application_deployment_queue->addLogEntry("Error stopping container $containerName: ".$error->getMessage(), 'stderr');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->remove_container($containerName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function remove_container(string $containerName)
|
||||||
|
{
|
||||||
$this->execute_remote_command(
|
$this->execute_remote_command(
|
||||||
["docker rm -f $containerName", 'hidden' => true, 'ignore_errors' => true]
|
["docker rm -f $containerName", 'hidden' => true, 'ignore_errors' => true]
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Jobs;
|
namespace App\Jobs;
|
||||||
|
|
||||||
use App\Models\InstanceSettings;
|
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldBeEncrypted;
|
use Illuminate\Contracts\Queue\ShouldBeEncrypted;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Illuminate\Support\Facades\Http;
|
|
||||||
use Illuminate\Support\Facades\File;
|
use Illuminate\Support\Facades\File;
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
|
|
||||||
class CheckForUpdatesJob implements ShouldBeEncrypted, ShouldQueue
|
class CheckForUpdatesJob implements ShouldBeEncrypted, ShouldQueue
|
||||||
{
|
{
|
||||||
@@ -22,7 +21,7 @@ class CheckForUpdatesJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
if (isDev() || isCloud()) {
|
if (isDev() || isCloud()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$settings = InstanceSettings::get();
|
$settings = instanceSettings();
|
||||||
$response = Http::retry(3, 1000)->get('https://cdn.coollabs.io/coolify/versions.json');
|
$response = Http::retry(3, 1000)->get('https://cdn.coollabs.io/coolify/versions.json');
|
||||||
if ($response->successful()) {
|
if ($response->successful()) {
|
||||||
$versions = $response->json();
|
$versions = $response->json();
|
||||||
|
|||||||
@@ -21,11 +21,10 @@ class CleanupHelperContainersJob implements ShouldBeEncrypted, ShouldBeUnique, S
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
ray('Cleaning up helper containers on '.$this->server->name);
|
ray('Cleaning up helper containers on '.$this->server->name);
|
||||||
$containers = instant_remote_process(['docker container ps --filter "ancestor=ghcr.io/coollabsio/coolify-helper:next" --filter "ancestor=ghcr.io/coollabsio/coolify-helper:latest" --format \'{{json .}}\''], $this->server, false);
|
$containers = instant_remote_process(['docker container ps --format \'{{json .}}\' | jq -s \'map(select(.Image | contains("ghcr.io/coollabsio/coolify-helper")))\''], $this->server, false);
|
||||||
$containers = format_docker_command_output_to_json($containers);
|
$containerIds = collect(json_decode($containers))->pluck('ID');
|
||||||
if ($containers->count() > 0) {
|
if ($containerIds->count() > 0) {
|
||||||
foreach ($containers as $container) {
|
foreach ($containerIds as $containerId) {
|
||||||
$containerId = data_get($container, 'ID');
|
|
||||||
ray('Removing container '.$containerId);
|
ray('Removing container '.$containerId);
|
||||||
instant_remote_process(['docker container rm -f '.$containerId], $this->server, false);
|
instant_remote_process(['docker container rm -f '.$containerId], $this->server, false);
|
||||||
}
|
}
|
||||||
|
|||||||
82
app/Jobs/CleanupStaleMultiplexedConnections.php
Normal file
82
app/Jobs/CleanupStaleMultiplexedConnections.php
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Jobs;
|
||||||
|
|
||||||
|
use App\Models\Server;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use Illuminate\Support\Facades\Process;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
class CleanupStaleMultiplexedConnections implements ShouldQueue
|
||||||
|
{
|
||||||
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$this->cleanupStaleConnections();
|
||||||
|
$this->cleanupNonExistentServerConnections();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function cleanupStaleConnections()
|
||||||
|
{
|
||||||
|
$muxFiles = Storage::disk('ssh-mux')->files();
|
||||||
|
|
||||||
|
foreach ($muxFiles as $muxFile) {
|
||||||
|
$serverUuid = $this->extractServerUuidFromMuxFile($muxFile);
|
||||||
|
$server = Server::where('uuid', $serverUuid)->first();
|
||||||
|
|
||||||
|
if (! $server) {
|
||||||
|
$this->removeMultiplexFile($muxFile);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$muxSocket = "/var/www/html/storage/app/ssh/mux/{$muxFile}";
|
||||||
|
$checkCommand = "ssh -O check -o ControlPath={$muxSocket} {$server->user}@{$server->ip} 2>/dev/null";
|
||||||
|
$checkProcess = Process::run($checkCommand);
|
||||||
|
|
||||||
|
if ($checkProcess->exitCode() !== 0) {
|
||||||
|
$this->removeMultiplexFile($muxFile);
|
||||||
|
} else {
|
||||||
|
$muxContent = Storage::disk('ssh-mux')->get($muxFile);
|
||||||
|
$establishedAt = Carbon::parse(substr($muxContent, 37));
|
||||||
|
$expirationTime = $establishedAt->addSeconds(config('constants.ssh.mux_persist_time'));
|
||||||
|
|
||||||
|
if (Carbon::now()->isAfter($expirationTime)) {
|
||||||
|
$this->removeMultiplexFile($muxFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function cleanupNonExistentServerConnections()
|
||||||
|
{
|
||||||
|
$muxFiles = Storage::disk('ssh-mux')->files();
|
||||||
|
$existingServerUuids = Server::pluck('uuid')->toArray();
|
||||||
|
|
||||||
|
foreach ($muxFiles as $muxFile) {
|
||||||
|
$serverUuid = $this->extractServerUuidFromMuxFile($muxFile);
|
||||||
|
if (! in_array($serverUuid, $existingServerUuids)) {
|
||||||
|
$this->removeMultiplexFile($muxFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function extractServerUuidFromMuxFile($muxFile)
|
||||||
|
{
|
||||||
|
return substr($muxFile, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function removeMultiplexFile($muxFile)
|
||||||
|
{
|
||||||
|
$muxSocket = "/var/www/html/storage/app/ssh/mux/{$muxFile}";
|
||||||
|
$closeCommand = "ssh -O exit -o ControlPath={$muxSocket} localhost 2>/dev/null";
|
||||||
|
Process::run($closeCommand);
|
||||||
|
Storage::disk('ssh-mux')->delete($muxFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,6 @@ use Illuminate\Contracts\Queue\ShouldBeEncrypted;
|
|||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class ContainerStatusJob implements ShouldBeEncrypted, ShouldQueue
|
class ContainerStatusJob implements ShouldBeEncrypted, ShouldQueue
|
||||||
@@ -25,16 +24,6 @@ class ContainerStatusJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
|
|
||||||
public function __construct(public Server $server) {}
|
public function __construct(public Server $server) {}
|
||||||
|
|
||||||
public function middleware(): array
|
|
||||||
{
|
|
||||||
return [(new WithoutOverlapping($this->server->uuid))];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function uniqueId(): int
|
|
||||||
{
|
|
||||||
return $this->server->uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
GetContainersStatus::run($this->server);
|
GetContainersStatus::run($this->server);
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Jobs;
|
namespace App\Jobs;
|
||||||
|
|
||||||
use App\Actions\Database\StopDatabase;
|
|
||||||
use App\Events\BackupCreated;
|
use App\Events\BackupCreated;
|
||||||
use App\Models\S3Storage;
|
use App\Models\S3Storage;
|
||||||
use App\Models\ScheduledDatabaseBackup;
|
use App\Models\ScheduledDatabaseBackup;
|
||||||
@@ -22,10 +21,8 @@ use Illuminate\Contracts\Queue\ShouldBeEncrypted;
|
|||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use App\Models\InstanceSettings;
|
|
||||||
|
|
||||||
class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
||||||
{
|
{
|
||||||
@@ -64,8 +61,15 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
public function __construct($backup)
|
public function __construct($backup)
|
||||||
{
|
{
|
||||||
$this->backup = $backup;
|
$this->backup = $backup;
|
||||||
$this->team = Team::find($backup->team_id);
|
}
|
||||||
if (is_null($this->team)) {
|
|
||||||
|
public function handle(): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$this->team = Team::find($this->backup->team_id);
|
||||||
|
if (! $this->team) {
|
||||||
|
$this->backup->delete();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (data_get($this->backup, 'database_type') === 'App\Models\ServiceDatabase') {
|
if (data_get($this->backup, 'database_type') === 'App\Models\ServiceDatabase') {
|
||||||
@@ -77,28 +81,11 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
$this->server = $this->database->destination->server;
|
$this->server = $this->database->destination->server;
|
||||||
$this->s3 = $this->backup->s3;
|
$this->s3 = $this->backup->s3;
|
||||||
}
|
}
|
||||||
|
if (is_null($this->server)) {
|
||||||
|
throw new \Exception('Server not found?!');
|
||||||
}
|
}
|
||||||
|
if (is_null($this->database)) {
|
||||||
public function middleware(): array
|
throw new \Exception('Database not found?!');
|
||||||
{
|
|
||||||
return [new WithoutOverlapping($this->backup->id)];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function uniqueId(): int
|
|
||||||
{
|
|
||||||
return $this->backup->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function handle(): void
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
// Check if team is exists
|
|
||||||
if (is_null($this->team)) {
|
|
||||||
$this->backup->update(['status' => 'failed']);
|
|
||||||
StopDatabase::run($this->database);
|
|
||||||
$this->database->delete();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BackupCreated::dispatch($this->team->id);
|
BackupCreated::dispatch($this->team->id);
|
||||||
@@ -249,7 +236,6 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->backup_dir = backup_dir().'/databases/'.str($this->team->name)->slug().'-'.$this->team->id.'/'.$this->directory_name;
|
$this->backup_dir = backup_dir().'/databases/'.str($this->team->name)->slug().'-'.$this->team->id.'/'.$this->directory_name;
|
||||||
|
|
||||||
if ($this->database->name === 'coolify-db') {
|
if ($this->database->name === 'coolify-db') {
|
||||||
$databasesToBackup = ['coolify'];
|
$databasesToBackup = ['coolify'];
|
||||||
$this->directory_name = $this->container_name = 'coolify-db';
|
$this->directory_name = $this->container_name = 'coolify-db';
|
||||||
@@ -262,6 +248,9 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
try {
|
try {
|
||||||
if (str($databaseType)->contains('postgres')) {
|
if (str($databaseType)->contains('postgres')) {
|
||||||
$this->backup_file = "/pg-dump-$database-".Carbon::now()->timestamp.'.dmp';
|
$this->backup_file = "/pg-dump-$database-".Carbon::now()->timestamp.'.dmp';
|
||||||
|
if ($this->backup->dump_all) {
|
||||||
|
$this->backup_file = '/pg-dump-all-'.Carbon::now()->timestamp.'.gz';
|
||||||
|
}
|
||||||
$this->backup_location = $this->backup_dir.$this->backup_file;
|
$this->backup_location = $this->backup_dir.$this->backup_file;
|
||||||
$this->backup_log = ScheduledDatabaseBackupExecution::create([
|
$this->backup_log = ScheduledDatabaseBackupExecution::create([
|
||||||
'database_name' => $database,
|
'database_name' => $database,
|
||||||
@@ -290,6 +279,9 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
$this->backup_standalone_mongodb($database);
|
$this->backup_standalone_mongodb($database);
|
||||||
} elseif (str($databaseType)->contains('mysql')) {
|
} elseif (str($databaseType)->contains('mysql')) {
|
||||||
$this->backup_file = "/mysql-dump-$database-".Carbon::now()->timestamp.'.dmp';
|
$this->backup_file = "/mysql-dump-$database-".Carbon::now()->timestamp.'.dmp';
|
||||||
|
if ($this->backup->dump_all) {
|
||||||
|
$this->backup_file = '/mysql-dump-all-'.Carbon::now()->timestamp.'.gz';
|
||||||
|
}
|
||||||
$this->backup_location = $this->backup_dir.$this->backup_file;
|
$this->backup_location = $this->backup_dir.$this->backup_file;
|
||||||
$this->backup_log = ScheduledDatabaseBackupExecution::create([
|
$this->backup_log = ScheduledDatabaseBackupExecution::create([
|
||||||
'database_name' => $database,
|
'database_name' => $database,
|
||||||
@@ -299,6 +291,9 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
$this->backup_standalone_mysql($database);
|
$this->backup_standalone_mysql($database);
|
||||||
} elseif (str($databaseType)->contains('mariadb')) {
|
} elseif (str($databaseType)->contains('mariadb')) {
|
||||||
$this->backup_file = "/mariadb-dump-$database-".Carbon::now()->timestamp.'.dmp';
|
$this->backup_file = "/mariadb-dump-$database-".Carbon::now()->timestamp.'.dmp';
|
||||||
|
if ($this->backup->dump_all) {
|
||||||
|
$this->backup_file = '/mariadb-dump-all-'.Carbon::now()->timestamp.'.gz';
|
||||||
|
}
|
||||||
$this->backup_location = $this->backup_dir.$this->backup_file;
|
$this->backup_location = $this->backup_dir.$this->backup_file;
|
||||||
$this->backup_log = ScheduledDatabaseBackupExecution::create([
|
$this->backup_log = ScheduledDatabaseBackupExecution::create([
|
||||||
'database_name' => $database,
|
'database_name' => $database,
|
||||||
@@ -337,9 +332,11 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
send_internal_notification('DatabaseBackupJob failed with: '.$e->getMessage());
|
send_internal_notification('DatabaseBackupJob failed with: '.$e->getMessage());
|
||||||
throw $e;
|
throw $e;
|
||||||
} finally {
|
} finally {
|
||||||
|
if ($this->team) {
|
||||||
BackupCreated::dispatch($this->team->id);
|
BackupCreated::dispatch($this->team->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private function backup_standalone_mongodb(string $databaseWithCollections): void
|
private function backup_standalone_mongodb(string $databaseWithCollections): void
|
||||||
{
|
{
|
||||||
@@ -396,9 +393,14 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
if ($this->postgres_password) {
|
if ($this->postgres_password) {
|
||||||
$backupCommand .= " -e PGPASSWORD=$this->postgres_password";
|
$backupCommand .= " -e PGPASSWORD=$this->postgres_password";
|
||||||
}
|
}
|
||||||
|
if ($this->backup->dump_all) {
|
||||||
|
$backupCommand .= " $this->container_name pg_dumpall --username {$this->database->postgres_user} | gzip > $this->backup_location";
|
||||||
|
} else {
|
||||||
$backupCommand .= " $this->container_name pg_dump --format=custom --no-acl --no-owner --username {$this->database->postgres_user} $database > $this->backup_location";
|
$backupCommand .= " $this->container_name pg_dump --format=custom --no-acl --no-owner --username {$this->database->postgres_user} $database > $this->backup_location";
|
||||||
|
}
|
||||||
|
|
||||||
$commands[] = $backupCommand;
|
$commands[] = $backupCommand;
|
||||||
|
ray($commands);
|
||||||
$this->backup_output = instant_remote_process($commands, $this->server);
|
$this->backup_output = instant_remote_process($commands, $this->server);
|
||||||
$this->backup_output = trim($this->backup_output);
|
$this->backup_output = trim($this->backup_output);
|
||||||
if ($this->backup_output === '') {
|
if ($this->backup_output === '') {
|
||||||
@@ -416,8 +418,11 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$commands[] = 'mkdir -p '.$this->backup_dir;
|
$commands[] = 'mkdir -p '.$this->backup_dir;
|
||||||
|
if ($this->backup->dump_all) {
|
||||||
|
$commands[] = "docker exec $this->container_name mysqldump -u root -p{$this->database->mysql_root_password} --all-databases --single-transaction --quick --lock-tables=false --compress | gzip > $this->backup_location";
|
||||||
|
} else {
|
||||||
$commands[] = "docker exec $this->container_name mysqldump -u root -p{$this->database->mysql_root_password} $database > $this->backup_location";
|
$commands[] = "docker exec $this->container_name mysqldump -u root -p{$this->database->mysql_root_password} $database > $this->backup_location";
|
||||||
ray($commands);
|
}
|
||||||
$this->backup_output = instant_remote_process($commands, $this->server);
|
$this->backup_output = instant_remote_process($commands, $this->server);
|
||||||
$this->backup_output = trim($this->backup_output);
|
$this->backup_output = trim($this->backup_output);
|
||||||
if ($this->backup_output === '') {
|
if ($this->backup_output === '') {
|
||||||
@@ -435,7 +440,11 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$commands[] = 'mkdir -p '.$this->backup_dir;
|
$commands[] = 'mkdir -p '.$this->backup_dir;
|
||||||
|
if ($this->backup->dump_all) {
|
||||||
|
$commands[] = "docker exec $this->container_name mariadb-dump -u root -p{$this->database->mariadb_root_password} --all-databases --single-transaction --quick --lock-tables=false --compress > $this->backup_location";
|
||||||
|
} else {
|
||||||
$commands[] = "docker exec $this->container_name mariadb-dump -u root -p{$this->database->mariadb_root_password} $database > $this->backup_location";
|
$commands[] = "docker exec $this->container_name mariadb-dump -u root -p{$this->database->mariadb_root_password} $database > $this->backup_location";
|
||||||
|
}
|
||||||
ray($commands);
|
ray($commands);
|
||||||
$this->backup_output = instant_remote_process($commands, $this->server);
|
$this->backup_output = instant_remote_process($commands, $this->server);
|
||||||
$this->backup_output = trim($this->backup_output);
|
$this->backup_output = trim($this->backup_output);
|
||||||
@@ -498,10 +507,27 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
$this->ensureHelperImageAvailable();
|
$this->ensureHelperImageAvailable();
|
||||||
|
|
||||||
$fullImageName = $this->getFullImageName();
|
$fullImageName = $this->getFullImageName();
|
||||||
|
|
||||||
|
if (isDev()) {
|
||||||
|
if ($this->database->name === 'coolify-db') {
|
||||||
|
$backup_location_from = '/var/lib/docker/volumes/coolify_dev_backups_data/_data/coolify/coolify-db-'.$this->server->ip.$this->backup_file;
|
||||||
|
$commands[] = "docker run -d --network {$network} --name backup-of-{$this->backup->uuid} --rm -v $backup_location_from:$this->backup_location:ro {$fullImageName}";
|
||||||
|
} else {
|
||||||
|
$backup_location_from = '/var/lib/docker/volumes/coolify_dev_backups_data/_data/databases/'.str($this->team->name)->slug().'-'.$this->team->id.'/'.$this->directory_name.$this->backup_file;
|
||||||
|
$commands[] = "docker run -d --network {$network} --name backup-of-{$this->backup->uuid} --rm -v $backup_location_from:$this->backup_location:ro {$fullImageName}";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
$commands[] = "docker run -d --network {$network} --name backup-of-{$this->backup->uuid} --rm -v $this->backup_location:$this->backup_location:ro {$fullImageName}";
|
$commands[] = "docker run -d --network {$network} --name backup-of-{$this->backup->uuid} --rm -v $this->backup_location:$this->backup_location:ro {$fullImageName}";
|
||||||
|
}
|
||||||
|
if ($this->s3->isHetzner()) {
|
||||||
|
$endpointWithoutBucket = 'https://'.str($endpoint)->after('https://')->after('.')->value();
|
||||||
|
$commands[] = "docker exec backup-of-{$this->backup->uuid} mc alias set --path=off --api=S3v4 temporary {$endpointWithoutBucket} $key $secret";
|
||||||
|
} else {
|
||||||
$commands[] = "docker exec backup-of-{$this->backup->uuid} mc config host add temporary {$endpoint} $key $secret";
|
$commands[] = "docker exec backup-of-{$this->backup->uuid} mc config host add temporary {$endpoint} $key $secret";
|
||||||
|
}
|
||||||
$commands[] = "docker exec backup-of-{$this->backup->uuid} mc cp $this->backup_location temporary/$bucket{$this->backup_dir}/";
|
$commands[] = "docker exec backup-of-{$this->backup->uuid} mc cp $this->backup_location temporary/$bucket{$this->backup_dir}/";
|
||||||
instant_remote_process($commands, $this->server);
|
instant_remote_process($commands, $this->server);
|
||||||
|
|
||||||
$this->add_to_backup_output('Uploaded to S3.');
|
$this->add_to_backup_output('Uploaded to S3.');
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
$this->add_to_backup_output($e->getMessage());
|
$this->add_to_backup_output($e->getMessage());
|
||||||
@@ -526,6 +552,7 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
private function checkImageExists(string $fullImageName): bool
|
private function checkImageExists(string $fullImageName): bool
|
||||||
{
|
{
|
||||||
$result = instant_remote_process(["docker image inspect {$fullImageName} >/dev/null 2>&1 && echo 'exists' || echo 'not exists'"], $this->server, false);
|
$result = instant_remote_process(["docker image inspect {$fullImageName} >/dev/null 2>&1 && echo 'exists' || echo 'not exists'"], $this->server, false);
|
||||||
|
|
||||||
return trim($result) === 'exists';
|
return trim($result) === 'exists';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -534,7 +561,7 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
try {
|
try {
|
||||||
instant_remote_process(["docker pull {$fullImageName}"], $this->server);
|
instant_remote_process(["docker pull {$fullImageName}"], $this->server);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$errorMessage = "Failed to pull helper image: " . $e->getMessage();
|
$errorMessage = 'Failed to pull helper image: '.$e->getMessage();
|
||||||
$this->add_to_backup_output($errorMessage);
|
$this->add_to_backup_output($errorMessage);
|
||||||
throw new \RuntimeException($errorMessage);
|
throw new \RuntimeException($errorMessage);
|
||||||
}
|
}
|
||||||
@@ -542,9 +569,10 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
|
|
||||||
private function getFullImageName(): string
|
private function getFullImageName(): string
|
||||||
{
|
{
|
||||||
$settings = InstanceSettings::get();
|
$settings = instanceSettings();
|
||||||
$helperImage = config('coolify.helper_image');
|
$helperImage = config('coolify.helper_image');
|
||||||
$latestVersion = $settings->helper_version;
|
$latestVersion = $settings->helper_version;
|
||||||
|
|
||||||
return "{$helperImage}:{$latestVersion}";
|
return "{$helperImage}:{$latestVersion}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,62 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Jobs;
|
|
||||||
|
|
||||||
use App\Models\ScheduledDatabaseBackup;
|
|
||||||
use App\Models\Team;
|
|
||||||
use App\Notifications\Database\DailyBackup;
|
|
||||||
use Illuminate\Bus\Queueable;
|
|
||||||
use Illuminate\Contracts\Queue\ShouldBeEncrypted;
|
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
|
||||||
|
|
||||||
class DatabaseBackupStatusJob implements ShouldBeEncrypted, ShouldQueue
|
|
||||||
{
|
|
||||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
||||||
|
|
||||||
public $tries = 1;
|
|
||||||
|
|
||||||
public function __construct() {}
|
|
||||||
|
|
||||||
public function handle()
|
|
||||||
{
|
|
||||||
// $teams = Team::all();
|
|
||||||
// foreach ($teams as $team) {
|
|
||||||
// $scheduled_backups = $team->scheduledDatabaseBackups()->get();
|
|
||||||
// if ($scheduled_backups->isEmpty()) {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// foreach ($scheduled_backups as $scheduled_backup) {
|
|
||||||
// $last_days_backups = $scheduled_backup->get_last_days_backup_status();
|
|
||||||
// if ($last_days_backups->isEmpty()) {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// $failed = $last_days_backups->where('status', 'failed');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// $scheduled_backups = ScheduledDatabaseBackup::all();
|
|
||||||
// $databases = collect();
|
|
||||||
// $teams = collect();
|
|
||||||
// foreach ($scheduled_backups as $scheduled_backup) {
|
|
||||||
// $last_days_backups = $scheduled_backup->get_last_days_backup_status();
|
|
||||||
// if ($last_days_backups->isEmpty()) {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// $failed = $last_days_backups->where('status', 'failed');
|
|
||||||
// $database = $scheduled_backup->database;
|
|
||||||
// $team = $database->team();
|
|
||||||
// $teams->put($team->id, $team);
|
|
||||||
// $databases->put("{$team->id}:{$database->name}", [
|
|
||||||
// 'failed_count' => $failed->count(),
|
|
||||||
// ]);
|
|
||||||
// }
|
|
||||||
// foreach ($databases as $name => $database) {
|
|
||||||
// [$team_id, $name] = explode(':', $name);
|
|
||||||
// $team = $teams->get($team_id);
|
|
||||||
// $team?->notify(new DailyBackup($databases));
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,6 +4,7 @@ namespace App\Jobs;
|
|||||||
|
|
||||||
use App\Actions\Application\StopApplication;
|
use App\Actions\Application\StopApplication;
|
||||||
use App\Actions\Database\StopDatabase;
|
use App\Actions\Database\StopDatabase;
|
||||||
|
use App\Actions\Server\CleanupDocker;
|
||||||
use App\Actions\Service\DeleteService;
|
use App\Actions\Service\DeleteService;
|
||||||
use App\Actions\Service\StopService;
|
use App\Actions\Service\StopService;
|
||||||
use App\Models\Application;
|
use App\Models\Application;
|
||||||
@@ -30,8 +31,11 @@ class DeleteResourceJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public Application|Service|StandalonePostgresql|StandaloneRedis|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse $resource,
|
public Application|Service|StandalonePostgresql|StandaloneRedis|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse $resource,
|
||||||
public bool $deleteConfigurations = false,
|
public bool $deleteConfigurations = true,
|
||||||
public bool $deleteVolumes = false) {}
|
public bool $deleteVolumes = true,
|
||||||
|
public bool $dockerCleanup = true,
|
||||||
|
public bool $deleteConnectedNetworks = true
|
||||||
|
) {}
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
@@ -51,11 +55,11 @@ class DeleteResourceJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
case 'standalone-dragonfly':
|
case 'standalone-dragonfly':
|
||||||
case 'standalone-clickhouse':
|
case 'standalone-clickhouse':
|
||||||
$persistentStorages = $this->resource?->persistentStorages()?->get();
|
$persistentStorages = $this->resource?->persistentStorages()?->get();
|
||||||
StopDatabase::run($this->resource);
|
StopDatabase::run($this->resource, true);
|
||||||
break;
|
break;
|
||||||
case 'service':
|
case 'service':
|
||||||
StopService::run($this->resource);
|
StopService::run($this->resource, true);
|
||||||
DeleteService::run($this->resource);
|
DeleteService::run($this->resource, $this->deleteConfigurations, $this->deleteVolumes, $this->dockerCleanup, $this->deleteConnectedNetworks);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,12 +69,31 @@ class DeleteResourceJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
if ($this->deleteConfigurations) {
|
if ($this->deleteConfigurations) {
|
||||||
$this->resource?->delete_configurations();
|
$this->resource?->delete_configurations();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$isDatabase = $this->resource instanceof StandalonePostgresql
|
||||||
|
|| $this->resource instanceof StandaloneRedis
|
||||||
|
|| $this->resource instanceof StandaloneMongodb
|
||||||
|
|| $this->resource instanceof StandaloneMysql
|
||||||
|
|| $this->resource instanceof StandaloneMariadb
|
||||||
|
|| $this->resource instanceof StandaloneKeydb
|
||||||
|
|| $this->resource instanceof StandaloneDragonfly
|
||||||
|
|| $this->resource instanceof StandaloneClickhouse;
|
||||||
|
$server = data_get($this->resource, 'server') ?? data_get($this->resource, 'destination.server');
|
||||||
|
if (($this->dockerCleanup || $isDatabase) && $server) {
|
||||||
|
CleanupDocker::dispatch($server, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->deleteConnectedNetworks && ! $isDatabase) {
|
||||||
|
$this->resource?->delete_connected_networks($this->resource->uuid);
|
||||||
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
ray($e->getMessage());
|
|
||||||
send_internal_notification('ContainerStoppingJob failed with: '.$e->getMessage());
|
send_internal_notification('ContainerStoppingJob failed with: '.$e->getMessage());
|
||||||
throw $e;
|
throw $e;
|
||||||
} finally {
|
} finally {
|
||||||
$this->resource->forceDelete();
|
$this->resource->forceDelete();
|
||||||
|
if ($this->dockerCleanup) {
|
||||||
|
CleanupDocker::dispatch($server, true);
|
||||||
|
}
|
||||||
Artisan::queue('cleanup:stucked-resources');
|
Artisan::queue('cleanup:stucked-resources');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ use Illuminate\Contracts\Queue\ShouldBeEncrypted;
|
|||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
@@ -24,17 +23,7 @@ class DockerCleanupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
|
|
||||||
public ?string $usageBefore = null;
|
public ?string $usageBefore = null;
|
||||||
|
|
||||||
public function __construct(public Server $server) {}
|
public function __construct(public Server $server, public bool $manualCleanup = false) {}
|
||||||
|
|
||||||
public function middleware(): array
|
|
||||||
{
|
|
||||||
return [new WithoutOverlapping($this->server->id)];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function uniqueId(): int
|
|
||||||
{
|
|
||||||
return $this->server->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
@@ -42,8 +31,9 @@ class DockerCleanupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
if (! $this->server->isFunctional()) {
|
if (! $this->server->isFunctional()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($this->server->settings->force_docker_cleanup) {
|
|
||||||
Log::info('DockerCleanupJob force cleanup on '.$this->server->name);
|
if ($this->manualCleanup || $this->server->settings->force_docker_cleanup) {
|
||||||
|
Log::info('DockerCleanupJob '.($this->manualCleanup ? 'manual' : 'force').' cleanup on '.$this->server->name);
|
||||||
CleanupDocker::run(server: $this->server);
|
CleanupDocker::run(server: $this->server);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ use Illuminate\Contracts\Queue\ShouldBeEncrypted;
|
|||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
|
|
||||||
@@ -25,16 +24,6 @@ class GithubAppPermissionJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
|
|
||||||
public function __construct(public GithubApp $github_app) {}
|
public function __construct(public GithubApp $github_app) {}
|
||||||
|
|
||||||
public function middleware(): array
|
|
||||||
{
|
|
||||||
return [(new WithoutOverlapping($this->github_app->uuid))];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function uniqueId(): int
|
|
||||||
{
|
|
||||||
return $this->github_app->uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -2,14 +2,12 @@
|
|||||||
|
|
||||||
namespace App\Jobs;
|
namespace App\Jobs;
|
||||||
|
|
||||||
use App\Models\InstanceSettings;
|
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldBeEncrypted;
|
use Illuminate\Contracts\Queue\ShouldBeEncrypted;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
|
|
||||||
@@ -19,17 +17,7 @@ class PullHelperImageJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
|
|
||||||
public $timeout = 1000;
|
public $timeout = 1000;
|
||||||
|
|
||||||
public function middleware(): array
|
public function __construct() {}
|
||||||
{
|
|
||||||
return [(new WithoutOverlapping($this->server->uuid))];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function uniqueId(): string
|
|
||||||
{
|
|
||||||
return $this->server->uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __construct(public Server $server) {}
|
|
||||||
|
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
@@ -37,13 +25,13 @@ class PullHelperImageJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
$response = Http::retry(3, 1000)->get('https://cdn.coollabs.io/coolify/versions.json');
|
$response = Http::retry(3, 1000)->get('https://cdn.coollabs.io/coolify/versions.json');
|
||||||
if ($response->successful()) {
|
if ($response->successful()) {
|
||||||
$versions = $response->json();
|
$versions = $response->json();
|
||||||
$settings = InstanceSettings::get();
|
$settings = instanceSettings();
|
||||||
$latest_version = data_get($versions, 'coolify.helper.version');
|
$latest_version = data_get($versions, 'coolify.helper.version');
|
||||||
$current_version = $settings->helper_version;
|
$current_version = $settings->helper_version;
|
||||||
if (version_compare($latest_version, $current_version, '>')) {
|
if (version_compare($latest_version, $current_version, '>')) {
|
||||||
// New version available
|
// New version available
|
||||||
$helperImage = config('coolify.helper_image');
|
// $helperImage = config('coolify.helper_image');
|
||||||
instant_remote_process(["docker pull -q {$helperImage}:{$latest_version}"], $this->server);
|
// instant_remote_process(["docker pull -q {$helperImage}:{$latest_version}"], $this->server);
|
||||||
$settings->update(['helper_version' => $latest_version]);
|
$settings->update(['helper_version' => $latest_version]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ use Illuminate\Contracts\Queue\ShouldBeEncrypted;
|
|||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class PullSentinelImageJob implements ShouldBeEncrypted, ShouldQueue
|
class PullSentinelImageJob implements ShouldBeEncrypted, ShouldQueue
|
||||||
@@ -18,16 +17,6 @@ class PullSentinelImageJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
|
|
||||||
public $timeout = 1000;
|
public $timeout = 1000;
|
||||||
|
|
||||||
public function middleware(): array
|
|
||||||
{
|
|
||||||
return [(new WithoutOverlapping($this->server->uuid))];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function uniqueId(): string
|
|
||||||
{
|
|
||||||
return $this->server->uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __construct(public Server $server) {}
|
public function __construct(public Server $server) {}
|
||||||
|
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ use Illuminate\Bus\Queueable;
|
|||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class ScheduledTaskJob implements ShouldQueue
|
class ScheduledTaskJob implements ShouldQueue
|
||||||
@@ -56,24 +55,17 @@ class ScheduledTaskJob implements ShouldQueue
|
|||||||
{
|
{
|
||||||
if ($this->resource instanceof Application) {
|
if ($this->resource instanceof Application) {
|
||||||
$timezone = $this->resource->destination->server->settings->server_timezone;
|
$timezone = $this->resource->destination->server->settings->server_timezone;
|
||||||
|
|
||||||
return $timezone;
|
return $timezone;
|
||||||
} elseif ($this->resource instanceof Service) {
|
} elseif ($this->resource instanceof Service) {
|
||||||
$timezone = $this->resource->server->settings->server_timezone;
|
$timezone = $this->resource->server->settings->server_timezone;
|
||||||
|
|
||||||
return $timezone;
|
return $timezone;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'UTC';
|
return 'UTC';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function middleware(): array
|
|
||||||
{
|
|
||||||
return [new WithoutOverlapping($this->task->id)];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function uniqueId(): int
|
|
||||||
{
|
|
||||||
return $this->task->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ use Illuminate\Contracts\Queue\ShouldBeEncrypted;
|
|||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
@@ -24,7 +23,9 @@ class ServerCheckJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
{
|
{
|
||||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||||
|
|
||||||
public $tries = 3;
|
public $tries = 1;
|
||||||
|
|
||||||
|
public $timeout = 60;
|
||||||
|
|
||||||
public $containers;
|
public $containers;
|
||||||
|
|
||||||
@@ -43,16 +44,6 @@ class ServerCheckJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
|
|
||||||
public function __construct(public Server $server) {}
|
public function __construct(public Server $server) {}
|
||||||
|
|
||||||
// public function middleware(): array
|
|
||||||
// {
|
|
||||||
// return [(new WithoutOverlapping($this->server->uuid))];
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public function uniqueId(): int
|
|
||||||
// {
|
|
||||||
// return $this->server->uuid;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -78,8 +69,10 @@ class ServerCheckJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
return 'No containers found.';
|
return 'No containers found.';
|
||||||
}
|
}
|
||||||
GetContainersStatus::run($this->server, $this->containers, $containerReplicates);
|
GetContainersStatus::run($this->server, $this->containers, $containerReplicates);
|
||||||
|
if ($this->server->isLogDrainEnabled()) {
|
||||||
$this->checkLogDrainContainer();
|
$this->checkLogDrainContainer();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
ray($e->getMessage());
|
ray($e->getMessage());
|
||||||
@@ -91,7 +84,7 @@ class ServerCheckJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
|
|
||||||
private function serverStatus()
|
private function serverStatus()
|
||||||
{
|
{
|
||||||
['uptime' => $uptime] = $this->server->validateConnection();
|
['uptime' => $uptime] = $this->server->validateConnection(false);
|
||||||
if ($uptime) {
|
if ($uptime) {
|
||||||
if ($this->server->unreachable_notification_sent === true) {
|
if ($this->server->unreachable_notification_sent === true) {
|
||||||
$this->server->update(['unreachable_notification_sent' => false]);
|
$this->server->update(['unreachable_notification_sent' => false]);
|
||||||
@@ -124,9 +117,6 @@ class ServerCheckJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
|
|
||||||
private function checkLogDrainContainer()
|
private function checkLogDrainContainer()
|
||||||
{
|
{
|
||||||
if(! $this->server->isLogDrainEnabled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$foundLogDrainContainer = $this->containers->filter(function ($value, $key) {
|
$foundLogDrainContainer = $this->containers->filter(function ($value, $key) {
|
||||||
return data_get($value, 'Name') === '/coolify-log-drain';
|
return data_get($value, 'Name') === '/coolify-log-drain';
|
||||||
})->first();
|
})->first();
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ use Illuminate\Contracts\Queue\ShouldBeEncrypted;
|
|||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class ServerLimitCheckJob implements ShouldBeEncrypted, ShouldQueue
|
class ServerLimitCheckJob implements ShouldBeEncrypted, ShouldQueue
|
||||||
@@ -26,16 +25,6 @@ class ServerLimitCheckJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
|
|
||||||
public function __construct(public Team $team) {}
|
public function __construct(public Team $team) {}
|
||||||
|
|
||||||
public function middleware(): array
|
|
||||||
{
|
|
||||||
return [(new WithoutOverlapping($this->team->uuid))];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function uniqueId(): int
|
|
||||||
{
|
|
||||||
return $this->team->uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ use Illuminate\Contracts\Queue\ShouldBeEncrypted;
|
|||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class ServerStatusJob implements ShouldBeEncrypted, ShouldQueue
|
class ServerStatusJob implements ShouldBeEncrypted, ShouldQueue
|
||||||
@@ -26,16 +25,6 @@ class ServerStatusJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
|
|
||||||
public function __construct(public Server $server) {}
|
public function __construct(public Server $server) {}
|
||||||
|
|
||||||
public function middleware(): array
|
|
||||||
{
|
|
||||||
return [(new WithoutOverlapping($this->server->uuid))];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function uniqueId(): int
|
|
||||||
{
|
|
||||||
return $this->server->uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
if (! $this->server->isServerReady($this->tries)) {
|
if (! $this->server->isServerReady($this->tries)) {
|
||||||
|
|||||||
59
app/Jobs/ServerStorageCheckJob.php
Normal file
59
app/Jobs/ServerStorageCheckJob.php
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Jobs;
|
||||||
|
|
||||||
|
use App\Models\Server;
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldBeEncrypted;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class ServerStorageCheckJob implements ShouldBeEncrypted, ShouldQueue
|
||||||
|
{
|
||||||
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public $tries = 1;
|
||||||
|
|
||||||
|
public $timeout = 60;
|
||||||
|
|
||||||
|
public $containers;
|
||||||
|
|
||||||
|
public $applications;
|
||||||
|
|
||||||
|
public $databases;
|
||||||
|
|
||||||
|
public $services;
|
||||||
|
|
||||||
|
public $previews;
|
||||||
|
|
||||||
|
public function backoff(): int
|
||||||
|
{
|
||||||
|
return isDev() ? 1 : 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __construct(public Server $server) {}
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if (! $this->server->isFunctional()) {
|
||||||
|
ray('Server is not ready.');
|
||||||
|
|
||||||
|
return 'Server is not ready.';
|
||||||
|
}
|
||||||
|
$team = $this->server->team;
|
||||||
|
$percentage = $this->server->storageCheck();
|
||||||
|
if ($percentage > 1) {
|
||||||
|
ray('Server storage is at '.$percentage.'%');
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
ray($e->getMessage());
|
||||||
|
|
||||||
|
return handleError($e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace App\Jobs;
|
namespace App\Jobs;
|
||||||
|
|
||||||
use App\Actions\Server\UpdateCoolify;
|
use App\Actions\Server\UpdateCoolify;
|
||||||
use App\Models\InstanceSettings;
|
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldBeEncrypted;
|
use Illuminate\Contracts\Queue\ShouldBeEncrypted;
|
||||||
@@ -23,7 +22,7 @@ class UpdateCoolifyJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
CheckForUpdatesJob::dispatchSync();
|
CheckForUpdatesJob::dispatchSync();
|
||||||
$settings = InstanceSettings::get();
|
$settings = instanceSettings();
|
||||||
if (! $settings->new_version_available) {
|
if (! $settings->new_version_available) {
|
||||||
Log::info('No new version available. Skipping update.');
|
Log::info('No new version available. Skipping update.');
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ class Index extends Component
|
|||||||
}
|
}
|
||||||
$this->privateKeyName = generate_random_name();
|
$this->privateKeyName = generate_random_name();
|
||||||
$this->remoteServerName = generate_random_name();
|
$this->remoteServerName = generate_random_name();
|
||||||
|
$this->remoteServerPort = $this->remoteServerPort;
|
||||||
|
$this->remoteServerUser = $this->remoteServerUser;
|
||||||
if (isDev()) {
|
if (isDev()) {
|
||||||
$this->privateKey = '-----BEGIN OPENSSH PRIVATE KEY-----
|
$this->privateKey = '-----BEGIN OPENSSH PRIVATE KEY-----
|
||||||
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
|
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
|
||||||
@@ -139,7 +141,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
|
|||||||
if (! $this->createdServer) {
|
if (! $this->createdServer) {
|
||||||
return $this->dispatch('error', 'Localhost server is not found. Something went wrong during installation. Please try to reinstall or contact support.');
|
return $this->dispatch('error', 'Localhost server is not found. Something went wrong during installation. Please try to reinstall or contact support.');
|
||||||
}
|
}
|
||||||
$this->serverPublicKey = $this->createdServer->privateKey->publicKey();
|
$this->serverPublicKey = $this->createdServer->privateKey->getPublicKey();
|
||||||
|
|
||||||
return $this->validateServer('localhost');
|
return $this->validateServer('localhost');
|
||||||
} elseif ($this->selectedServerType === 'remote') {
|
} elseif ($this->selectedServerType === 'remote') {
|
||||||
@@ -154,6 +156,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
|
|||||||
$this->servers = Server::ownedByCurrentTeam(['name'])->where('id', '!=', 0)->get();
|
$this->servers = Server::ownedByCurrentTeam(['name'])->where('id', '!=', 0)->get();
|
||||||
if ($this->servers->count() > 0) {
|
if ($this->servers->count() > 0) {
|
||||||
$this->selectedExistingServer = $this->servers->first()->id;
|
$this->selectedExistingServer = $this->servers->first()->id;
|
||||||
|
$this->updateServerDetails();
|
||||||
$this->currentState = 'select-existing-server';
|
$this->currentState = 'select-existing-server';
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -172,10 +175,19 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->selectedExistingPrivateKey = $this->createdServer->privateKey->id;
|
$this->selectedExistingPrivateKey = $this->createdServer->privateKey->id;
|
||||||
$this->serverPublicKey = $this->createdServer->privateKey->publicKey();
|
$this->serverPublicKey = $this->createdServer->privateKey->getPublicKey();
|
||||||
|
$this->updateServerDetails();
|
||||||
$this->currentState = 'validate-server';
|
$this->currentState = 'validate-server';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function updateServerDetails()
|
||||||
|
{
|
||||||
|
if ($this->createdServer) {
|
||||||
|
$this->remoteServerPort = $this->createdServer->port;
|
||||||
|
$this->remoteServerUser = $this->createdServer->user;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function getProxyType()
|
public function getProxyType()
|
||||||
{
|
{
|
||||||
// Set Default Proxy Type
|
// Set Default Proxy Type
|
||||||
@@ -219,27 +231,35 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
|
|||||||
public function savePrivateKey()
|
public function savePrivateKey()
|
||||||
{
|
{
|
||||||
$this->validate([
|
$this->validate([
|
||||||
'privateKeyName' => 'required',
|
'privateKeyName' => 'required|string|max:255',
|
||||||
'privateKey' => 'required',
|
'privateKeyDescription' => 'nullable|string|max:255',
|
||||||
|
'privateKey' => 'required|string',
|
||||||
]);
|
]);
|
||||||
$this->createdPrivateKey = PrivateKey::create([
|
|
||||||
|
try {
|
||||||
|
$privateKey = PrivateKey::createAndStore([
|
||||||
'name' => $this->privateKeyName,
|
'name' => $this->privateKeyName,
|
||||||
'description' => $this->privateKeyDescription,
|
'description' => $this->privateKeyDescription,
|
||||||
'private_key' => $this->privateKey,
|
'private_key' => $this->privateKey,
|
||||||
'team_id' => currentTeam()->id,
|
'team_id' => currentTeam()->id,
|
||||||
]);
|
]);
|
||||||
$this->createdPrivateKey->save();
|
|
||||||
|
$this->createdPrivateKey = $privateKey;
|
||||||
$this->currentState = 'create-server';
|
$this->currentState = 'create-server';
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$this->addError('privateKey', 'Failed to save private key: '.$e->getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function saveServer()
|
public function saveServer()
|
||||||
{
|
{
|
||||||
$this->validate([
|
$this->validate([
|
||||||
'remoteServerName' => 'required',
|
'remoteServerName' => 'required|string',
|
||||||
'remoteServerHost' => 'required',
|
'remoteServerHost' => 'required|string',
|
||||||
'remoteServerPort' => 'required|integer',
|
'remoteServerPort' => 'required|integer',
|
||||||
'remoteServerUser' => 'required',
|
'remoteServerUser' => 'required|string',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->privateKey = formatPrivateKey($this->privateKey);
|
$this->privateKey = formatPrivateKey($this->privateKey);
|
||||||
$foundServer = Server::whereIp($this->remoteServerHost)->first();
|
$foundServer = Server::whereIp($this->remoteServerHost)->first();
|
||||||
if ($foundServer) {
|
if ($foundServer) {
|
||||||
@@ -269,7 +289,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
|
|||||||
public function validateServer()
|
public function validateServer()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
config()->set('coolify.mux_enabled', false);
|
config()->set('constants.ssh.mux_enabled', false);
|
||||||
|
|
||||||
// EC2 does not have `uptime` command, lol
|
// EC2 does not have `uptime` command, lol
|
||||||
instant_remote_process(['ls /'], $this->createdServer, true);
|
instant_remote_process(['ls /'], $this->createdServer, true);
|
||||||
@@ -277,9 +297,12 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
|
|||||||
$this->createdServer->settings()->update([
|
$this->createdServer->settings()->update([
|
||||||
'is_reachable' => true,
|
'is_reachable' => true,
|
||||||
]);
|
]);
|
||||||
|
$this->serverReachable = true;
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
$this->serverReachable = false;
|
$this->serverReachable = false;
|
||||||
$this->createdServer->delete();
|
$this->createdServer->settings()->update([
|
||||||
|
'is_reachable' => false,
|
||||||
|
]);
|
||||||
|
|
||||||
return handleError(error: $e, livewire: $this);
|
return handleError(error: $e, livewire: $this);
|
||||||
}
|
}
|
||||||
@@ -296,6 +319,10 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
|
|||||||
]);
|
]);
|
||||||
$this->getProxyType();
|
$this->getProxyType();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
|
$this->createdServer->settings()->update([
|
||||||
|
'is_usable' => false,
|
||||||
|
]);
|
||||||
|
|
||||||
return handleError(error: $e, livewire: $this);
|
return handleError(error: $e, livewire: $this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -349,6 +376,21 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function saveAndValidateServer()
|
||||||
|
{
|
||||||
|
$this->validate([
|
||||||
|
'remoteServerPort' => 'required|integer|min:1|max:65535',
|
||||||
|
'remoteServerUser' => 'required|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->createdServer->update([
|
||||||
|
'port' => $this->remoteServerPort,
|
||||||
|
'user' => $this->remoteServerUser,
|
||||||
|
'timezone' => 'UTC',
|
||||||
|
]);
|
||||||
|
$this->validateServer();
|
||||||
|
}
|
||||||
|
|
||||||
private function createNewPrivateKey()
|
private function createNewPrivateKey()
|
||||||
{
|
{
|
||||||
$this->privateKeyName = generate_random_name();
|
$this->privateKeyName = generate_random_name();
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Livewire\CommandCenter;
|
|
||||||
|
|
||||||
use App\Models\Server;
|
|
||||||
use Livewire\Component;
|
|
||||||
|
|
||||||
class Index extends Component
|
|
||||||
{
|
|
||||||
public $servers = [];
|
|
||||||
|
|
||||||
public function mount()
|
|
||||||
{
|
|
||||||
$this->servers = Server::isReachable()->get();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function render()
|
|
||||||
{
|
|
||||||
return view('livewire.command-center.index');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -30,8 +30,7 @@ class Dashboard extends Component
|
|||||||
|
|
||||||
public function cleanup_queue()
|
public function cleanup_queue()
|
||||||
{
|
{
|
||||||
$this->dispatch('success', 'Cleanup started.');
|
Artisan::queue('cleanup:deployment-queue', [
|
||||||
Artisan::queue('cleanup:application-deployment-queue', [
|
|
||||||
'--team-id' => currentTeam()->id,
|
'--team-id' => currentTeam()->id,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class Form extends Component
|
|||||||
}
|
}
|
||||||
$this->destination->delete();
|
$this->destination->delete();
|
||||||
|
|
||||||
return redirect()->route('dashboard');
|
return redirect()->route('destination.all');
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class Help extends Component
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
$mail->subject("[HELP]: {$this->subject}");
|
$mail->subject("[HELP]: {$this->subject}");
|
||||||
$settings = \App\Models\InstanceSettings::get();
|
$settings = instanceSettings();
|
||||||
$type = set_transanctional_email_settings($settings);
|
$type = set_transanctional_email_settings($settings);
|
||||||
if (! $type) {
|
if (! $type) {
|
||||||
$url = 'https://app.coolify.io/api/feedback';
|
$url = 'https://app.coolify.io/api/feedback';
|
||||||
@@ -61,6 +61,7 @@ class Help extends Component
|
|||||||
send_user_an_email($mail, auth()->user()?->email, 'hi@coollabs.io');
|
send_user_an_email($mail, auth()->user()?->email, 'hi@coollabs.io');
|
||||||
}
|
}
|
||||||
$this->dispatch('success', 'Feedback sent.', 'We will get in touch with you as soon as possible.');
|
$this->dispatch('success', 'Feedback sent.', 'We will get in touch with you as soon as possible.');
|
||||||
|
$this->reset('description', 'subject');
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,28 @@
|
|||||||
|
|
||||||
namespace App\Livewire;
|
namespace App\Livewire;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
class NavbarDeleteTeam extends Component
|
class NavbarDeleteTeam extends Component
|
||||||
{
|
{
|
||||||
public function delete()
|
public $team;
|
||||||
|
|
||||||
|
public function mount()
|
||||||
{
|
{
|
||||||
|
$this->team = currentTeam()->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete($password)
|
||||||
|
{
|
||||||
|
if (! Hash::check($password, Auth::user()->password)) {
|
||||||
|
$this->addError('password', 'The provided password is incorrect.');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$currentTeam = currentTeam();
|
$currentTeam = currentTeam();
|
||||||
$currentTeam->delete();
|
$currentTeam->delete();
|
||||||
|
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ class Email extends Component
|
|||||||
|
|
||||||
public function copyFromInstanceSettings()
|
public function copyFromInstanceSettings()
|
||||||
{
|
{
|
||||||
$settings = \App\Models\InstanceSettings::get();
|
$settings = instanceSettings();
|
||||||
if ($settings->smtp_enabled) {
|
if ($settings->smtp_enabled) {
|
||||||
$team = currentTeam();
|
$team = currentTeam();
|
||||||
$team->update([
|
$team->update([
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ namespace App\Livewire\Project\Application\Deployment;
|
|||||||
|
|
||||||
use App\Models\Application;
|
use App\Models\Application;
|
||||||
use App\Models\ApplicationDeploymentQueue;
|
use App\Models\ApplicationDeploymentQueue;
|
||||||
use Illuminate\Support\Collection;
|
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
class Show extends Component
|
class Show extends Component
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ class Heading extends Component
|
|||||||
|
|
||||||
protected string $deploymentUuid;
|
protected string $deploymentUuid;
|
||||||
|
|
||||||
|
public bool $docker_cleanup = true;
|
||||||
|
|
||||||
public function getListeners()
|
public function getListeners()
|
||||||
{
|
{
|
||||||
$teamId = auth()->user()->currentTeam()->id;
|
$teamId = auth()->user()->currentTeam()->id;
|
||||||
@@ -102,7 +104,7 @@ class Heading extends Component
|
|||||||
|
|
||||||
public function stop()
|
public function stop()
|
||||||
{
|
{
|
||||||
StopApplication::run($this->application);
|
StopApplication::run($this->application, false, $this->docker_cleanup);
|
||||||
$this->application->status = 'exited';
|
$this->application->status = 'exited';
|
||||||
$this->application->save();
|
$this->application->save();
|
||||||
if ($this->application->additional_servers->count() > 0) {
|
if ($this->application->additional_servers->count() > 0) {
|
||||||
@@ -135,4 +137,13 @@ class Heading extends Component
|
|||||||
'environment_name' => $this->parameters['environment_name'],
|
'environment_name' => $this->parameters['environment_name'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
return view('livewire.project.application.heading', [
|
||||||
|
'checkboxes' => [
|
||||||
|
['id' => 'docker_cleanup', 'label' => __('resource.docker_cleanup')],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ namespace App\Livewire\Project\Application;
|
|||||||
use App\Actions\Docker\GetContainersStatus;
|
use App\Actions\Docker\GetContainersStatus;
|
||||||
use App\Models\Application;
|
use App\Models\Application;
|
||||||
use App\Models\ApplicationPreview;
|
use App\Models\ApplicationPreview;
|
||||||
|
use Illuminate\Process\InvokedProcess;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Process;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use Spatie\Url\Url;
|
use Spatie\Url\Url;
|
||||||
use Visus\Cuid2\Cuid2;
|
use Visus\Cuid2\Cuid2;
|
||||||
@@ -184,17 +186,20 @@ class Previews extends Component
|
|||||||
public function stop(int $pull_request_id)
|
public function stop(int $pull_request_id)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
$server = $this->application->destination->server;
|
||||||
|
$timeout = 300;
|
||||||
|
|
||||||
if ($this->application->destination->server->isSwarm()) {
|
if ($this->application->destination->server->isSwarm()) {
|
||||||
instant_remote_process(["docker stack rm {$this->application->uuid}-{$pull_request_id}"], $this->application->destination->server);
|
instant_remote_process(["docker stack rm {$this->application->uuid}-{$pull_request_id}"], $server);
|
||||||
} else {
|
} else {
|
||||||
$containers = getCurrentApplicationContainerStatus($this->application->destination->server, $this->application->id, $pull_request_id);
|
$containers = getCurrentApplicationContainerStatus($server, $this->application->id, $pull_request_id)->toArray();
|
||||||
foreach ($containers as $container) {
|
$this->stopContainers($containers, $server, $timeout);
|
||||||
$name = str_replace('/', '', $container['Names']);
|
|
||||||
instant_remote_process(["docker rm -f $name"], $this->application->destination->server, throwError: false);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
GetContainersStatus::dispatchSync($this->application->destination->server)->onQueue('high');
|
GetContainersStatus::run($server);
|
||||||
$this->dispatch('reloadWindow');
|
$this->application->refresh();
|
||||||
|
$this->dispatch('containerStatusUpdated');
|
||||||
|
$this->dispatch('success', 'Preview Deployment stopped.');
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
@@ -203,16 +208,21 @@ class Previews extends Component
|
|||||||
public function delete(int $pull_request_id)
|
public function delete(int $pull_request_id)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
$server = $this->application->destination->server;
|
||||||
|
$timeout = 300;
|
||||||
|
|
||||||
if ($this->application->destination->server->isSwarm()) {
|
if ($this->application->destination->server->isSwarm()) {
|
||||||
instant_remote_process(["docker stack rm {$this->application->uuid}-{$pull_request_id}"], $this->application->destination->server);
|
instant_remote_process(["docker stack rm {$this->application->uuid}-{$pull_request_id}"], $server);
|
||||||
} else {
|
} else {
|
||||||
$containers = getCurrentApplicationContainerStatus($this->application->destination->server, $this->application->id, $pull_request_id);
|
$containers = getCurrentApplicationContainerStatus($server, $this->application->id, $pull_request_id)->toArray();
|
||||||
foreach ($containers as $container) {
|
$this->stopContainers($containers, $server, $timeout);
|
||||||
$name = str_replace('/', '', $container['Names']);
|
|
||||||
instant_remote_process(["docker rm -f $name"], $this->application->destination->server, throwError: false);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ApplicationPreview::where('application_id', $this->application->id)->where('pull_request_id', $pull_request_id)->first()->delete();
|
ApplicationPreview::where('application_id', $this->application->id)
|
||||||
|
->where('pull_request_id', $pull_request_id)
|
||||||
|
->first()
|
||||||
|
->delete();
|
||||||
|
|
||||||
$this->application->refresh();
|
$this->application->refresh();
|
||||||
$this->dispatch('update_links');
|
$this->dispatch('update_links');
|
||||||
$this->dispatch('success', 'Preview deleted.');
|
$this->dispatch('success', 'Preview deleted.');
|
||||||
@@ -220,4 +230,49 @@ class Previews extends Component
|
|||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function stopContainers(array $containers, $server, int $timeout)
|
||||||
|
{
|
||||||
|
$processes = [];
|
||||||
|
foreach ($containers as $container) {
|
||||||
|
$containerName = str_replace('/', '', $container['Names']);
|
||||||
|
$processes[$containerName] = $this->stopContainer($containerName, $timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
$startTime = time();
|
||||||
|
while (count($processes) > 0) {
|
||||||
|
$finishedProcesses = array_filter($processes, function ($process) {
|
||||||
|
return ! $process->running();
|
||||||
|
});
|
||||||
|
foreach (array_keys($finishedProcesses) as $containerName) {
|
||||||
|
unset($processes[$containerName]);
|
||||||
|
$this->removeContainer($containerName, $server);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (time() - $startTime >= $timeout) {
|
||||||
|
$this->forceStopRemainingContainers(array_keys($processes), $server);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(100000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function stopContainer(string $containerName, int $timeout): InvokedProcess
|
||||||
|
{
|
||||||
|
return Process::timeout($timeout)->start("docker stop --time=$timeout $containerName");
|
||||||
|
}
|
||||||
|
|
||||||
|
private function removeContainer(string $containerName, $server)
|
||||||
|
{
|
||||||
|
instant_remote_process(["docker rm -f $containerName"], $server, throwError: false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function forceStopRemainingContainers(array $containerNames, $server)
|
||||||
|
{
|
||||||
|
foreach ($containerNames as $containerName) {
|
||||||
|
instant_remote_process(["docker kill $containerName"], $server, throwError: false);
|
||||||
|
$this->removeContainer($containerName, $server);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
namespace App\Livewire\Project\Database;
|
namespace App\Livewire\Project\Database;
|
||||||
|
|
||||||
use App\Models\ScheduledDatabaseBackup;
|
use App\Models\ScheduledDatabaseBackup;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use Spatie\Url\Url;
|
use Spatie\Url\Url;
|
||||||
|
|
||||||
@@ -12,6 +14,12 @@ class BackupEdit extends Component
|
|||||||
|
|
||||||
public $s3s;
|
public $s3s;
|
||||||
|
|
||||||
|
public bool $delete_associated_backups_locally = false;
|
||||||
|
|
||||||
|
public bool $delete_associated_backups_s3 = false;
|
||||||
|
|
||||||
|
public bool $delete_associated_backups_sftp = false;
|
||||||
|
|
||||||
public ?string $status = null;
|
public ?string $status = null;
|
||||||
|
|
||||||
public array $parameters;
|
public array $parameters;
|
||||||
@@ -23,6 +31,7 @@ class BackupEdit extends Component
|
|||||||
'backup.save_s3' => 'required|boolean',
|
'backup.save_s3' => 'required|boolean',
|
||||||
'backup.s3_storage_id' => 'nullable|integer',
|
'backup.s3_storage_id' => 'nullable|integer',
|
||||||
'backup.databases_to_backup' => 'nullable',
|
'backup.databases_to_backup' => 'nullable',
|
||||||
|
'backup.dump_all' => 'required|boolean',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $validationAttributes = [
|
protected $validationAttributes = [
|
||||||
@@ -32,6 +41,7 @@ class BackupEdit extends Component
|
|||||||
'backup.save_s3' => 'Save to S3',
|
'backup.save_s3' => 'Save to S3',
|
||||||
'backup.s3_storage_id' => 'S3 Storage',
|
'backup.s3_storage_id' => 'S3 Storage',
|
||||||
'backup.databases_to_backup' => 'Databases to Backup',
|
'backup.databases_to_backup' => 'Databases to Backup',
|
||||||
|
'backup.dump_all' => 'Backup All Databases',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $messages = [
|
protected $messages = [
|
||||||
@@ -46,10 +56,24 @@ class BackupEdit extends Component
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete()
|
public function delete($password)
|
||||||
{
|
{
|
||||||
|
if (! Hash::check($password, Auth::user()->password)) {
|
||||||
|
$this->addError('password', 'The provided password is incorrect.');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($this->delete_associated_backups_locally) {
|
||||||
|
$this->deleteAssociatedBackupsLocally();
|
||||||
|
}
|
||||||
|
if ($this->delete_associated_backups_s3) {
|
||||||
|
$this->deleteAssociatedBackupsS3();
|
||||||
|
}
|
||||||
|
|
||||||
$this->backup->delete();
|
$this->backup->delete();
|
||||||
|
|
||||||
if ($this->backup->database->getMorphClass() === 'App\Models\ServiceDatabase') {
|
if ($this->backup->database->getMorphClass() === 'App\Models\ServiceDatabase') {
|
||||||
$previousUrl = url()->previous();
|
$previousUrl = url()->previous();
|
||||||
$url = Url::fromString($previousUrl);
|
$url = Url::fromString($previousUrl);
|
||||||
@@ -104,4 +128,66 @@ class BackupEdit extends Component
|
|||||||
$this->dispatch('error', $e->getMessage());
|
$this->dispatch('error', $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function deleteAssociatedBackupsLocally()
|
||||||
|
{
|
||||||
|
$executions = $this->backup->executions;
|
||||||
|
$backupFolder = null;
|
||||||
|
|
||||||
|
foreach ($executions as $execution) {
|
||||||
|
if ($this->backup->database->getMorphClass() === 'App\Models\ServiceDatabase') {
|
||||||
|
$server = $this->backup->database->service->destination->server;
|
||||||
|
} else {
|
||||||
|
$server = $this->backup->database->destination->server;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $backupFolder) {
|
||||||
|
$backupFolder = dirname($execution->filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
delete_backup_locally($execution->filename, $server);
|
||||||
|
$execution->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($backupFolder) {
|
||||||
|
$this->deleteEmptyBackupFolder($backupFolder, $server);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteAssociatedBackupsS3()
|
||||||
|
{
|
||||||
|
//Add function to delete backups from S3
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteAssociatedBackupsSftp()
|
||||||
|
{
|
||||||
|
//Add function to delete backups from SFTP
|
||||||
|
}
|
||||||
|
|
||||||
|
private function deleteEmptyBackupFolder($folderPath, $server)
|
||||||
|
{
|
||||||
|
$checkEmpty = instant_remote_process(["[ -z \"$(ls -A '$folderPath')\" ] && echo 'empty' || echo 'not empty'"], $server);
|
||||||
|
|
||||||
|
if (trim($checkEmpty) === 'empty') {
|
||||||
|
instant_remote_process(["rmdir '$folderPath'"], $server);
|
||||||
|
|
||||||
|
$parentFolder = dirname($folderPath);
|
||||||
|
$checkParentEmpty = instant_remote_process(["[ -z \"$(ls -A '$parentFolder')\" ] && echo 'empty' || echo 'not empty'"], $server);
|
||||||
|
|
||||||
|
if (trim($checkParentEmpty) === 'empty') {
|
||||||
|
instant_remote_process(["rmdir '$parentFolder'"], $server);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
return view('livewire.project.database.backup-edit', [
|
||||||
|
'checkboxes' => [
|
||||||
|
['id' => 'delete_associated_backups_locally', 'label' => __('database.delete_backups_locally')],
|
||||||
|
// ['id' => 'delete_associated_backups_s3', 'label' => 'All backups associated with this backup job from this database will be permanently deleted from the selected S3 Storage.']
|
||||||
|
// ['id' => 'delete_associated_backups_sftp', 'label' => 'All backups associated with this backup job from this database will be permanently deleted from the selected SFTP Storage.']
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,18 +3,28 @@
|
|||||||
namespace App\Livewire\Project\Database;
|
namespace App\Livewire\Project\Database;
|
||||||
|
|
||||||
use App\Models\ScheduledDatabaseBackup;
|
use App\Models\ScheduledDatabaseBackup;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Livewire\Attributes\On;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
class BackupExecutions extends Component
|
class BackupExecutions extends Component
|
||||||
{
|
{
|
||||||
public ?ScheduledDatabaseBackup $backup = null;
|
public ?ScheduledDatabaseBackup $backup = null;
|
||||||
|
|
||||||
public $database;
|
public $database;
|
||||||
|
|
||||||
public $executions = [];
|
public $executions = [];
|
||||||
|
|
||||||
public $setDeletableBackup;
|
public $setDeletableBackup;
|
||||||
|
|
||||||
|
public $delete_backup_s3 = true;
|
||||||
|
|
||||||
|
public $delete_backup_sftp = true;
|
||||||
|
|
||||||
public function getListeners()
|
public function getListeners()
|
||||||
{
|
{
|
||||||
$userId = auth()->user()->id;
|
$userId = Auth::id();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
"echo-private:team.{$userId},BackupCreated" => 'refreshBackupExecutions',
|
"echo-private:team.{$userId},BackupCreated" => 'refreshBackupExecutions',
|
||||||
@@ -31,19 +41,36 @@ class BackupExecutions extends Component
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteBackup($exeuctionId)
|
#[On('deleteBackup')]
|
||||||
|
public function deleteBackup($executionId, $password)
|
||||||
{
|
{
|
||||||
$execution = $this->backup->executions()->where('id', $exeuctionId)->first();
|
if (! Hash::check($password, Auth::user()->password)) {
|
||||||
|
$this->addError('password', 'The provided password is incorrect.');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$execution = $this->backup->executions()->where('id', $executionId)->first();
|
||||||
if (is_null($execution)) {
|
if (is_null($execution)) {
|
||||||
$this->dispatch('error', 'Backup execution not found.');
|
$this->dispatch('error', 'Backup execution not found.');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($execution->scheduledDatabaseBackup->database->getMorphClass() === 'App\Models\ServiceDatabase') {
|
if ($execution->scheduledDatabaseBackup->database->getMorphClass() === 'App\Models\ServiceDatabase') {
|
||||||
delete_backup_locally($execution->filename, $execution->scheduledDatabaseBackup->database->service->destination->server);
|
delete_backup_locally($execution->filename, $execution->scheduledDatabaseBackup->database->service->destination->server);
|
||||||
} else {
|
} else {
|
||||||
delete_backup_locally($execution->filename, $execution->scheduledDatabaseBackup->database->destination->server);
|
delete_backup_locally($execution->filename, $execution->scheduledDatabaseBackup->database->destination->server);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->delete_backup_s3) {
|
||||||
|
// Add logic to delete from S3
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->delete_backup_sftp) {
|
||||||
|
// Add logic to delete from SFTP
|
||||||
|
}
|
||||||
|
|
||||||
$execution->delete();
|
$execution->delete();
|
||||||
$this->dispatch('success', 'Backup deleted.');
|
$this->dispatch('success', 'Backup deleted.');
|
||||||
$this->refreshBackupExecutions();
|
$this->refreshBackupExecutions();
|
||||||
@@ -82,6 +109,7 @@ class BackupExecutions extends Component
|
|||||||
return $server;
|
return $server;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,6 +120,7 @@ class BackupExecutions extends Component
|
|||||||
return 'UTC';
|
return 'UTC';
|
||||||
}
|
}
|
||||||
$serverTimezone = $server->settings->server_timezone;
|
$serverTimezone = $server->settings->server_timezone;
|
||||||
|
|
||||||
return $serverTimezone;
|
return $serverTimezone;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,6 +133,17 @@ class BackupExecutions extends Component
|
|||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$dateObj->setTimezone(new \DateTimeZone('UTC'));
|
$dateObj->setTimezone(new \DateTimeZone('UTC'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $dateObj->format('Y-m-d H:i:s T');
|
return $dateObj->format('Y-m-d H:i:s T');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
return view('livewire.project.database.backup-executions', [
|
||||||
|
'checkboxes' => [
|
||||||
|
['id' => 'delete_backup_s3', 'label' => 'Delete the selected backup permanently form S3 Storage'],
|
||||||
|
['id' => 'delete_backup_sftp', 'label' => 'Delete the selected backup permanently form SFTP Storage'],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ class Heading extends Component
|
|||||||
|
|
||||||
public array $parameters;
|
public array $parameters;
|
||||||
|
|
||||||
|
public $docker_cleanup = true;
|
||||||
|
|
||||||
public function getListeners()
|
public function getListeners()
|
||||||
{
|
{
|
||||||
$userId = auth()->user()->id;
|
$userId = auth()->user()->id;
|
||||||
@@ -54,7 +56,7 @@ class Heading extends Component
|
|||||||
|
|
||||||
public function stop()
|
public function stop()
|
||||||
{
|
{
|
||||||
StopDatabase::run($this->database);
|
StopDatabase::run($this->database, false, $this->docker_cleanup);
|
||||||
$this->database->status = 'exited';
|
$this->database->status = 'exited';
|
||||||
$this->database->save();
|
$this->database->save();
|
||||||
$this->check_status();
|
$this->check_status();
|
||||||
@@ -71,4 +73,13 @@ class Heading extends Component
|
|||||||
$activity = StartDatabase::run($this->database);
|
$activity = StartDatabase::run($this->database);
|
||||||
$this->dispatch('activityMonitor', $activity->id);
|
$this->dispatch('activityMonitor', $activity->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
return view('livewire.project.database.heading', [
|
||||||
|
'checkboxes' => [
|
||||||
|
['id' => 'docker_cleanup', 'label' => __('resource.docker_cleanup')],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class ScheduledBackups extends Component
|
|||||||
public function mount(): void
|
public function mount(): void
|
||||||
{
|
{
|
||||||
if ($this->selectedBackupId) {
|
if ($this->selectedBackupId) {
|
||||||
$this->setSelectedBackup($this->selectedBackupId);
|
$this->setSelectedBackup($this->selectedBackupId, true);
|
||||||
}
|
}
|
||||||
$this->parameters = get_route_parameters();
|
$this->parameters = get_route_parameters();
|
||||||
if ($this->database->getMorphClass() === 'App\Models\ServiceDatabase') {
|
if ($this->database->getMorphClass() === 'App\Models\ServiceDatabase') {
|
||||||
@@ -37,10 +37,13 @@ class ScheduledBackups extends Component
|
|||||||
$this->s3s = currentTeam()->s3s;
|
$this->s3s = currentTeam()->s3s;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setSelectedBackup($backupId)
|
public function setSelectedBackup($backupId, $force = false)
|
||||||
{
|
{
|
||||||
|
if ($this->selectedBackupId === $backupId && ! $force) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
$this->selectedBackupId = $backupId;
|
$this->selectedBackupId = $backupId;
|
||||||
$this->selectedBackup = $this->database->scheduledBackups->find($this->selectedBackupId);
|
$this->selectedBackup = $this->database->scheduledBackups->find($backupId);
|
||||||
if (is_null($this->selectedBackup)) {
|
if (is_null($this->selectedBackup)) {
|
||||||
$this->selectedBackupId = null;
|
$this->selectedBackupId = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,12 @@ class DeleteEnvironment extends Component
|
|||||||
|
|
||||||
public bool $disabled = false;
|
public bool $disabled = false;
|
||||||
|
|
||||||
|
public string $environmentName = '';
|
||||||
|
|
||||||
public function mount()
|
public function mount()
|
||||||
{
|
{
|
||||||
$this->parameters = get_route_parameters();
|
$this->parameters = get_route_parameters();
|
||||||
|
$this->environmentName = Environment::findOrFail($this->environment_id)->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete()
|
public function delete()
|
||||||
|
|||||||
@@ -13,9 +13,12 @@ class DeleteProject extends Component
|
|||||||
|
|
||||||
public bool $disabled = false;
|
public bool $disabled = false;
|
||||||
|
|
||||||
|
public string $projectName = '';
|
||||||
|
|
||||||
public function mount()
|
public function mount()
|
||||||
{
|
{
|
||||||
$this->parameters = get_route_parameters();
|
$this->parameters = get_route_parameters();
|
||||||
|
$this->projectName = Project::findOrFail($this->project_id)->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete()
|
public function delete()
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -52,7 +52,7 @@ class Configuration extends Component
|
|||||||
$application = $this->service->applications->find($id);
|
$application = $this->service->applications->find($id);
|
||||||
if ($application) {
|
if ($application) {
|
||||||
$application->restart();
|
$application->restart();
|
||||||
$this->dispatch('success', 'Application restarted successfully.');
|
$this->dispatch('success', 'Service application restarted successfully.');
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
@@ -65,7 +65,7 @@ class Configuration extends Component
|
|||||||
$database = $this->service->databases->find($id);
|
$database = $this->service->databases->find($id);
|
||||||
if ($database) {
|
if ($database) {
|
||||||
$database->restart();
|
$database->restart();
|
||||||
$this->dispatch('success', 'Database restarted successfully.');
|
$this->dispatch('success', 'Service database restarted successfully.');
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ use App\Models\StandaloneMongodb;
|
|||||||
use App\Models\StandaloneMysql;
|
use App\Models\StandaloneMysql;
|
||||||
use App\Models\StandalonePostgresql;
|
use App\Models\StandalonePostgresql;
|
||||||
use App\Models\StandaloneRedis;
|
use App\Models\StandaloneRedis;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
class FileStorage extends Component
|
class FileStorage extends Component
|
||||||
@@ -83,8 +85,14 @@ class FileStorage extends Component
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete()
|
public function delete($password)
|
||||||
{
|
{
|
||||||
|
if (! Hash::check($password, Auth::user()->password)) {
|
||||||
|
$this->addError('password', 'The provided password is incorrect.');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$message = 'File deleted.';
|
$message = 'File deleted.';
|
||||||
if ($this->fileStorage->is_directory) {
|
if ($this->fileStorage->is_directory) {
|
||||||
@@ -129,6 +137,13 @@ class FileStorage extends Component
|
|||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
return view('livewire.project.service.file-storage');
|
return view('livewire.project.service.file-storage', [
|
||||||
|
'directoryDeletionCheckboxes' => [
|
||||||
|
['id' => 'permanently_delete', 'label' => 'The selected directory and all its contents will be permantely deleted form the server.'],
|
||||||
|
],
|
||||||
|
'fileDeletionCheckboxes' => [
|
||||||
|
['id' => 'permanently_delete', 'label' => 'The selected file will be permanently deleted form the server.'],
|
||||||
|
],
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ class Navbar extends Component
|
|||||||
|
|
||||||
public $isDeploymentProgress = false;
|
public $isDeploymentProgress = false;
|
||||||
|
|
||||||
|
public $docker_cleanup = true;
|
||||||
|
|
||||||
|
public $title = 'Configuration';
|
||||||
|
|
||||||
public function mount()
|
public function mount()
|
||||||
{
|
{
|
||||||
if (str($this->service->status())->contains('running') && is_null($this->service->config_hash)) {
|
if (str($this->service->status())->contains('running') && is_null($this->service->config_hash)) {
|
||||||
@@ -40,7 +44,7 @@ class Navbar extends Component
|
|||||||
|
|
||||||
public function serviceStarted()
|
public function serviceStarted()
|
||||||
{
|
{
|
||||||
$this->dispatch('success', 'Service status changed.');
|
// $this->dispatch('success', 'Service status changed.');
|
||||||
if (is_null($this->service->config_hash) || $this->service->isConfigurationChanged()) {
|
if (is_null($this->service->config_hash) || $this->service->isConfigurationChanged()) {
|
||||||
$this->service->isConfigurationChanged(true);
|
$this->service->isConfigurationChanged(true);
|
||||||
$this->dispatch('configurationChanged');
|
$this->dispatch('configurationChanged');
|
||||||
@@ -60,11 +64,6 @@ class Navbar extends Component
|
|||||||
$this->dispatch('success', 'Service status updated.');
|
$this->dispatch('success', 'Service status updated.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
|
||||||
{
|
|
||||||
return view('livewire.project.service.navbar');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function checkDeployments()
|
public function checkDeployments()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -95,14 +94,9 @@ class Navbar extends Component
|
|||||||
$this->dispatch('activityMonitor', $activity->id);
|
$this->dispatch('activityMonitor', $activity->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function stop(bool $forceCleanup = false)
|
public function stop()
|
||||||
{
|
{
|
||||||
StopService::run($this->service);
|
StopService::run($this->service, false, $this->docker_cleanup);
|
||||||
if ($forceCleanup) {
|
|
||||||
$this->dispatch('success', 'Containers cleaned up.');
|
|
||||||
} else {
|
|
||||||
$this->dispatch('success', 'Service stopped.');
|
|
||||||
}
|
|
||||||
ServiceStatusChanged::dispatch();
|
ServiceStatusChanged::dispatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,11 +108,35 @@ class Navbar extends Component
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PullImage::run($this->service);
|
StopService::run(service: $this->service, dockerCleanup: false);
|
||||||
StopService::run($this->service);
|
|
||||||
$this->service->parse();
|
$this->service->parse();
|
||||||
$this->dispatch('imagePulled');
|
$this->dispatch('imagePulled');
|
||||||
$activity = StartService::run($this->service);
|
$activity = StartService::run($this->service);
|
||||||
$this->dispatch('activityMonitor', $activity->id);
|
$this->dispatch('activityMonitor', $activity->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function pullAndRestartEvent()
|
||||||
|
{
|
||||||
|
$this->checkDeployments();
|
||||||
|
if ($this->isDeploymentProgress) {
|
||||||
|
$this->dispatch('error', 'There is a deployment in progress.');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PullImage::run($this->service);
|
||||||
|
StopService::run(service: $this->service, dockerCleanup: false);
|
||||||
|
$this->service->parse();
|
||||||
|
$this->dispatch('imagePulled');
|
||||||
|
$activity = StartService::run($this->service);
|
||||||
|
$this->dispatch('activityMonitor', $activity->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
return view('livewire.project.service.navbar', [
|
||||||
|
'checkboxes' => [
|
||||||
|
['id' => 'docker_cleanup', 'label' => __('resource.docker_cleanup')],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
namespace App\Livewire\Project\Service;
|
namespace App\Livewire\Project\Service;
|
||||||
|
|
||||||
use App\Models\ServiceApplication;
|
use App\Models\ServiceApplication;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
class ServiceApplicationView extends Component
|
class ServiceApplicationView extends Component
|
||||||
@@ -11,6 +13,10 @@ class ServiceApplicationView extends Component
|
|||||||
|
|
||||||
public $parameters;
|
public $parameters;
|
||||||
|
|
||||||
|
public $docker_cleanup = true;
|
||||||
|
|
||||||
|
public $delete_volumes = true;
|
||||||
|
|
||||||
protected $rules = [
|
protected $rules = [
|
||||||
'application.human_name' => 'nullable',
|
'application.human_name' => 'nullable',
|
||||||
'application.description' => 'nullable',
|
'application.description' => 'nullable',
|
||||||
@@ -23,11 +29,6 @@ class ServiceApplicationView extends Component
|
|||||||
'application.is_stripprefix_enabled' => 'nullable|boolean',
|
'application.is_stripprefix_enabled' => 'nullable|boolean',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function render()
|
|
||||||
{
|
|
||||||
return view('livewire.project.service.service-application-view');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function updatedApplicationFqdn()
|
public function updatedApplicationFqdn()
|
||||||
{
|
{
|
||||||
$this->application->fqdn = str($this->application->fqdn)->replaceEnd(',', '')->trim();
|
$this->application->fqdn = str($this->application->fqdn)->replaceEnd(',', '')->trim();
|
||||||
@@ -56,8 +57,14 @@ class ServiceApplicationView extends Component
|
|||||||
$this->dispatch('success', 'You need to restart the service for the changes to take effect.');
|
$this->dispatch('success', 'You need to restart the service for the changes to take effect.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete()
|
public function delete($password)
|
||||||
{
|
{
|
||||||
|
if (! Hash::check($password, Auth::user()->password)) {
|
||||||
|
$this->addError('password', 'The provided password is incorrect.');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->application->delete();
|
$this->application->delete();
|
||||||
$this->dispatch('success', 'Application deleted.');
|
$this->dispatch('success', 'Application deleted.');
|
||||||
@@ -91,4 +98,17 @@ class ServiceApplicationView extends Component
|
|||||||
$this->dispatch('generateDockerCompose');
|
$this->dispatch('generateDockerCompose');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
return view('livewire.project.service.service-application-view', [
|
||||||
|
'checkboxes' => [
|
||||||
|
['id' => 'delete_volumes', 'label' => __('resource.delete_volumes')],
|
||||||
|
['id' => 'docker_cleanup', 'label' => __('resource.docker_cleanup')],
|
||||||
|
// ['id' => 'delete_associated_backups_locally', 'label' => 'All backups associated with this Ressource will be permanently deleted from local storage.'],
|
||||||
|
// ['id' => 'delete_associated_backups_s3', 'label' => 'All backups associated with this Ressource will be permanently deleted from the selected S3 Storage.'],
|
||||||
|
// ['id' => 'delete_associated_backups_sftp', 'label' => 'All backups associated with this Ressource will be permanently deleted from the selected SFTP Storage.']
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class StackForm extends Component
|
|||||||
$key = data_get($field, 'key');
|
$key = data_get($field, 'key');
|
||||||
$value = data_get($field, 'value');
|
$value = data_get($field, 'value');
|
||||||
$rules = data_get($field, 'rules', 'nullable');
|
$rules = data_get($field, 'rules', 'nullable');
|
||||||
$isPassword = data_get($field, 'isPassword');
|
$isPassword = data_get($field, 'isPassword', false);
|
||||||
$this->fields->put($key, [
|
$this->fields->put($key, [
|
||||||
'serviceName' => $serviceName,
|
'serviceName' => $serviceName,
|
||||||
'key' => $key,
|
'key' => $key,
|
||||||
@@ -47,7 +47,15 @@ class StackForm extends Component
|
|||||||
$this->validationAttributes["fields.$key.value"] = $fieldKey;
|
$this->validationAttributes["fields.$key.value"] = $fieldKey;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->fields = $this->fields->sortBy('name');
|
$this->fields = $this->fields->groupBy('serviceName')->map(function ($group) {
|
||||||
|
return $group->sortBy(function ($field) {
|
||||||
|
return data_get($field, 'isPassword') ? 1 : 0;
|
||||||
|
})->mapWithKeys(function ($field) {
|
||||||
|
return [$field['key'] => $field];
|
||||||
|
});
|
||||||
|
})->flatMap(function ($group) {
|
||||||
|
return $group;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function saveCompose($raw)
|
public function saveCompose($raw)
|
||||||
|
|||||||
@@ -3,6 +3,11 @@
|
|||||||
namespace App\Livewire\Project\Shared;
|
namespace App\Livewire\Project\Shared;
|
||||||
|
|
||||||
use App\Jobs\DeleteResourceJob;
|
use App\Jobs\DeleteResourceJob;
|
||||||
|
use App\Models\Service;
|
||||||
|
use App\Models\ServiceApplication;
|
||||||
|
use App\Models\ServiceDatabase;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use Visus\Cuid2\Cuid2;
|
use Visus\Cuid2\Cuid2;
|
||||||
|
|
||||||
@@ -10,6 +15,8 @@ class Danger extends Component
|
|||||||
{
|
{
|
||||||
public $resource;
|
public $resource;
|
||||||
|
|
||||||
|
public $resourceName;
|
||||||
|
|
||||||
public $projectUuid;
|
public $projectUuid;
|
||||||
|
|
||||||
public $environmentName;
|
public $environmentName;
|
||||||
@@ -18,22 +25,95 @@ class Danger extends Component
|
|||||||
|
|
||||||
public bool $delete_volumes = true;
|
public bool $delete_volumes = true;
|
||||||
|
|
||||||
|
public bool $docker_cleanup = true;
|
||||||
|
|
||||||
|
public bool $delete_connected_networks = true;
|
||||||
|
|
||||||
public ?string $modalId = null;
|
public ?string $modalId = null;
|
||||||
|
|
||||||
|
public string $resourceDomain = '';
|
||||||
|
|
||||||
public function mount()
|
public function mount()
|
||||||
{
|
{
|
||||||
$this->modalId = new Cuid2;
|
|
||||||
$parameters = get_route_parameters();
|
$parameters = get_route_parameters();
|
||||||
|
$this->modalId = new Cuid2;
|
||||||
$this->projectUuid = data_get($parameters, 'project_uuid');
|
$this->projectUuid = data_get($parameters, 'project_uuid');
|
||||||
$this->environmentName = data_get($parameters, 'environment_name');
|
$this->environmentName = data_get($parameters, 'environment_name');
|
||||||
|
|
||||||
|
if ($this->resource === null) {
|
||||||
|
if (isset($parameters['service_uuid'])) {
|
||||||
|
$this->resource = Service::where('uuid', $parameters['service_uuid'])->first();
|
||||||
|
} elseif (isset($parameters['stack_service_uuid'])) {
|
||||||
|
$this->resource = ServiceApplication::where('uuid', $parameters['stack_service_uuid'])->first()
|
||||||
|
?? ServiceDatabase::where('uuid', $parameters['stack_service_uuid'])->first();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete()
|
if ($this->resource === null) {
|
||||||
|
$this->resourceName = 'Unknown Resource';
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! method_exists($this->resource, 'type')) {
|
||||||
|
$this->resourceName = 'Unknown Resource';
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($this->resource->type()) {
|
||||||
|
case 'application':
|
||||||
|
$this->resourceName = $this->resource->name ?? 'Application';
|
||||||
|
break;
|
||||||
|
case 'standalone-postgresql':
|
||||||
|
case 'standalone-redis':
|
||||||
|
case 'standalone-mongodb':
|
||||||
|
case 'standalone-mysql':
|
||||||
|
case 'standalone-mariadb':
|
||||||
|
case 'standalone-keydb':
|
||||||
|
case 'standalone-dragonfly':
|
||||||
|
case 'standalone-clickhouse':
|
||||||
|
$this->resourceName = $this->resource->name ?? 'Database';
|
||||||
|
break;
|
||||||
|
case 'service':
|
||||||
|
$this->resourceName = $this->resource->name ?? 'Service';
|
||||||
|
break;
|
||||||
|
case 'service-application':
|
||||||
|
$this->resourceName = $this->resource->name ?? 'Service Application';
|
||||||
|
break;
|
||||||
|
case 'service-database':
|
||||||
|
$this->resourceName = $this->resource->name ?? 'Service Database';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$this->resourceName = 'Unknown Resource';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete($password)
|
||||||
{
|
{
|
||||||
|
if (isProduction()) {
|
||||||
|
if (! Hash::check($password, Auth::user()->password)) {
|
||||||
|
$this->addError('password', 'The provided password is incorrect.');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $this->resource) {
|
||||||
|
$this->addError('resource', 'Resource not found.');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// $this->authorize('delete', $this->resource);
|
|
||||||
$this->resource->delete();
|
$this->resource->delete();
|
||||||
DeleteResourceJob::dispatch($this->resource, $this->delete_configurations, $this->delete_volumes);
|
DeleteResourceJob::dispatch(
|
||||||
|
$this->resource,
|
||||||
|
$this->delete_configurations,
|
||||||
|
$this->delete_volumes,
|
||||||
|
$this->docker_cleanup,
|
||||||
|
$this->delete_connected_networks
|
||||||
|
);
|
||||||
|
|
||||||
return redirect()->route('project.resource.index', [
|
return redirect()->route('project.resource.index', [
|
||||||
'project_uuid' => $this->projectUuid,
|
'project_uuid' => $this->projectUuid,
|
||||||
@@ -43,4 +123,19 @@ class Danger extends Component
|
|||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
return view('livewire.project.shared.danger', [
|
||||||
|
'checkboxes' => [
|
||||||
|
['id' => 'delete_volumes', 'label' => __('resource.delete_volumes')],
|
||||||
|
['id' => 'delete_connected_networks', 'label' => __('resource.delete_connected_networks')],
|
||||||
|
['id' => 'delete_configurations', 'label' => __('resource.delete_configurations')],
|
||||||
|
['id' => 'docker_cleanup', 'label' => __('resource.docker_cleanup')],
|
||||||
|
// ['id' => 'delete_associated_backups_locally', 'label' => 'All backups associated with this Ressource will be permanently deleted from local storage.'],
|
||||||
|
// ['id' => 'delete_associated_backups_s3', 'label' => 'All backups associated with this Ressource will be permanently deleted from the selected S3 Storage.'],
|
||||||
|
// ['id' => 'delete_associated_backups_sftp', 'label' => 'All backups associated with this Ressource will be permanently deleted from the selected SFTP Storage.']
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user