2
0
Fork 0
mirror of https://github.com/friendica/docker synced 2024-11-14 14:03:43 +01:00

Merge pull request #27 from nupplaphil/caching

Adding Cache-Options
This commit is contained in:
Hypolite Petovan 2018-06-22 16:06:17 -04:00 committed by GitHub
commit b876d92b54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 299 additions and 11 deletions

View file

@ -110,4 +110,28 @@ $a->config['system']['auth_cookie_lifetime'] = 7;
if (!empty(getenv('VALIDATION'))) {
$a->config['system']['disable_url_validation'] = strtolower(getenv('VALIDATION'));
$a->config['system']['disable_email_validation'] = strtolower(getenv('VALIDATION'));
}
if (!empty(getenv('CACHE_DRIVER'))) {
$a->config['system']['cache_driver'] = strtolower(getenv('CACHE_DRIVER'));
if (!empty(getenv('REDIS_HOST'))) {
$a->config['system']['redis_host'] = getenv('REDIS_HOST');
}
if (!empty(getenv('REDIS_PORT'))) {
$a->config['system']['redis_port'] = getenv('REDIS_PORT');
}
if (!empty(getenv('MEMCACHE_HOST'))) {
$a->config['system']['memcache_host'] = getenv('MEMCACHE_HOST');
}
if (!empty(getenv('MEMCACHE_PORT'))) {
$a->config['system']['memcache_port'] = getenv('MEMCACHE_PORT');
}
if (!empty(getenv('MEMCACHED_HOSTS'))) {
$a->config['system']['memcached_hosts'] = getenv('MEMCACHED_HOSTS');
}
}

View file

@ -11,6 +11,10 @@ services:
env_file:
- db.env
redis:
image: redis
restart: always
app:
image: friendica/server:apache
restart: always
@ -18,6 +22,8 @@ services:
- friendica:/var/www/html
environment:
- AUTOINSTALL=true
- CACHE_DRIVER=redis
- REDIS_HOST=redis
- MAILNAME=
- TZ=
- LANGUAGE=
@ -37,6 +43,8 @@ services:
- friendica:/var/www/html
entrypoint: /cron.sh
environment:
- CACHE_DRIVER=redis
- REDIS_HOST=redis
- MAILNAME=
- TZ=
- LANGUAGE=

View file

@ -11,6 +11,10 @@ services:
env_file:
- db.env
redis:
image: redis
restart: always
app:
image: friendica/server:fpm-alpine
restart: always
@ -18,6 +22,8 @@ services:
- friendica:/var/www/html
environment:
- AUTOINSTALL=true
- CACHE_DRIVER=redis
- REDIS_HOST=redis
- MAILNAME=
- TZ=
- LANGUAGE=
@ -35,6 +41,8 @@ services:
- friendica:/var/www/html
entrypoint: /cron.sh
environment:
- CACHE_DRIVER=redis
- REDIS_HOST=redis
- MAILNAME=
- TZ=
- LANGUAGE=

View file

@ -11,6 +11,10 @@ services:
env_file:
- db.env
redis:
image: redis
restart: always
app:
image: friendica/server:fpm
restart: always
@ -18,6 +22,8 @@ services:
- friendica:/var/www/html
environment:
- AUTOINSTALL=true
- CACHE_DRIVER=redis
- REDIS_HOST=redis
- MAILNAME=
- TZ=
- LANGUAGE=
@ -34,6 +40,8 @@ services:
- friendica:/var/www/html
entrypoint: /cron.sh
environment:
- CACHE_DRIVER=redis
- REDIS_HOST=redis
- MAILNAME=
- TZ=
- LANGUAGE=

View file

@ -38,6 +38,7 @@ RUN set -ex; \
libmcrypt-dev \
imagemagick \
libmagick++-dev \
libmemcached-dev \
libgraphicsmagick1-dev \
libfreetype6 \
libfreetype6-dev \
@ -60,6 +61,15 @@ RUN set -ex; \
; \
docker-php-ext-install -j 4 curl pdo pdo_mysql xml gd zip opcache mbstring posix ctype json iconv mcrypt \
; \
# pecl will claim success even if one install fails, so we need to perform each install separately
pecl install memcached-3.0.4; \
pecl install redis-3.1.6; \
\
docker-php-ext-enable \
memcached \
redis \
; \
\
# 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; \

