Page MenuHomePhabricator

Cloud-vagrant: shared directory (/vagrant/settings.d/) seen by CLI PHP only
Open, Needs TriagePublic

Description

After lots of debugging of an apparen wiki misconfiguration issue, I found this that early on when Vagrant loads /var/www/w/dblist.php, and that file calls glob( '/vagrant/settings.d/wikis/dbConf/*dbConf.php' ), /vagrant/settings.d/wikis/dbConf/10-wiki-dbConf.php is not picked up (and so $wgLocalDatabases will be left empty and the site will fail to load). The file looks normal:

vagrant@mediawikivagrant:~$ ls -l /vagrant/settings.d/wikis/dbConf/*dbConf.php
-rw-r--r-- 1 vagrant_share vagrant_share 226 Sep 12 23:12 /vagrant/settings.d/wikis/dbConf/10-wiki-dbConf.php

although I don't quite get why it's owned by vagrant_share, but both the vagrant and www-data users can see it, and accessing it from PHP also works in most contexts (e.g. shell.php, plain CLI, built-in server with php -s). The web-based PHP processes don't see it though:

var_dump(['u' => get_current_user(), 'glob' => glob( '/vagrant/settings.d/wikis/dbConf/*dbConf.php' ), 'c' => file_get_contents('/vagrant/settings.d/wikis/dbConf/10-wiki-dbConf.php') ]);

Warning: file_get_contents(/vagrant/settings.d/wikis/dbConf/10-wiki-dbConf.php): failed to open stream: No such file or directory in /var/www/w/dblist.php on line 9

array (size=3)
  'u' => string 'vagrant' (length=7)
  'glob' => 
    array (size=0)
      empty
  'c' => boolean false

Event Timeline

Tgr created this task.Fri, Oct 4, 9:09 PM
Restricted Application added subscribers: Liuxinyu970226, Aklapper. · View Herald TranscriptFri, Oct 4, 9:09 PM
Tgr added a project: Cloud-VPS.
Tgr renamed this task from Labs-vagrant: /vagrant/settings.d/wikis/dbConf/10-wiki-dbConf.php seen by CLI PHP only to Cloud-vagrant: shared directory (/vagrant/settings.d/) seen by CLI PHP only.Fri, Oct 4, 9:23 PM
Tgr added a comment.Mon, Oct 7, 8:48 AM

Worked around via vagrant config nfs_shares false. But that's slower and NFS worked until know so it would be nice to know what's going on...

Tgr added a comment.Mon, Oct 7, 8:49 AM

(This was for the cloud-vagrant instance running on roebling.wikispore.eqiad.wmflabs, by the way.)

Pharos added a subscriber: Pharos.Mon, Oct 7, 6:23 PM
bd808 added a subscriber: bd808.Mon, Oct 7, 7:09 PM

Probably not related. NFS issues there were with the shared NFS servers that are used for things like $HOME in Toolforge. The NFS here would be the instance providing it's local disk to the Vagrant managed LXC container hosted on the same instance.

This sounds more like the issue we have seen in multiple places where Debian's systemd unit for Apache starts it before the Vagrant managed shared are mounted. This in turn makes lots of things look broken from mod_php's perspective. Usually restarting the apache2 process with something like vagrant ssh -- sudo service apache2 restart fixes it.