Skip to content

Commit 22b5f4e

Browse files
authored
Merge pull request #1 from devilbox-community/release/v3.0.0-beta-0.4
Release/v3.0.0 beta 0.4
2 parents edddbf1 + 678d068 commit 22b5f4e

File tree

19 files changed

+282
-82
lines changed

19 files changed

+282
-82
lines changed

.devilbox/www/config.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
putenv('RES_OPTIONS=retrans:1 retry:1 timeout:1 attempts:1');
1414

1515

16-
$DEVILBOX_VERSION = 'v3.0.0-beta-0.3';
17-
$DEVILBOX_DATE = '2023-01-02';
16+
$DEVILBOX_VERSION = 'v3.0.0-beta-0.4';
17+
$DEVILBOX_DATE = '2023-01-30';
1818
$DEVILBOX_API_PAGE = 'devilbox-api/status.json';
1919

2020
//

.devilbox/www/htdocs/cnc.php

+99-28
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,39 @@
22
<?php loadClass('Helper')->authPage(); ?>
33
<?php
44
// TODO: This is currently a temporary hack to talk to supervisor on the HTTPD server
5-
function run_supervisor_command($command) {
6-
$supervisor_config_file = '/tmp/supervisorctl.conf';
7-
$port = getenv('SVCTL_LISTEN_PORT');
8-
$user = getenv('SVCTL_USER');
9-
$pass = getenv('SVCTL_PASS');
10-
11-
$content = "[supervisorctl]\n";
12-
$content .= "serverurl=http://httpd:" . $port . "\n";
13-
$content .= "username=" . $user . "\n";
14-
$content .= "password=" . $pass . "\n";
15-
16-
$fp = fopen($supervisor_config_file, 'w');
17-
fwrite($fp, $content);
18-
fclose($fp);
19-
20-
return loadClass('Helper')->exec('supervisorctl -c ' . $supervisor_config_file . ' ' . $command);
5+
function run_supervisor_command($host, $command) {
6+
if ($host == 'httpd') {
7+
$supervisor_config_file = '/tmp/supervisorctl.conf';
8+
$port = getenv('SVCTL_LISTEN_PORT');
9+
$user = getenv('SVCTL_USER');
10+
$pass = getenv('SVCTL_PASS');
11+
12+
$content = "[supervisorctl]\n";
13+
$content .= "serverurl=http://httpd:" . $port . "\n";
14+
$content .= "username=" . $user . "\n";
15+
$content .= "password=" . $pass . "\n";
16+
17+
$fp = fopen($supervisor_config_file, 'w');
18+
fwrite($fp, $content);
19+
fclose($fp);
20+
21+
return loadClass('Helper')->exec('supervisorctl -c ' . $supervisor_config_file . ' ' . $command);
22+
} else if ($host == 'php') {
23+
return loadClass('Helper')->exec('sudo supervisorctl ' . $command);
24+
}
2125
}
2226

2327

2428
?>
25-
<?php if ( isset($_POST['watcherd']) && $_POST['watcherd'] == 'reload' ) {
26-
run_supervisor_command('restart watcherd');
27-
sleep(1);
28-
loadClass('Helper')->redirect('/cnc.php');
29-
}
29+
<?php
30+
if ( isset($_POST['watcherd']) && $_POST['watcherd'] == 'reload' ) {
31+
run_supervisor_command('httpd', 'restart watcherd');
32+
sleep(1);
33+
loadClass('Helper')->redirect('/cnc.php');
34+
} else if ( isset($_POST['php-fpm']) && $_POST['php-fpm'] == 'reload' ) {
35+
run_supervisor_command('php', 'restart php-fpm');
36+
loadClass('Helper')->redirect('/cnc.php');
37+
}
3038
?>
3139
<!DOCTYPE html>
3240
<html lang="en">
@@ -46,8 +54,9 @@ function run_supervisor_command($command) {
4654
<div class="col-md-12">
4755

4856
<?php
49-
$status_w = run_supervisor_command('status watcherd');
50-
$status_h = run_supervisor_command('status httpd');
57+
$status_w = run_supervisor_command('httpd', 'status watcherd');
58+
$status_h = run_supervisor_command('httpd', 'status httpd');
59+
$status_p = run_supervisor_command('php', 'status php-fpm');
5160

5261
$words = preg_split("/\s+/", $status_w);
5362
$data_w = array(
@@ -63,33 +72,54 @@ function run_supervisor_command($command) {
6372
'pid' => isset($words[3]) ? preg_replace('/,$/', '', $words[3]) : '',
6473
'uptime' => isset($words[5]) ? $words[5] : '',
6574
);
75+
$words = preg_split("/\s+/", $status_p);
76+
$data_p = array(
77+
'name' => isset($words[0]) ? $words[0] : '',
78+
'state' => isset($words[1]) ? $words[1] : '',
79+
'pid' => isset($words[3]) ? preg_replace('/,$/', '', $words[3]) : '',
80+
'uptime' => isset($words[5]) ? $words[5] : '',
81+
);
6682
?>
6783
<h3>Daemon overview</h3><br/>
68-
<p>If you made any changes to vhost settings (vhost-gen templates or backend configuration) or to the webserver configuration itself, you can trigger a manual reload of <code>watcherd</code> here to apply them. No need to restart the Docker Compose stack.</p>
6984
<table class="table table-striped">
7085
<thead class="thead-inverse">
7186
<tr>
7287
<th>Daemon</th>
88+
<th>Container</th>
7389
<th>Status</th>
7490
<th>Pid</th>
7591
<th>Uptime</th>
92+
<th>Info</th>
7693
<th>Action</th>
7794
</tr>
7895
</thead>
7996
<tbody>
8097
<tr>
81-
<td><?php echo $data_w['name']; ?></td>
98+
<td><code><?php echo $data_p['name']; ?></code></td>
99+
<td>php</td>
100+
<td><?php echo $data_p['state']; ?></td>
101+
<td><?php echo $data_p['pid']; ?></td>
102+
<td><?php echo $data_p['uptime']; ?></td>
103+
<td><a href="#"><i class="fa fa-info" aria-hidden="true" data-toggle="modal" data-target="#info-php-fpm"></i></a></td>
104+
<td><form method="post"><button type="submit" name="php-fpm" value="reload" class="btn btn-primary">Reload</button></form></td>
105+
</tr>
106+
<tr>
107+
<td><code><?php echo $data_w['name']; ?></code></td>
108+
<td>httpd</td>
82109
<td><?php echo $data_w['state']; ?></td>
83110
<td><?php echo $data_w['pid']; ?></td>
84111
<td><?php echo $data_w['uptime']; ?></td>
112+
<td><a href="#"><i class="fa fa-info" aria-hidden="true" data-toggle="modal" data-target="#info-watcherd"></i></a></td>
85113
<td><form method="post"><button type="submit" name="watcherd" value="reload" class="btn btn-primary">Reload</button></form></td>
86114
</tr>
87115
<tr>
88-
<td><?php echo $data_h['name']; ?></td>
116+
<td><code><?php echo $data_h['name']; ?></code></td>
117+
<td>httpd</td>
89118
<td><?php echo $data_h['state']; ?></td>
90119
<td><?php echo $data_h['pid']; ?></td>
91120
<td><?php echo $data_h['uptime']; ?></td>
92121
<td></td>
122+
<td></td>
93123
</tr>
94124
</tbody>
95125
</table>
@@ -99,7 +129,7 @@ function run_supervisor_command($command) {
99129
<h3>watcherd stderr</h3>
100130
<br/>
101131
<?php
102-
$output = run_supervisor_command('tail -1000000 watcherd stderr');
132+
$output = run_supervisor_command('httpd', 'tail -1000000 watcherd stderr');
103133
echo '<pre>';
104134
foreach(preg_split("/((\r?\n)|(\r\n?))/", $output) as $line) {
105135
if ( strpos($line, "[ERR]") !== false ) {
@@ -120,7 +150,7 @@ function run_supervisor_command($command) {
120150
<h3>watcherd stdout</h3>
121151
<br/>
122152
<?php
123-
$output = run_supervisor_command('tail -1000000 watcherd');
153+
$output = run_supervisor_command('httpd', 'tail -1000000 watcherd');
124154
echo '<pre>';
125155
foreach(preg_split("/((\r?\n)|(\r\n?))/", $output) as $line) {
126156
$pos_info = strpos($line, "[INFO]");
@@ -142,6 +172,47 @@ function run_supervisor_command($command) {
142172

143173
</div><!-- /.container -->
144174

175+
<!-- Modals (php-fpm) -->
176+
<div class="modal fade" id="info-php-fpm" tabindex="-1" role="dialog" aria-labelledby="info-php-fpmLabel" aria-hidden="true">
177+
<div class="modal-dialog" role="document">
178+
<div class="modal-content">
179+
<div class="modal-header">
180+
<h5 class="modal-title" id="info-php-fpmLabel">Reload <code>php-fpm</code></h5>
181+
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
182+
<span aria-hidden="true">&times;</span>
183+
</button>
184+
</div>
185+
<div class="modal-body">
186+
<p>If you made any changes to PHP such as adding/altering <code>php.ini</code> or <code>php-fpm.conf</code> configuration files (e.g.: Xdebug or other settings), you can trigger a manual restart of the <code>php-fpm</code> process to apply your changes.</p>
187+
<p>Reloading php-fpm will apply those changes immediately. There is no need to restart docker compose.</p>
188+
</div>
189+
<div class="modal-footer">
190+
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
191+
</div>
192+
</div>
193+
</div>
194+
</div>
195+
<!-- Modals (php-fpm) -->
196+
<div class="modal fade" id="info-watcherd" tabindex="-1" role="dialog" aria-labelledby="info-watcherdLabel" aria-hidden="true">
197+
<div class="modal-dialog" role="document">
198+
<div class="modal-content">
199+
<div class="modal-header">
200+
<h5 class="modal-title" id="info-watcherdLabel">Reload <code>watcherd</code></h5>
201+
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
202+
<span aria-hidden="true">&times;</span>
203+
</button>
204+
</div>
205+
<div class="modal-body">
206+
<p>If you have made any changes to vhost settings such as adding/altering custom vhost-gen templates, backend configuration or changes to the webserver itself, you can trigger a manual reload of <code>watcherd</code>.</p>
207+
<p>Reloading watcherd will update all vhosts based and your configuration and reload the webserver. There is no need to restart docker compose.</p>
208+
</div>
209+
<div class="modal-footer">
210+
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
211+
</div>
212+
</div>
213+
</div>
214+
</div>
215+
145216
<?php echo loadClass('Html')->getFooter(); ?>
146217
<script>
147218
$(function() {

.devilbox/www/include/lib/container/Httpd.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function getVirtualHosts()
7171

7272
if ($handle = opendir($docRoot)) {
7373
while (false !== ($directory = readdir($handle))) {
74-
if ($this->_is_valid_dir($docRoot . DIRECTORY_SEPARATOR . $directory) && $directory != '.' && $directory != '..') {
74+
if ($this->_is_valid_dir($docRoot . DIRECTORY_SEPARATOR . $directory) && $directory[0] != '.' ) {
7575

7676
$vhosts[$directory] = array(
7777
'name' => $directory,

.devilbox/www/include/vendor/Mail/Mbox.php

+6
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,12 @@ class Mail_Mbox extends PEAR
190190
var $autoReopen = true;
191191

192192

193+
/**
194+
* cytoia added to prevent deprecation warning about dynamically creating
195+
* this variable inside the constructor
196+
*/
197+
var $_file = null;
198+
193199

194200
/**
195201
* Create a new Mbox class instance.

CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,22 @@ Make sure to have a look at [UPDATING.md](https://github.com/cytopia/devilbox/bl
66
## Unreleased
77

88

9+
## Release v3.0.0-beta-0.4 (2022-01-30)
10+
11+
### Fixed
12+
- Ignore directories starting with a `.` in `/shared/httpd` (invalid server names)
13+
- Fixed: `Creation of dynamic property Mail_Mbox::$_file is deprecated` (PHP 8.2)
14+
- Fixed: Xdebug default configuration files in cfg/php-ini-X.Y/devilbox-php.ini-xdebug [#866](https://github.com/cytopia/devilbox/issues/866)
15+
- Fixed: Show httpd access logs via docker logs when `DOCKER_LOGS=1` instead of piping it to supervisord [#956](https://github.com/cytopia/devilbox/issues/956)
16+
17+
### Added
18+
- Intranet: Allow to reload PHP-FPM to reflect `php.ini` or `php-fpm.conf` changes on-the-fly without restarting docker-compose
19+
20+
### Changed
21+
- Updated httpd images
22+
- Updated php-fpm images
23+
24+
925
## Release v3.0.0-beta-0.3 (2022-01-02)
1026

1127
This release provides the `dvl.to` domain to be used with `TLD_SUFFIX` (set to default), which eliminates the need to set any entries in `/etc/hosts`, as all of its subdomain will point to `127.0.0.1` via official DNS. Domain has been acquired thanks to awesome sponsors!

cfg/php-ini-5.2/devilbox-php.ini-xdebug

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
;
2121
[PHP]
2222

23-
; Xdebug
23+
; Xdebug (version 2.2.7)
24+
;
2425
; Use these settings to enable Xdebug for PHP
2526
; Make sure to read up on Xdebug some settings might significantly slow down requests.
2627
; The following is just an example configuration and should be adjusted

cfg/php-ini-5.3/devilbox-php.ini-xdebug

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
;
2121
[PHP]
2222

23-
; Xdebug
23+
; Xdebug (version 2.2.7)
24+
;
2425
; Use these settings to enable Xdebug for PHP
2526
; Make sure to read up on Xdebug some settings might significantly slow down requests.
2627
; The following is just an example configuration and should be adjusted

cfg/php-ini-5.4/devilbox-php.ini-xdebug

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
;
2121
[PHP]
2222

23-
; Xdebug
23+
; Xdebug (version 2.4.1)
24+
;
2425
; Use these settings to enable Xdebug for PHP
2526
; Make sure to read up on Xdebug some settings might significantly slow down requests.
2627
; The following is just an example configuration and should be adjusted

cfg/php-ini-5.5/devilbox-php.ini-xdebug

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
;
2121
[PHP]
2222

23-
; Xdebug
23+
; Xdebug (version 2.4.1)
24+
;
2425
; Use these settings to enable Xdebug for PHP
2526
; Make sure to read up on Xdebug some settings might significantly slow down requests.
2627
; The following is just an example configuration and should be adjusted

cfg/php-ini-5.6/devilbox-php.ini-xdebug

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
;
2121
[PHP]
2222

23-
; Xdebug
23+
; Xdebug (version 2.4.1)
24+
;
2425
; Use these settings to enable Xdebug for PHP
2526
; Make sure to read up on Xdebug some settings might significantly slow down requests.
2627
; The following is just an example configuration and should be adjusted

cfg/php-ini-7.0/devilbox-php.ini-xdebug

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
;
2121
[PHP]
2222

23-
; Xdebug
23+
; Xdebug (version 2.9.0)
24+
;
2425
; Use these settings to enable Xdebug for PHP
2526
; Make sure to read up on Xdebug some settings might significantly slow down requests.
2627
; The following is just an example configuration and should be adjusted

cfg/php-ini-7.1/devilbox-php.ini-xdebug

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
;
2121
[PHP]
2222

23-
; Xdebug
23+
; Xdebug (version 2.9.8)
24+
;
2425
; Use these settings to enable Xdebug for PHP
2526
; Make sure to read up on Xdebug some settings might significantly slow down requests.
2627
; The following is just an example configuration and should be adjusted

cfg/php-ini-7.2/devilbox-php.ini-xdebug

+23-7
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,32 @@
2020
;
2121
[PHP]
2222

23-
; Xdebug
24-
; https://3.xdebug.org/docs/upgrade_guide
23+
; Xdebug (version 3.1.6)
24+
; Upgrade Guide: https://3.xdebug.org/docs/upgrade_guide
25+
; Settings Guide: https://xdebug.org/docs/all_settings
26+
;
2527
; Use these settings to enable Xdebug for PHP
2628
; Make sure to read up on Xdebug some settings might significantly slow down requests.
27-
; The following is just an example configuration and should be adjusted
29+
; The following is just an example configuration and should be adjusted.
30+
31+
; Defaults
2832
xdebug.mode = debug
33+
xdebug.remote_handler = dbgp
2934
xdebug.start_with_request = yes
30-
xdebug.remote_handler = dbgp
31-
xdebug.remote_port = 9000
32-
xdebug.idekey = PHPSTORM
33-
xdebug.remote_log = /var/log/php/xdebug.log
35+
;xdebug.start_with_request = trigger
36+
;xdebug.trigger_value = randomkey
37+
38+
; How to connect
39+
xdebug.client_port = 9000
40+
xdebug.client_host = host.docker.internal
41+
xdebug.discover_client_host = 0
42+
43+
; Logging
44+
xdebug.log = /var/log/php/xdebug.log
45+
xdebug.log_level = 7
46+
47+
; IDE Configuration
48+
xdebug.idekey = PHPSTORM
49+
;xdebug.idekey = VSCODE
3450

3551
; vim: set ft=dosini:

0 commit comments

Comments
 (0)