View file

@ -110,4 +110,28 @@ $a->config['system']['auth_cookie_lifetime'] = 7;
if (!empty(getenv('VALIDATION'))) {
$a->config['system']['disable_url_validation'] = strtolower(getenv('VALIDATION'));
$a->config['system']['disable_email_validation'] = strtolower(getenv('VALIDATION'));
}
if (!empty(getenv('CACHE_DRIVER'))) {
$a->config['system']['cache_driver'] = strtolower(getenv('CACHE_DRIVER'));
if (!empty(getenv('REDIS_HOST'))) {
$a->config['system']['redis_host'] = getenv('REDIS_HOST');
}
if (!empty(getenv('REDIS_PORT'))) {
$a->config['system']['redis_port'] = getenv('REDIS_PORT');
}
if (!empty(getenv('MEMCACHE_HOST'))) {
$a->config['system']['memcache_host'] = getenv('MEMCACHE_HOST');
}
if (!empty(getenv('MEMCACHE_PORT'))) {
$a->config['system']['memcache_port'] = getenv('MEMCACHE_PORT');
}
if (!empty(getenv('MEMCACHED_HOSTS'))) {
$a->config['system']['memcached_hosts'] = getenv('MEMCACHED_HOSTS');
}
}

View file

@ -31,6 +31,8 @@ RUN set -ex; \
libtool \
libmcrypt \
libmcrypt-dev \
libmemcached-dev \
cyrus-sasl-dev \
freetype \
libpng \
libjpeg-turbo-dev \
@ -55,6 +57,15 @@ RUN set -ex; \
; \
docker-php-ext-install -j 4 curl pdo pdo_mysql xml gd zip opcache mbstring posix ctype json iconv mcrypt; \
\
# pecl will claim success even if one install fails, so we need to perform each install separately
pecl install memcached-3.0.4; \
pecl install redis-3.1.6; \
\
docker-php-ext-enable \
memcached \
redis \
; \
\
runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
| tr ',' '\n' \

View file

@ -110,4 +110,28 @@ $a->config['system']['auth_cookie_lifetime'] = 7;
if (!empty(getenv('VALIDATION'))) {
$a->config['system']['disable_url_validation'] = strtolower(getenv('VALIDATION'));
$a->config['system']['disable_email_validation'] = strtolower(getenv('VALIDATION'));
}
if (!empty(getenv('CACHE_DRIVER'))) {
$a->config['system']['cache_driver'] = strtolower(getenv('CACHE_DRIVER'));
if (!empty(getenv('REDIS_HOST'))) {
$a->config['system']['redis_host'] = getenv('REDIS_HOST');
}
if (!empty(getenv('REDIS_PORT'))) {
$a->config['system']['redis_port'] = getenv('REDIS_PORT');
}
if (!empty(getenv('MEMCACHE_HOST'))) {
$a->config['system']['memcache_host'] = getenv('MEMCACHE_HOST');
}
if (!empty(getenv('MEMCACHE_PORT'))) {
$a->config['system']['memcache_port'] = getenv('MEMCACHE_PORT');
}
if (!empty(getenv('MEMCACHED_HOSTS'))) {
$a->config['system']['memcached_hosts'] = getenv('MEMCACHED_HOSTS');
}
}

View file

@ -38,6 +38,7 @@ RUN set -ex; \
libmcrypt-dev \
imagemagick \
libmagick++-dev \
libmemcached-dev \
libgraphicsmagick1-dev \
libfreetype6 \
libfreetype6-dev \
@ -60,6 +61,15 @@ RUN set -ex; \
; \
docker-php-ext-install -j 4 curl pdo pdo_mysql xml gd zip opcache mbstring posix ctype json iconv mcrypt \
; \
# pecl will claim success even if one install fails, so we need to perform each install separately
pecl install memcached-3.0.4; \
pecl install redis-3.1.6; \
\
docker-php-ext-enable \
memcached \
redis \
; \
\
# 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; \

View file

@ -110,4 +110,28 @@ $a->config['system']['auth_cookie_lifetime'] = 7;
if (!empty(getenv('VALIDATION'))) {
$a->config['system']['disable_url_validation'] = strtolower(getenv('VALIDATION'));
$a->config['system']['disable_email_validation'] = strtolower(getenv('VALIDATION'));
}
if (!empty(getenv('CACHE_DRIVER'))) {
$a->config['system']['cache_driver'] = strtolower(getenv('CACHE_DRIVER'));
if (!empty(getenv('REDIS_HOST'))) {
$a->config['system']['redis_host'] = getenv('REDIS_HOST');
}
if (!empty(getenv('REDIS_PORT'))) {
$a->config['system']['redis_port'] = getenv('REDIS_PORT');
}
if (!empty(getenv('MEMCACHE_HOST'))) {
$a->config['system']['memcache_host'] = getenv('MEMCACHE_HOST');
}
if (!empty(getenv('MEMCACHE_PORT'))) {
$a->config['system']['memcache_port'] = getenv('MEMCACHE_PORT');
}
if (!empty(getenv('MEMCACHED_HOSTS'))) {
$a->config['system']['memcached_hosts'] = getenv('MEMCACHED_HOSTS');
}
}

View file

@ -38,6 +38,7 @@ RUN set -ex; \
libmcrypt-dev \
imagemagick \
libmagick++-dev \
libmemcached-dev \
libgraphicsmagick1-dev \
libfreetype6 \
libfreetype6-dev \
@ -60,6 +61,15 @@ RUN set -ex; \
; \
docker-php-ext-install -j 4 curl pdo pdo_mysql xml gd zip opcache mbstring posix ctype json iconv mcrypt \
; \
# pecl will claim success even if one install fails, so we need to perform each install separately
pecl install memcached-3.0.4; \
pecl install redis-3.1.6; \
\
docker-php-ext-enable \
memcached \
redis \
; \
\
# 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; \

View file

@ -110,4 +110,28 @@ $a->config['system']['auth_cookie_lifetime'] = 7;
if (!empty(getenv('VALIDATION'))) {
$a->config['system']['disable_url_validation'] = strtolower(getenv('VALIDATION'));
$a->config['system']['disable_email_validation'] = strtolower(getenv('VALIDATION'));
}
if (!empty(getenv('CACHE_DRIVER'))) {
$a->config['system']['cache_driver'] = strtolower(getenv('CACHE_DRIVER'));
if (!empty(getenv('REDIS_HOST'))) {
$a->config['system']['redis_host'] = getenv('REDIS_HOST');
}
if (!empty(getenv('REDIS_PORT'))) {
$a->config['system']['redis_port'] = getenv('REDIS_PORT');
}
if (!empty(getenv('MEMCACHE_HOST'))) {
$a->config['system']['memcache_host'] = getenv('MEMCACHE_HOST');
}
if (!empty(getenv('MEMCACHE_PORT'))) {
$a->config['system']['memcache_port'] = getenv('MEMCACHE_PORT');
}
if (!empty(getenv('MEMCACHED_HOSTS'))) {
$a->config['system']['memcached_hosts'] = getenv('MEMCACHED_HOSTS');
}
}

View file

@ -31,6 +31,8 @@ RUN set -ex; \
libtool \
libmcrypt \
libmcrypt-dev \
libmemcached-dev \
cyrus-sasl-dev \
freetype \
libpng \
libjpeg-turbo-dev \
@ -55,6 +57,15 @@ RUN set -ex; \
; \
docker-php-ext-install -j 4 curl pdo pdo_mysql xml gd zip opcache mbstring posix ctype json iconv mcrypt; \
\
# pecl will claim success even if one install fails, so we need to perform each install separately
pecl install memcached-3.0.4; \
pecl install redis-3.1.6; \
\
docker-php-ext-enable \
memcached \
redis \
; \
\
runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
| tr ',' '\n' \

View file

