fiveai / Cachet

📛 An open source status page system for everyone.
https://cachethq.io
BSD 3-Clause "New" or "Revised" License
101 stars 28 forks source link

Add support for chroot'ed environments #41

Open h3artbl33d opened 3 years ago

h3artbl33d commented 3 years ago

Thank you tremendously for continuing Cachet development :) I'd like to add a feature request, if you are open for it. I do miss a setting in .env or a configurable setting to support the chroot functionality of PHP-FPM.

FPM supports setting a custom chroot - but the CLI interpreter doesn't support this functionality. However, using CLI is required to install Cachet, to run artisan and it's the interpreter used with cron. This discrepancy between the two interpreters break the application.

Example:

In this example, accessing Cachet from the webbrowser fires up FPM which tries to pull includes from /var/www/var/www/cachet/ - and thus throws an internal server error.

Proposed fix:

The ability to define the chroot in .env - in conjunction with detecting which interpreter is used (if that option is not set to null) gives Cachet the ability to run from chroot environments. In the above example, that prefix would be /var/www - which boils down to this path definition:

'path' => ((php_sapi_name() == 'cli') ? '/var/www' : '') . '/cachet/storage',

I hope this makes sense :)

sedan07 commented 3 years ago

@h3artbl33d thanks for the issue. Good idea :+1: , i'll look into this.

h3artbl33d commented 3 years ago

Awesome, thank you :D