2
0
Fork 0
mirror of https://github.com/friendica/docker synced 2024-12-28 08:05:20 +01:00

Add dynamic config compatibility

- Use APCu cache as default caching mechanism
- Add explicit redis environment variables for redis lock-support
- Add a lot of environment variables, which aren't part of admin-page
- Add possibility to disable URL & E-Mail validation (for demo-page)
- Dynamically copy /config/ content without overwriting existing one

Add opcache support for performance reason
Add multi-core support for php extensions install

Bump redis version to 5.0.1 (last stable)

Exclude /log/ directory during sync (to avoid deleting logs)
This commit is contained in:
Philipp Holzer 2019-07-19 17:37:44 +02:00
parent 617b12fd7f
commit 841a0b438b
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
49 changed files with 845 additions and 122 deletions

12
.config/00apcu.config.php Normal file
View file

@ -0,0 +1,12 @@
<?php
/**
* If nothing else set, use APCu as a caching driver (best performance for local caching)
*/
return [
'system' => [
'cache_driver' => 'apcu',
'session_handler' => 'cache',
],
];

View file

@ -0,0 +1,13 @@
<?php
if (getenv('REDIS_HOST')) {
return [
'system' => [
'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),
],
];
}

View file

@ -0,0 +1,66 @@
<?php
/**
* Fallback config to make it possible overwriting config values
* because of docker environment variables
*
* This doesn't affect DB configurations, but will replace other config values
*/
$config = [
'system' => [
// 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;

View file

@ -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`)

View file

@ -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

View file

@ -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"]

View file

@ -0,0 +1,12 @@
<?php
/**
* If nothing else set, use APCu as a caching driver (best performance for local caching)
*/
return [
'system' => [
'cache_driver' => 'apcu',
'session_handler' => 'cache',
],
];

View file

@ -0,0 +1,13 @@
<?php
if (getenv('REDIS_HOST')) {
return [
'system' => [
'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),
],
];
}

View file

@ -0,0 +1,66 @@
<?php
/**
* Fallback config to make it possible overwriting config values
* because of docker environment variables
*
* This doesn't affect DB configurations, but will replace other config values
*/
$config = [
'system' => [
// 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;

View file

@ -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"

View file

@ -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

View file

@ -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"]

View file

@ -0,0 +1,12 @@
<?php
/**
* If nothing else set, use APCu as a caching driver (best performance for local caching)
*/
return [
'system' => [
'cache_driver' => 'apcu',
'session_handler' => 'cache',
],
];

View file

@ -0,0 +1,13 @@
<?php
if (getenv('REDIS_HOST')) {
return [
'system' => [
'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),
],
];
}

View file

@ -0,0 +1,66 @@
<?php
/**
* Fallback config to make it possible overwriting config values
* because of docker environment variables
*
* This doesn't affect DB configurations, but will replace other config values
*/
$config = [
'system' => [
// 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;

View file

@ -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"

View file

@ -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

View file

@ -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"]

View file

@ -0,0 +1,12 @@
<?php
/**
* If nothing else set, use APCu as a caching driver (best performance for local caching)
*/
return [
'system' => [
'cache_driver' => 'apcu',
'session_handler' => 'cache',
],
];

View file

@ -0,0 +1,13 @@
<?php
if (getenv('REDIS_HOST')) {
return [
'system' => [
'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),
],
];
}

View file

@ -0,0 +1,66 @@
<?php
/**
* Fallback config to make it possible overwriting config values
* because of docker environment variables
*
* This doesn't affect DB configurations, but will replace other config values
*/
$config = [
'system' => [
// 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;

View file

@ -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"

View file

@ -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

View file

@ -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"]

View file

@ -0,0 +1,12 @@
<?php
/**
* If nothing else set, use APCu as a caching driver (best performance for local caching)
*/
return [
'system' => [
'cache_driver' => 'apcu',
'session_handler' => 'cache',
],
];

View file

@ -0,0 +1,13 @@
<?php
if (getenv('REDIS_HOST')) {
return [
'system' => [
'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),
],
];
}

View file

@ -0,0 +1,66 @@
<?php
/**
* Fallback config to make it possible overwriting config values
* because of docker environment variables
*
* This doesn't affect DB configurations, but will replace other config values
*/
$config = [
'system' => [
// 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;

View file

@ -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"

View file

@ -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

View file

@ -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"]

View file

@ -0,0 +1,12 @@
<?php
/**
* If nothing else set, use APCu as a caching driver (best performance for local caching)
*/
return [
'system' => [
'cache_driver' => 'apcu',
'session_handler' => 'cache',
],
];

View file

@ -0,0 +1,13 @@
<?php
if (getenv('REDIS_HOST')) {
return [
'system' => [
'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),
],
];
}

View file

@ -0,0 +1,66 @@
<?php
/**
* Fallback config to make it possible overwriting config values
* because of docker environment variables
*
* This doesn't affect DB configurations, but will replace other config values
*/
$config = [
'system' => [
// 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;

View file

@ -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"

View file

@ -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

View file

@ -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"]

View file

@ -0,0 +1,12 @@
<?php
/**
* If nothing else set, use APCu as a caching driver (best performance for local caching)
*/
return [
'system' => [
'cache_driver' => 'apcu',
'session_handler' => 'cache',
],
];

View file

@ -0,0 +1,13 @@
<?php
if (getenv('REDIS_HOST')) {
return [
'system' => [
'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),
],
];
}

View file

@ -0,0 +1,66 @@
<?php
/**
* Fallback config to make it possible overwriting config values
* because of docker environment variables
*
* This doesn't affect DB configurations, but will replace other config values
*/
$config = [
'system' => [
// 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;

View file

@ -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"

View file

@ -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

View file

@ -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%%"]

View file

@ -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%%"]

View file

@ -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`)

View file

@ -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"

View file

@ -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

View file

@ -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"

10
upgrade.exclude Normal file
View file

@ -0,0 +1,10 @@
/.git/
/photo/
/proxy/
/.htconfig.php
/.htaccess
/home.*
/config/
/storage/
/log/
*.log