Skip to content

Commit

Permalink
follow-up to #1377
Browse files Browse the repository at this point in the history
Signed-off-by: Simon L <[email protected]>
  • Loading branch information
szaimen committed Nov 10, 2022
1 parent a049470 commit 1d5f62e
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 14 deletions.
2 changes: 0 additions & 2 deletions Containers/nextcloud/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ RUN set -ex; \
openldap-dev \
pcre-dev \
postgresql-dev \
imagemagick-dev \
libwebp-dev \
gmp-dev \
; \
Expand Down Expand Up @@ -142,7 +141,6 @@ RUN set -ex; \
\
apk add --no-cache \
ffmpeg \
imagemagick \
procps \
samba-client \
supervisor \
Expand Down
29 changes: 22 additions & 7 deletions Containers/nextcloud/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ if [ -n "$ADDITIONAL_PHP_EXTENSIONS" ]; then
if ! [ -f "/additional-php-extensions-are-installed" ]; then
read -ra ADDITIONAL_PHP_EXTENSIONS_ARRAY <<< "$ADDITIONAL_PHP_EXTENSIONS"
for app in "${ADDITIONAL_PHP_EXTENSIONS_ARRAY[@]}"; do
echo "Installing PHP build dependencies..."
# shellcheck disable=SC2086
if [ "$PHP_DEPS_ARE_INSTALLED" != 1 ]; then
if ! apk add --no-cache --virtual .build-deps libxml2-dev imagemagick-dev autoconf $PHPIZE_DEPS >/dev/null; then
echo "Could not install build-deps!"
fi
PHP_DEPS_ARE_INSTALLED=1
fi
if [ "$app" = imagick ]; then
echo "Installing Imagick via PECL..."
pecl install imagick-3.7.0 >/dev/null
Expand All @@ -74,19 +82,26 @@ if [ -n "$ADDITIONAL_PHP_EXTENSIONS" ]; then
fi
else
echo "Installing PHP extension $app ..."
if pecl install "$app" >/dev/null; then
if ! docker-php-ext-install -j "$(nproc)" "$app" >/dev/null; then
echo "Could not install $app from core. Trying to install from PECL..."
pecl install "$app" >/dev/null; then
if ! docker-php-ext-enable "$app" >/dev/null; then
echo "Could not install PHP extension $app!"
fi
else
echo "Could not install $app using PECL. Trying to install from core..."
if ! docker-php-ext-install -j "$(nproc)" "$app" >/dev/null; then
echo "Could also not install $app from core. The PHP extensions was not installed!"
echo "Could also not install $app from PECL. The PHP extensions was not installed!"
fi
fi
fi
done
fi
rm -rf /tmp/pear
runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)";
# shellcheck disable=SC2086
apk add --virtual .nextcloud-phpext-rundeps $runDeps >/dev/null
apk del .build-deps >/dev/null
touch /additional-php-extensions-are-installed
fi

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ services:
# - NEXTCLOUD_TRUSTED_CACERTS_DIR=/path/to/my/cacerts # CA certificates in this directory will be trusted by the OS of the nexcloud container (Useful e.g. for LDAPS) See See https://github.com/nextcloud/all-in-one#how-to-trust-user-defiend-certification-authorities-ca
# - COLLABORA_SECCOMP_DISABLED=false # Setting this to true allows to disable Collabora's Seccomp feature. See https://github.com/nextcloud/all-in-one#how-to-disable-collaboras-seccomp-feature
# - NEXTCLOUD_STARTUP_APPS=twofactor_totp deck tasks calendar contacts apporder # Allows to modify the Nextcloud apps that are installed on starting AIO the first time. See https://github.com/nextcloud/all-in-one#how-to-change-the-nextcloud-apps-that-are-installed-on-the-first-startup
# - NEXTCLOUD_ADDITIONAL_APKS=imagick # This allows to add additional packages to the Nextcloud container permanently. See https://github.com/nextcloud/all-in-one#how-to-add-packets-permanently-to-the-nextcloud-container
# - NEXTCLOUD_ADDITIONAL_APKS=imagemagick # This allows to add additional packages to the Nextcloud container permanently. See https://github.com/nextcloud/all-in-one#how-to-add-packets-permanently-to-the-nextcloud-container
# - NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS=imagick # This allows to add additional php extensions to the Nextcloud container permanently. Default is imagick but can be overwritten by modifying this value. See https://github.com/nextcloud/all-in-one#how-to-add-php-extensions-permanently-to-the-nextcloud-container

