mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-19 22:16:49 +00:00
allow to run this behind a reverse proxy
Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
parent
704c4ad331
commit
6e9261f306
10 changed files with 84 additions and 9 deletions
|
|
@ -10,17 +10,18 @@
|
|||
"displayName": "Apache",
|
||||
"containerName": "nextcloud/aio-apache",
|
||||
"ports": [
|
||||
"443/tcp"
|
||||
"%APACHE_PORT%/tcp"
|
||||
],
|
||||
"internalPorts": [
|
||||
"443"
|
||||
"%APACHE_PORT%"
|
||||
],
|
||||
"secrets": [],
|
||||
"environmentVariables": [
|
||||
"NC_DOMAIN=%NC_DOMAIN%",
|
||||
"NEXTCLOUD_HOST=nextcloud-aio-nextcloud",
|
||||
"COLLABORA_HOST=nextcloud-aio-collabora",
|
||||
"TALK_HOST=nextcloud-aio-talk"
|
||||
"TALK_HOST=nextcloud-aio-talk",
|
||||
"APACHE_PORT=%APACHE_PORT%"
|
||||
],
|
||||
"volumes": [
|
||||
{
|
||||
|
|
@ -276,11 +277,12 @@
|
|||
"displayName": "Domaincheck",
|
||||
"containerName": "nextcloud/aio-domaincheck",
|
||||
"ports": [
|
||||
"443/tcp"
|
||||
"%APACHE_PORT%/tcp"
|
||||
],
|
||||
"internalPorts": [],
|
||||
"environmentVariables": [
|
||||
"INSTANCE_ID=%INSTANCE_ID%"
|
||||
"INSTANCE_ID=%INSTANCE_ID%",
|
||||
"APACHE_PORT=%APACHE_PORT%"
|
||||
],
|
||||
"volumes": [],
|
||||
"secrets": [
|
||||
|
|
|
|||
|
|
@ -51,11 +51,17 @@ class ContainerDefinitionFetcher
|
|||
foreach ($data['production'] as $entry) {
|
||||
$ports = new ContainerPorts();
|
||||
foreach ($entry['ports'] as $port) {
|
||||
if($port === '%APACHE_PORT%/tcp') {
|
||||
$port = $this->configurationManager->GetApachePort() . '/tcp';
|
||||
}
|
||||
$ports->AddPort($port);
|
||||
}
|
||||
|
||||
$internalPorts = new ContainerInternalPorts();
|
||||
foreach ($entry['internalPorts'] as $internalPort) {
|
||||
if($internalPort === '%APACHE_PORT%') {
|
||||
$internalPort = $this->configurationManager->GetApachePort();
|
||||
}
|
||||
$internalPorts->AddInternalPort($internalPort);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -148,8 +148,16 @@ class ConfigurationManager
|
|||
// Get Instance ID
|
||||
$instanceID = $this->GetSecret('INSTANCE_ID');
|
||||
|
||||
// set protocol
|
||||
$port = $this->GetApachePort();
|
||||
if ($port !== '443') {
|
||||
$protocol = 'https://';
|
||||
} else {
|
||||
$protocol = 'http://';
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL,'http://' . $domain . ':443');
|
||||
curl_setopt($ch, CURLOPT_URL, $protocol . $domain . ':443');
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$response = (string)curl_exec($ch);
|
||||
# Get rid of trailing \n
|
||||
|
|
@ -232,6 +240,29 @@ class ConfigurationManager
|
|||
$this->WriteConfig($config);
|
||||
}
|
||||
|
||||
public function GetApachePort() : string {
|
||||
$port = getenv('APACHE_PORT');
|
||||
if ($port === false) {
|
||||
$config = $this->GetConfig();
|
||||
if (!isset($config['apache_port']) || $config['apache_port'] === '') {
|
||||
$config['apache_port'] = '443';
|
||||
}
|
||||
return $config['apache_port'];
|
||||
} else {
|
||||
if(file_exists(DataConst::GetConfigFile())) {
|
||||
$config = $this->GetConfig();
|
||||
if (!isset($config['apache_port'])) {
|
||||
$config['apache_port'] = '';
|
||||
}
|
||||
if ($port !== $config['apache_port']) {
|
||||
$config['apache_port'] = $port;
|
||||
$this->WriteConfig($config);
|
||||
}
|
||||
}
|
||||
return $port;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws InvalidSettingConfigurationException
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -214,6 +214,8 @@ class DockerActionManager
|
|||
$replacements[1] = $this->configurationManager->GetAIOURL();
|
||||
} elseif ($out[1] === 'SELECTED_RESTORE_TIME') {
|
||||
$replacements[1] = $this->configurationManager->GetSelectedRestoreTime();
|
||||
} elseif ($out[1] === 'APACHE_PORT') {
|
||||
$replacements[1] = $this->configurationManager->GetApachePort();
|
||||
} else {
|
||||
$replacements[1] = $this->configurationManager->GetSecret($out[1]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue