php-spx support #719
Replies: 6 comments 4 replies
-
Here are the instructions that I did: Installing php-spx extension
# opening warden shell in our project
warden shell
# logging in as a root user
sudo su -
# installing all needed dependencies to build php-spx
yum install php-devel
# going to temp diretory
cd /tmp/
# installing php-spx extensino
git clone https://github.com/NoiseByNorthwest/php-spx.git
cd php-spx/
phpize
./configure
make
sudo make install
# enabling php-spx php extension & configuring it
cat - <<EOF > /etc/php.d/99-spx.ini
extension=spx.so
spx.debug=1
spx.http_enabled=1
spx.http_ip_whitelist="*"
spx.http_key="dev"
spx.http_trusted_proxies=REMOTE_ADDR
EOF After running all these commands, we should log out from the root user and from the warden shell (2 times type
warden env restart php-fpm Great! We did it! Let's check if it works fine:
Opening control panelhttps://mydomain.test/?SPX_KEY=dev&SPX_UI_URI=/ (replace UsageBasic usage is shown there: CLI usage exampleAs an example, you can run the following command inside your SPX_ENABLED=1 php bin/magento cache:flush full_page If you want to generate a full report (that will be available through web UI), you should also add SPX_ENABLED=1 SPX_REPORT=full php bin/magento cache:flush full_page Browser usage exampleFor generating report from the browser, you should:
Opening a full reportSince we have a Varnish, which caches all requests to SPX (for retrieving list of profiles), we have 2 options: Flush varnish cache & view the list in the SPX control panel
warden env exec -T varnish varnishadm 'ban req.url ~ .'
Manually retrieve the list of profiles
ls -l /tmp/spx/ Example output:
Each profile will have a
|
Beta Was this translation helpful? Give feedback.
-
Great job, nice tool 👍 I would love to see this as part of the base warden :) For now you can always add your own images in project's Dockerfile, which should be better option, since every time you rebuild your image, you will loose extension. This is example of installing SPX on 8.2 fpm-debug and fpm images:
Downside of this approach is that after pulling new image version you have to run |
Beta Was this translation helpful? Give feedback.
-
I've created a PR to build the images and give NGINX and Varnish support for SPX. There's still leg-work to be done on the warden side of things, but this will at least start building the base SPX image. |
Beta Was this translation helpful? Give feedback.
-
Where are we at regarding php-spx support? |
Beta Was this translation helpful? Give feedback.
-
+1 for this, been using the following shell script to bootstrap SPX into the current warden environment, as and when needed. Be nice to have a feature flag in the ENV Essentially Ihor's steps with a added Varnish cache bypass |
Beta Was this translation helpful? Give feedback.
-
@navarr Given the current state of PHP images being built, you think this is good to look at merging now? |
Beta Was this translation helpful? Give feedback.
-
It would be nice to see the support of https://github.com/NoiseByNorthwest/php-spx in Warden for profiling web requests.
It might be some built-in feature or just an instruction.
Maybe someone is already using it?
Beta Was this translation helpful? Give feedback.
All reactions