Merge pull request #793 from nextcloud/enh/734/talk-port

allow to adjust the talk port
This commit is contained in:
Simon L 2022-07-04 14:21:35 +02:00 committed by GitHub
commit a26d36c084
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 50 additions and 15 deletions

View file

@ -114,6 +114,22 @@ It is set to '$APACHE_PORT'."
exit 1 exit 1
fi fi
fi fi
if [ -n "$TALK_PORT" ]; then
if ! check_if_number "$TALK_PORT"; then
echo "You provided an Talk port but did not only use numbers.
It is set to '$TALK_PORT'."
exit 1
elif ! [ "$TALK_PORT" -le 65535 ] || ! [ "$TALK_PORT" -ge 1 ]; then
echo "The provided Talk port is invalid. It must be between 1 and 65535"
exit 1
fi
fi
if [ -n "$APACHE_PORT" ] && [ -n "$TALK_PORT" ]; then
if [ "$APACHE_PORT" = "$TALK_PORT" ]; then
echo "APACHE_PORT and TALK_PORT are not allowed to be equal."
exit 1
fi
fi
if [ -n "$DOCKER_SOCKET_PATH" ]; then if [ -n "$DOCKER_SOCKET_PATH" ]; then
if ! echo "$DOCKER_SOCKET_PATH" | grep -q "^/" || echo "$DOCKER_SOCKET_PATH" | grep -q "/$"; then if ! echo "$DOCKER_SOCKET_PATH" | grep -q "^/" || echo "$DOCKER_SOCKET_PATH" | grep -q "/$"; then
echo "You've set DOCKER_SOCKET_PATH but not to an allowed value. echo "You've set DOCKER_SOCKET_PATH but not to an allowed value.

View file

@ -360,8 +360,8 @@ if [ "$TALK_ENABLED" = 'yes' ]; then
else else
php /var/www/html/occ app:update spreed php /var/www/html/occ app:update spreed
fi fi
STUN_SERVERS="[\"$NC_DOMAIN:3478\"]" STUN_SERVERS="[\"$NC_DOMAIN:$TALK_PORT\"]"
TURN_SERVERS="[{\"server\":\"$NC_DOMAIN:3478\",\"secret\":\"$TURN_SECRET\",\"protocols\":\"udp,tcp\"}]" TURN_SERVERS="[{\"server\":\"$NC_DOMAIN:$TALK_PORT\",\"secret\":\"$TURN_SECRET\",\"protocols\":\"udp,tcp\"}]"
SIGNALING_SERVERS="{\"servers\":[{\"server\":\"https://$NC_DOMAIN/standalone-signaling/\",\"verify\":true}],\"secret\":\"$SIGNALING_SECRET\"}" SIGNALING_SERVERS="{\"servers\":[{\"server\":\"https://$NC_DOMAIN/standalone-signaling/\",\"verify\":true}],\"secret\":\"$SIGNALING_SECRET\"}"
php /var/www/html/occ config:app:set spreed stun_servers --value="$STUN_SERVERS" --output json php /var/www/html/occ config:app:set spreed stun_servers --value="$STUN_SERVERS" --output json
php /var/www/html/occ config:app:set spreed turn_servers --value="$TURN_SERVERS" --output json php /var/www/html/occ config:app:set spreed turn_servers --value="$TURN_SERVERS" --output json

View file

@ -1,7 +1,5 @@
FROM ubuntu:focal-20220531 FROM ubuntu:focal-20220531
EXPOSE 3478
RUN set -ex; \ RUN set -ex; \
\ \
apt-get update; \ apt-get update; \

View file

