diff options
| author | Ben Fuhrmannek | 2021-02-16 11:16:59 +0100 |
|---|---|---|
| committer | Ben Fuhrmannek | 2021-02-16 11:16:59 +0100 |
| commit | 5484bcb5eb2714e7438927e2566c86a74d7c51af (patch) | |
| tree | b78326d2999397be4c08e06b23209981f82a4ea9 /doc/source/installation.rst | |
| parent | 7ac1e3866ef4f146c6c93a5ca13b9aebb14e936a (diff) | |
| parent | cecfdd808da67be908dbe7144cc8c74dfb3f855e (diff) | |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'doc/source/installation.rst')
| -rw-r--r-- | doc/source/installation.rst | 80 |
1 files changed, 79 insertions, 1 deletions
diff --git a/doc/source/installation.rst b/doc/source/installation.rst index a6b0ff8..c4cc355 100644 --- a/doc/source/installation.rst +++ b/doc/source/installation.rst | |||
| @@ -73,7 +73,85 @@ solvable via: | |||
| 73 | make | 73 | make |
| 74 | 74 | ||
| 75 | 75 | ||
| 76 | Heroku installation | ||
| 77 | ------------------- | ||
| 78 | |||
| 79 | Heroku's official `buildpack <https://github.com/heroku/heroku-buildpack-php/>`_ | ||
| 80 | uses ``Composer`` to install all dependencies required by your PHP application. | ||
| 81 | Careful with the `default set of rules | ||
| 82 | <https://github.com/jvoisin/snuffleupagus/blob/master/config/default.rules>`__, | ||
| 83 | since it might block the composer deployment, leading to the following errors: | ||
| 84 | |||
| 85 | :: | ||
| 86 | |||
| 87 | heroku[web.1]: Starting process with command `vendor/bin/heroku-php-apache2 -F fpm_custom.conf public/` | ||
| 88 | heroku[web.1]: Stopping all processes with SIGTERM | ||
| 89 | app[web.1]: Stopping httpd... | ||
| 90 | app[web.1]: SIGTERM received, attempting graceful shutdown... | ||
| 91 | app[web.1]: Stopping php-fpm... | ||
| 92 | app[web.1]: Shutdown complete. | ||
| 93 | heroku[web.1]: Process exited with status 143 | ||
| 94 | app[web.1]: [heroku-exec] Starting | ||
| 95 | app[web.1]: Unable to determine Composer vendor-dir setting; is 'composer' executable on path or 'composer.phar' in current working directory? | ||
| 96 | heroku[web.1]: Process exited with status 1 | ||
| 97 | heroku[web.1]: State changed from starting to crashed | ||
| 98 | |||
| 99 | Requirements | ||
| 100 | ^^^^^^^^^^^^ | ||
| 101 | |||
| 102 | To install snuffleupagus on heroku, simply follow the `documentation <https://devcenter.heroku.com/articles/php-support#custom-compile-step>`_, | ||
| 103 | and edit the ``composer.json`` file, as well as the ``Procfile`` to load the additional PHP-FPM configuration. | ||
| 104 | |||
| 105 | composer.json | ||
| 106 | """"""""""""" | ||
| 107 | |||
| 108 | :: | ||
| 109 | |||
| 110 | { | ||
| 111 | "require": { | ||
| 112 | "php": "~7.4.6" | ||
| 113 | }, | ||
| 114 | "config": { | ||
| 115 | "platform": { | ||
| 116 | "php": "7.4.6" | ||
| 117 | } | ||
| 118 | }, | ||
| 119 | "scripts": { | ||
| 120 | "compile": [ | ||
| 121 | "git clone https://github.com/jvoisin/snuffleupagus /tmp/snuffleupagus", | ||
| 122 | "cd /tmp/snuffleupagus/src && phpize && ./configure --enable-snuffleupagus && make && make install", | ||
| 123 | "echo 'extension=snuffleupagus.so\nsp.allow_broken_configuration=on\nsp.configuration_file=/dev/null' > /app/.heroku/php/etc/php/conf.d/999-ext-snuffleupagus.ini" | ||
| 124 | ] | ||
| 125 | } | ||
| 126 | } | ||
| 127 | |||
| 128 | This configuration will compile Snuffleupagus to shared library, install it to the proper | ||
| 129 | location and specify an empty configuration in ``sp.configuration_file`` to ensure | ||
| 130 | that the ``composer`` deployment phase won't get killed by some rules. | ||
| 131 | |||
| 132 | PHP-FPM | ||
| 133 | """"""" | ||
| 134 | |||
| 135 | :: | ||
| 136 | |||
| 137 | ; ext-snuffleupagus | ||
| 138 | php_admin_flag[sp.allow_broken_configuration] = off | ||
| 139 | php_admin_value[sp.configuration_file] = /app/default.rules | ||
| 140 | |||
| 141 | The final step is to point ``sp.configuration_file`` to a rule set by setting | ||
| 142 | the preference in an additional `PHP-FPM | ||
| 143 | configuration <https://devcenter.heroku.com/articles/custom-php-settings#php-fpm-configuration-include>`_. | ||
| 144 | |||
| 145 | You should now be running Snuffleupagus in PHP on heroku: | ||
| 146 | |||
| 147 | :: | ||
| 148 | |||
| 149 | app[web.1]: [05-Jul-2020 07:45:22 UTC] PHP Fatal error: [snuffleupagus][0.0.0.0][disabled_function] Aborted execution on call of the function 'exec', because its argument '$command' content (id;whoami) matched a rule in /app/public/test2.php on line 1 | ||
| 150 | app[web.1]: 10.9.226.141 - - [05/Jul/2020:07:45:22 +0000] "GET /test2.php?cmd=id;whoami HTTP/1.1" 500 - "-" "curl/7.68.0 | ||
| 151 | heroku[router]: at=info method=GET path="/test2.php?cmd=id;whoami" host=heroku-x-snuffleupagus.herokuapp.com request_id=012345678-9012-3456-7890-123456789012 fwd="1.2.3.4" dyno=web.1 connect=0ms service=7ms status=500 bytes=169 protocol=http | ||
| 152 | |||
| 153 | |||
| 76 | Upgrading | 154 | Upgrading |
| 77 | --------- | 155 | --------- |
| 78 | 156 | ||
| 79 | Upgrading the Snuffleupagus is as simple as recompiling it (or using a binary), replacing the file and restarting your webserver. | 157 | Upgrading Snuffleupagus is as simple as recompiling it (or using a binary), replacing the file and restarting your webserver. |
