5

What is the best way to modify the file paths for a site deployed using Aegir?

Aegir installs sites with the file paths pointing in this format:

sites/<sitename>/files

(This path being relative to the site's platform)

What is the best way to change it to a NAS mount, mounted at, say, /var/nasmount ? For e.g., for a site called firstsite.com, the file paths would be:

/var/nasmount/firstsite.com/files
/var/nasmount/firstsite.com/files/tmp

and so on, along with the the corresponding entries in the site's apache conf file.

These lines appear in /var/aegir/.drush/provision/platform/provision_drupal_settings.tpl.php, but I am reluctant to change here as this is from 'core' Aegir (if you will):

  $conf['file_directory_path'] = 'sites/<?php print $this->uri ?>/files';
  $conf['file_directory_temp'] = 'sites/<?php print $this->uri ?>/files/tmp';

Should this be done in:

  • provision_drupal_settings.tpl.php file above?
  • Somewhere else?

Ideally, this change would be done once so all sites deployed via Aegir have this in place, and these changes survive the re-verify process of a site and/or platform.

Thanks!

3 Answers 3

5

The answer is to mv siltes/firstsite.com/files to /var/nasmount, then create a symbolic link to it.
(from inside your sites/firstsites.com directory, mkdir /var/nasmount/firstsite.com, mv ./files /var/nasmount/firstsite.com, ln -s /var/nasmount/firstsite.com/files files).

I would put this in a script so this becomes a drush command, then make it run at the end of the aegir create a site process.

I'm not an expert of where to put this script and/or how to create it.

2
  • Thanks iStryker, looks like we're heading the sym link route. We tried editing the provision_drupal_settings.tpl.php file but to no avail -- the file paths got over-written.
    – KM.
    Commented Jul 20, 2011 at 0:33
  • I am trying to do the exact same thing. Can anyone please tell me where and in which hook to put this script? Commented Sep 12, 2018 at 11:29
5

Edit /var/aegir/config/includes/global.inc and put in it:

<?php
$conf['file_directory_path'] = '/var/nasmount/<?php print $this->uri ?>/files';
$conf['file_directory_temp'] = '/var/nasmount/<?php print $this->uri ?>/files/tmp';

This will be applied globally to all sites. If you only want to make this change for one or two sites, create a new file called 'local.settings.php' in the site dir (same level as settings.php) and put the change in there.

This is the best way of doing this without hacking templates or messing up your system with symlinks.

See also the documentation at http://community.aegirproject.org/node/71

2
  • Thanks @mig5. We tried this exactly (made the above change, verified the platform, verified the site), and it did not work. It appears that the file paths get overwritten later ... ?
    – KM.
    Commented Aug 1, 2011 at 16:00
  • That should not happen if you edited the global.inc or the local.settings.php (note: not the settings.php) - there is nothing in the Aegir codebase that writes to these files (they are yours to override). If your local.settings.php / global.inc files got overwritten, please open a ticket at drupal.org
    – mig5
    Commented Aug 2, 2011 at 4:18
2

If you edit edit /var/aegir/config/includes/global.inc, as mig5 is proposing, and the sites are running on remote servers (not on Aegir master), then you should additionally verify the remote servers in Aegir, in order to get the changes in /config synchronised on remote servers.

See http://community.aegirproject.org/node/71

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.