Unnecessary to use the script – simple setup
-
I didn’t want to have another script to setup and maintain so I tested using bindfs (not bind, get it with apt-get bindfs) and it works perfectly.
sudo bindfs –force-user=”user_name” –force-group=”webserver-group” –perms=u=rwx:g=rwx:o=rx “orig fastcgi cache path” “new folder int he var/cache/ directory”Add it to fstab and you have a persistent connection.
-
This topic was modified 5 months ago by
coldrealms65. Reason: clarity
-
This topic was modified 5 months ago by
-
Hello @coldrealms65,
I tested your approach with the following setup on my gentoo server:
My actual setup have PHP-FPM-USER (as a known WEBSITE-USER or PHP process owner) and WEBSERVER-USER (commonly, nginx or www-data)
Environment:
Web Server: NGINX, configured with FastCGI cache
Source Path: (Original NGINX Cache Path)
/dev/shm/fastcgi-cache-psauxit
FUSE Mount Point (with altered permissions for PHP process owner): This FUSE mount point will be used as the NGINX Cache Path in the NPP plugin settings instead of the original.
/dev/shm/fastcgi-cache-psauxit-mnt
PHP Process Owner: (Also known as the WEBSITE-USER or PHP-FPM-USER)
psauxit
WEBSERVER-USER:
nginx
To complete the setup:
1- Install bindfs via package manager: (vary on your linux distro)
emerge --ask sys-fs/bindfs
2- Create the new FUSE mount directory:
mkdir /dev/shm/fastcgi-cache-psauxit-mnt
3- Set up the bindfs mount with appropriate permissions:
bindfs -u psauxit -g psauxit --perms=u=rwx:g=rwx:o=rx /dev/shm/fastcgi-cache-psauxit /dev/shm/fastcgi-cache-psauxit-mnt
Alternatively make it persistent via
/etc/fstab
:bindfs#/dev/shm/fastcgi-cache-psauxit /dev/shm/fastcgi-cache-psauxit-mnt fuse force-user=psauxit,force-group=psauxit,perms=u=rwx:g=rwx:o=rx 0 0
4- Set
/dev/shm/fastcgi-cache-psauxit-mnt
as a NGINX Cache Path in NPP plugin settings page and test Purge and Preload actions.Your approach works exceptionally well and, in my tests, it’s more stable than the original
inotifywait/setfacl
setup that I scripted it in bash for WP community. I was seeking a more reliable solution, asinotifywait/setfacl
sometimes struggles with responding consistently to rapid file creation events during cache preloading.I will try to automate this approach with bash scripting as much as possible for easy NPP integration.
This is very valuable technical feedback. Thank you!
-
This reply was modified 5 months ago by
Hasan CALISIR. Reason: fix mount path
You are most welcome. I was so excited when I got this to work 🙂
Hello @coldrealms65,
I implemented your bindfs-based approach into a main plugin helper bash script to streamline the setup process for users of the NPP plugin. After thorough testing, I found it more stable than the previous inotifywait/setfacl setup, especially under heavy cache Preloading. So I removed inotifywait/setfacl logic completely and now rely on bindfs appraoch.
I’ve pushed the updates to GitHub with some adjustments for compatibility across different environments. You can check the changes here use bindfs instead of inotifywait/setfacl (thanks to coldrealms65).
Important Note: While testing, I noticed that the latest versions of libfuse and bindfs are not widely available in the official repositories of many Linux distributions—some cutting-edge distros include them so users may need to compile packages manually if encountering issues. To help, I added a version check in the helper script to alert users if their versions might be outdated or incompatible.
Also If you prefer to use the NPP main helper bash script you will be able to manage FUSE re-mount operations directly from plugin STATUS tab.
bash <(curl -Ss https://psaux-it.github.io/install.sh)
Thanks again for your valuable insight!
-
This reply was modified 5 months ago by
- You must be logged in to reply to this topic.