@ -17,7 +17,7 @@ fi
# Turn # Turn
cat << TURN_CONF > "/etc/turnserver.conf" cat << TURN_CONF > "/etc/turnserver.conf"
listening-port=3478 listening-port=$TALK_PORT
fingerprint fingerprint
lt-cred-mech lt-cred-mech
use-auth-secret use-auth-secret
@ -36,8 +36,8 @@ set -x
sed -i "s|#turn_rest_api_key.*|turn_rest_api_key = \"$JANUS_API_KEY\"|" /etc/janus/janus.jcfg sed -i "s|#turn_rest_api_key.*|turn_rest_api_key = \"$JANUS_API_KEY\"|" /etc/janus/janus.jcfg
sed -i "s|#full_trickle.*|full_trickle = true|g" /etc/janus/janus.jcfg sed -i "s|#full_trickle.*|full_trickle = true|g" /etc/janus/janus.jcfg
sed -i 's|#stun_server.*|stun_server = "127.0.0.1"|g' /etc/janus/janus.jcfg sed -i 's|#stun_server.*|stun_server = "127.0.0.1"|g' /etc/janus/janus.jcfg
sed -i "s|#stun_port.*|stun_port = 3478|g" /etc/janus/janus.jcfg sed -i "s|#stun_port.*|stun_port = $TALK_PORT|g" /etc/janus/janus.jcfg
sed -i "s|#turn_port.*|turn_port = 3478|g" /etc/janus/janus.jcfg sed -i "s|#turn_port.*|turn_port = $TALK_PORT|g" /etc/janus/janus.jcfg
sed -i 's|#turn_server.*|turn_server = "127.0.0.1"|g'/etc/janus/janus.jcfg sed -i 's|#turn_server.*|turn_server = "127.0.0.1"|g'/etc/janus/janus.jcfg
sed -i 's|#turn_type .*|turn_type = "udp"|g' /etc/janus/janus.jcfg sed -i 's|#turn_type .*|turn_type = "udp"|g' /etc/janus/janus.jcfg
sed -i 's|#ice_ignore_list .*|ice_ignore_list = "udp"|g' /etc/janus/janus.jcfg sed -i 's|#ice_ignore_list .*|ice_ignore_list = "udp"|g' /etc/janus/janus.jcfg
@ -80,7 +80,7 @@ url = ws://127.0.0.1:8188
[turn] [turn]
apikey = ${JANUS_API_KEY} apikey = ${JANUS_API_KEY}
secret = ${TURN_SECRET} secret = ${TURN_SECRET}
servers = turn:$NC_DOMAIN:3478?transport=tcp,turn:$NC_DOMAIN:3478?transport=udp servers = turn:$NC_DOMAIN:$TALK_PORT?transport=tcp,turn:$NC_DOMAIN:$TALK_PORT?transport=udp
SIGNALING_CONF SIGNALING_CONF
exec "$@" exec "$@"

View file

@ -18,6 +18,7 @@ services:
- 8443:8443 # Can be removed when running behind a reverse proxy. See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md - 8443:8443 # Can be removed when running behind a reverse proxy. See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
# environment: # Is needed when using any of the options below # environment: # Is needed when using any of the options below
# - APACHE_PORT=11000 # Is needed when running behind a reverse proxy. See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md # - APACHE_PORT=11000 # Is needed when running behind a reverse proxy. See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
# - TALK_PORT=3478 # This allows to adjust the port that the talk container is using.
# - NEXTCLOUD_DATADIR=/mnt/ncdata # Allows to set the host directory for Nextcloud's datadir. See https://github.com/nextcloud/all-in-one#how-to-change-the-default-location-of-nextclouds-datadir # - NEXTCLOUD_DATADIR=/mnt/ncdata # Allows to set the host directory for Nextcloud's datadir. See https://github.com/nextcloud/all-in-one#how-to-change-the-default-location-of-nextclouds-datadir
# - NEXTCLOUD_MOUNT=/mnt/ # Allows the Nextcloud container to access the chosen directory on the host. See https://github.com/nextcloud/all-in-one#how-to-allow-the-nextcloud-container-to-access-directories-on-the-host # - NEXTCLOUD_MOUNT=/mnt/ # Allows the Nextcloud container to access the chosen directory on the host. See https://github.com/nextcloud/all-in-one#how-to-allow-the-nextcloud-container-to-access-directories-on-the-host
# - DOCKER_SOCKET_PATH=/var/run/docker.sock # Needs to be specified if the docker socket on the host is not located in the default '/var/run/docker.sock'. Otherwise mastercontainer updates will fail. # - DOCKER_SOCKET_PATH=/var/run/docker.sock # Needs to be specified if the docker socket on the host is not located in the default '/var/run/docker.sock'. Otherwise mastercontainer updates will fail.

View file

@ -63,6 +63,7 @@ sed -i 's|NEXTCLOUD_DATADIR=|NEXTCLOUD_DATADIR=nextcloud_aio_nextcloud_data
sed -i 's|NEXTCLOUD_MOUNT=|NEXTCLOUD_MOUNT=/mnt/ # This allows the Nextcloud container to access directories on the host. It must never be equal to the value of NEXTCLOUD_DATADIR!|' sample.conf sed -i 's|NEXTCLOUD_MOUNT=|NEXTCLOUD_MOUNT=/mnt/ # This allows the Nextcloud container to access directories on the host. It must never be equal to the value of NEXTCLOUD_DATADIR!|' sample.conf
sed -i 's|DAILY_BACKUP_RUNNING=|DAILY_BACKUP_RUNNING=no # When setting to yes, it will automatically update all installed Nextcloud apps upon container startup.|' sample.conf sed -i 's|DAILY_BACKUP_RUNNING=|DAILY_BACKUP_RUNNING=no # When setting to yes, it will automatically update all installed Nextcloud apps upon container startup.|' sample.conf
sed -i 's|APACHE_PORT=|APACHE_PORT=443 # Changing this to a different value than 443 will allow you to run it behind a reverse proxy.|' sample.conf sed -i 's|APACHE_PORT=|APACHE_PORT=443 # Changing this to a different value than 443 will allow you to run it behind a reverse proxy.|' sample.conf
sed -i 's|TALK_PORT=|TALK_PORT=3478 # This allows to adjust the port that the talk container is using.|' sample.conf
sed -i 's|AIO_TOKEN=|AIO_TOKEN=123456 # Has no function but needs to be set!|' sample.conf sed -i 's|AIO_TOKEN=|AIO_TOKEN=123456 # Has no function but needs to be set!|' sample.conf
sed -i 's|AIO_URL=|AIO_URL=localhost # Has no function but needs to be set!|' sample.conf sed -i 's|AIO_URL=|AIO_URL=localhost # Has no function but needs to be set!|' sample.conf
sed -i 's|NC_DOMAIN=|NC_DOMAIN=yourdomain.com # TODO! Needs to be changed to the domain that you want to use for Nextcloud.|' sample.conf sed -i 's|NC_DOMAIN=|NC_DOMAIN=yourdomain.com # TODO! Needs to be changed to the domain that you want to use for Nextcloud.|' sample.conf

View file

@ -139,7 +139,8 @@
"TALK_ENABLED=%TALK_ENABLED%", "TALK_ENABLED=%TALK_ENABLED%",
"ONLYOFFICE_HOST=nextcloud-aio-onlyoffice", "ONLYOFFICE_HOST=nextcloud-aio-onlyoffice",
"DAILY_BACKUP_RUNNING=%DAILY_BACKUP_RUNNING%", "DAILY_BACKUP_RUNNING=%DAILY_BACKUP_RUNNING%",
"TZ=%TIMEZONE%" "TZ=%TIMEZONE%",
"TALK_PORT=%TALK_PORT%"
], ],
"maxShutdownTime": 10, "maxShutdownTime": 10,
"restartPolicy": "unless-stopped" "restartPolicy": "unless-stopped"
@ -190,18 +191,19 @@
"displayName": "Talk", "displayName": "Talk",
"containerName": "nextcloud/aio-talk", "containerName": "nextcloud/aio-talk",
"ports": [ "ports": [
"3478/tcp", "%TALK_PORT%/tcp",
"3478/udp" "%TALK_PORT%/udp"
], ],
"internalPorts": [ "internalPorts": [
"3478" "%TALK_PORT%"
], ],
"environmentVariables": [ "environmentVariables": [
"NC_DOMAIN=%NC_DOMAIN%", "NC_DOMAIN=%NC_DOMAIN%",
"TURN_SECRET=%TURN_SECRET%", "TURN_SECRET=%TURN_SECRET%",
"SIGNALING_SECRET=%SIGNALING_SECRET%", "SIGNALING_SECRET=%SIGNALING_SECRET%",
"JANUS_API_KEY=%JANUS_API_KEY%", "JANUS_API_KEY=%JANUS_API_KEY%",
"TZ=%TIMEZONE%" "TZ=%TIMEZONE%",
"TALK_PORT=%TALK_PORT%"
], ],
"volumes": [], "volumes": [],
"secrets": [ "secrets": [

View file

@ -98,6 +98,7 @@ $app->get('/containers', function ($request, $response, $args) use ($container)
'is_daily_backup_running' => $configurationManager->isDailyBackupRunning(), 'is_daily_backup_running' => $configurationManager->isDailyBackupRunning(),
'timezone' => $configurationManager->GetTimezone(), 'timezone' => $configurationManager->GetTimezone(),
'skip_domain_validation' => $configurationManager->shouldDomainValidationBeSkipped(), 'skip_domain_validation' => $configurationManager->shouldDomainValidationBeSkipped(),
'talk_port' => $configurationManager->GetTalkPort(),
]); ]);
})->setName('profile'); })->setName('profile');
$app->get('/login', function ($request, $response, $args) use ($container) { $app->get('/login', function ($request, $response, $args) use ($container) {

View file

@ -71,6 +71,10 @@ class ContainerDefinitionFetcher
foreach ($entry['ports'] as $port) { foreach ($entry['ports'] as $port) {
if($port === '%APACHE_PORT%/tcp') { if($port === '%APACHE_PORT%/tcp') {
$port = $this->configurationManager->GetApachePort() . '/tcp'; $port = $this->configurationManager->GetApachePort() . '/tcp';
} elseif($port === '%TALK_PORT%/tcp') {
$port = $this->configurationManager->GetTalkPort() . '/tcp';
} elseif($port === '%TALK_PORT%/udp') {
$port = $this->configurationManager->GetTalkPort() . '/udp';
} }
$ports->AddPort($port); $ports->AddPort($port);
} }
@ -79,6 +83,8 @@ class ContainerDefinitionFetcher
foreach ($entry['internalPorts'] as $internalPort) { foreach ($entry['internalPorts'] as $internalPort) {
if($internalPort === '%APACHE_PORT%') { if($internalPort === '%APACHE_PORT%') {
$internalPort = $this->configurationManager->GetApachePort(); $internalPort = $this->configurationManager->GetApachePort();
} elseif($internalPort === '%TALK_PORT%') {
$internalPort = $this->configurationManager->GetTalkPort();
} }
$internalPorts->AddInternalPort($internalPort); $internalPorts->AddInternalPort($internalPort);
} }

View file

@ -395,6 +395,13 @@ class ConfigurationManager
return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue);
} }
public function GetTalkPort() : string {
$envVariableName = 'TALK_PORT';
$configName = 'talk_port';
$defaultValue = '3478';
return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue);
}
/** /**
* @throws InvalidSettingConfigurationException * @throws InvalidSettingConfigurationException
*/ */

View file

@ -250,6 +250,8 @@ class DockerActionManager
$replacements[1] = $this->configurationManager->GetSelectedRestoreTime(); $replacements[1] = $this->configurationManager->GetSelectedRestoreTime();
} elseif ($out[1] === 'APACHE_PORT') { } elseif ($out[1] === 'APACHE_PORT') {
$replacements[1] = $this->configurationManager->GetApachePort(); $replacements[1] = $this->configurationManager->GetApachePort();
} elseif ($out[1] === 'TALK_PORT') {
$replacements[1] = $this->configurationManager->GetTalkPort();
} elseif ($out[1] === 'NEXTCLOUD_MOUNT') { } elseif ($out[1] === 'NEXTCLOUD_MOUNT') {
$replacements[1] = $this->configurationManager->GetNextcloudMount(); $replacements[1] = $this->configurationManager->GetNextcloudMount();
} elseif ($out[1] === 'BACKUP_RESTORE_PASSWORD') { } elseif ($out[1] === 'BACKUP_RESTORE_PASSWORD') {

View file

@ -438,9 +438,9 @@
<input type="checkbox" id="collabora" name="collabora"><label for="collabora">Collabora (Nextcloud Office)</label><br> <input type="checkbox" id="collabora" name="collabora"><label for="collabora">Collabora (Nextcloud Office)</label><br>
{% endif %} {% endif %}
{% if is_talk_enabled == true %} {% if is_talk_enabled == true %}
<input type="checkbox" id="talk" name="talk" checked="checked"><label for="talk">Nextcloud Talk (needs ports 3478/TCP and 3478/UDP open in your firewall/router)</label><br><br> <input type="checkbox" id="talk" name="talk" checked="checked"><label for="talk">Nextcloud Talk (needs ports {{ talk_port }}/TCP and {{ talk_port }}/UDP open in your firewall/router)</label><br><br>
{% else %} {% else %}
<input type="checkbox" id="talk" name="talk"><label for="talk">Nextcloud Talk (needs ports 3478/TCP and 3478/UDP open in your firewall/router)</label><br><br> <input type="checkbox" id="talk" name="talk"><label for="talk">Nextcloud Talk (needs ports {{ talk_port }}/TCP and {{ talk_port }}/UDP open in your firewall/router)</label><br><br>
{% endif %} {% endif %}
{% if is_onlyoffice_enabled == true %} {% if is_onlyoffice_enabled == true %}
<input type="checkbox" id="onlyoffice" name="onlyoffice" checked="checked"><label for="onlyoffice">OnlyOffice (only supported on x64)</label><br> <input type="checkbox" id="onlyoffice" name="onlyoffice" checked="checked"><label for="onlyoffice">OnlyOffice (only supported on x64)</label><br>

View file

@ -1,6 +1,7 @@
# Environmental variables # Environmental variables
- [ ] When starting the mastercontainer with `-e APACHE_PORT=11000` on a clean instance, the domaincheck container should be started with that same port published. That makes sure that also the Apache container will use that port later on. Using a value here that is not a port will not allow the mastercontainer to start correctly. - [ ] When starting the mastercontainer with `-e APACHE_PORT=11000` on a clean instance, the domaincheck container should be started with that same port published. That makes sure that also the Apache container will use that port later on. Using a value here that is not a port will not allow the mastercontainer to start correctly.
- [ ] When starting the mastercontainer with `-e TALK_PORT=3479` on a clean instance, the talk container should use this port later on. Using a value here that is not a port will not allow the mastercontainer to start correctly. Also it should stop if apache_port and talk_port are set to the same value.
- [ ] Make also sure that reverse proxies work by following https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md#reverse-proxy-documentation and following [001-initial-setup.md](./001-initial-setup.md) and [002-new-instance.md](./002-new-instance.md) - [ ] Make also sure that reverse proxies work by following https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md#reverse-proxy-documentation and following [001-initial-setup.md](./001-initial-setup.md) and [002-new-instance.md](./002-new-instance.md)
- [ ] When starting the mastercontainer with `-e SKIP_DOMAIN_VALIDATION=true` on a clean instance, it should skip the domain verification. So it should accept any domain that you type in then. - [ ] When starting the mastercontainer with `-e SKIP_DOMAIN_VALIDATION=true` on a clean instance, it should skip the domain verification. So it should accept any domain that you type in then.
- [ ] When starting the mastercontainer with `-e NEXTCLOUD_DATADIR="/mnt/testdata"` it should map that location from `/mnt/testdata` to `/mnt/ncdata` inside the Nextcloud container. Not having adjusted the permissions correctly before starting the Nextcloud container the first time will not allow the Nextcloud container to start correctly. See https://github.com/nextcloud/all-in-one#how-to-change-the-default-location-of-nextclouds-datadir for allowed values. - [ ] When starting the mastercontainer with `-e NEXTCLOUD_DATADIR="/mnt/testdata"` it should map that location from `/mnt/testdata` to `/mnt/ncdata` inside the Nextcloud container. Not having adjusted the permissions correctly before starting the Nextcloud container the first time will not allow the Nextcloud container to start correctly. See https://github.com/nextcloud/all-in-one#how-to-change-the-default-location-of-nextclouds-datadir for allowed values.