Commit 990dd877 authored by Jon Pugh's avatar Jon Pugh

Add web_user and web_user_uid as console config so we can chgrp on the host...

Add web_user and web_user_uid as console config so we can chgrp on the host and use the UID for setting www-data UID inside the container.
parent e7e6c899
......@@ -51,6 +51,9 @@ class Config extends ProvisionConfig
$this->set('aegir_root', $this->getHomeDir());
$this->set('script_user', $this->getScriptUser());
$this->set('script_uid', $this->getScriptUid());
$this->set('web_user', $this->getWebUser());
$this->set('web_user_uid', $this->getWebUserUid());
// If user has a ~/.config path, use it.
if (file_exists($this->getHomeDir() . '/.config')) {
......@@ -142,8 +145,8 @@ class Config extends ProvisionConfig
);
}
}
/**
* Get the name of the source for this configuration object.
*
......@@ -244,4 +247,19 @@ class Config extends ProvisionConfig
static public function getScriptUid() {
return posix_getuid();
}
/**
* Return the UID of the discovered web user group on the current system.
*/
static public function getWebUser() {
return Provision::defaultWebGroup();
}
/**
* Return the UID of the discovered web user group on the current system.
*/
static public function getWebUserUid() {
$info = posix_getpwnam(Provision::defaultWebGroup());
return $info['uid'];
}
}
......@@ -152,11 +152,11 @@ class SiteContext extends ContextSubscriber implements ConfigurationInterface
// @TODO: chgrp only works when running locally with apache.
// @TODO: Figure out a way to store host web group vs container web group, and get it working with docker web service.
// @TODO: Might want to do chgrp verification inside container?
if ($this->platform->getService('http')->getType() == 'apache' || $this->platform->getService('http')->getType() == 'nginx') {
$this->fs->chgrp([
"$site_path/files",
], $this->platform->getService('http')->provider->getProperty('web_group'));
}
$this->fs->chgrp([
"$site_path/files",
], $this->getProvision()->getConfig()->get('web_user'));
// Copy Drupal's default settings.php file into place.
$this->fs->copy("$docroot/sites/default/default.settings.php", "$site_path/settings.php");
$this->fs->chmod("$site_path/settings.php", 02770);
......
......@@ -287,7 +287,8 @@ YML;
'context' => __DIR__ . DIRECTORY_SEPARATOR . 'ApacheDocker',
'dockerfile' => 'http.Dockerfile',
'args' => [
"AEGIR_UID" => $this->getProvision()->getConfig()->get('aegir_uid'),
"AEGIR_UID" => $this->getProvision()->getConfig()->get('script_uid'),
"APACHE_UID" => $this->getProvision()->getConfig()->get('web_user_uid'),
"AEGIR_SERVER_NAME" => $this->provider->name,
],
],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment