Skip to content

Commit

Permalink
allow to specify AIO_COMMUNITY_CONTAINERS
Browse files Browse the repository at this point in the history
Signed-off-by: Simon L <[email protected]>
  • Loading branch information
szaimen committed Sep 27, 2023
1 parent 598faf7 commit 2a74686
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Containers/mastercontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ RUN set -ex; \
chmod +x /usr/local/bin/composer; \
cd /var/www/docker-aio; \
git clone https://github.com/nextcloud-releases/all-in-one.git --depth 1 .; \
find ./ -maxdepth 1 -mindepth 1 -not -path ./php -exec rm -r {} \; ; \
find ./ -maxdepth 1 -mindepth 1 -not -path ./php -not -path ./community-containers -exec rm -r {} \; ; \
chown www-data:www-data -R /var/www/docker-aio; \
cd php; \
sudo -u www-data composer install --no-dev; \
Expand Down
14 changes: 14 additions & 0 deletions Containers/mastercontainer/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,20 @@ It is set to '$NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS'."
exit 1
fi
fi
if [ -n "$AIO_COMMUNITY_CONTAINERS" ]; then
read -ra AIO_CCONTAINERS <<< "$AIO_COMMUNITY_CONTAINERS"
for container in "${AIO_CCONTAINERS[@]}"; do
if ! [ -d "/var/www/docker-aio/community-containers/$container" ]; then
echo "The community container $container was not found!"
FAIL_CCONTAINERS=1
fi
done
if [ -n "$FAIL_CCONTAINERS" ]; then
print_red "You've set AIO_COMMUNITY_CONTAINERS but at least one container was not found.
It is set to '$AIO_COMMUNITY_CONTAINERS'."
exit 1
fi
fi

# Check DNS resolution
# Prevents issues like https://github.com/nextcloud/all-in-one/discussions/565
Expand Down
2 changes: 2 additions & 0 deletions community-containers/readme.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
## This is a WIP and not working yet!

You might want to add additional community containers to the default AIO stack. You can do so by adding `--env AIO_COMMUNITY_CONTAINERS="container1 container2"` to the docker run command of the mastercontainer (but before the last line `nextcloud/all-in-one:latest`! If it was started already, you will need to stop the mastercontainer, remove it (no data will be lost) and recreate it using the docker run command that you initially used) and customize the value to your fitting. It must match the folder names in this directory! ⚠️⚠️⚠️ Please review the folder for documentation on each of the containers before adding them! Not reviewing the documentation for each of them first might break starting the AIO containers because e.g. fail2ban only works on Linux and not on Docker Desktop!
11 changes: 11 additions & 0 deletions php/src/Data/ConfigurationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,17 @@ public function isBackupSectionEnabled() : bool {
}
}

private function GetCommunityContainers() : string {
$envVariableName = 'AIO_COMMUNITY_CONTAINERS';
$configName = 'aio_community_containers';
$defaultValue = '';
return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue);
}

public function GetEnabledCommunityContainers() : array {
return explode(' ', $this->GetCommunityContainers());
}

private function GetEnabledDriDevice() : string {
$envVariableName = 'NEXTCLOUD_ENABLE_DRI_DEVICE';
$configName = 'nextcloud_enable_dri_device';
Expand Down
4 changes: 4 additions & 0 deletions php/src/Data/DataConst.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,8 @@ public static function GetBackupArchivesList() : string {
public static function GetSessionDateFile() : string {
return self::GetDataDirectory() . '/session_date_file';
}

public static function GetCommunityContainersDirectory() : string {
return realpath(__DIR__ . '/../../../community-containers/');
}
}
1 change: 1 addition & 0 deletions tests/QA/060-environmental-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ See https://github.com/nextcloud/all-in-one#how-to-trust-user-defined-certificat
- [ ] When starting the mastercontainer with `--env NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS=inotify`, the resulting Nextcloud container should have the inotify extension installed and not the imagick extension.
- [ ] When starting the mastercontainer with `--env NEXTCLOUD_ENABLE_DRI_DEVICE=true`, the resulting Nextcloud container should have the /dev/dri device mounted into the container. (Only works if a `/dev/dri` device is present on the host)
- [ ] When starting the mastercontainer with `--env NEXTCLOUD_KEEP_DISABLED_APPS=true` it should keep apps in Nextcloud that are disabled in the AIO interface. For example if Collabora is disabled in the AIO interface and you install the richdocuments app in Nextcloud, a restart should not uninstall the richdocuments app in Nextcloud anymore.
- [ ] When starting the mastercontainer with `--env AIO_COMMUNITY_CONTAINERS="fail2ban"`, it should add the fail2ban container to the container stack and show it in the AIO interface as well as start it, etc.

You can now continue with [070-timezone-change.md](./070-timezone-change.md)

0 comments on commit 2a74686

Please sign in to comment.