@ -110,4 +110,28 @@ $a->config['system']['auth_cookie_lifetime'] = 7;
if (!empty(getenv('VALIDATION'))) {
$a->config['system']['disable_url_validation'] = strtolower(getenv('VALIDATION'));
$a->config['system']['disable_email_validation'] = strtolower(getenv('VALIDATION'));
}
if (!empty(getenv('CACHE_DRIVER'))) {
$a->config['system']['cache_driver'] = strtolower(getenv('CACHE_DRIVER'));
if (!empty(getenv('REDIS_HOST'))) {
$a->config['system']['redis_host'] = getenv('REDIS_HOST');
}
if (!empty(getenv('REDIS_PORT'))) {
$a->config['system']['redis_port'] = getenv('REDIS_PORT');
}
if (!empty(getenv('MEMCACHE_HOST'))) {
$a->config['system']['memcache_host'] = getenv('MEMCACHE_HOST');
}
if (!empty(getenv('MEMCACHE_PORT'))) {
$a->config['system']['memcache_port'] = getenv('MEMCACHE_PORT');
}
if (!empty(getenv('MEMCACHED_HOSTS'))) {
$a->config['system']['memcached_hosts'] = getenv('MEMCACHED_HOSTS');
}
}

View file

@ -38,6 +38,7 @@ RUN set -ex; \
libmcrypt-dev \
imagemagick \
libmagick++-dev \
libmemcached-dev \
libgraphicsmagick1-dev \
libfreetype6 \
libfreetype6-dev \
@ -60,6 +61,15 @@ RUN set -ex; \
; \
docker-php-ext-install -j 4 curl pdo pdo_mysql xml gd zip opcache mbstring posix ctype json iconv mcrypt \
; \
# pecl will claim success even if one install fails, so we need to perform each install separately
pecl install memcached-3.0.4; \
pecl install redis-3.1.6; \
\
docker-php-ext-enable \
memcached \
redis \
; \
\
# 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; \

View file

@ -110,4 +110,28 @@ $a->config['system']['auth_cookie_lifetime'] = 7;
if (!empty(getenv('VALIDATION'))) {
$a->config['system']['disable_url_validation'] = strtolower(getenv('VALIDATION'));
$a->config['system']['disable_email_validation'] = strtolower(getenv('VALIDATION'));
}
if (!empty(getenv('CACHE_DRIVER'))) {
$a->config['system']['cache_driver'] = strtolower(getenv('CACHE_DRIVER'));
if (!empty(getenv('REDIS_HOST'))) {
$a->config['system']['redis_host'] = getenv('REDIS_HOST');
}
if (!empty(getenv('REDIS_PORT'))) {
$a->config['system']['redis_port'] = getenv('REDIS_PORT');
}
if (!empty(getenv('MEMCACHE_HOST'))) {
$a->config['system']['memcache_host'] = getenv('MEMCACHE_HOST');
}
if (!empty(getenv('MEMCACHE_PORT'))) {
$a->config['system']['memcache_port'] = getenv('MEMCACHE_PORT');
}
if (!empty(getenv('MEMCACHED_HOSTS'))) {
$a->config['system']['memcached_hosts'] = getenv('MEMCACHED_HOSTS');
}
}

View file

@ -30,6 +30,8 @@ RUN set -ex; \
libtool \
libmcrypt \
libmcrypt-dev \
libmemcached-dev \
cyrus-sasl-dev \
freetype \
libpng \
libjpeg-turbo-dev \
@ -54,6 +56,15 @@ RUN set -ex; \
; \
docker-php-ext-install -j 4 curl pdo pdo_mysql xml gd zip opcache mbstring posix ctype json iconv mcrypt; \
\
# pecl will claim success even if one install fails, so we need to perform each install separately
pecl install memcached-%%MEMCACHED_VERSION%%; \
pecl install redis-%%REDIS_VERSION%%; \
\
docker-php-ext-enable \
memcached \
redis \
; \
\
runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
| tr ',' '\n' \

View file

@ -37,6 +37,7 @@ RUN set -ex; \
libmcrypt-dev \
imagemagick \
libmagick++-dev \
libmemcached-dev \
libgraphicsmagick1-dev \
libfreetype6 \
libfreetype6-dev \
@ -59,6 +60,15 @@ RUN set -ex; \
; \
docker-php-ext-install -j 4 curl pdo pdo_mysql xml gd zip opcache mbstring posix ctype json iconv mcrypt \
; \
# pecl will claim success even if one install fails, so we need to perform each install separately
pecl install memcached-%%MEMCACHED_VERSION%%; \
pecl install redis-%%REDIS_VERSION%%; \
\
docker-php-ext-enable \
memcached \
redis \
; \
\
# 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; \

