diff --git a/.config/00apcu.config.php b/.config/00apcu.config.php new file mode 100644 index 0000000..d6dac4f --- /dev/null +++ b/.config/00apcu.config.php @@ -0,0 +1,12 @@ + [ + 'cache_driver' => 'apcu', + 'session_handler' => 'cache', + ], +]; diff --git a/.config/01redis.config.php b/.config/01redis.config.php new file mode 100644 index 0000000..422e4a5 --- /dev/null +++ b/.config/01redis.config.php @@ -0,0 +1,13 @@ + [ + 'lock_driver' => 'redis', + 'redis_host' => getenv('REDIS_HOST'), + 'redis_port' => (getenv('REDIS_PORT') ? getenv('REDIS_PORT') : ''), + 'redis_password' => (getenv('REDIS_PW') ? getenv('REDIS_PW') : ''), + 'redis_db' => (getenv('REDIS_DB') ? getenv('REDIS_DB') : 0), + ], + ]; +} diff --git a/.config/zz-docker.config.php b/.config/zz-docker.config.php new file mode 100644 index 0000000..638bef0 --- /dev/null +++ b/.config/zz-docker.config.php @@ -0,0 +1,66 @@ + [ + // Necessary because otherwise the daemon isn't working + 'pidfile' => '/var/run/friendica.pid', + + 'logfile' => '/var/www/html/friendica.log', + 'loglevel' => 'notice', + ], + 'storage' => [ + 'filesystem_path' => '/var/www/data', + ], +]; + +if (getenv('FRIENDICA_TZ')) { + $config['config']['timezone'] = getenv('FRIENDICA_TZ'); +} + +if (getenv('FRIENDICA_LANG')) { + $config['config']['language'] = getenv('FRIENDICA_LANG'); +} + +if (getenv('FRIENDICA_ADMIN_MAIL')) { + $config['config']['admin_mail'] = getenv('FRIENDICA_ADMIN_MAIL'); +} + +if (getenv('FRIENDICA_SITENAME')) { + $config['config']['sitename'] = getenv('FRIENDICA_SITENAME'); +} + +if (!empty(getenv('FRIENDICA_NO_VALIDATION'))) { + $config['system']['disable_url_validation'] = true; + $config['system']['disable_email_validation'] = true; +} + +if (!empty(getenv('FRIENDICA_DATA'))) { + $config['storage']['class'] = \Friendica\Model\Storage\Filesystem::class; + + if (!empty(getenv('FRIENDICA_DATA_DIR'))) { + $config['storage']['filesystem_path'] = getenv('FRIENDICA_DATA'); + } +} + +if (!empty(getenv('FRIENDICA_DEBUGGING'))) { + $config['system']['debugging'] = true; + if (!empty(getenv('FRIENDICA_LOGFILE'))) { + $config['system']['logfile'] = getenv('FRIENDICA_LOGFILE'); + } + if (!empty(getenv('FRIENDICA_LOGLEVEL'))) { + $config['system']['loglevel'] = getenv('FRIENDICA_LOGLEVEL'); + } +} + +if (!empty(getenv('HOSTNAME'))) { + $config['config']['hostname'] = getenv('HOSTNAME'); +} + +return $config; diff --git a/.docker-files/README.md b/.docker-files/README.md deleted file mode 100644 index 02f0759..0000000 --- a/.docker-files/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# Docker Files -This files are directly load to the docker image's root directory. -Any files except `*.sh` and `*.exclude` will get ignored during the repository upgrade. - -## `entrypoint.sh` -This file is the default entrypoint of each start of Friendica. -It automatically checks the following things: - -- If the image is for a develop or Release candidate, checkout the latest sources from github if necessary -- Setup the SMTP settings for SSMTP -- Check if an upgrade is necessary (due to new checkout or because of a new version) -- Check if it's a fresh installation and initialize Friendica -- Check if auto install is set and execute the auto-installer -- Read all environment variables and combine them with `local.config.php` - -## `cron.sh` -This file is for overwriting the default entrypoint. -It starts the daemon of the current Friendica instance. - -**Warning** Currently only **one** daemon service is allowed to run! - -## `upgrade.exclude` -Contains all files to exclude during an upgrade or a fresh installation of Friendica (f.e. `local.config.php`) \ No newline at end of file diff --git a/.docker-files/upgrade.exclude b/.docker-files/upgrade.exclude deleted file mode 100644 index 70fcec9..0000000 --- a/.docker-files/upgrade.exclude +++ /dev/null @@ -1,12 +0,0 @@ -/.git/ -/photo/ -/proxy/ -/.htconfig.php -/.htaccess -/home.* -/config/local.ini.php -/config/addon.ini.php -/config/local.config.php -/config/addon.config.php -/storage/ -*.log \ No newline at end of file diff --git a/2019.06/apache/Dockerfile b/2019.06/apache/Dockerfile index e039fa5..7483f1e 100644 --- a/2019.06/apache/Dockerfile +++ b/2019.06/apache/Dockerfile @@ -54,7 +54,7 @@ RUN set -ex; \ --with-png-dir=/usr/include/ \ --with-jpeg-dir=/usr/include/ \ ; \ - docker-php-ext-install -j 4 \ + docker-php-ext-install -j "$(nproc)" \ curl \ pdo \ pdo_mysql \ @@ -72,7 +72,7 @@ RUN set -ex; \ # pecl will claim success even if one install fails, so we need to perform each install separately pecl install apcu-5.1.17; \ pecl install memcached-3.1.3; \ - pecl install redis-4.3.0; \ + pecl install redis-5.0.1; \ pecl install imagick-3.4.4; \ \ docker-php-ext-enable \ @@ -96,8 +96,18 @@ RUN set -ex; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ rm -rf /var/lib/apt/lists/* -RUN {\ - echo sendmail_path = "/usr/sbin/sendmail -t -i" ;\ +# set recommended PHP.ini settings +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.revalidte_freq=1'; \ + } > /usr/local/etc/php/conf.d/opcache-recommended.ini; \ + \ + { \ + echo sendmail_path = "/usr/sbin/sendmail -t -i"; \ } > /usr/local/etc/php/conf.d/sendmail.ini; \ \ echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \ @@ -119,9 +129,6 @@ RUN a2enmod rewrite remoteip ;\ } > /etc/apache2/conf-available/remoteip.conf;\ a2enconf remoteip -COPY *.sh upgrade.exclude / -RUN chmod +x /*.sh - ENV FRIENDICA_VERSION 2019.06 ENV FRIENDICA_ADDONS 2019.06 @@ -140,5 +147,9 @@ RUN set -ex; \ rm friendica_addons.tar.gz; \ /usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica; +COPY *.sh upgrade.exclude / +COPY config/* /usr/src/friendica/config/ +RUN chmod +x /*.sh + ENTRYPOINT ["/entrypoint.sh"] CMD ["apache2-foreground"] diff --git a/2019.06/apache/config/00apcu.config.php b/2019.06/apache/config/00apcu.config.php new file mode 100644 index 0000000..d6dac4f --- /dev/null +++ b/2019.06/apache/config/00apcu.config.php @@ -0,0 +1,12 @@ + [ + 'cache_driver' => 'apcu', + 'session_handler' => 'cache', + ], +]; diff --git a/2019.06/apache/config/01redis.config.php b/2019.06/apache/config/01redis.config.php new file mode 100644 index 0000000..422e4a5 --- /dev/null +++ b/2019.06/apache/config/01redis.config.php @@ -0,0 +1,13 @@ + [ + 'lock_driver' => 'redis', + 'redis_host' => getenv('REDIS_HOST'), + 'redis_port' => (getenv('REDIS_PORT') ? getenv('REDIS_PORT') : ''), + 'redis_password' => (getenv('REDIS_PW') ? getenv('REDIS_PW') : ''), + 'redis_db' => (getenv('REDIS_DB') ? getenv('REDIS_DB') : 0), + ], + ]; +} diff --git a/2019.06/apache/config/zz-docker.config.php b/2019.06/apache/config/zz-docker.config.php new file mode 100644 index 0000000..638bef0 --- /dev/null +++ b/2019.06/apache/config/zz-docker.config.php @@ -0,0 +1,66 @@ + [ + // Necessary because otherwise the daemon isn't working + 'pidfile' => '/var/run/friendica.pid', + + 'logfile' => '/var/www/html/friendica.log', + 'loglevel' => 'notice', + ], + 'storage' => [ + 'filesystem_path' => '/var/www/data', + ], +]; + +if (getenv('FRIENDICA_TZ')) { + $config['config']['timezone'] = getenv('FRIENDICA_TZ'); +} + +if (getenv('FRIENDICA_LANG')) { + $config['config']['language'] = getenv('FRIENDICA_LANG'); +} + +if (getenv('FRIENDICA_ADMIN_MAIL')) { + $config['config']['admin_mail'] = getenv('FRIENDICA_ADMIN_MAIL'); +} + +if (getenv('FRIENDICA_SITENAME')) { + $config['config']['sitename'] = getenv('FRIENDICA_SITENAME'); +} + +if (!empty(getenv('FRIENDICA_NO_VALIDATION'))) { + $config['system']['disable_url_validation'] = true; + $config['system']['disable_email_validation'] = true; +} + +if (!empty(getenv('FRIENDICA_DATA'))) { + $config['storage']['class'] = \Friendica\Model\Storage\Filesystem::class; + + if (!empty(getenv('FRIENDICA_DATA_DIR'))) { + $config['storage']['filesystem_path'] = getenv('FRIENDICA_DATA'); + } +} + +if (!empty(getenv('FRIENDICA_DEBUGGING'))) { + $config['system']['debugging'] = true; + if (!empty(getenv('FRIENDICA_LOGFILE'))) { + $config['system']['logfile'] = getenv('FRIENDICA_LOGFILE'); + } + if (!empty(getenv('FRIENDICA_LOGLEVEL'))) { + $config['system']['loglevel'] = getenv('FRIENDICA_LOGLEVEL'); + } +} + +if (!empty(getenv('HOSTNAME'))) { + $config['config']['hostname'] = getenv('HOSTNAME'); +} + +return $config; diff --git a/2019.06/apache/entrypoint.sh b/2019.06/apache/entrypoint.sh index abd2b83..d6750b7 100644 --- a/2019.06/apache/entrypoint.sh +++ b/2019.06/apache/entrypoint.sh @@ -128,6 +128,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/ + # Update docker-based config files, but never delete other config files + rsync $rsync_options --update /usr/src/friendica/config/ /var/www/html/config/ + # In case there is no .htaccess, copy it from the default dist file if [ ! -f "/var/www/html/.htaccess" ]; then cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess" diff --git a/2019.06/apache/upgrade.exclude b/2019.06/apache/upgrade.exclude index 70fcec9..2fb6533 100644 --- a/2019.06/apache/upgrade.exclude +++ b/2019.06/apache/upgrade.exclude @@ -4,9 +4,7 @@ /.htconfig.php /.htaccess /home.* -/config/local.ini.php -/config/addon.ini.php -/config/local.config.php -/config/addon.config.php +/config/ /storage/ +/log/ *.log \ No newline at end of file diff --git a/2019.06/fpm-alpine/Dockerfile b/2019.06/fpm-alpine/Dockerfile index 0f75235..8b6ef17 100644 --- a/2019.06/fpm-alpine/Dockerfile +++ b/2019.06/fpm-alpine/Dockerfile @@ -52,7 +52,7 @@ RUN set -ex; \ --with-jpeg-dir=/usr/include/ \ ; \ \ - docker-php-ext-install -j 4 \ + docker-php-ext-install -j "$(nproc)" \ curl \ pdo \ pdo_mysql \ @@ -70,7 +70,7 @@ RUN set -ex; \ # pecl will claim success even if one install fails, so we need to perform each install separately pecl install APCu-5.1.17; \ pecl install memcached-3.1.3; \ - pecl install redis-4.3.0; \ + pecl install redis-5.0.1; \ pecl install imagick-3.4.4; \ \ docker-php-ext-enable \ @@ -89,8 +89,18 @@ RUN set -ex; \ apk add --virtual .friendica-phpext-rundeps $runDeps; \ apk del .build-deps; -RUN {\ - echo sendmail_path = "/usr/sbin/sendmail -t -i" ;\ +# set recommended PHP.ini settings +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.revalidte_freq=1'; \ + } > /usr/local/etc/php/conf.d/opcache-recommended.ini; \ + \ + { \ + echo sendmail_path = "/usr/sbin/sendmail -t -i"; \ } > /usr/local/etc/php/conf.d/sendmail.ini; \ \ echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \ @@ -104,9 +114,6 @@ RUN {\ VOLUME /var/www/html -COPY *.sh upgrade.exclude / -RUN chmod +x /*.sh - ENV FRIENDICA_VERSION 2019.06 ENV FRIENDICA_ADDONS 2019.06 @@ -125,5 +132,9 @@ RUN set -ex; \ rm friendica_addons.tar.gz; \ /usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica; +COPY *.sh upgrade.exclude / +COPY config/* /usr/src/friendica/config/ +RUN chmod +x /*.sh + ENTRYPOINT ["/entrypoint.sh"] CMD ["php-fpm"] diff --git a/2019.06/fpm-alpine/config/00apcu.config.php b/2019.06/fpm-alpine/config/00apcu.config.php new file mode 100644 index 0000000..d6dac4f --- /dev/null +++ b/2019.06/fpm-alpine/config/00apcu.config.php @@ -0,0 +1,12 @@ + [ + 'cache_driver' => 'apcu', + 'session_handler' => 'cache', + ], +]; diff --git a/2019.06/fpm-alpine/config/01redis.config.php b/2019.06/fpm-alpine/config/01redis.config.php new file mode 100644 index 0000000..422e4a5 --- /dev/null +++ b/2019.06/fpm-alpine/config/01redis.config.php @@ -0,0 +1,13 @@ + [ + 'lock_driver' => 'redis', + 'redis_host' => getenv('REDIS_HOST'), + 'redis_port' => (getenv('REDIS_PORT') ? getenv('REDIS_PORT') : ''), + 'redis_password' => (getenv('REDIS_PW') ? getenv('REDIS_PW') : ''), + 'redis_db' => (getenv('REDIS_DB') ? getenv('REDIS_DB') : 0), + ], + ]; +} diff --git a/2019.06/fpm-alpine/config/zz-docker.config.php b/2019.06/fpm-alpine/config/zz-docker.config.php new file mode 100644 index 0000000..638bef0 --- /dev/null +++ b/2019.06/fpm-alpine/config/zz-docker.config.php @@ -0,0 +1,66 @@ + [ + // Necessary because otherwise the daemon isn't working + 'pidfile' => '/var/run/friendica.pid', + + 'logfile' => '/var/www/html/friendica.log', + 'loglevel' => 'notice', + ], + 'storage' => [ + 'filesystem_path' => '/var/www/data', + ], +]; + +if (getenv('FRIENDICA_TZ')) { + $config['config']['timezone'] = getenv('FRIENDICA_TZ'); +} + +if (getenv('FRIENDICA_LANG')) { + $config['config']['language'] = getenv('FRIENDICA_LANG'); +} + +if (getenv('FRIENDICA_ADMIN_MAIL')) { + $config['config']['admin_mail'] = getenv('FRIENDICA_ADMIN_MAIL'); +} + +if (getenv('FRIENDICA_SITENAME')) { + $config['config']['sitename'] = getenv('FRIENDICA_SITENAME'); +} + +if (!empty(getenv('FRIENDICA_NO_VALIDATION'))) { + $config['system']['disable_url_validation'] = true; + $config['system']['disable_email_validation'] = true; +} + +if (!empty(getenv('FRIENDICA_DATA'))) { + $config['storage']['class'] = \Friendica\Model\Storage\Filesystem::class; + + if (!empty(getenv('FRIENDICA_DATA_DIR'))) { + $config['storage']['filesystem_path'] = getenv('FRIENDICA_DATA'); + } +} + +if (!empty(getenv('FRIENDICA_DEBUGGING'))) { + $config['system']['debugging'] = true; + if (!empty(getenv('FRIENDICA_LOGFILE'))) { + $config['system']['logfile'] = getenv('FRIENDICA_LOGFILE'); + } + if (!empty(getenv('FRIENDICA_LOGLEVEL'))) { + $config['system']['loglevel'] = getenv('FRIENDICA_LOGLEVEL'); + } +} + +if (!empty(getenv('HOSTNAME'))) { + $config['config']['hostname'] = getenv('HOSTNAME'); +} + +return $config; diff --git a/2019.06/fpm-alpine/entrypoint.sh b/2019.06/fpm-alpine/entrypoint.sh index abd2b83..d6750b7 100644 --- a/2019.06/fpm-alpine/entrypoint.sh +++ b/2019.06/fpm-alpine/entrypoint.sh @@ -128,6 +128,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/ + # Update docker-based config files, but never delete other config files + rsync $rsync_options --update /usr/src/friendica/config/ /var/www/html/config/ + # In case there is no .htaccess, copy it from the default dist file if [ ! -f "/var/www/html/.htaccess" ]; then cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess" diff --git a/2019.06/fpm-alpine/upgrade.exclude b/2019.06/fpm-alpine/upgrade.exclude index 70fcec9..2fb6533 100644 --- a/2019.06/fpm-alpine/upgrade.exclude +++ b/2019.06/fpm-alpine/upgrade.exclude @@ -4,9 +4,7 @@ /.htconfig.php /.htaccess /home.* -/config/local.ini.php -/config/addon.ini.php -/config/local.config.php -/config/addon.config.php +/config/ /storage/ +/log/ *.log \ No newline at end of file diff --git a/2019.06/fpm/Dockerfile b/2019.06/fpm/Dockerfile index 79733e4..9694c69 100644 --- a/2019.06/fpm/Dockerfile +++ b/2019.06/fpm/Dockerfile @@ -54,7 +54,7 @@ RUN set -ex; \ --with-png-dir=/usr/include/ \ --with-jpeg-dir=/usr/include/ \ ; \ - docker-php-ext-install -j 4 \ + docker-php-ext-install -j "$(nproc)" \ curl \ pdo \ pdo_mysql \ @@ -72,7 +72,7 @@ RUN set -ex; \ # pecl will claim success even if one install fails, so we need to perform each install separately pecl install apcu-5.1.17; \ pecl install memcached-3.1.3; \ - pecl install redis-4.3.0; \ + pecl install redis-5.0.1; \ pecl install imagick-3.4.4; \ \ docker-php-ext-enable \ @@ -96,8 +96,18 @@ RUN set -ex; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ rm -rf /var/lib/apt/lists/* -RUN {\ - echo sendmail_path = "/usr/sbin/sendmail -t -i" ;\ +# set recommended PHP.ini settings +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.revalidte_freq=1'; \ + } > /usr/local/etc/php/conf.d/opcache-recommended.ini; \ + \ + { \ + echo sendmail_path = "/usr/sbin/sendmail -t -i"; \ } > /usr/local/etc/php/conf.d/sendmail.ini; \ \ echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \ @@ -111,9 +121,6 @@ RUN {\ VOLUME /var/www/html -COPY *.sh upgrade.exclude / -RUN chmod +x /*.sh - ENV FRIENDICA_VERSION 2019.06 ENV FRIENDICA_ADDONS 2019.06 @@ -132,5 +139,9 @@ RUN set -ex; \ rm friendica_addons.tar.gz; \ /usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica; +COPY *.sh upgrade.exclude / +COPY config/* /usr/src/friendica/config/ +RUN chmod +x /*.sh + ENTRYPOINT ["/entrypoint.sh"] CMD ["php-fpm"] diff --git a/2019.06/fpm/config/00apcu.config.php b/2019.06/fpm/config/00apcu.config.php new file mode 100644 index 0000000..d6dac4f --- /dev/null +++ b/2019.06/fpm/config/00apcu.config.php @@ -0,0 +1,12 @@ + [ + 'cache_driver' => 'apcu', + 'session_handler' => 'cache', + ], +]; diff --git a/2019.06/fpm/config/01redis.config.php b/2019.06/fpm/config/01redis.config.php new file mode 100644 index 0000000..422e4a5 --- /dev/null +++ b/2019.06/fpm/config/01redis.config.php @@ -0,0 +1,13 @@ + [ + 'lock_driver' => 'redis', + 'redis_host' => getenv('REDIS_HOST'), + 'redis_port' => (getenv('REDIS_PORT') ? getenv('REDIS_PORT') : ''), + 'redis_password' => (getenv('REDIS_PW') ? getenv('REDIS_PW') : ''), + 'redis_db' => (getenv('REDIS_DB') ? getenv('REDIS_DB') : 0), + ], + ]; +} diff --git a/2019.06/fpm/config/zz-docker.config.php b/2019.06/fpm/config/zz-docker.config.php new file mode 100644 index 0000000..638bef0 --- /dev/null +++ b/2019.06/fpm/config/zz-docker.config.php @@ -0,0 +1,66 @@ + [ + // Necessary because otherwise the daemon isn't working + 'pidfile' => '/var/run/friendica.pid', + + 'logfile' => '/var/www/html/friendica.log', + 'loglevel' => 'notice', + ], + 'storage' => [ + 'filesystem_path' => '/var/www/data', + ], +]; + +if (getenv('FRIENDICA_TZ')) { + $config['config']['timezone'] = getenv('FRIENDICA_TZ'); +} + +if (getenv('FRIENDICA_LANG')) { + $config['config']['language'] = getenv('FRIENDICA_LANG'); +} + +if (getenv('FRIENDICA_ADMIN_MAIL')) { + $config['config']['admin_mail'] = getenv('FRIENDICA_ADMIN_MAIL'); +} + +if (getenv('FRIENDICA_SITENAME')) { + $config['config']['sitename'] = getenv('FRIENDICA_SITENAME'); +} + +if (!empty(getenv('FRIENDICA_NO_VALIDATION'))) { + $config['system']['disable_url_validation'] = true; + $config['system']['disable_email_validation'] = true; +} + +if (!empty(getenv('FRIENDICA_DATA'))) { + $config['storage']['class'] = \Friendica\Model\Storage\Filesystem::class; + + if (!empty(getenv('FRIENDICA_DATA_DIR'))) { + $config['storage']['filesystem_path'] = getenv('FRIENDICA_DATA'); + } +} + +if (!empty(getenv('FRIENDICA_DEBUGGING'))) { + $config['system']['debugging'] = true; + if (!empty(getenv('FRIENDICA_LOGFILE'))) { + $config['system']['logfile'] = getenv('FRIENDICA_LOGFILE'); + } + if (!empty(getenv('FRIENDICA_LOGLEVEL'))) { + $config['system']['loglevel'] = getenv('FRIENDICA_LOGLEVEL'); + } +} + +if (!empty(getenv('HOSTNAME'))) { + $config['config']['hostname'] = getenv('HOSTNAME'); +} + +return $config; diff --git a/2019.06/fpm/entrypoint.sh b/2019.06/fpm/entrypoint.sh index abd2b83..d6750b7 100644 --- a/2019.06/fpm/entrypoint.sh +++ b/2019.06/fpm/entrypoint.sh @@ -128,6 +128,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/ + # Update docker-based config files, but never delete other config files + rsync $rsync_options --update /usr/src/friendica/config/ /var/www/html/config/ + # In case there is no .htaccess, copy it from the default dist file if [ ! -f "/var/www/html/.htaccess" ]; then cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess" diff --git a/2019.06/fpm/upgrade.exclude b/2019.06/fpm/upgrade.exclude index 70fcec9..2fb6533 100644 --- a/2019.06/fpm/upgrade.exclude +++ b/2019.06/fpm/upgrade.exclude @@ -4,9 +4,7 @@ /.htconfig.php /.htaccess /home.* -/config/local.ini.php -/config/addon.ini.php -/config/local.config.php -/config/addon.config.php +/config/ /storage/ +/log/ *.log \ No newline at end of file diff --git a/2019.09-dev/apache/Dockerfile b/2019.09-dev/apache/Dockerfile index cad6505..6e45917 100644 --- a/2019.09-dev/apache/Dockerfile +++ b/2019.09-dev/apache/Dockerfile @@ -54,7 +54,7 @@ RUN set -ex; \ --with-png-dir=/usr/include/ \ --with-jpeg-dir=/usr/include/ \ ; \ - docker-php-ext-install -j 4 \ + docker-php-ext-install -j "$(nproc)" \ curl \ pdo \ pdo_mysql \ @@ -72,7 +72,7 @@ RUN set -ex; \ # pecl will claim success even if one install fails, so we need to perform each install separately pecl install apcu-5.1.17; \ pecl install memcached-3.1.3; \ - pecl install redis-4.3.0; \ + pecl install redis-5.0.1; \ pecl install imagick-3.4.4; \ \ docker-php-ext-enable \ @@ -96,8 +96,18 @@ RUN set -ex; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ rm -rf /var/lib/apt/lists/* -RUN {\ - echo sendmail_path = "/usr/sbin/sendmail -t -i" ;\ +# set recommended PHP.ini settings +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.revalidte_freq=1'; \ + } > /usr/local/etc/php/conf.d/opcache-recommended.ini; \ + \ + { \ + echo sendmail_path = "/usr/sbin/sendmail -t -i"; \ } > /usr/local/etc/php/conf.d/sendmail.ini; \ \ echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \ @@ -119,12 +129,13 @@ RUN a2enmod rewrite remoteip ;\ } > /etc/apache2/conf-available/remoteip.conf;\ a2enconf remoteip -COPY *.sh upgrade.exclude / -RUN chmod +x /*.sh - ENV FRIENDICA_VERSION 2019.09-dev ENV FRIENDICA_ADDONS 2019.09-dev +COPY *.sh upgrade.exclude / +COPY config/* /usr/src/friendica/config/ +RUN chmod +x /*.sh + ENTRYPOINT ["/entrypoint.sh"] CMD ["apache2-foreground"] diff --git a/2019.09-dev/apache/config/00apcu.config.php b/2019.09-dev/apache/config/00apcu.config.php new file mode 100644 index 0000000..d6dac4f --- /dev/null +++ b/2019.09-dev/apache/config/00apcu.config.php @@ -0,0 +1,12 @@ + [ + 'cache_driver' => 'apcu', + 'session_handler' => 'cache', + ], +]; diff --git a/2019.09-dev/apache/config/01redis.config.php b/2019.09-dev/apache/config/01redis.config.php new file mode 100644 index 0000000..422e4a5 --- /dev/null +++ b/2019.09-dev/apache/config/01redis.config.php @@ -0,0 +1,13 @@ + [ + 'lock_driver' => 'redis', + 'redis_host' => getenv('REDIS_HOST'), + 'redis_port' => (getenv('REDIS_PORT') ? getenv('REDIS_PORT') : ''), + 'redis_password' => (getenv('REDIS_PW') ? getenv('REDIS_PW') : ''), + 'redis_db' => (getenv('REDIS_DB') ? getenv('REDIS_DB') : 0), + ], + ]; +} diff --git a/2019.09-dev/apache/config/zz-docker.config.php b/2019.09-dev/apache/config/zz-docker.config.php new file mode 100644 index 0000000..638bef0 --- /dev/null +++ b/2019.09-dev/apache/config/zz-docker.config.php @@ -0,0 +1,66 @@ + [ + // Necessary because otherwise the daemon isn't working + 'pidfile' => '/var/run/friendica.pid', + + 'logfile' => '/var/www/html/friendica.log', + 'loglevel' => 'notice', + ], + 'storage' => [ + 'filesystem_path' => '/var/www/data', + ], +]; + +if (getenv('FRIENDICA_TZ')) { + $config['config']['timezone'] = getenv('FRIENDICA_TZ'); +} + +if (getenv('FRIENDICA_LANG')) { + $config['config']['language'] = getenv('FRIENDICA_LANG'); +} + +if (getenv('FRIENDICA_ADMIN_MAIL')) { + $config['config']['admin_mail'] = getenv('FRIENDICA_ADMIN_MAIL'); +} + +if (getenv('FRIENDICA_SITENAME')) { + $config['config']['sitename'] = getenv('FRIENDICA_SITENAME'); +} + +if (!empty(getenv('FRIENDICA_NO_VALIDATION'))) { + $config['system']['disable_url_validation'] = true; + $config['system']['disable_email_validation'] = true; +} + +if (!empty(getenv('FRIENDICA_DATA'))) { + $config['storage']['class'] = \Friendica\Model\Storage\Filesystem::class; + + if (!empty(getenv('FRIENDICA_DATA_DIR'))) { + $config['storage']['filesystem_path'] = getenv('FRIENDICA_DATA'); + } +} + +if (!empty(getenv('FRIENDICA_DEBUGGING'))) { + $config['system']['debugging'] = true; + if (!empty(getenv('FRIENDICA_LOGFILE'))) { + $config['system']['logfile'] = getenv('FRIENDICA_LOGFILE'); + } + if (!empty(getenv('FRIENDICA_LOGLEVEL'))) { + $config['system']['loglevel'] = getenv('FRIENDICA_LOGLEVEL'); + } +} + +if (!empty(getenv('HOSTNAME'))) { + $config['config']['hostname'] = getenv('HOSTNAME'); +} + +return $config; diff --git a/2019.09-dev/apache/entrypoint.sh b/2019.09-dev/apache/entrypoint.sh index abd2b83..d6750b7 100644 --- a/2019.09-dev/apache/entrypoint.sh +++ b/2019.09-dev/apache/entrypoint.sh @@ -128,6 +128,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/ + # Update docker-based config files, but never delete other config files + rsync $rsync_options --update /usr/src/friendica/config/ /var/www/html/config/ + # In case there is no .htaccess, copy it from the default dist file if [ ! -f "/var/www/html/.htaccess" ]; then cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess" diff --git a/2019.09-dev/apache/upgrade.exclude b/2019.09-dev/apache/upgrade.exclude index 70fcec9..2fb6533 100644 --- a/2019.09-dev/apache/upgrade.exclude +++ b/2019.09-dev/apache/upgrade.exclude @@ -4,9 +4,7 @@ /.htconfig.php /.htaccess /home.* -/config/local.ini.php -/config/addon.ini.php -/config/local.config.php -/config/addon.config.php +/config/ /storage/ +/log/ *.log \ No newline at end of file diff --git a/2019.09-dev/fpm-alpine/Dockerfile b/2019.09-dev/fpm-alpine/Dockerfile index fcf5e10..5a267a0 100644 --- a/2019.09-dev/fpm-alpine/Dockerfile +++ b/2019.09-dev/fpm-alpine/Dockerfile @@ -52,7 +52,7 @@ RUN set -ex; \ --with-jpeg-dir=/usr/include/ \ ; \ \ - docker-php-ext-install -j 4 \ + docker-php-ext-install -j "$(nproc)" \ curl \ pdo \ pdo_mysql \ @@ -70,7 +70,7 @@ RUN set -ex; \ # pecl will claim success even if one install fails, so we need to perform each install separately pecl install APCu-5.1.17; \ pecl install memcached-3.1.3; \ - pecl install redis-4.3.0; \ + pecl install redis-5.0.1; \ pecl install imagick-3.4.4; \ \ docker-php-ext-enable \ @@ -89,8 +89,18 @@ RUN set -ex; \ apk add --virtual .friendica-phpext-rundeps $runDeps; \ apk del .build-deps; -RUN {\ - echo sendmail_path = "/usr/sbin/sendmail -t -i" ;\ +# set recommended PHP.ini settings +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.revalidte_freq=1'; \ + } > /usr/local/etc/php/conf.d/opcache-recommended.ini; \ + \ + { \ + echo sendmail_path = "/usr/sbin/sendmail -t -i"; \ } > /usr/local/etc/php/conf.d/sendmail.ini; \ \ echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \ @@ -104,12 +114,13 @@ RUN {\ VOLUME /var/www/html -COPY *.sh upgrade.exclude / -RUN chmod +x /*.sh - ENV FRIENDICA_VERSION 2019.09-dev ENV FRIENDICA_ADDONS 2019.09-dev +COPY *.sh upgrade.exclude / +COPY config/* /usr/src/friendica/config/ +RUN chmod +x /*.sh + ENTRYPOINT ["/entrypoint.sh"] CMD ["php-fpm"] diff --git a/2019.09-dev/fpm-alpine/config/00apcu.config.php b/2019.09-dev/fpm-alpine/config/00apcu.config.php new file mode 100644 index 0000000..d6dac4f --- /dev/null +++ b/2019.09-dev/fpm-alpine/config/00apcu.config.php @@ -0,0 +1,12 @@ + [ + 'cache_driver' => 'apcu', + 'session_handler' => 'cache', + ], +]; diff --git a/2019.09-dev/fpm-alpine/config/01redis.config.php b/2019.09-dev/fpm-alpine/config/01redis.config.php new file mode 100644 index 0000000..422e4a5 --- /dev/null +++ b/2019.09-dev/fpm-alpine/config/01redis.config.php @@ -0,0 +1,13 @@ + [ + 'lock_driver' => 'redis', + 'redis_host' => getenv('REDIS_HOST'), + 'redis_port' => (getenv('REDIS_PORT') ? getenv('REDIS_PORT') : ''), + 'redis_password' => (getenv('REDIS_PW') ? getenv('REDIS_PW') : ''), + 'redis_db' => (getenv('REDIS_DB') ? getenv('REDIS_DB') : 0), + ], + ]; +} diff --git a/2019.09-dev/fpm-alpine/config/zz-docker.config.php b/2019.09-dev/fpm-alpine/config/zz-docker.config.php new file mode 100644 index 0000000..638bef0 --- /dev/null +++ b/2019.09-dev/fpm-alpine/config/zz-docker.config.php @@ -0,0 +1,66 @@ + [ + // Necessary because otherwise the daemon isn't working + 'pidfile' => '/var/run/friendica.pid', + + 'logfile' => '/var/www/html/friendica.log', + 'loglevel' => 'notice', + ], + 'storage' => [ + 'filesystem_path' => '/var/www/data', + ], +]; + +if (getenv('FRIENDICA_TZ')) { + $config['config']['timezone'] = getenv('FRIENDICA_TZ'); +} + +if (getenv('FRIENDICA_LANG')) { + $config['config']['language'] = getenv('FRIENDICA_LANG'); +} + +if (getenv('FRIENDICA_ADMIN_MAIL')) { + $config['config']['admin_mail'] = getenv('FRIENDICA_ADMIN_MAIL'); +} + +if (getenv('FRIENDICA_SITENAME')) { + $config['config']['sitename'] = getenv('FRIENDICA_SITENAME'); +} + +if (!empty(getenv('FRIENDICA_NO_VALIDATION'))) { + $config['system']['disable_url_validation'] = true; + $config['system']['disable_email_validation'] = true; +} + +if (!empty(getenv('FRIENDICA_DATA'))) { + $config['storage']['class'] = \Friendica\Model\Storage\Filesystem::class; + + if (!empty(getenv('FRIENDICA_DATA_DIR'))) { + $config['storage']['filesystem_path'] = getenv('FRIENDICA_DATA'); + } +} + +if (!empty(getenv('FRIENDICA_DEBUGGING'))) { + $config['system']['debugging'] = true; + if (!empty(getenv('FRIENDICA_LOGFILE'))) { + $config['system']['logfile'] = getenv('FRIENDICA_LOGFILE'); + } + if (!empty(getenv('FRIENDICA_LOGLEVEL'))) { + $config['system']['loglevel'] = getenv('FRIENDICA_LOGLEVEL'); + } +} + +if (!empty(getenv('HOSTNAME'))) { + $config['config']['hostname'] = getenv('HOSTNAME'); +} + +return $config; diff --git a/2019.09-dev/fpm-alpine/entrypoint.sh b/2019.09-dev/fpm-alpine/entrypoint.sh index abd2b83..d6750b7 100644 --- a/2019.09-dev/fpm-alpine/entrypoint.sh +++ b/2019.09-dev/fpm-alpine/entrypoint.sh @@ -128,6 +128,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/ + # Update docker-based config files, but never delete other config files + rsync $rsync_options --update /usr/src/friendica/config/ /var/www/html/config/ + # In case there is no .htaccess, copy it from the default dist file if [ ! -f "/var/www/html/.htaccess" ]; then cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess" diff --git a/2019.09-dev/fpm-alpine/upgrade.exclude b/2019.09-dev/fpm-alpine/upgrade.exclude index 70fcec9..2fb6533 100644 --- a/2019.09-dev/fpm-alpine/upgrade.exclude +++ b/2019.09-dev/fpm-alpine/upgrade.exclude @@ -4,9 +4,7 @@ /.htconfig.php /.htaccess /home.* -/config/local.ini.php -/config/addon.ini.php -/config/local.config.php -/config/addon.config.php +/config/ /storage/ +/log/ *.log \ No newline at end of file diff --git a/2019.09-dev/fpm/Dockerfile b/2019.09-dev/fpm/Dockerfile index 306ef2d..ec92216 100644 --- a/2019.09-dev/fpm/Dockerfile +++ b/2019.09-dev/fpm/Dockerfile @@ -54,7 +54,7 @@ RUN set -ex; \ --with-png-dir=/usr/include/ \ --with-jpeg-dir=/usr/include/ \ ; \ - docker-php-ext-install -j 4 \ + docker-php-ext-install -j "$(nproc)" \ curl \ pdo \ pdo_mysql \ @@ -72,7 +72,7 @@ RUN set -ex; \ # pecl will claim success even if one install fails, so we need to perform each install separately pecl install apcu-5.1.17; \ pecl install memcached-3.1.3; \ - pecl install redis-4.3.0; \ + pecl install redis-5.0.1; \ pecl install imagick-3.4.4; \ \ docker-php-ext-enable \ @@ -96,8 +96,18 @@ RUN set -ex; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ rm -rf /var/lib/apt/lists/* -RUN {\ - echo sendmail_path = "/usr/sbin/sendmail -t -i" ;\ +# set recommended PHP.ini settings +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.revalidte_freq=1'; \ + } > /usr/local/etc/php/conf.d/opcache-recommended.ini; \ + \ + { \ + echo sendmail_path = "/usr/sbin/sendmail -t -i"; \ } > /usr/local/etc/php/conf.d/sendmail.ini; \ \ echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \ @@ -111,12 +121,13 @@ RUN {\ VOLUME /var/www/html -COPY *.sh upgrade.exclude / -RUN chmod +x /*.sh - ENV FRIENDICA_VERSION 2019.09-dev ENV FRIENDICA_ADDONS 2019.09-dev +COPY *.sh upgrade.exclude / +COPY config/* /usr/src/friendica/config/ +RUN chmod +x /*.sh + ENTRYPOINT ["/entrypoint.sh"] CMD ["php-fpm"] diff --git a/2019.09-dev/fpm/config/00apcu.config.php b/2019.09-dev/fpm/config/00apcu.config.php new file mode 100644 index 0000000..d6dac4f --- /dev/null +++ b/2019.09-dev/fpm/config/00apcu.config.php @@ -0,0 +1,12 @@ + [ + 'cache_driver' => 'apcu', + 'session_handler' => 'cache', + ], +]; diff --git a/2019.09-dev/fpm/config/01redis.config.php b/2019.09-dev/fpm/config/01redis.config.php new file mode 100644 index 0000000..422e4a5 --- /dev/null +++ b/2019.09-dev/fpm/config/01redis.config.php @@ -0,0 +1,13 @@ + [ + 'lock_driver' => 'redis', + 'redis_host' => getenv('REDIS_HOST'), + 'redis_port' => (getenv('REDIS_PORT') ? getenv('REDIS_PORT') : ''), + 'redis_password' => (getenv('REDIS_PW') ? getenv('REDIS_PW') : ''), + 'redis_db' => (getenv('REDIS_DB') ? getenv('REDIS_DB') : 0), + ], + ]; +} diff --git a/2019.09-dev/fpm/config/zz-docker.config.php b/2019.09-dev/fpm/config/zz-docker.config.php new file mode 100644 index 0000000..638bef0 --- /dev/null +++ b/2019.09-dev/fpm/config/zz-docker.config.php @@ -0,0 +1,66 @@ + [ + // Necessary because otherwise the daemon isn't working + 'pidfile' => '/var/run/friendica.pid', + + 'logfile' => '/var/www/html/friendica.log', + 'loglevel' => 'notice', + ], + 'storage' => [ + 'filesystem_path' => '/var/www/data', + ], +]; + +if (getenv('FRIENDICA_TZ')) { + $config['config']['timezone'] = getenv('FRIENDICA_TZ'); +} + +if (getenv('FRIENDICA_LANG')) { + $config['config']['language'] = getenv('FRIENDICA_LANG'); +} + +if (getenv('FRIENDICA_ADMIN_MAIL')) { + $config['config']['admin_mail'] = getenv('FRIENDICA_ADMIN_MAIL'); +} + +if (getenv('FRIENDICA_SITENAME')) { + $config['config']['sitename'] = getenv('FRIENDICA_SITENAME'); +} + +if (!empty(getenv('FRIENDICA_NO_VALIDATION'))) { + $config['system']['disable_url_validation'] = true; + $config['system']['disable_email_validation'] = true; +} + +if (!empty(getenv('FRIENDICA_DATA'))) { + $config['storage']['class'] = \Friendica\Model\Storage\Filesystem::class; + + if (!empty(getenv('FRIENDICA_DATA_DIR'))) { + $config['storage']['filesystem_path'] = getenv('FRIENDICA_DATA'); + } +} + +if (!empty(getenv('FRIENDICA_DEBUGGING'))) { + $config['system']['debugging'] = true; + if (!empty(getenv('FRIENDICA_LOGFILE'))) { + $config['system']['logfile'] = getenv('FRIENDICA_LOGFILE'); + } + if (!empty(getenv('FRIENDICA_LOGLEVEL'))) { + $config['system']['loglevel'] = getenv('FRIENDICA_LOGLEVEL'); + } +} + +if (!empty(getenv('HOSTNAME'))) { + $config['config']['hostname'] = getenv('HOSTNAME'); +} + +return $config; diff --git a/2019.09-dev/fpm/entrypoint.sh b/2019.09-dev/fpm/entrypoint.sh index abd2b83..d6750b7 100644 --- a/2019.09-dev/fpm/entrypoint.sh +++ b/2019.09-dev/fpm/entrypoint.sh @@ -128,6 +128,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/ + # Update docker-based config files, but never delete other config files + rsync $rsync_options --update /usr/src/friendica/config/ /var/www/html/config/ + # In case there is no .htaccess, copy it from the default dist file if [ ! -f "/var/www/html/.htaccess" ]; then cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess" diff --git a/2019.09-dev/fpm/upgrade.exclude b/2019.09-dev/fpm/upgrade.exclude index 70fcec9..2fb6533 100644 --- a/2019.09-dev/fpm/upgrade.exclude +++ b/2019.09-dev/fpm/upgrade.exclude @@ -4,9 +4,7 @@ /.htconfig.php /.htaccess /home.* -/config/local.ini.php -/config/addon.ini.php -/config/local.config.php -/config/addon.config.php +/config/ /storage/ +/log/ *.log \ No newline at end of file diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index b647dcd..d7574c5 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -51,7 +51,7 @@ RUN set -ex; \ --with-jpeg-dir=/usr/include/ \ ; \ \ - docker-php-ext-install -j 4 \ + docker-php-ext-install -j "$(nproc)" \ curl \ pdo \ pdo_mysql \ @@ -88,8 +88,18 @@ RUN set -ex; \ apk add --virtual .friendica-phpext-rundeps $runDeps; \ apk del .build-deps; -RUN {\ - echo sendmail_path = "/usr/sbin/sendmail -t -i" ;\ +# set recommended PHP.ini settings +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.revalidte_freq=1'; \ + } > /usr/local/etc/php/conf.d/opcache-recommended.ini; \ + \ + { \ + echo sendmail_path = "/usr/sbin/sendmail -t -i"; \ } > /usr/local/etc/php/conf.d/sendmail.ini; \ \ echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \ @@ -103,12 +113,13 @@ RUN {\ VOLUME /var/www/html %%VARIANT_EXTRAS%% -COPY *.sh upgrade.exclude / -RUN chmod +x /*.sh - ENV FRIENDICA_VERSION %%VERSION%% ENV FRIENDICA_ADDONS %%VERSION%% %%INSTALL_EXTRAS%% +COPY *.sh upgrade.exclude / +COPY config/* /usr/src/friendica/config/ +RUN chmod +x /*.sh + ENTRYPOINT ["/entrypoint.sh"] CMD ["%%CMD%%"] diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template index 919c06a..aa8e3f3 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-debian.template @@ -53,7 +53,7 @@ RUN set -ex; \ --with-png-dir=/usr/include/ \ --with-jpeg-dir=/usr/include/ \ ; \ - docker-php-ext-install -j 4 \ + docker-php-ext-install -j "$(nproc)" \ curl \ pdo \ pdo_mysql \ @@ -95,8 +95,18 @@ RUN set -ex; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ rm -rf /var/lib/apt/lists/* -RUN {\ - echo sendmail_path = "/usr/sbin/sendmail -t -i" ;\ +# set recommended PHP.ini settings +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.revalidte_freq=1'; \ + } > /usr/local/etc/php/conf.d/opcache-recommended.ini; \ + \ + { \ + echo sendmail_path = "/usr/sbin/sendmail -t -i"; \ } > /usr/local/etc/php/conf.d/sendmail.ini; \ \ echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \ @@ -110,12 +120,13 @@ RUN {\ VOLUME /var/www/html %%VARIANT_EXTRAS%% -COPY *.sh upgrade.exclude / -RUN chmod +x /*.sh - ENV FRIENDICA_VERSION %%VERSION%% ENV FRIENDICA_ADDONS %%VERSION%% %%INSTALL_EXTRAS%% +COPY *.sh upgrade.exclude / +COPY config/* /usr/src/friendica/config/ +RUN chmod +x /*.sh + ENTRYPOINT ["/entrypoint.sh"] CMD ["%%CMD%%"] diff --git a/README.md b/README.md index ceb2227..ec59296 100644 --- a/README.md +++ b/README.md @@ -66,11 +66,20 @@ There are three options to enable the cron-job for Friendica: ## Possible Environment Variables -**Auto Install Settings** +**Friendica Settings** - `FRIENDICA_ADMIN_MAIL` E-Mail address of the administrator. - `FRIENDICA_TZ` The default localization of the Friendica server. - `FRIENDICA_LANG` The default language of the Friendica server. - `FRIENDICA_PHP_PATH` The path of the PHP binary. +- `FRIENDICA_SITENAME` The Sitename of the Friendica server. +- `FRIENDICA_NO_VALIDATION` If set to `true`, the URL and E-Mail validation will be disabled. +- `FRIENDICA_DATA` If set to `true`, the fileystem will be used instead of the DB backend. +- `FRIENDICA_DATA_DIR` The data directory of the Friendica server (Default: /var/www/data). + +**Friendica Logging** +- `FRIENDICA_DEBUGGING` If set to `true`, the logging of Friendica is enabled. +- `FRIENDICA_LOGFILE` (optional) The path to the logfile (Default: /var/www/friendica.log). +- `FRIENDICA_LOGLEVEL` (optional) The loglevel to log (Default: notice). **Database** (**required at installation**) - `MYSQL_USERNAME` Username for the database user using mysql. @@ -80,6 +89,12 @@ There are three options to enable the cron-job for Friendica: - `MYSQL_HOST` Hostname of the database server using mysql / mariadb. - `MYSQL_PORT` Port of the database server using mysql / mariadb (Default: `3306`) +**Lock Driver (Redis)** +- `REDIS_HOST` The hostname of the redis instance (in case of locking). +- `REDIS_PORT` (optional) The port of the redis instance (in case of locking). +- `REDIS_PW` (optional) The password for the redis instance (in case of locking). +- `REDIS_DB` (optional) The database instance of the redis instance (in case of locking). + **Develop/Release Candidat Settings** - `FRIENDICA_UPGRADE` If set to `true`, a develop or release candidat node will get updated at startup. - `FRIENDICA_REPOSITORY` If set, a custom repository will be chosen (Default: `friendica`) diff --git a/.docker-files/cron.sh b/docker-cron.sh similarity index 100% rename from .docker-files/cron.sh rename to docker-cron.sh diff --git a/.docker-files/entrypoint.sh b/docker-entrypoint.sh similarity index 97% rename from .docker-files/entrypoint.sh rename to docker-entrypoint.sh index abd2b83..d6750b7 100644 --- a/.docker-files/entrypoint.sh +++ b/docker-entrypoint.sh @@ -128,6 +128,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/ + # Update docker-based config files, but never delete other config files + rsync $rsync_options --update /usr/src/friendica/config/ /var/www/html/config/ + # In case there is no .htaccess, copy it from the default dist file if [ ! -f "/var/www/html/.htaccess" ]; then cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess" diff --git a/stack.yml b/stack.yml index 692fd1c..9d3cbca 100644 --- a/stack.yml +++ b/stack.yml @@ -26,6 +26,7 @@ services: - MYSQL_DATABASE=friendica - FRIENDICA_ADMIN_MAIL=root@friendica.local - SITENAME=Friendica PWD Test Node + - FRIENDICA_NO_VALIDATION=true hostname: friendica.local depends_on: - db diff --git a/update.sh b/update.sh index 2e09b5b..314f970 100755 --- a/update.sh +++ b/update.sh @@ -118,16 +118,14 @@ function create_variant() { s/%%REDIS_VERSION%%/'"${pecl_versions[redis]}"'/g; ' "$dir/Dockerfile" - # Copy the .docker-files to the directories (excluding README.md) - for name in ".docker-files"/*; do - # Don't copy the README of any directory - if [[ "$name" == *.sh || "$name" == *.exclude ]]; then - file=${name#".docker-files"} - mkdir -p $(dirname $dir/$file) - cp -r "$name" "$dir/$file" - fi + for name in entrypoint cron; do + cp "docker-$name.sh" "$dir/$name.sh" done + cp upgrade.exclude "$dir/" + + cp -rT .config "$dir/config" + travisEnvAmd64='\n - env: VERSION='"$dockerName"' VARIANT='"$variant"' ARCH=amd64'"$travisEnvAmd64" for arch in i386 amd64; do travisEnv='\n - env: VERSION='"$dockerName"' VARIANT='"$variant"' ARCH='"$arch$travisEnv" diff --git a/upgrade.exclude b/upgrade.exclude new file mode 100644 index 0000000..2fb6533 --- /dev/null +++ b/upgrade.exclude @@ -0,0 +1,10 @@ +/.git/ +/photo/ +/proxy/ +/.htconfig.php +/.htaccess +/home.* +/config/ +/storage/ +/log/ +*.log \ No newline at end of file