• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Plesk 11.5 extend chroot with MySQL access and /var/www/vhosts/<domain>/httpdocs/

StéphanS

Regular Pleskian
Hi,

when messing around with Drush (a Drupal CLI application that can automate your Drupal deploys) I applied following fixes to my chroots:


To install:

Code:
mkdir -p /var/www/vhosts/<domain>/var/www/vhosts/<domain>/httpdocs/
mount --bind /var/www/vhosts/<domain>/httpdocs/ /var/www/vhosts/<domain>/var/www/vhosts/<domain>/httpdocs/
##Symlink is not an option since Drush knows that it's symlinked and uses /httpdocs/ in it's configs, giving non-working site via http://<domain>/

Code:
mkdir -p /var/www/vhosts/<domain>/var/lib/mysql/
touch /var/www/vhosts/<domain>/var/lib/mysql/mysql.sock
mount --bind /var/lib/mysql/mysql.sock /var/www/vhosts/<domain>/var/lib/mysql/mysql.sock
##Symlink is also not an option since /var/lib/mysql/mysql.sock resides outside of the chroot


To remove:

Code:
umount /var/www/vhosts/<domain>/var/www/vhosts/<domain>/httpdocs/
umount /var/www/vhosts/<domain>/var/lib/mysql/mysql.sock


Would it be possible for Parallels to incorporate these fixes into chrootmng ?



The problem right now, is that when I delete a subscription my mounts remain active and /var/www/vhosts/<domain>/ is not deleted.
Furthermore ftpuser does not get deleted because of failed deletion, resulting in a messy state.

If chrootmng could create the mount for httpdocs and mysql.sock and remove it again before doing all the other deletes, then this would work perfectly!




NOTE: Do _NOT_ bind mount /var/lib/mysql/ !
If you do, you will be deleting all your databases once somebody deletes his domain via Plesk.
This is because Plesk deletes vhosts with root, and can thus delete everything in /var/lib/mysql/ .








Edit:

I created a dirty fix for now:


Code:
/usr/local/src/exec-notify | awk '$10 ~ "--del-user" {system("echo " $12 " | sed -e s@--homedir=@@ -es@/var/www/vhosts/@@ | xargs -I {} sh /root/cleanchroot.sh {}")}'

/root/cleanchroot.sh
Code:
#!/bin/bash

HTTPD_VHOSTS_D=$(awk '$1 = /HTTPD_VHOSTS_D/{print $2}' /etc/psa/psa.conf)


umount $HTTPD_VHOSTS_D/$1/var/lib/mysql/mysql.sock
umount $HTTPD_VHOSTS_D/$1/var/www/vhosts/$1/httpdocs/


echo $1 >> /var/log/cleanchroot.log


exec-notify can be installed using:
Code:
yum -y install make gcc
cd /usr/local/src/
wget http://users.suse.com/~krahmer/exec-notify.c
make exec-notify
 
Last edited:
Back
Top