View file

@ -69,19 +69,19 @@ There are three options to enable the cron-job for Friendica:
This is the full list of all possible environment variables used for this image:
**Common**
- `MAILNAME` E-Mail address of the administrator (**required**)
- `TZ` The default localization of the Friendica server (Default: `America/Los_Angeles`)
- `LANGUAGE` The default language of the Friendica server (Default: `en`)
- `SITENAME` The default name of the Friendica server (Default: `Friendica Social Network` )
- `VALIDATION` The default setting if url/emails are getting validated (Default: `true`)
- `AUTOINSTALL` if `true`, the automatic configuration will start (Default: `false`)
- `MAILNAME` E-Mail address of the administrator. (**required**)
- `TZ` The default localization of the Friendica server. (Default: `America/Los_Angeles`)
- `LANGUAGE` The default language of the Friendica server. (Default: `en`)
- `SITENAME` The default name of the Friendica server. (Default: `Friendica Social Network` )
- `VALIDATION` The default setting if url/emails are getting validated. (Default: `true`)
- `AUTOINSTALL` if `true`, the automatic configuration will start. (Default: `false`)
**SMTP/Mail**
- `SMTP` address of the SMTP Mail-Gateway (**required** - Default: `localhost`)
- `SMTP_FROM` sender user-part of the address (Default: `no-reply` - e.g. no-reply@friendica.local)
- `SMTP_AUTH_USER` Username for the SMTP Mail-Gateway (Default: empty)
- `SMTP_AUTH_PASS` Password for the SMTP Mail-Gateway (Default: empty)
- `SMTP_AUTH_METHOD` Authentication method for the SMTP Mail-Gateway (Default: empty/plain text)
- `SMTP` Address of the SMTP Mail-Gateway. (**required** - Default: `localhost`)
- `SMTP_FROM` Sender user-part of the address. (Default: `no-reply` - e.g. no-reply@friendica.local)
- `SMTP_AUTH_USER` Username for the SMTP Mail-Gateway. (Default: empty)
- `SMTP_AUTH_PASS` Password for the SMTP Mail-Gateway. (Default: empty)
- `SMTP_AUTH_METHOD` Authentication method for the SMTP Mail-Gateway. (Default: empty/plain text)
**Database** (**required**)
- `MYSQL_USERNAME` Username for the database user using mysql.
@ -91,6 +91,15 @@ This is the full list of all possible environment variables used for this image:
- `MYSQL_HOST` Hostname of the database server using mysql / mariadb.
- `MYSQL_PORT` Port of the database server using mysql / mariadb.
**Caching**
- `CACHE_DRIVER` Driver of the Friendica cache (`memcache`, `memcached` or `redis`)
- `MEMCACHE_HOST` Host of the memcache cache server. (Default: `127.0.0.1`)
- `MEMCACHE_PORT` Port of the memcache cache server. (Default: `11211`)
- `MEMCACHED_HOSTS` Hosts of the memcached cache server. (Default: `[['127.0.0.1', 11211]]`)
- `REDIS_HOST` Host of the redis cache server. (Default: `127.0.0.1`)
- `REDIS_PORT` Port of the redis cache server. (Default: `6379`)
## Administrator account
Because Friendica links the administrator account to a specific mail address, you **have** to set a valid address for `MAILNAME`.

View file

@ -25,6 +25,8 @@ declare -A extras=(
declare -A pecl_versions=(
[Imagick]='3.4.3'
[memcached]='3.0.4'
[redis]='3.1.6'
)
declare -A install_extras=(
@ -73,6 +75,8 @@ function create_variant() {
s|%%VARIANT_EXTRAS%%|'"${extras[$variant]}"'|g;
s|%%INSTALL_EXTRAS%%|'"${install_extras[$install_type]}"'|g;
s/%%IMAGICK_VERSION%%/'"${pecl_versions[Imagick]}"'/g;
s/%%MEMCACHED_VERSION%%/'"${pecl_versions[memcached]}"'/g;
s/%%REDIS_VERSION%%/'"${pecl_versions[redis]}"'/g;
' "$dir/Dockerfile"
# Copy the shell scripts