mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-19 22:16:49 +00:00
Initial import
This commit is contained in:
commit
2295a33590
884 changed files with 93939 additions and 0 deletions
244
Containers/nextcloud/Dockerfile
Normal file
244
Containers/nextcloud/Dockerfile
Normal file
|
|
@ -0,0 +1,244 @@
|
|||
# From https://github.com/nextcloud/docker/blob/master/22/fpm/Dockerfile
|
||||
FROM php:8.0-fpm-bullseye
|
||||
|
||||
# entrypoint.sh and cron.sh dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
rsync \
|
||||
bzip2 \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*;
|
||||
|
||||
# install the PHP extensions we need
|
||||
# see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html
|
||||
ENV PHP_MEMORY_LIMIT 512M
|
||||
ENV PHP_UPLOAD_LIMIT 512M
|
||||
RUN set -ex; \
|
||||
\
|
||||
savedAptMark="$(apt-mark showmanual)"; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
libcurl4-openssl-dev \
|
||||
libevent-dev \
|
||||
libfreetype6-dev \
|
||||
libicu-dev \
|
||||
libjpeg-dev \
|
||||
libldap2-dev \
|
||||
libmcrypt-dev \
|
||||
libmemcached-dev \
|
||||
libpng-dev \
|
||||
libpq-dev \
|
||||
libxml2-dev \
|
||||
libmagickwand-dev \
|
||||
libzip-dev \
|
||||
libwebp-dev \
|
||||
libgmp-dev \
|
||||
; \
|
||||
\
|
||||
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
|
||||
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \
|
||||
docker-php-ext-configure ldap --with-libdir="lib/$debMultiarch"; \
|
||||
docker-php-ext-install -j "$(nproc)" \
|
||||
bcmath \
|
||||
exif \
|
||||
gd \
|
||||
intl \
|
||||
ldap \
|
||||
opcache \
|
||||
pcntl \
|
||||
pdo_mysql \
|
||||
pdo_pgsql \
|
||||
zip \
|
||||
gmp \
|
||||
; \
|
||||
\
|
||||
# pecl will claim success even if one install fails, so we need to perform each install separately
|
||||
pecl install APCu-5.1.20; \
|
||||
pecl install memcached-3.1.5; \
|
||||
pecl install redis-5.3.4; \
|
||||
pecl install imagick-3.5.1; \
|
||||
\
|
||||
docker-php-ext-enable \
|
||||
apcu \
|
||||
memcached \
|
||||
redis \
|
||||
imagick \
|
||||
; \
|
||||
rm -r /tmp/pear; \
|
||||
\
|
||||
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
|
||||
apt-mark auto '.*' > /dev/null; \
|
||||
apt-mark manual $savedAptMark; \
|
||||
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
|
||||
| awk '/=>/ { print $3 }' \
|
||||
| sort -u \
|
||||
| xargs -r dpkg-query -S \
|
||||
| cut -d: -f1 \
|
||||
| sort -u \
|
||||
| xargs -rt apt-mark manual; \
|
||||
\
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# set recommended PHP.ini settings
|
||||
# see https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/server_tuning.html#enable-php-opcache
|
||||
RUN { \
|
||||
echo 'opcache.enable=1'; \
|
||||
echo 'opcache.interned_strings_buffer=8'; \
|
||||
echo 'opcache.max_accelerated_files=10000'; \
|
||||
echo 'opcache.memory_consumption=128'; \
|
||||
echo 'opcache.save_comments=1'; \
|
||||
echo 'opcache.revalidate_freq=1'; \
|
||||
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
||||
\
|
||||
echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \
|
||||
\
|
||||
{ \
|
||||
echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \
|
||||
echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \
|
||||
echo 'post_max_size=${PHP_UPLOAD_LIMIT}'; \
|
||||
} > /usr/local/etc/php/conf.d/nextcloud.ini; \
|
||||
\
|
||||
mkdir /var/www/data; \
|
||||
chown -R www-data:root /var/www; \
|
||||
chmod -R g=u /var/www
|
||||
|
||||
VOLUME /var/www/html
|
||||
|
||||
|
||||
ENV NEXTCLOUD_VERSION 22.2.3
|
||||
|
||||
RUN set -ex; \
|
||||
fetchDeps=" \
|
||||
gnupg \
|
||||
dirmngr \
|
||||
"; \
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends $fetchDeps; \
|
||||
\
|
||||
curl -fsSL -o nextcloud.tar.bz2 \
|
||||
"https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2"; \
|
||||
curl -fsSL -o nextcloud.tar.bz2.asc \
|
||||
"https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2.asc"; \
|
||||
export GNUPGHOME="$(mktemp -d)"; \
|
||||
# gpg key from https://nextcloud.com/nextcloud.asc
|
||||
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A; \
|
||||
gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2; \
|
||||
tar -xjf nextcloud.tar.bz2 -C /usr/src/; \
|
||||
gpgconf --kill all; \
|
||||
rm nextcloud.tar.bz2.asc nextcloud.tar.bz2; \
|
||||
rm -rf "$GNUPGHOME" /usr/src/nextcloud/updater; \
|
||||
mkdir -p /usr/src/nextcloud/data; \
|
||||
mkdir -p /usr/src/nextcloud/custom_apps; \
|
||||
chmod +x /usr/src/nextcloud/occ; \
|
||||
\
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY *.sh upgrade.exclude /
|
||||
COPY config/* /usr/src/nextcloud/config/
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["php-fpm"]
|
||||
|
||||
# Template from https://github.com/nextcloud/docker/blob/master/.examples/dockerfiles/full/fpm/Dockerfile
|
||||
|
||||
RUN set -ex; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
ffmpeg \
|
||||
libmagickcore-6.q16-6-extra \
|
||||
procps \
|
||||
smbclient \
|
||||
supervisor \
|
||||
# libreoffice \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN set -ex; \
|
||||
\
|
||||
savedAptMark="$(apt-mark showmanual)"; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
libbz2-dev \
|
||||
libc-client-dev \
|
||||
libkrb5-dev \
|
||||
libsmbclient-dev \
|
||||
; \
|
||||
\
|
||||
docker-php-ext-configure imap --with-kerberos --with-imap-ssl; \
|
||||
docker-php-ext-install \
|
||||
bz2 \
|
||||
imap \
|
||||
; \
|
||||
pecl install smbclient; \
|
||||
docker-php-ext-enable smbclient; \
|
||||
\
|
||||
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
|
||||
apt-mark auto '.*' > /dev/null; \
|
||||
apt-mark manual $savedAptMark; \
|
||||
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
|
||||
| awk '/=>/ { print $3 }' \
|
||||
| sort -u \
|
||||
| xargs -r dpkg-query -S \
|
||||
| cut -d: -f1 \
|
||||
| sort -u \
|
||||
| xargs -rt apt-mark manual; \
|
||||
\
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN mkdir -p \
|
||||
/var/log/supervisord \
|
||||
/var/run/supervisord \
|
||||
;
|
||||
|
||||
COPY supervisord.conf /
|
||||
|
||||
ENV NEXTCLOUD_UPDATE=1
|
||||
|
||||
CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"]
|
||||
|
||||
# Custom:
|
||||
RUN set -ex; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
netcat \
|
||||
openssl \
|
||||
gnupg \
|
||||
dirmngr \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN chown www-data:root -R /usr/src && \
|
||||
chown www-data:root -R /usr/local/etc/php/conf.d && \
|
||||
chown www-data:root -R /var/log/supervisord/ && \
|
||||
chown www-data:root -R /var/run/supervisord/ && \
|
||||
mkdir -p /var/log/nextcloud/ && \
|
||||
chown -R www-data:root /var/log/nextcloud/
|
||||
|
||||
COPY start.sh /
|
||||
COPY notify.sh /
|
||||
RUN chmod +x /start.sh && \
|
||||
chmod +r /supervisord.conf && \
|
||||
chmod +x /entrypoint.sh && \
|
||||
chmod +r /upgrade.exclude && \
|
||||
chmod +x /cron.sh && \
|
||||
chmod +x /notify.sh
|
||||
|
||||
RUN mkdir /mnt/ncdata; \
|
||||
chown www-data:www-data /mnt/ncdata;
|
||||
|
||||
VOLUME /mnt/ncdata
|
||||
|
||||
# Give root a random password
|
||||
RUN echo "root:$(openssl rand -base64 12)" | chpasswd
|
||||
|
||||
USER www-data
|
||||
ENTRYPOINT ["/start.sh"]
|
||||
4
Containers/nextcloud/config/apcu.config.php
Normal file
4
Containers/nextcloud/config/apcu.config.php
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
$CONFIG = array (
|
||||
'memcache.local' => '\OC\Memcache\APCu',
|
||||
);
|
||||
15
Containers/nextcloud/config/apps.config.php
Normal file
15
Containers/nextcloud/config/apps.config.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
$CONFIG = array (
|
||||
'apps_paths' => array (
|
||||
0 => array (
|
||||
'path' => OC::$SERVERROOT.'/apps',
|
||||
'url' => '/apps',
|
||||
'writable' => false,
|
||||
),
|
||||
1 => array (
|
||||
'path' => OC::$SERVERROOT.'/custom_apps',
|
||||
'url' => '/custom_apps',
|
||||
'writable' => true,
|
||||
),
|
||||
),
|
||||
);
|
||||
17
Containers/nextcloud/config/redis.config.php
Normal file
17
Containers/nextcloud/config/redis.config.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
if (getenv('REDIS_HOST')) {
|
||||
$CONFIG = array(
|
||||
'memcache.distributed' => '\OC\Memcache\Redis',
|
||||
'memcache.locking' => '\OC\Memcache\Redis',
|
||||
'redis' => array(
|
||||
'host' => getenv('REDIS_HOST'),
|
||||
'password' => (string) getenv('REDIS_HOST_PASSWORD'),
|
||||
),
|
||||
);
|
||||
|
||||
if (getenv('REDIS_HOST_PORT') !== false) {
|
||||
$CONFIG['redis']['port'] = (int) getenv('REDIS_HOST_PORT');
|
||||
} elseif (getenv('REDIS_HOST')[0] != '/') {
|
||||
$CONFIG['redis']['port'] = 6379;
|
||||
}
|
||||
}
|
||||
25
Containers/nextcloud/config/reverse-proxy.config.php
Normal file
25
Containers/nextcloud/config/reverse-proxy.config.php
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
$overwriteHost = getenv('OVERWRITEHOST');
|
||||
if ($overwriteHost) {
|
||||
$CONFIG['overwritehost'] = $overwriteHost;
|
||||
}
|
||||
|
||||
$overwriteProtocol = getenv('OVERWRITEPROTOCOL');
|
||||
if ($overwriteProtocol) {
|
||||
$CONFIG['overwriteprotocol'] = $overwriteProtocol;
|
||||
}
|
||||
|
||||
$overwriteWebRoot = getenv('OVERWRITEWEBROOT');
|
||||
if ($overwriteWebRoot) {
|
||||
$CONFIG['overwritewebroot'] = $overwriteWebRoot;
|
||||
}
|
||||
|
||||
$overwriteCondAddr = getenv('OVERWRITECONDADDR');
|
||||
if ($overwriteCondAddr) {
|
||||
$CONFIG['overwritecondaddr'] = $overwriteCondAddr;
|
||||
}
|
||||
|
||||
$trustedProxies = getenv('TRUSTED_PROXIES');
|
||||
if ($trustedProxies) {
|
||||
$CONFIG['trusted_proxies'] = array_filter(array_map('trim', explode(' ', $trustedProxies)));
|
||||
}
|
||||
7
Containers/nextcloud/cron.sh
Normal file
7
Containers/nextcloud/cron.sh
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
while true; do
|
||||
php -f /var/www/html/cron.php &
|
||||
sleep 5m
|
||||
done
|
||||
254
Containers/nextcloud/entrypoint.sh
Normal file
254
Containers/nextcloud/entrypoint.sh
Normal file
|
|
@ -0,0 +1,254 @@
|
|||
#!/bin/sh
|
||||
|
||||
# version_greater A B returns whether A > B
|
||||
version_greater() {
|
||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 -k3,3 -k4,4 | head -n 1)" != "$1" ]
|
||||
}
|
||||
|
||||
# return true if specified directory is empty
|
||||
directory_empty() {
|
||||
[ -z "$(ls -A "$1/")" ]
|
||||
}
|
||||
|
||||
echo "Configuring Redis as session handler"
|
||||
cat << REDIS_CONF > /usr/local/etc/php/conf.d/redis-session.ini
|
||||
session.save_handler = redis
|
||||
session.save_path = "tcp://${REDIS_HOST}:${REDIS_HOST_PORT:=6379}?auth=${REDIS_HOST_PASSWORD}"
|
||||
redis.session.locking_enabled = 1
|
||||
redis.session.lock_retries = -1
|
||||
# redis.session.lock_wait_time is specified in microseconds.
|
||||
# Wait 10ms before retrying the lock rather than the default 2ms.
|
||||
redis.session.lock_wait_time = 10000
|
||||
REDIS_CONF
|
||||
|
||||
if [ -f /var/www/html/version.php ]; then
|
||||
# shellcheck disable=SC2016
|
||||
installed_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
|
||||
else
|
||||
installed_version="0.0.0.0"
|
||||
fi
|
||||
if [ -f "/usr/src/nextcloud/version.php" ]; then
|
||||
# shellcheck disable=SC2016
|
||||
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
|
||||
else
|
||||
image_version="$installed_version"
|
||||
fi
|
||||
|
||||
# unset admin password
|
||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
||||
unset ADMIN_PASSWORD
|
||||
fi
|
||||
|
||||
|
||||
if version_greater "$image_version" "$installed_version"; then
|
||||
# Check if it skips a major version
|
||||
INSTALLED_MAJOR="${installed_version%%.*}"
|
||||
IMAGE_MAJOR="${image_version%%.*}"
|
||||
if [ "$installed_version" != "0.0.0.0" ] && [ "$((IMAGE_MAJOR - INSTALLED_MAJOR))" -gt 1 ]; then
|
||||
set -ex
|
||||
NEXT_MAJOR="$((INSTALLED_MAJOR + 1))"
|
||||
curl -fsSL -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/latest-${NEXT_MAJOR}.tar.bz2"
|
||||
curl -fsSL -o nextcloud.tar.bz2.asc "https://download.nextcloud.com/server/releases/latest-${NEXT_MAJOR}.tar.bz2.asc"
|
||||
export GNUPGHOME="$(mktemp -d)"
|
||||
# gpg key from https://nextcloud.com/nextcloud.asc
|
||||
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 28806A878AE423A28372792ED75899B9A724937A
|
||||
gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2
|
||||
mkdir -p /usr/src/tmp
|
||||
tar -xjf nextcloud.tar.bz2 -C /usr/src/tmp/
|
||||
gpgconf --kill all
|
||||
rm nextcloud.tar.bz2.asc nextcloud.tar.bz2
|
||||
rm -rf "$GNUPGHOME" /usr/src/tmp/nextcloud/updater
|
||||
mkdir -p /usr/src/tmp/nextcloud/data
|
||||
mkdir -p /usr/src/tmp/nextcloud/custom_apps
|
||||
chmod +x /usr/src/tmp/nextcloud/occ
|
||||
cp /usr/src/nextcloud/config/* /usr/src/tmp/nextcloud/config/
|
||||
mv /usr/src/nextcloud /usr/src/temp-nextcloud
|
||||
mv /usr/src/tmp/nextcloud /usr/src/nextcloud
|
||||
rm -r /usr/src/tmp
|
||||
rm -r /usr/src/temp-nextcloud
|
||||
# shellcheck disable=SC2016
|
||||
image_version="$(php -r 'require "/usr/src/nextcloud/version.php"; echo implode(".", $OC_Version);')"
|
||||
IMAGE_MAJOR="${image_version%%.*}"
|
||||
set +ex
|
||||
fi
|
||||
|
||||
if [ "$installed_version" != "0.0.0.0" ]; then
|
||||
while true; do
|
||||
echo -e "Checking connection to appstore"
|
||||
CURL_STATUS="$(curl -LI "https://apps.nextcloud.com/" -o /dev/null -w '%{http_code}\n' -s)"
|
||||
if [[ "$CURL_STATUS" = "200" ]]
|
||||
then
|
||||
echo "Appstore is reachable"
|
||||
break
|
||||
else
|
||||
echo "Curl didn't produce a 200 status, is appstore reachable?"
|
||||
fi
|
||||
done
|
||||
|
||||
php /var/www/html/occ maintenance:mode --off
|
||||
|
||||
echo "Getting and backing up the status of apps for later, this might take a while..."
|
||||
php /var/www/html/occ app:list | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_before
|
||||
|
||||
if [ "$((IMAGE_MAJOR - INSTALLED_MAJOR))" -eq 1 ]; then
|
||||
php /var/www/html/occ config:system:delete app_install_overwrite
|
||||
fi
|
||||
|
||||
php /var/www/html/occ app:update --all
|
||||
fi
|
||||
|
||||
echo "Initializing nextcloud $image_version ..."
|
||||
rsync -rlD --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
|
||||
|
||||
for dir in config data custom_apps themes; do
|
||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
||||
rsync -rlD --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||
fi
|
||||
done
|
||||
rsync -rlD --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/
|
||||
echo "Initializing finished"
|
||||
|
||||
#install
|
||||
if [ "$installed_version" = "0.0.0.0" ]; then
|
||||
echo "New nextcloud instance"
|
||||
|
||||
INSTALL_OPTIONS=(-n --admin-user "$ADMIN_USER" --admin-pass "$ADMIN_PASSWORD")
|
||||
if [ -n "${NEXTCLOUD_DATA_DIR}" ]; then
|
||||
INSTALL_OPTIONS+=(--data-dir "$NEXTCLOUD_DATA_DIR")
|
||||
fi
|
||||
|
||||
echo "Installing with PostgreSQL database"
|
||||
INSTALL_OPTIONS+=(--database pgsql --database-name "$POSTGRES_DB" --database-user "$POSTGRES_USER" --database-pass "$POSTGRES_PASSWORD" --database-host "$POSTGRES_HOST")
|
||||
|
||||
echo "starting nextcloud installation"
|
||||
max_retries=10
|
||||
try=0
|
||||
until php /var/www/html/occ maintenance:install "${INSTALL_OPTIONS[@]}" || [ "$try" -gt "$max_retries" ]
|
||||
do
|
||||
echo "retrying install..."
|
||||
try=$((try+1))
|
||||
sleep 10s
|
||||
done
|
||||
if [ "$try" -gt "$max_retries" ]; then
|
||||
echo "installing of nextcloud failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# unset admin password
|
||||
unset ADMIN_PASSWORD
|
||||
|
||||
# Apply log settings
|
||||
echo "Applying default settings..."
|
||||
mkdir -p /var/www/html/data
|
||||
php /var/www/html/occ config:system:set loglevel --value=2
|
||||
php /var/www/html/occ config:system:set log_type --value=file
|
||||
php /var/www/html/occ config:system:set logfile --value="/var/log/nextcloud/nextcloud.log"
|
||||
php /var/www/html/occ config:system:set log_rotate_size --value="10485760"
|
||||
php /var/www/html/occ app:enable admin_audit
|
||||
php /var/www/html/occ config:app:set admin_audit logfile --value="/var/log/nextcloud/audit.log"
|
||||
php /var/www/html/occ config:system:set log.condition apps 0 --value="admin_audit"
|
||||
|
||||
# Apply preview settings
|
||||
echo "Applying preview settings..."
|
||||
php /var/www/html/occ config:system:set preview_max_x --value="2048"
|
||||
php /var/www/html/occ config:system:set preview_max_y --value="2048"
|
||||
php /var/www/html/occ config:system:set jpeg_quality --value="60"
|
||||
php /var/www/html/occ config:app:set preview jpeg_quality --value="60"
|
||||
php /var/www/html/occ config:system:delete enabledPreviewProviders
|
||||
php /var/www/html/occ config:system:set enabledPreviewProviders 1 --value="OC\\Preview\\Image"
|
||||
php /var/www/html/occ config:system:set enabledPreviewProviders 2 --value="OC\\Preview\\MarkDown"
|
||||
php /var/www/html/occ config:system:set enabledPreviewProviders 3 --value="OC\\Preview\\MP3"
|
||||
php /var/www/html/occ config:system:set enabledPreviewProviders 4 --value="OC\\Preview\\TXT"
|
||||
php /var/www/html/occ config:system:set enabledPreviewProviders 5 --value="OC\\Preview\\OpenDocument"
|
||||
php /var/www/html/occ config:system:set enabledPreviewProviders 6 --value="OC\\Preview\\Movie"
|
||||
php /var/www/html/occ config:system:set enable_previews --value=true --type=boolean
|
||||
|
||||
# Apply other settings
|
||||
echo "Applying other settings..."
|
||||
php /var/www/html/occ config:system:set upgrade.disable-web --type=bool --value=true
|
||||
php /var/www/html/occ config:app:set updatenotification notify_groups --value="[]"
|
||||
php /var/www/html/occ config:system:set mail_smtpmode --value="smtp"
|
||||
php /var/www/html/occ config:system:set trashbin_retention_obligation --value="auto, 30"
|
||||
php /var/www/html/occ config:system:set versions_retention_obligation --value="auto, 30"
|
||||
php /var/www/html/occ config:system:set activity_expire_days --value="30"
|
||||
php /var/www/html/occ config:system:set simpleSignUpLink.shown --type=bool --value=false
|
||||
php /var/www/html/occ config:system:set share_folder --value="/Shared"
|
||||
|
||||
#upgrade
|
||||
else
|
||||
while [ -n "$(pgrep -f cron.php)" ]
|
||||
do
|
||||
echo "Waiting for Nextclouds cronjob to finish..."
|
||||
sleep 5
|
||||
done
|
||||
|
||||
echo "Upgrading nextcloud from $installed_version to $image_version..."
|
||||
if ! php /var/www/html/occ upgrade || ! php /var/www/html/occ -V; then
|
||||
echo "Upgrade failed. Please restore from backup."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
php /var/www/html/occ app:list | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_after
|
||||
echo "The following apps have been disabled:"
|
||||
diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1
|
||||
rm -f /tmp/list_before /tmp/list_after
|
||||
|
||||
# Apply optimization
|
||||
echo "Doing some optimizations..."
|
||||
php /var/www/html/occ maintenance:repair
|
||||
php /var/www/html/occ db:add-missing-indices
|
||||
php /var/www/html/occ db:add-missing-columns
|
||||
php /var/www/html/occ db:add-missing-primary-keys
|
||||
yes | php /var/www/html/occ db:convert-filecache-bigint
|
||||
php /var/www/html/occ maintenance:mimetype:update-js
|
||||
php /var/www/html/occ maintenance:mimetype:update-db
|
||||
fi
|
||||
fi
|
||||
|
||||
# Apply one-click-instance settings
|
||||
echo "Applying one-click-instance settings..."
|
||||
php /var/www/html/occ config:system:set one-click-instance --value=true --type=bool
|
||||
php /var/www/html/occ config:system:set one-click-instance.user-limit --value=100 --type=int
|
||||
|
||||
# Apply network settings
|
||||
echo "Applying network settings..."
|
||||
php /var/www/html/occ config:system:set trusted_domains 1 --value="$NC_DOMAIN"
|
||||
php /var/www/html/occ config:system:set overwrite.cli.url --value="https://$NC_DOMAIN/"
|
||||
php /var/www/html/occ config:system:set htaccess.RewriteBase --value="/"
|
||||
php /var/www/html/occ maintenance:update:htaccess
|
||||
|
||||
# Notify push
|
||||
if ! [ -d "/var/www/html/custom_apps/notify_push" ]; then
|
||||
php /var/www/html/occ app:install notify_push
|
||||
elif [ "$(php /var/www/html/occ config:app:get notify_push enabled)" = "no" ]; then
|
||||
php /var/www/html/occ app:enable notify_push
|
||||
else
|
||||
php /var/www/html/occ app:update notify_push
|
||||
fi
|
||||
php /var/www/html/occ config:app:set notify_push base_endpoint --value="https://$NC_DOMAIN/push"
|
||||
|
||||
# Collabora
|
||||
if ! [ -d "/var/www/html/custom_apps/richdocuments" ]; then
|
||||
php /var/www/html/occ app:install richdocuments
|
||||
elif [ "$(php /var/www/html/occ config:app:get richdocuments enabled)" = "no" ]; then
|
||||
php /var/www/html/occ app:enable richdocuments
|
||||
else
|
||||
php /var/www/html/occ app:update richdocuments
|
||||
fi
|
||||
php /var/www/html/occ config:app:set richdocuments wopi_url --value="https://$NC_DOMAIN/"
|
||||
# php /var/www/html/occ richdocuments:activate-config
|
||||
|
||||
# Talk
|
||||
if ! [ -d "/var/www/html/custom_apps/spreed" ]; then
|
||||
php /var/www/html/occ app:install spreed
|
||||
elif [ "$(php /var/www/html/occ config:app:get spreed enabled)" = "no" ]; then
|
||||
php /var/www/html/occ app:enable spreed
|
||||
else
|
||||
php /var/www/html/occ app:update spreed
|
||||
fi
|
||||
STUN_SERVERS="[\"$NC_DOMAIN:3478\"]"
|
||||
TURN_SERVERS="[{\"server\":\"$NC_DOMAIN:3478\",\"secret\":\"$TURN_SECRET\",\"protocols\":\"udp,tcp\"}]"
|
||||
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 turn_servers --value="$TURN_SERVERS" --output json
|
||||
php /var/www/html/occ config:app:set spreed signaling_servers --value="$SIGNALING_SERVERS" --output json
|
||||
29
Containers/nextcloud/notify.sh
Normal file
29
Containers/nextcloud/notify.sh
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#!/bin/bash
|
||||
|
||||
SUBJECT="$1"
|
||||
MESSAGE="$2"
|
||||
|
||||
if [ "$(php /var/www/html/occ config:app:get notificaations enabled)" = "no" ]; then
|
||||
echo "Cannot send notification as notification app is not enabled."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Posting notifications to users that are admins..."
|
||||
NC_USERS=$(php /var/www/html/occ user:list | sed 's|^ - ||g' | sed 's|:.*||')
|
||||
mapfile -t NC_USERS <<< "$NC_USERS"
|
||||
for user in "${NC_USERS[@]}"
|
||||
do
|
||||
if php /var/www/html/occ user:info "$user" | cut -d "-" -f2 | grep -x -q " admin"
|
||||
then
|
||||
NC_ADMIN_USER+=("$user")
|
||||
fi
|
||||
done
|
||||
|
||||
for admin in "${NC_ADMIN_USER[@]}"
|
||||
do
|
||||
echo "Posting '$SUBJECT' to: $admin"
|
||||
php /var/www/html/occ notification:generate "$admin" "$NC_DOMAIN: $SUBJECT" -l "$MESSAGE"
|
||||
done
|
||||
|
||||
echo "Done!"
|
||||
exit 0
|
||||
14
Containers/nextcloud/start.sh
Normal file
14
Containers/nextcloud/start.sh
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Only start container if database is accessible
|
||||
while ! nc -z "$POSTGRES_HOST" 5432; do
|
||||
echo "Waiting for database to start..."
|
||||
sleep 5
|
||||
done
|
||||
|
||||
# Run original entrypoint
|
||||
if ! bash /entrypoint.sh; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
30
Containers/nextcloud/supervisord.conf
Normal file
30
Containers/nextcloud/supervisord.conf
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# From https://github.com/nextcloud/docker/blob/master/.examples/dockerfiles/full/fpm/supervisord.conf
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
logfile=/var/log/supervisord/supervisord.log
|
||||
pidfile=/var/run/supervisord/supervisord.pid
|
||||
childlogdir=/var/log/supervisord/
|
||||
logfile_maxbytes=50MB ; maximum size of logfile before rotation
|
||||
logfile_backups=10 ; number of backed up logfiles
|
||||
loglevel=error
|
||||
|
||||
[program:php-fpm]
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
command=php-fpm
|
||||
|
||||
[program:cron]
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
command=/cron.sh
|
||||
|
||||
[program:notify-push]
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
command=/var/www/html/custom_apps/notify_push/bin/x86_64/notify_push /var/www/html/config/config.php --port 7867 --redis-url redis://:%(ENV_REDIS_HOST_PASSWORD)s@%(ENV_REDIS_HOST)s
|
||||
5
Containers/nextcloud/upgrade.exclude
Normal file
5
Containers/nextcloud/upgrade.exclude
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/config/
|
||||
/data/
|
||||
/custom_apps/
|
||||
/themes/
|
||||
/version.php
|
||||
Loading…
Add table
Add a link
Reference in a new issue