# # Optional: Caddy reverse proxy. See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
Expand Down
2 changes: 1 addition & 1 deletion manual-install/update-yaml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ sed -i 's|NEXTCLOUD_PASSWORD=|NEXTCLOUD_PASSWORD= # TODO! This is the p
sed -i 's|TIMEZONE=|TIMEZONE=Europe/Berlin # TODO! This is the timezone that your containers will use.|' sample.conf
sed -i 's|COLLABORA_SECCOMP_POLICY=|COLLABORA_SECCOMP_POLICY=--o:security.seccomp=true # Changing the value to false allows to disable the seccomp feature of the Collabora container.|' sample.conf
sed -i 's|NEXTCLOUD_STARTUP_APPS=|NEXTCLOUD_STARTUP_APPS=twofactor_totp deck tasks calendar contacts apporder # Allows to modify the Nextcloud apps that are installed on starting AIO the first time|' sample.conf
sed -i 's|NEXTCLOUD_ADDITIONAL_APKS=|NEXTCLOUD_ADDITIONAL_APKS=imagick # This allows to add additional packages to the Nextcloud container permanently.|' sample.conf
sed -i 's|NEXTCLOUD_ADDITIONAL_APKS=|NEXTCLOUD_ADDITIONAL_APKS=imagemagick # This allows to add additional packages to the Nextcloud container permanently.|' sample.conf
sed -i 's|NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS=|NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS=imagick # This allows to add additional php extensions to the Nextcloud container permanently. Default is imagick but can be overwritten by modifying this value.|' sample.conf
sed -i 's|=$|= # TODO! This needs to be a unique and good password!|' sample.conf

Expand Down
2 changes: 1 addition & 1 deletion php/src/Data/ConfigurationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ public function GetTrustedCacertsDir() : string {
public function GetNextcloudAdditionalApks() : string {
$envVariableName = 'NEXTCLOUD_ADDITIONAL_APKS';
$configName = 'nextcloud_additional_apks';
$defaultValue = '';
$defaultValue = 'imagemagick';
return trim($this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue));
}

Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ You might want to adjust the Nextcloud apps that are installed upon the first st
### How to add packets permanently to the Nextcloud container?
Some Nextcloud apps require additional external dependencies that must be bundled within Nextcloud container in order to work correctly. As we cannot put each and every dependency for all apps into the container - as this would make the project very fast unmaintainable - there is an official way how you can add additional dependencies into the Nextcloud container. However note that doing this is not recommended since we do not test Nextcloud apps that require external dependencies.
You can do so by adding `-e NEXTCLOUD_ADDITIONAL_APKS="dependency1 dependency2"` to the docker run command of the mastercontainer and customize the value to your fitting. It must be a string with small letters a-z, spaces and hyphens or '_'. You can find available packages here: https://pkgs.alpinelinux.org/packages?name=&branch=v3.16&repo=&arch=&maintainer=
You can do so by adding `-e NEXTCLOUD_ADDITIONAL_APKS="imagemagick dependency2 dependency3"` to the docker run command of the mastercontainer and customize the value to your fitting. It must be a string with small letters a-z, spaces and hyphens or '_'. You can find available packages here: https://pkgs.alpinelinux.org/packages?name=&branch=v3.16&repo=&arch=&maintainer=. By default added is `imagemagick`. If you want to keep that, you need to specify it as well.
### How to add PHP extensions permanently to the Nextcloud container?
Some Nextcloud apps require additional php extensions that must be bundled within Nextcloud container in order to work correctly. As we cannot put each and every dependency for all apps into the container - as this would make the project very fast unmaintainable - there is an official way how you can add additional php extensions into the Nextcloud container. However note that doing this is not recommended since we do not test Nextcloud apps that require additional php extensions.
Expand Down
2 changes: 1 addition & 1 deletion tests/QA/060-environmental-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
See https://github.com/nextcloud/all-in-one#how-to-trust-user-defiend-certification-authorities-ca
- [ ] When starting the mastercontainer with `-e COLLABORA_SECCOMP_DISABLED=true`, the resulting collabora container should have `--o:security.seccomp=false` applied to it.
- [ ] When starting the mastercontainer with `-e NEXTCLOUD_STARTUP_APPS=deck`, the resulting Nextcloud should have only installed the deck app and not the other apps that get installed by default. Default are `twofactor_totp deck tasks calendar contacts apporder`.
- [ ] When starting the mastercontainer with `-e NEXTCLOUD_ADDITIONAL_APKS=zip`, the resulting Nextcloud container should have the zip package installed.
- [ ] When starting the mastercontainer with `-e NEXTCLOUD_ADDITIONAL_APKS=zip`, the resulting Nextcloud container should have the zip package installed and not imagemagick.
- [ ] When starting the mastercontainer with `-e NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS=inotify`, the resulting Nextcloud container should have the inotify extension installed and not the imagick extension.

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

0 comments on commit 1d5f62e

Please sign in to comment.