From fec33c98be957436279b7074ca08068b18622627 Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Wed, 6 Jun 2018 20:37:02 +0200 Subject: [PATCH] Bugfixings SMTP / - changed sendmail to ssmtp support - deleted smtp-examples (not necessary anymore) - added vendor libraries in stable-docker images ("full" package) - changed stack.yml to new SMTP behavior --- .bin/friendica | 66 +++++++++++++------ .config/htconfig.php | 5 ++ .examples/README.md | 1 - .examples/dockerfiles/cron/apache/Dockerfile | 2 +- .examples/dockerfiles/cron/fpm/Dockerfile | 2 +- .examples/dockerfiles/smtp/README.md | 24 ------- .../dockerfiles/smtp/apache/smtp-config.sh | 45 ------------- .../dockerfiles/smtp/fpm-alpine/Dockerfile | 18 ----- .examples/dockerfiles/smtp/fpm/smtp-config.sh | 45 ------------- 2018.05/apache/Dockerfile | 20 +++--- 2018.05/apache/bin/friendica | 66 +++++++++++++------ 2018.05/apache/config/htconfig.php | 5 ++ 2018.05/apache/entrypoint.sh | 2 +- 2018.05/fpm-alpine/Dockerfile | 23 ++++--- 2018.05/fpm-alpine/bin/friendica | 66 +++++++++++++------ 2018.05/fpm-alpine/config/htconfig.php | 5 ++ 2018.05/fpm-alpine/entrypoint.sh | 2 +- 2018.05/fpm/Dockerfile | 20 +++--- 2018.05/fpm/bin/friendica | 66 +++++++++++++------ 2018.05/fpm/config/htconfig.php | 5 ++ 2018.05/fpm/entrypoint.sh | 2 +- 2018.08-dev/apache/Dockerfile | 7 +- 2018.08-dev/apache/bin/friendica | 66 +++++++++++++------ 2018.08-dev/apache/config/htconfig.php | 5 ++ 2018.08-dev/apache/entrypoint.sh | 2 +- 2018.08-dev/fpm-alpine/Dockerfile | 10 ++- 2018.08-dev/fpm-alpine/bin/friendica | 66 +++++++++++++------ 2018.08-dev/fpm-alpine/config/htconfig.php | 5 ++ 2018.08-dev/fpm-alpine/entrypoint.sh | 2 +- 2018.08-dev/fpm/Dockerfile | 7 +- 2018.08-dev/fpm/bin/friendica | 66 +++++++++++++------ 2018.08-dev/fpm/config/htconfig.php | 5 ++ 2018.08-dev/fpm/entrypoint.sh | 2 +- Dockerfile-alpine.template | 10 ++- Dockerfile-debian.template | 7 +- README.md | 15 ++++- docker-entrypoint.sh | 2 +- stack.yml | 3 + update.sh | 2 +- 39 files changed, 442 insertions(+), 330 deletions(-) delete mode 100644 .examples/dockerfiles/smtp/README.md delete mode 100644 .examples/dockerfiles/smtp/apache/smtp-config.sh delete mode 100644 .examples/dockerfiles/smtp/fpm-alpine/Dockerfile delete mode 100644 .examples/dockerfiles/smtp/fpm/smtp-config.sh diff --git a/.bin/friendica b/.bin/friendica index f8d1733..49d95b3 100644 --- a/.bin/friendica +++ b/.bin/friendica @@ -1,18 +1,23 @@ #!/bin/sh set -eu -FRIENDICA_VERSION=${FRIENDICA_VERSION:-develop} -FRIENDICA_ADDONS=${FRIENDICA_ADDONS:-develop} -AUTOINSTALL=${AUTOINSTALL:-false} +SMTP=${SMTP:-localhost} +SMTP_FROM=${SMTP_FROM:-no-reply} -SOURCEDIR=/usr/src -WORKDIR=/var/www/html +SOURCEDIR=${SOURCEDIR:-/usr/src} +WORKDIR=${WORKDIR:-/var/www/html} + +SMTP_TLS=${SMTP_TLS:-} +SMTP_STARTTLS=${SMTP_STARTTLS:-} +SMTP_AUTH_USER=${SMTP_AUTH_USER:-} +SMTP_AUTH_PASS=${SMTP_AUTH_PASS:-} +SMTP_AUTH_METHOD=${SMTP_AUTH_METHOD:-} VERBOSE=1 for arg; do case "$arg" in -q|--quit) - if [ "$VERBOSE" -eq "2" ]; then + if [ "$VERBOSE" -eq 2 ]; then echo 'You cannot use verbose and quiet at the same time' exit 1 fi @@ -20,7 +25,7 @@ for arg; do break ;; -v|--verbose) - if [ "$VERBOSE" -eq "0" ]; then + if [ "$VERBOSE" -eq 0 ]; then echo 'You cannot use verbose and quiet at the same time' exit 1 fi @@ -32,7 +37,7 @@ done # run an command with the www-data user run_as() { - if [ "$(id -u)" = 0 ]; then + if [ "$(id -u)" -eq 0 ]; then su - www-data -s /bin/sh -c "$1" else sh -c "$1" @@ -42,7 +47,7 @@ run_as() { # log event log() { currVerb=1 - if [ $# -eq 2 ]; then + if [ "$#" -eq 2 ]; then currVerb=$2 fi if [ "$VERBOSE" -ge "$currVerb" ]; then @@ -105,6 +110,9 @@ console() { composer() { if [ -f $WORKDIR/bin/composer.phar ]; then run_as "cd $WORKDIR;$WORKDIR/bin/composer.phar $@ -d $WORKDIR" + elif [ -f $SOURCEDIR/friendica/bin/composer.phar ]; then + cd $SOURCEDIR/friendica + $SOURCEDIR/friendica/bin/composer.phar "$@" -d $SOURCEDIR/friendica fi } @@ -133,7 +141,7 @@ copy_sources() { fi if version_greater "$image_version" "$installed_version"; then - if [ "$(id -u)" = 0 ]; then + if [ "$(id -u)" -eq 0 ]; then rsync_options="-rlDog --chown=www-data:root" else rsync_options="-rlD" @@ -163,7 +171,7 @@ install() { if [ ! -f ${WORKDIR}/.htconfig.php ] && [ -f ${SOURCEDIR}/config/htconfig.php ] && - "$AUTOINSTALL" == "true"; then + [ "$AUTOINSTALL" = "true" ]; then run_as "cp ${SOURCEDIR}/config/htconfig.php ${WORKDIR}/.htconfig.php" console autoinstall -f .htconfig.php # TODO Workaround because of a strange permission issue @@ -186,21 +194,37 @@ update() { console dbstructure update } -sendmail() { - if [ ! -f /etc/init.d/sendmail ]; then - # If sendmail isn't installed, exit this method +configmail() { + if [ "$SMTP" = "localhost" ]; then + # SMTP is a required setting + # do nothing if it is "localhost" (= not changed) return fi - line=$(head -n 1 /etc/hosts) - line2=$(echo $line | awk '{print $2}') - echo "$line $line2.localdomain" >> /etc/hosts + sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd + sed -i "s/Linux\ User/${SITENAME}/g" /etc/passwd - log 'Starting sendmail for Mail-Support' - nohup /etc/init.d/sendmail start > /dev/null 2>&1 & + # add possible mail-senders + echo "www-data:$SMTP_FROM@$HOSTNAME:$SMTP" >> /etc/ssmtp/revaliases + echo "root:$SMTP_FROM@$HOSTNAME:$SMTP" >> /etc/ssmtp/revaliases + + # replace ssmtp.conf settings + cat << EOF > /etc/ssmtp/ssmtp.conf +# /etc/ssmtp/ssmtp.conf + +root=$SMTP_FROM@$HOSTNAME +hostname=$HOSTNAME +mailhub=$SMTP +FromLineOverride=YES +EOF + [ -z "$SMTP_TLS" ] || echo "UseTLS=$SMTP_TLS" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_STARTTLS" ] || echo "UseSTARTTLS=$SMTP_STARTTLS" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_AUTH_USER" ] || echo "AuthUser=$SMTP_AUTH_USER" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_AUTH_PASS" ] || echo "AuthPass=$SMTP_AUTH_PASS" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_AUTH_METHOD" ] || echo "AuthMethod=$SMTP_AUTH_METHOD" >> /etc/ssmtp/ssmtp.conf } -if [ $# -eq 0 ]; then +if [ "$#" -eq 0 ]; then friendica_help exit 0 fi @@ -210,6 +234,6 @@ case "$1" in update) shift; update $@ ;; console) shift; console $@ ;; composer) shift; composer $@ ;; - sendmail) shift; sendmail $@ ;; + configmail) shift; configmail $@ ;; *) friendica_help ;; esac diff --git a/.config/htconfig.php b/.config/htconfig.php index c94b94a..ccd86da 100644 --- a/.config/htconfig.php +++ b/.config/htconfig.php @@ -106,3 +106,8 @@ $a->config['system']['allowed_link_protocols'] = ['ftp', 'ftps', 'mailto', 'cid' // Authentication cookie lifetime, in days $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')); +} \ No newline at end of file diff --git a/.examples/README.md b/.examples/README.md index a1ac925..7af8455 100644 --- a/.examples/README.md +++ b/.examples/README.md @@ -16,7 +16,6 @@ The Dockerfiles use the default images as base image and build on top of it. Examples | Descriptions -------- | ------- [cron](https://github.com/friendica/docker/tree/master/.examples/dockerfiles/cron) | uses supervisor to run the cron job inside the container (so no extra container is needed). -[smtp](https://github.com/friendica/docker/tree/master/.examples/dockerfiles/smtp) | adds dependencies required to use SMTP as mail relay/smarthost ## docker-compose diff --git a/.examples/dockerfiles/cron/apache/Dockerfile b/.examples/dockerfiles/cron/apache/Dockerfile index b4f1898..f491d93 100644 --- a/.examples/dockerfiles/cron/apache/Dockerfile +++ b/.examples/dockerfiles/cron/apache/Dockerfile @@ -9,6 +9,6 @@ RUN set -ex; \ rm -rf /var/lib/apt/lists/*; \ mkdir /var/log/supervisord /var/run/supervisord -COPY ./supervisord.conf /etc/supervisor/supervisord.conf +COPY supervisord.conf /etc/supervisor/supervisord.conf CMD ["/usr/bin/supervisord"] \ No newline at end of file diff --git a/.examples/dockerfiles/cron/fpm/Dockerfile b/.examples/dockerfiles/cron/fpm/Dockerfile index 0113fda..7eee503 100644 --- a/.examples/dockerfiles/cron/fpm/Dockerfile +++ b/.examples/dockerfiles/cron/fpm/Dockerfile @@ -9,6 +9,6 @@ RUN set -ex; \ rm -rf /var/lib/apt/lists/*; \ mkdir /var/log/supervisord /var/run/supervisord -COPY ./supervisord.conf /etc/supervisor/supervisord.conf +COPY supervisord.conf /etc/supervisor/supervisord.conf CMD ["/usr/bin/supervisord"] \ No newline at end of file diff --git a/.examples/dockerfiles/smtp/README.md b/.examples/dockerfiles/smtp/README.md deleted file mode 100644 index 3bf9a6d..0000000 --- a/.examples/dockerfiles/smtp/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# SMTP section - -In this subfolder are examples how to add SMTP support to the Friendica docker images. - -Each directory represents the image-version of the Dockerfile. -It uses the stable-branches of the Friendica Dockerfiles out-of-the-box. -So if you want to use the develop-branch, you have to add the prefix `develop-` at the `FROM`clause (e.g. `FROM friendica:apache` -> `FROM friendica:develop-apache`) - -- `SMTP_HOST` The host/IP of the SMTP-MTA - -## Custom SMTP Settings - -Currently, only `apache` and `fpm` supports custom SMTP settings. -You **have** to set `SMTP_TYPE` to `custom` for other settings than `SMTP_HOST` (default: `simple`) - -### SMTP Authentication -- `SMTP_USERNAME` Username for the SMTP-MTA user to authenticate. -- `SMTP_PASSWORD` Password for the SMTP-MTA user to authenticate. - -### Additional settings -- `SMTP_PORT` The port of the SMTP-MTA (default: `25`) -- `SMTP_AUTH` The authentication string for the SMTP-MTA (default: `A p`) -- `SMTP_TRUST_AUTH_MECH` The trusted authentication mechanism for the SMTP-MTA (default: `EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN`) -- `SMTP_AUTH_MECH` The authentication mechanism for the SMTP-MTA (default: `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN`) \ No newline at end of file diff --git a/.examples/dockerfiles/smtp/apache/smtp-config.sh b/.examples/dockerfiles/smtp/apache/smtp-config.sh deleted file mode 100644 index 9fa076d..0000000 --- a/.examples/dockerfiles/smtp/apache/smtp-config.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh -set -eu - -IFS=\n - -SMTP_TYPE=${SMTP_TYPE:-simple} - -# config options -SMTP_HOST=${SMTP_HOST:-'localhost'} -SMTP_PORT=${SMTP_PORT:-'25'} -SMTP_AUTH=${SMTP_AUTH:-'A p'} -SMTP_TRUST_AUTH_MECH=${SMTP_TRUST_AUTH_MECH:-'EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN'} -SMTP_AUTH_MECH=${SMTP_AUTH_MECH:-'EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN'} - -SMTP_USERNAME=${SMTP_USERNAME:-''} -SMTP_PASSWORD=${SMTP_PASSWORD:-''} - -smtp_simple() { - sed -i '/MAILER_DEFINITIONS/i define(`SMART_HOST'\'',`'$SMTP_HOST''\'')dnl/' /etc/mail/sendmail.mc -} - -smtp_custom() { - cd /etc/mail - mkdir -m 700 authinfo - cd authinfo/ - echo 'Authinfo: "U:www-data" "I:'$SMTP_USERNAME'" "P:'$SMTP_PASSWORD'"' > auth_file - makemap hash auth < auth_file - - sed -i '/MAILER_DEFINITIONS/i \ -define(`SMART_HOST'\'',`'$SMTP_HOST''\'')dnl \ -define(`RELAY_MAILER_ARGS'\'', `TCP '$SMTP_HOST' '$SMTP_PORT''\'')dnl \ -define(`ESMTP_MAILER_ARGS'\'', `TCP '$SMTP_HOST' '$SMTP_PORT''\'')dnl \ -define(`confAUTH_OPTIONS'\'', `'$SMTP_AUTH''\'')dnl \ -TRUST_AUTH_MECH(`'$SMTP_TRUST_AUTH_MECH''\'')dnl \ -define(`confAUTH_MECHANISMS'\'', `'$SMTP_AUTH_MECH''\'')dnl \ -FEATURE(`authinfo'\'',`hash -o /etc/mail/authinfo/auth.db'\'')dnl' /etc/mail/sendmail.mc -} - -case $SMTP_TYPE in - simple) smtp_simple ;; - custom) smtp_custom ;; - *) - echo "Unknown SMTP-Type '$SMTP_TYPE'" - exit 1 -esac \ No newline at end of file diff --git a/.examples/dockerfiles/smtp/fpm-alpine/Dockerfile b/.examples/dockerfiles/smtp/fpm-alpine/Dockerfile deleted file mode 100644 index d8d8693..0000000 --- a/.examples/dockerfiles/smtp/fpm-alpine/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM friendica/server:fpm-alpine - -# at least you HAVE to set one SMTP_HOST (normally something like mail.example.org) -ENV SMTP_HOST mail - -RUN set -ex; \ - \ - apk add --no-cache \ - ssmtp \ - ; \ - # disable the current mailhub - sed -i "s|mailhub=|#mailhub= |g" /etc/ssmtp/ssmtp.conf; \ - # enable the new mailhub - echo "mailhub=${SMTP_HOST:-localhost}" >> /etc/ssmtp/ssmtp.conf; - -# simple = using an smtp without any credentials (mostly in local networks) -# custom = you need to set host, port, auth_options, authinfo (e.g. for GMX support) -ENV SMTP_TYPE simple \ No newline at end of file diff --git a/.examples/dockerfiles/smtp/fpm/smtp-config.sh b/.examples/dockerfiles/smtp/fpm/smtp-config.sh deleted file mode 100644 index 9fa076d..0000000 --- a/.examples/dockerfiles/smtp/fpm/smtp-config.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh -set -eu - -IFS=\n - -SMTP_TYPE=${SMTP_TYPE:-simple} - -# config options -SMTP_HOST=${SMTP_HOST:-'localhost'} -SMTP_PORT=${SMTP_PORT:-'25'} -SMTP_AUTH=${SMTP_AUTH:-'A p'} -SMTP_TRUST_AUTH_MECH=${SMTP_TRUST_AUTH_MECH:-'EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN'} -SMTP_AUTH_MECH=${SMTP_AUTH_MECH:-'EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN'} - -SMTP_USERNAME=${SMTP_USERNAME:-''} -SMTP_PASSWORD=${SMTP_PASSWORD:-''} - -smtp_simple() { - sed -i '/MAILER_DEFINITIONS/i define(`SMART_HOST'\'',`'$SMTP_HOST''\'')dnl/' /etc/mail/sendmail.mc -} - -smtp_custom() { - cd /etc/mail - mkdir -m 700 authinfo - cd authinfo/ - echo 'Authinfo: "U:www-data" "I:'$SMTP_USERNAME'" "P:'$SMTP_PASSWORD'"' > auth_file - makemap hash auth < auth_file - - sed -i '/MAILER_DEFINITIONS/i \ -define(`SMART_HOST'\'',`'$SMTP_HOST''\'')dnl \ -define(`RELAY_MAILER_ARGS'\'', `TCP '$SMTP_HOST' '$SMTP_PORT''\'')dnl \ -define(`ESMTP_MAILER_ARGS'\'', `TCP '$SMTP_HOST' '$SMTP_PORT''\'')dnl \ -define(`confAUTH_OPTIONS'\'', `'$SMTP_AUTH''\'')dnl \ -TRUST_AUTH_MECH(`'$SMTP_TRUST_AUTH_MECH''\'')dnl \ -define(`confAUTH_MECHANISMS'\'', `'$SMTP_AUTH_MECH''\'')dnl \ -FEATURE(`authinfo'\'',`hash -o /etc/mail/authinfo/auth.db'\'')dnl' /etc/mail/sendmail.mc -} - -case $SMTP_TYPE in - simple) smtp_simple ;; - custom) smtp_custom ;; - *) - echo "Unknown SMTP-Type '$SMTP_TYPE'" - exit 1 -esac \ No newline at end of file diff --git a/2018.05/apache/Dockerfile b/2018.05/apache/Dockerfile index bf6ee42..c3c7a07 100644 --- a/2018.05/apache/Dockerfile +++ b/2018.05/apache/Dockerfile @@ -11,7 +11,7 @@ RUN set -ex; \ bzip2 \ git \ # For mail() support - sendmail \ + ssmtp \ ; \ rm -rf /var/lib/apt/lists/*; @@ -93,10 +93,19 @@ RUN {\ } > /usr/local/etc/php/conf.d/sendmail.ini; ENV AUTOINSTALL false +ENV VALIDATION true +ENV SITENAME "Friendica Social Network" ENV FRIENDICA_VERSION 2018.05 ENV FRIENDICA_ADDONS 2018.05 +COPY bin/* /usr/local/bin/ +COPY config/* /usr/src/config/ +COPY *.sh / +RUN chmod +x /*.sh +RUN chmod +x /usr/local/bin/* + + RUN set -ex; \ curl -fsSL -o friendica.tar.gz \ "https://github.com/friendica/friendica/archive/${FRIENDICA_VERSION}.tar.gz"; \ @@ -108,13 +117,8 @@ RUN set -ex; \ "https://github.com/friendica/friendica-addons/archive/${FRIENDICA_ADDONS}.tar.gz"; \ mkdir /usr/src/friendica/addon; \ tar -xzf friendica_addons.tar.gz -C /usr/src/friendica/addon --strip-components=1; \ - rm friendica_addons.tar.gz; - -COPY bin/* /usr/local/bin/ -COPY config/* /usr/src/config/ -COPY *.sh / -RUN chmod +x /*.sh -RUN chmod +x /usr/local/bin/* + rm friendica_addons.tar.gz; \ + friendica composer install; ENTRYPOINT ["/entrypoint.sh"] CMD ["apache2-foreground"] diff --git a/2018.05/apache/bin/friendica b/2018.05/apache/bin/friendica index f8d1733..49d95b3 100644 --- a/2018.05/apache/bin/friendica +++ b/2018.05/apache/bin/friendica @@ -1,18 +1,23 @@ #!/bin/sh set -eu -FRIENDICA_VERSION=${FRIENDICA_VERSION:-develop} -FRIENDICA_ADDONS=${FRIENDICA_ADDONS:-develop} -AUTOINSTALL=${AUTOINSTALL:-false} +SMTP=${SMTP:-localhost} +SMTP_FROM=${SMTP_FROM:-no-reply} -SOURCEDIR=/usr/src -WORKDIR=/var/www/html +SOURCEDIR=${SOURCEDIR:-/usr/src} +WORKDIR=${WORKDIR:-/var/www/html} + +SMTP_TLS=${SMTP_TLS:-} +SMTP_STARTTLS=${SMTP_STARTTLS:-} +SMTP_AUTH_USER=${SMTP_AUTH_USER:-} +SMTP_AUTH_PASS=${SMTP_AUTH_PASS:-} +SMTP_AUTH_METHOD=${SMTP_AUTH_METHOD:-} VERBOSE=1 for arg; do case "$arg" in -q|--quit) - if [ "$VERBOSE" -eq "2" ]; then + if [ "$VERBOSE" -eq 2 ]; then echo 'You cannot use verbose and quiet at the same time' exit 1 fi @@ -20,7 +25,7 @@ for arg; do break ;; -v|--verbose) - if [ "$VERBOSE" -eq "0" ]; then + if [ "$VERBOSE" -eq 0 ]; then echo 'You cannot use verbose and quiet at the same time' exit 1 fi @@ -32,7 +37,7 @@ done # run an command with the www-data user run_as() { - if [ "$(id -u)" = 0 ]; then + if [ "$(id -u)" -eq 0 ]; then su - www-data -s /bin/sh -c "$1" else sh -c "$1" @@ -42,7 +47,7 @@ run_as() { # log event log() { currVerb=1 - if [ $# -eq 2 ]; then + if [ "$#" -eq 2 ]; then currVerb=$2 fi if [ "$VERBOSE" -ge "$currVerb" ]; then @@ -105,6 +110,9 @@ console() { composer() { if [ -f $WORKDIR/bin/composer.phar ]; then run_as "cd $WORKDIR;$WORKDIR/bin/composer.phar $@ -d $WORKDIR" + elif [ -f $SOURCEDIR/friendica/bin/composer.phar ]; then + cd $SOURCEDIR/friendica + $SOURCEDIR/friendica/bin/composer.phar "$@" -d $SOURCEDIR/friendica fi } @@ -133,7 +141,7 @@ copy_sources() { fi if version_greater "$image_version" "$installed_version"; then - if [ "$(id -u)" = 0 ]; then + if [ "$(id -u)" -eq 0 ]; then rsync_options="-rlDog --chown=www-data:root" else rsync_options="-rlD" @@ -163,7 +171,7 @@ install() { if [ ! -f ${WORKDIR}/.htconfig.php ] && [ -f ${SOURCEDIR}/config/htconfig.php ] && - "$AUTOINSTALL" == "true"; then + [ "$AUTOINSTALL" = "true" ]; then run_as "cp ${SOURCEDIR}/config/htconfig.php ${WORKDIR}/.htconfig.php" console autoinstall -f .htconfig.php # TODO Workaround because of a strange permission issue @@ -186,21 +194,37 @@ update() { console dbstructure update } -sendmail() { - if [ ! -f /etc/init.d/sendmail ]; then - # If sendmail isn't installed, exit this method +configmail() { + if [ "$SMTP" = "localhost" ]; then + # SMTP is a required setting + # do nothing if it is "localhost" (= not changed) return fi - line=$(head -n 1 /etc/hosts) - line2=$(echo $line | awk '{print $2}') - echo "$line $line2.localdomain" >> /etc/hosts + sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd + sed -i "s/Linux\ User/${SITENAME}/g" /etc/passwd - log 'Starting sendmail for Mail-Support' - nohup /etc/init.d/sendmail start > /dev/null 2>&1 & + # add possible mail-senders + echo "www-data:$SMTP_FROM@$HOSTNAME:$SMTP" >> /etc/ssmtp/revaliases + echo "root:$SMTP_FROM@$HOSTNAME:$SMTP" >> /etc/ssmtp/revaliases + + # replace ssmtp.conf settings + cat << EOF > /etc/ssmtp/ssmtp.conf +# /etc/ssmtp/ssmtp.conf + +root=$SMTP_FROM@$HOSTNAME +hostname=$HOSTNAME +mailhub=$SMTP +FromLineOverride=YES +EOF + [ -z "$SMTP_TLS" ] || echo "UseTLS=$SMTP_TLS" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_STARTTLS" ] || echo "UseSTARTTLS=$SMTP_STARTTLS" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_AUTH_USER" ] || echo "AuthUser=$SMTP_AUTH_USER" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_AUTH_PASS" ] || echo "AuthPass=$SMTP_AUTH_PASS" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_AUTH_METHOD" ] || echo "AuthMethod=$SMTP_AUTH_METHOD" >> /etc/ssmtp/ssmtp.conf } -if [ $# -eq 0 ]; then +if [ "$#" -eq 0 ]; then friendica_help exit 0 fi @@ -210,6 +234,6 @@ case "$1" in update) shift; update $@ ;; console) shift; console $@ ;; composer) shift; composer $@ ;; - sendmail) shift; sendmail $@ ;; + configmail) shift; configmail $@ ;; *) friendica_help ;; esac diff --git a/2018.05/apache/config/htconfig.php b/2018.05/apache/config/htconfig.php index c94b94a..ccd86da 100644 --- a/2018.05/apache/config/htconfig.php +++ b/2018.05/apache/config/htconfig.php @@ -106,3 +106,8 @@ $a->config['system']['allowed_link_protocols'] = ['ftp', 'ftps', 'mailto', 'cid' // Authentication cookie lifetime, in days $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')); +} \ No newline at end of file diff --git a/2018.05/apache/entrypoint.sh b/2018.05/apache/entrypoint.sh index 4a0608c..8b75f8d 100644 --- a/2018.05/apache/entrypoint.sh +++ b/2018.05/apache/entrypoint.sh @@ -2,6 +2,6 @@ set -eu friendica install -q -friendica sendmail -q +friendica configmail -q exec "$@" \ No newline at end of file diff --git a/2018.05/fpm-alpine/Dockerfile b/2018.05/fpm-alpine/Dockerfile index 5b1c9bf..9b4b66b 100644 --- a/2018.05/fpm-alpine/Dockerfile +++ b/2018.05/fpm-alpine/Dockerfile @@ -4,10 +4,11 @@ LABEL maintainer="Philipp Holzer " # entrypoint.sh and cron.sh dependencies RUN set -ex; \ - \ apk add --no-cache \ rsync \ - git; + git \ + # For mail() support + ssmtp; # install the PHP extensions we need # see https://friendi.ca/resources/requirements/ @@ -74,10 +75,19 @@ RUN {\ } > /usr/local/etc/php/conf.d/sendmail.ini; ENV AUTOINSTALL false +ENV VALIDATION true +ENV SITENAME "Friendica Social Network" ENV FRIENDICA_VERSION 2018.05 ENV FRIENDICA_ADDONS 2018.05 +COPY bin/* /usr/local/bin/ +COPY config/* /usr/src/config/ +COPY *.sh / +RUN chmod +x /*.sh +RUN chmod +x /usr/local/bin/* + + RUN set -ex; \ curl -fsSL -o friendica.tar.gz \ "https://github.com/friendica/friendica/archive/${FRIENDICA_VERSION}.tar.gz"; \ @@ -89,13 +99,8 @@ RUN set -ex; \ "https://github.com/friendica/friendica-addons/archive/${FRIENDICA_ADDONS}.tar.gz"; \ mkdir /usr/src/friendica/addon; \ tar -xzf friendica_addons.tar.gz -C /usr/src/friendica/addon --strip-components=1; \ - rm friendica_addons.tar.gz; - -COPY bin/* /usr/local/bin/ -COPY config/* /usr/src/config/ -COPY *.sh / -RUN chmod +x /*.sh -RUN chmod +x /usr/local/bin/* + rm friendica_addons.tar.gz; \ + friendica composer install; ENTRYPOINT ["/entrypoint.sh"] CMD ["php-fpm"] \ No newline at end of file diff --git a/2018.05/fpm-alpine/bin/friendica b/2018.05/fpm-alpine/bin/friendica index f8d1733..49d95b3 100644 --- a/2018.05/fpm-alpine/bin/friendica +++ b/2018.05/fpm-alpine/bin/friendica @@ -1,18 +1,23 @@ #!/bin/sh set -eu -FRIENDICA_VERSION=${FRIENDICA_VERSION:-develop} -FRIENDICA_ADDONS=${FRIENDICA_ADDONS:-develop} -AUTOINSTALL=${AUTOINSTALL:-false} +SMTP=${SMTP:-localhost} +SMTP_FROM=${SMTP_FROM:-no-reply} -SOURCEDIR=/usr/src -WORKDIR=/var/www/html +SOURCEDIR=${SOURCEDIR:-/usr/src} +WORKDIR=${WORKDIR:-/var/www/html} + +SMTP_TLS=${SMTP_TLS:-} +SMTP_STARTTLS=${SMTP_STARTTLS:-} +SMTP_AUTH_USER=${SMTP_AUTH_USER:-} +SMTP_AUTH_PASS=${SMTP_AUTH_PASS:-} +SMTP_AUTH_METHOD=${SMTP_AUTH_METHOD:-} VERBOSE=1 for arg; do case "$arg" in -q|--quit) - if [ "$VERBOSE" -eq "2" ]; then + if [ "$VERBOSE" -eq 2 ]; then echo 'You cannot use verbose and quiet at the same time' exit 1 fi @@ -20,7 +25,7 @@ for arg; do break ;; -v|--verbose) - if [ "$VERBOSE" -eq "0" ]; then + if [ "$VERBOSE" -eq 0 ]; then echo 'You cannot use verbose and quiet at the same time' exit 1 fi @@ -32,7 +37,7 @@ done # run an command with the www-data user run_as() { - if [ "$(id -u)" = 0 ]; then + if [ "$(id -u)" -eq 0 ]; then su - www-data -s /bin/sh -c "$1" else sh -c "$1" @@ -42,7 +47,7 @@ run_as() { # log event log() { currVerb=1 - if [ $# -eq 2 ]; then + if [ "$#" -eq 2 ]; then currVerb=$2 fi if [ "$VERBOSE" -ge "$currVerb" ]; then @@ -105,6 +110,9 @@ console() { composer() { if [ -f $WORKDIR/bin/composer.phar ]; then run_as "cd $WORKDIR;$WORKDIR/bin/composer.phar $@ -d $WORKDIR" + elif [ -f $SOURCEDIR/friendica/bin/composer.phar ]; then + cd $SOURCEDIR/friendica + $SOURCEDIR/friendica/bin/composer.phar "$@" -d $SOURCEDIR/friendica fi } @@ -133,7 +141,7 @@ copy_sources() { fi if version_greater "$image_version" "$installed_version"; then - if [ "$(id -u)" = 0 ]; then + if [ "$(id -u)" -eq 0 ]; then rsync_options="-rlDog --chown=www-data:root" else rsync_options="-rlD" @@ -163,7 +171,7 @@ install() { if [ ! -f ${WORKDIR}/.htconfig.php ] && [ -f ${SOURCEDIR}/config/htconfig.php ] && - "$AUTOINSTALL" == "true"; then + [ "$AUTOINSTALL" = "true" ]; then run_as "cp ${SOURCEDIR}/config/htconfig.php ${WORKDIR}/.htconfig.php" console autoinstall -f .htconfig.php # TODO Workaround because of a strange permission issue @@ -186,21 +194,37 @@ update() { console dbstructure update } -sendmail() { - if [ ! -f /etc/init.d/sendmail ]; then - # If sendmail isn't installed, exit this method +configmail() { + if [ "$SMTP" = "localhost" ]; then + # SMTP is a required setting + # do nothing if it is "localhost" (= not changed) return fi - line=$(head -n 1 /etc/hosts) - line2=$(echo $line | awk '{print $2}') - echo "$line $line2.localdomain" >> /etc/hosts + sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd + sed -i "s/Linux\ User/${SITENAME}/g" /etc/passwd - log 'Starting sendmail for Mail-Support' - nohup /etc/init.d/sendmail start > /dev/null 2>&1 & + # add possible mail-senders + echo "www-data:$SMTP_FROM@$HOSTNAME:$SMTP" >> /etc/ssmtp/revaliases + echo "root:$SMTP_FROM@$HOSTNAME:$SMTP" >> /etc/ssmtp/revaliases + + # replace ssmtp.conf settings + cat << EOF > /etc/ssmtp/ssmtp.conf +# /etc/ssmtp/ssmtp.conf + +root=$SMTP_FROM@$HOSTNAME +hostname=$HOSTNAME +mailhub=$SMTP +FromLineOverride=YES +EOF + [ -z "$SMTP_TLS" ] || echo "UseTLS=$SMTP_TLS" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_STARTTLS" ] || echo "UseSTARTTLS=$SMTP_STARTTLS" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_AUTH_USER" ] || echo "AuthUser=$SMTP_AUTH_USER" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_AUTH_PASS" ] || echo "AuthPass=$SMTP_AUTH_PASS" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_AUTH_METHOD" ] || echo "AuthMethod=$SMTP_AUTH_METHOD" >> /etc/ssmtp/ssmtp.conf } -if [ $# -eq 0 ]; then +if [ "$#" -eq 0 ]; then friendica_help exit 0 fi @@ -210,6 +234,6 @@ case "$1" in update) shift; update $@ ;; console) shift; console $@ ;; composer) shift; composer $@ ;; - sendmail) shift; sendmail $@ ;; + configmail) shift; configmail $@ ;; *) friendica_help ;; esac diff --git a/2018.05/fpm-alpine/config/htconfig.php b/2018.05/fpm-alpine/config/htconfig.php index c94b94a..ccd86da 100644 --- a/2018.05/fpm-alpine/config/htconfig.php +++ b/2018.05/fpm-alpine/config/htconfig.php @@ -106,3 +106,8 @@ $a->config['system']['allowed_link_protocols'] = ['ftp', 'ftps', 'mailto', 'cid' // Authentication cookie lifetime, in days $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')); +} \ No newline at end of file diff --git a/2018.05/fpm-alpine/entrypoint.sh b/2018.05/fpm-alpine/entrypoint.sh index 4a0608c..8b75f8d 100644 --- a/2018.05/fpm-alpine/entrypoint.sh +++ b/2018.05/fpm-alpine/entrypoint.sh @@ -2,6 +2,6 @@ set -eu friendica install -q -friendica sendmail -q +friendica configmail -q exec "$@" \ No newline at end of file diff --git a/2018.05/fpm/Dockerfile b/2018.05/fpm/Dockerfile index a28f67e..c3a24c2 100644 --- a/2018.05/fpm/Dockerfile +++ b/2018.05/fpm/Dockerfile @@ -11,7 +11,7 @@ RUN set -ex; \ bzip2 \ git \ # For mail() support - sendmail \ + ssmtp \ ; \ rm -rf /var/lib/apt/lists/*; @@ -85,10 +85,19 @@ RUN {\ } > /usr/local/etc/php/conf.d/sendmail.ini; ENV AUTOINSTALL false +ENV VALIDATION true +ENV SITENAME "Friendica Social Network" ENV FRIENDICA_VERSION 2018.05 ENV FRIENDICA_ADDONS 2018.05 +COPY bin/* /usr/local/bin/ +COPY config/* /usr/src/config/ +COPY *.sh / +RUN chmod +x /*.sh +RUN chmod +x /usr/local/bin/* + + RUN set -ex; \ curl -fsSL -o friendica.tar.gz \ "https://github.com/friendica/friendica/archive/${FRIENDICA_VERSION}.tar.gz"; \ @@ -100,13 +109,8 @@ RUN set -ex; \ "https://github.com/friendica/friendica-addons/archive/${FRIENDICA_ADDONS}.tar.gz"; \ mkdir /usr/src/friendica/addon; \ tar -xzf friendica_addons.tar.gz -C /usr/src/friendica/addon --strip-components=1; \ - rm friendica_addons.tar.gz; - -COPY bin/* /usr/local/bin/ -COPY config/* /usr/src/config/ -COPY *.sh / -RUN chmod +x /*.sh -RUN chmod +x /usr/local/bin/* + rm friendica_addons.tar.gz; \ + friendica composer install; ENTRYPOINT ["/entrypoint.sh"] CMD ["php-fpm"] diff --git a/2018.05/fpm/bin/friendica b/2018.05/fpm/bin/friendica index f8d1733..49d95b3 100644 --- a/2018.05/fpm/bin/friendica +++ b/2018.05/fpm/bin/friendica @@ -1,18 +1,23 @@ #!/bin/sh set -eu -FRIENDICA_VERSION=${FRIENDICA_VERSION:-develop} -FRIENDICA_ADDONS=${FRIENDICA_ADDONS:-develop} -AUTOINSTALL=${AUTOINSTALL:-false} +SMTP=${SMTP:-localhost} +SMTP_FROM=${SMTP_FROM:-no-reply} -SOURCEDIR=/usr/src -WORKDIR=/var/www/html +SOURCEDIR=${SOURCEDIR:-/usr/src} +WORKDIR=${WORKDIR:-/var/www/html} + +SMTP_TLS=${SMTP_TLS:-} +SMTP_STARTTLS=${SMTP_STARTTLS:-} +SMTP_AUTH_USER=${SMTP_AUTH_USER:-} +SMTP_AUTH_PASS=${SMTP_AUTH_PASS:-} +SMTP_AUTH_METHOD=${SMTP_AUTH_METHOD:-} VERBOSE=1 for arg; do case "$arg" in -q|--quit) - if [ "$VERBOSE" -eq "2" ]; then + if [ "$VERBOSE" -eq 2 ]; then echo 'You cannot use verbose and quiet at the same time' exit 1 fi @@ -20,7 +25,7 @@ for arg; do break ;; -v|--verbose) - if [ "$VERBOSE" -eq "0" ]; then + if [ "$VERBOSE" -eq 0 ]; then echo 'You cannot use verbose and quiet at the same time' exit 1 fi @@ -32,7 +37,7 @@ done # run an command with the www-data user run_as() { - if [ "$(id -u)" = 0 ]; then + if [ "$(id -u)" -eq 0 ]; then su - www-data -s /bin/sh -c "$1" else sh -c "$1" @@ -42,7 +47,7 @@ run_as() { # log event log() { currVerb=1 - if [ $# -eq 2 ]; then + if [ "$#" -eq 2 ]; then currVerb=$2 fi if [ "$VERBOSE" -ge "$currVerb" ]; then @@ -105,6 +110,9 @@ console() { composer() { if [ -f $WORKDIR/bin/composer.phar ]; then run_as "cd $WORKDIR;$WORKDIR/bin/composer.phar $@ -d $WORKDIR" + elif [ -f $SOURCEDIR/friendica/bin/composer.phar ]; then + cd $SOURCEDIR/friendica + $SOURCEDIR/friendica/bin/composer.phar "$@" -d $SOURCEDIR/friendica fi } @@ -133,7 +141,7 @@ copy_sources() { fi if version_greater "$image_version" "$installed_version"; then - if [ "$(id -u)" = 0 ]; then + if [ "$(id -u)" -eq 0 ]; then rsync_options="-rlDog --chown=www-data:root" else rsync_options="-rlD" @@ -163,7 +171,7 @@ install() { if [ ! -f ${WORKDIR}/.htconfig.php ] && [ -f ${SOURCEDIR}/config/htconfig.php ] && - "$AUTOINSTALL" == "true"; then + [ "$AUTOINSTALL" = "true" ]; then run_as "cp ${SOURCEDIR}/config/htconfig.php ${WORKDIR}/.htconfig.php" console autoinstall -f .htconfig.php # TODO Workaround because of a strange permission issue @@ -186,21 +194,37 @@ update() { console dbstructure update } -sendmail() { - if [ ! -f /etc/init.d/sendmail ]; then - # If sendmail isn't installed, exit this method +configmail() { + if [ "$SMTP" = "localhost" ]; then + # SMTP is a required setting + # do nothing if it is "localhost" (= not changed) return fi - line=$(head -n 1 /etc/hosts) - line2=$(echo $line | awk '{print $2}') - echo "$line $line2.localdomain" >> /etc/hosts + sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd + sed -i "s/Linux\ User/${SITENAME}/g" /etc/passwd - log 'Starting sendmail for Mail-Support' - nohup /etc/init.d/sendmail start > /dev/null 2>&1 & + # add possible mail-senders + echo "www-data:$SMTP_FROM@$HOSTNAME:$SMTP" >> /etc/ssmtp/revaliases + echo "root:$SMTP_FROM@$HOSTNAME:$SMTP" >> /etc/ssmtp/revaliases + + # replace ssmtp.conf settings + cat << EOF > /etc/ssmtp/ssmtp.conf +# /etc/ssmtp/ssmtp.conf + +root=$SMTP_FROM@$HOSTNAME +hostname=$HOSTNAME +mailhub=$SMTP +FromLineOverride=YES +EOF + [ -z "$SMTP_TLS" ] || echo "UseTLS=$SMTP_TLS" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_STARTTLS" ] || echo "UseSTARTTLS=$SMTP_STARTTLS" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_AUTH_USER" ] || echo "AuthUser=$SMTP_AUTH_USER" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_AUTH_PASS" ] || echo "AuthPass=$SMTP_AUTH_PASS" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_AUTH_METHOD" ] || echo "AuthMethod=$SMTP_AUTH_METHOD" >> /etc/ssmtp/ssmtp.conf } -if [ $# -eq 0 ]; then +if [ "$#" -eq 0 ]; then friendica_help exit 0 fi @@ -210,6 +234,6 @@ case "$1" in update) shift; update $@ ;; console) shift; console $@ ;; composer) shift; composer $@ ;; - sendmail) shift; sendmail $@ ;; + configmail) shift; configmail $@ ;; *) friendica_help ;; esac diff --git a/2018.05/fpm/config/htconfig.php b/2018.05/fpm/config/htconfig.php index c94b94a..ccd86da 100644 --- a/2018.05/fpm/config/htconfig.php +++ b/2018.05/fpm/config/htconfig.php @@ -106,3 +106,8 @@ $a->config['system']['allowed_link_protocols'] = ['ftp', 'ftps', 'mailto', 'cid' // Authentication cookie lifetime, in days $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')); +} \ No newline at end of file diff --git a/2018.05/fpm/entrypoint.sh b/2018.05/fpm/entrypoint.sh index 4a0608c..8b75f8d 100644 --- a/2018.05/fpm/entrypoint.sh +++ b/2018.05/fpm/entrypoint.sh @@ -2,6 +2,6 @@ set -eu friendica install -q -friendica sendmail -q +friendica configmail -q exec "$@" \ No newline at end of file diff --git a/2018.08-dev/apache/Dockerfile b/2018.08-dev/apache/Dockerfile index a4774f9..5225307 100644 --- a/2018.08-dev/apache/Dockerfile +++ b/2018.08-dev/apache/Dockerfile @@ -11,7 +11,7 @@ RUN set -ex; \ bzip2 \ git \ # For mail() support - sendmail \ + ssmtp \ ; \ rm -rf /var/lib/apt/lists/*; @@ -93,16 +93,19 @@ RUN {\ } > /usr/local/etc/php/conf.d/sendmail.ini; ENV AUTOINSTALL false +ENV VALIDATION true +ENV SITENAME "Friendica Social Network" ENV FRIENDICA_VERSION 2018.08-dev ENV FRIENDICA_ADDONS 2018.08-dev - COPY bin/* /usr/local/bin/ COPY config/* /usr/src/config/ COPY *.sh / RUN chmod +x /*.sh RUN chmod +x /usr/local/bin/* + + ENTRYPOINT ["/entrypoint.sh"] CMD ["apache2-foreground"] diff --git a/2018.08-dev/apache/bin/friendica b/2018.08-dev/apache/bin/friendica index f8d1733..49d95b3 100644 --- a/2018.08-dev/apache/bin/friendica +++ b/2018.08-dev/apache/bin/friendica @@ -1,18 +1,23 @@ #!/bin/sh set -eu -FRIENDICA_VERSION=${FRIENDICA_VERSION:-develop} -FRIENDICA_ADDONS=${FRIENDICA_ADDONS:-develop} -AUTOINSTALL=${AUTOINSTALL:-false} +SMTP=${SMTP:-localhost} +SMTP_FROM=${SMTP_FROM:-no-reply} -SOURCEDIR=/usr/src -WORKDIR=/var/www/html +SOURCEDIR=${SOURCEDIR:-/usr/src} +WORKDIR=${WORKDIR:-/var/www/html} + +SMTP_TLS=${SMTP_TLS:-} +SMTP_STARTTLS=${SMTP_STARTTLS:-} +SMTP_AUTH_USER=${SMTP_AUTH_USER:-} +SMTP_AUTH_PASS=${SMTP_AUTH_PASS:-} +SMTP_AUTH_METHOD=${SMTP_AUTH_METHOD:-} VERBOSE=1 for arg; do case "$arg" in -q|--quit) - if [ "$VERBOSE" -eq "2" ]; then + if [ "$VERBOSE" -eq 2 ]; then echo 'You cannot use verbose and quiet at the same time' exit 1 fi @@ -20,7 +25,7 @@ for arg; do break ;; -v|--verbose) - if [ "$VERBOSE" -eq "0" ]; then + if [ "$VERBOSE" -eq 0 ]; then echo 'You cannot use verbose and quiet at the same time' exit 1 fi @@ -32,7 +37,7 @@ done # run an command with the www-data user run_as() { - if [ "$(id -u)" = 0 ]; then + if [ "$(id -u)" -eq 0 ]; then su - www-data -s /bin/sh -c "$1" else sh -c "$1" @@ -42,7 +47,7 @@ run_as() { # log event log() { currVerb=1 - if [ $# -eq 2 ]; then + if [ "$#" -eq 2 ]; then currVerb=$2 fi if [ "$VERBOSE" -ge "$currVerb" ]; then @@ -105,6 +110,9 @@ console() { composer() { if [ -f $WORKDIR/bin/composer.phar ]; then run_as "cd $WORKDIR;$WORKDIR/bin/composer.phar $@ -d $WORKDIR" + elif [ -f $SOURCEDIR/friendica/bin/composer.phar ]; then + cd $SOURCEDIR/friendica + $SOURCEDIR/friendica/bin/composer.phar "$@" -d $SOURCEDIR/friendica fi } @@ -133,7 +141,7 @@ copy_sources() { fi if version_greater "$image_version" "$installed_version"; then - if [ "$(id -u)" = 0 ]; then + if [ "$(id -u)" -eq 0 ]; then rsync_options="-rlDog --chown=www-data:root" else rsync_options="-rlD" @@ -163,7 +171,7 @@ install() { if [ ! -f ${WORKDIR}/.htconfig.php ] && [ -f ${SOURCEDIR}/config/htconfig.php ] && - "$AUTOINSTALL" == "true"; then + [ "$AUTOINSTALL" = "true" ]; then run_as "cp ${SOURCEDIR}/config/htconfig.php ${WORKDIR}/.htconfig.php" console autoinstall -f .htconfig.php # TODO Workaround because of a strange permission issue @@ -186,21 +194,37 @@ update() { console dbstructure update } -sendmail() { - if [ ! -f /etc/init.d/sendmail ]; then - # If sendmail isn't installed, exit this method +configmail() { + if [ "$SMTP" = "localhost" ]; then + # SMTP is a required setting + # do nothing if it is "localhost" (= not changed) return fi - line=$(head -n 1 /etc/hosts) - line2=$(echo $line | awk '{print $2}') - echo "$line $line2.localdomain" >> /etc/hosts + sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd + sed -i "s/Linux\ User/${SITENAME}/g" /etc/passwd - log 'Starting sendmail for Mail-Support' - nohup /etc/init.d/sendmail start > /dev/null 2>&1 & + # add possible mail-senders + echo "www-data:$SMTP_FROM@$HOSTNAME:$SMTP" >> /etc/ssmtp/revaliases + echo "root:$SMTP_FROM@$HOSTNAME:$SMTP" >> /etc/ssmtp/revaliases + + # replace ssmtp.conf settings + cat << EOF > /etc/ssmtp/ssmtp.conf +# /etc/ssmtp/ssmtp.conf + +root=$SMTP_FROM@$HOSTNAME +hostname=$HOSTNAME +mailhub=$SMTP +FromLineOverride=YES +EOF + [ -z "$SMTP_TLS" ] || echo "UseTLS=$SMTP_TLS" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_STARTTLS" ] || echo "UseSTARTTLS=$SMTP_STARTTLS" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_AUTH_USER" ] || echo "AuthUser=$SMTP_AUTH_USER" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_AUTH_PASS" ] || echo "AuthPass=$SMTP_AUTH_PASS" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_AUTH_METHOD" ] || echo "AuthMethod=$SMTP_AUTH_METHOD" >> /etc/ssmtp/ssmtp.conf } -if [ $# -eq 0 ]; then +if [ "$#" -eq 0 ]; then friendica_help exit 0 fi @@ -210,6 +234,6 @@ case "$1" in update) shift; update $@ ;; console) shift; console $@ ;; composer) shift; composer $@ ;; - sendmail) shift; sendmail $@ ;; + configmail) shift; configmail $@ ;; *) friendica_help ;; esac diff --git a/2018.08-dev/apache/config/htconfig.php b/2018.08-dev/apache/config/htconfig.php index c94b94a..ccd86da 100644 --- a/2018.08-dev/apache/config/htconfig.php +++ b/2018.08-dev/apache/config/htconfig.php @@ -106,3 +106,8 @@ $a->config['system']['allowed_link_protocols'] = ['ftp', 'ftps', 'mailto', 'cid' // Authentication cookie lifetime, in days $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')); +} \ No newline at end of file diff --git a/2018.08-dev/apache/entrypoint.sh b/2018.08-dev/apache/entrypoint.sh index 4a0608c..8b75f8d 100644 --- a/2018.08-dev/apache/entrypoint.sh +++ b/2018.08-dev/apache/entrypoint.sh @@ -2,6 +2,6 @@ set -eu friendica install -q -friendica sendmail -q +friendica configmail -q exec "$@" \ No newline at end of file diff --git a/2018.08-dev/fpm-alpine/Dockerfile b/2018.08-dev/fpm-alpine/Dockerfile index d5f02a5..9e8c874 100644 --- a/2018.08-dev/fpm-alpine/Dockerfile +++ b/2018.08-dev/fpm-alpine/Dockerfile @@ -4,10 +4,11 @@ LABEL maintainer="Philipp Holzer " # entrypoint.sh and cron.sh dependencies RUN set -ex; \ - \ apk add --no-cache \ rsync \ - git; + git \ + # For mail() support + ssmtp; # install the PHP extensions we need # see https://friendi.ca/resources/requirements/ @@ -74,16 +75,19 @@ RUN {\ } > /usr/local/etc/php/conf.d/sendmail.ini; ENV AUTOINSTALL false +ENV VALIDATION true +ENV SITENAME "Friendica Social Network" ENV FRIENDICA_VERSION 2018.08-dev ENV FRIENDICA_ADDONS 2018.08-dev - COPY bin/* /usr/local/bin/ COPY config/* /usr/src/config/ COPY *.sh / RUN chmod +x /*.sh RUN chmod +x /usr/local/bin/* + + ENTRYPOINT ["/entrypoint.sh"] CMD ["php-fpm"] \ No newline at end of file diff --git a/2018.08-dev/fpm-alpine/bin/friendica b/2018.08-dev/fpm-alpine/bin/friendica index f8d1733..49d95b3 100644 --- a/2018.08-dev/fpm-alpine/bin/friendica +++ b/2018.08-dev/fpm-alpine/bin/friendica @@ -1,18 +1,23 @@ #!/bin/sh set -eu -FRIENDICA_VERSION=${FRIENDICA_VERSION:-develop} -FRIENDICA_ADDONS=${FRIENDICA_ADDONS:-develop} -AUTOINSTALL=${AUTOINSTALL:-false} +SMTP=${SMTP:-localhost} +SMTP_FROM=${SMTP_FROM:-no-reply} -SOURCEDIR=/usr/src -WORKDIR=/var/www/html +SOURCEDIR=${SOURCEDIR:-/usr/src} +WORKDIR=${WORKDIR:-/var/www/html} + +SMTP_TLS=${SMTP_TLS:-} +SMTP_STARTTLS=${SMTP_STARTTLS:-} +SMTP_AUTH_USER=${SMTP_AUTH_USER:-} +SMTP_AUTH_PASS=${SMTP_AUTH_PASS:-} +SMTP_AUTH_METHOD=${SMTP_AUTH_METHOD:-} VERBOSE=1 for arg; do case "$arg" in -q|--quit) - if [ "$VERBOSE" -eq "2" ]; then + if [ "$VERBOSE" -eq 2 ]; then echo 'You cannot use verbose and quiet at the same time' exit 1 fi @@ -20,7 +25,7 @@ for arg; do break ;; -v|--verbose) - if [ "$VERBOSE" -eq "0" ]; then + if [ "$VERBOSE" -eq 0 ]; then echo 'You cannot use verbose and quiet at the same time' exit 1 fi @@ -32,7 +37,7 @@ done # run an command with the www-data user run_as() { - if [ "$(id -u)" = 0 ]; then + if [ "$(id -u)" -eq 0 ]; then su - www-data -s /bin/sh -c "$1" else sh -c "$1" @@ -42,7 +47,7 @@ run_as() { # log event log() { currVerb=1 - if [ $# -eq 2 ]; then + if [ "$#" -eq 2 ]; then currVerb=$2 fi if [ "$VERBOSE" -ge "$currVerb" ]; then @@ -105,6 +110,9 @@ console() { composer() { if [ -f $WORKDIR/bin/composer.phar ]; then run_as "cd $WORKDIR;$WORKDIR/bin/composer.phar $@ -d $WORKDIR" + elif [ -f $SOURCEDIR/friendica/bin/composer.phar ]; then + cd $SOURCEDIR/friendica + $SOURCEDIR/friendica/bin/composer.phar "$@" -d $SOURCEDIR/friendica fi } @@ -133,7 +141,7 @@ copy_sources() { fi if version_greater "$image_version" "$installed_version"; then - if [ "$(id -u)" = 0 ]; then + if [ "$(id -u)" -eq 0 ]; then rsync_options="-rlDog --chown=www-data:root" else rsync_options="-rlD" @@ -163,7 +171,7 @@ install() { if [ ! -f ${WORKDIR}/.htconfig.php ] && [ -f ${SOURCEDIR}/config/htconfig.php ] && - "$AUTOINSTALL" == "true"; then + [ "$AUTOINSTALL" = "true" ]; then run_as "cp ${SOURCEDIR}/config/htconfig.php ${WORKDIR}/.htconfig.php" console autoinstall -f .htconfig.php # TODO Workaround because of a strange permission issue @@ -186,21 +194,37 @@ update() { console dbstructure update } -sendmail() { - if [ ! -f /etc/init.d/sendmail ]; then - # If sendmail isn't installed, exit this method +configmail() { + if [ "$SMTP" = "localhost" ]; then + # SMTP is a required setting + # do nothing if it is "localhost" (= not changed) return fi - line=$(head -n 1 /etc/hosts) - line2=$(echo $line | awk '{print $2}') - echo "$line $line2.localdomain" >> /etc/hosts + sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd + sed -i "s/Linux\ User/${SITENAME}/g" /etc/passwd - log 'Starting sendmail for Mail-Support' - nohup /etc/init.d/sendmail start > /dev/null 2>&1 & + # add possible mail-senders + echo "www-data:$SMTP_FROM@$HOSTNAME:$SMTP" >> /etc/ssmtp/revaliases + echo "root:$SMTP_FROM@$HOSTNAME:$SMTP" >> /etc/ssmtp/revaliases + + # replace ssmtp.conf settings + cat << EOF > /etc/ssmtp/ssmtp.conf +# /etc/ssmtp/ssmtp.conf + +root=$SMTP_FROM@$HOSTNAME +hostname=$HOSTNAME +mailhub=$SMTP +FromLineOverride=YES +EOF + [ -z "$SMTP_TLS" ] || echo "UseTLS=$SMTP_TLS" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_STARTTLS" ] || echo "UseSTARTTLS=$SMTP_STARTTLS" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_AUTH_USER" ] || echo "AuthUser=$SMTP_AUTH_USER" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_AUTH_PASS" ] || echo "AuthPass=$SMTP_AUTH_PASS" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_AUTH_METHOD" ] || echo "AuthMethod=$SMTP_AUTH_METHOD" >> /etc/ssmtp/ssmtp.conf } -if [ $# -eq 0 ]; then +if [ "$#" -eq 0 ]; then friendica_help exit 0 fi @@ -210,6 +234,6 @@ case "$1" in update) shift; update $@ ;; console) shift; console $@ ;; composer) shift; composer $@ ;; - sendmail) shift; sendmail $@ ;; + configmail) shift; configmail $@ ;; *) friendica_help ;; esac diff --git a/2018.08-dev/fpm-alpine/config/htconfig.php b/2018.08-dev/fpm-alpine/config/htconfig.php index c94b94a..ccd86da 100644 --- a/2018.08-dev/fpm-alpine/config/htconfig.php +++ b/2018.08-dev/fpm-alpine/config/htconfig.php @@ -106,3 +106,8 @@ $a->config['system']['allowed_link_protocols'] = ['ftp', 'ftps', 'mailto', 'cid' // Authentication cookie lifetime, in days $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')); +} \ No newline at end of file diff --git a/2018.08-dev/fpm-alpine/entrypoint.sh b/2018.08-dev/fpm-alpine/entrypoint.sh index 4a0608c..8b75f8d 100644 --- a/2018.08-dev/fpm-alpine/entrypoint.sh +++ b/2018.08-dev/fpm-alpine/entrypoint.sh @@ -2,6 +2,6 @@ set -eu friendica install -q -friendica sendmail -q +friendica configmail -q exec "$@" \ No newline at end of file diff --git a/2018.08-dev/fpm/Dockerfile b/2018.08-dev/fpm/Dockerfile index 51d9c32..ee60307 100644 --- a/2018.08-dev/fpm/Dockerfile +++ b/2018.08-dev/fpm/Dockerfile @@ -11,7 +11,7 @@ RUN set -ex; \ bzip2 \ git \ # For mail() support - sendmail \ + ssmtp \ ; \ rm -rf /var/lib/apt/lists/*; @@ -85,16 +85,19 @@ RUN {\ } > /usr/local/etc/php/conf.d/sendmail.ini; ENV AUTOINSTALL false +ENV VALIDATION true +ENV SITENAME "Friendica Social Network" ENV FRIENDICA_VERSION 2018.08-dev ENV FRIENDICA_ADDONS 2018.08-dev - COPY bin/* /usr/local/bin/ COPY config/* /usr/src/config/ COPY *.sh / RUN chmod +x /*.sh RUN chmod +x /usr/local/bin/* + + ENTRYPOINT ["/entrypoint.sh"] CMD ["php-fpm"] diff --git a/2018.08-dev/fpm/bin/friendica b/2018.08-dev/fpm/bin/friendica index f8d1733..49d95b3 100644 --- a/2018.08-dev/fpm/bin/friendica +++ b/2018.08-dev/fpm/bin/friendica @@ -1,18 +1,23 @@ #!/bin/sh set -eu -FRIENDICA_VERSION=${FRIENDICA_VERSION:-develop} -FRIENDICA_ADDONS=${FRIENDICA_ADDONS:-develop} -AUTOINSTALL=${AUTOINSTALL:-false} +SMTP=${SMTP:-localhost} +SMTP_FROM=${SMTP_FROM:-no-reply} -SOURCEDIR=/usr/src -WORKDIR=/var/www/html +SOURCEDIR=${SOURCEDIR:-/usr/src} +WORKDIR=${WORKDIR:-/var/www/html} + +SMTP_TLS=${SMTP_TLS:-} +SMTP_STARTTLS=${SMTP_STARTTLS:-} +SMTP_AUTH_USER=${SMTP_AUTH_USER:-} +SMTP_AUTH_PASS=${SMTP_AUTH_PASS:-} +SMTP_AUTH_METHOD=${SMTP_AUTH_METHOD:-} VERBOSE=1 for arg; do case "$arg" in -q|--quit) - if [ "$VERBOSE" -eq "2" ]; then + if [ "$VERBOSE" -eq 2 ]; then echo 'You cannot use verbose and quiet at the same time' exit 1 fi @@ -20,7 +25,7 @@ for arg; do break ;; -v|--verbose) - if [ "$VERBOSE" -eq "0" ]; then + if [ "$VERBOSE" -eq 0 ]; then echo 'You cannot use verbose and quiet at the same time' exit 1 fi @@ -32,7 +37,7 @@ done # run an command with the www-data user run_as() { - if [ "$(id -u)" = 0 ]; then + if [ "$(id -u)" -eq 0 ]; then su - www-data -s /bin/sh -c "$1" else sh -c "$1" @@ -42,7 +47,7 @@ run_as() { # log event log() { currVerb=1 - if [ $# -eq 2 ]; then + if [ "$#" -eq 2 ]; then currVerb=$2 fi if [ "$VERBOSE" -ge "$currVerb" ]; then @@ -105,6 +110,9 @@ console() { composer() { if [ -f $WORKDIR/bin/composer.phar ]; then run_as "cd $WORKDIR;$WORKDIR/bin/composer.phar $@ -d $WORKDIR" + elif [ -f $SOURCEDIR/friendica/bin/composer.phar ]; then + cd $SOURCEDIR/friendica + $SOURCEDIR/friendica/bin/composer.phar "$@" -d $SOURCEDIR/friendica fi } @@ -133,7 +141,7 @@ copy_sources() { fi if version_greater "$image_version" "$installed_version"; then - if [ "$(id -u)" = 0 ]; then + if [ "$(id -u)" -eq 0 ]; then rsync_options="-rlDog --chown=www-data:root" else rsync_options="-rlD" @@ -163,7 +171,7 @@ install() { if [ ! -f ${WORKDIR}/.htconfig.php ] && [ -f ${SOURCEDIR}/config/htconfig.php ] && - "$AUTOINSTALL" == "true"; then + [ "$AUTOINSTALL" = "true" ]; then run_as "cp ${SOURCEDIR}/config/htconfig.php ${WORKDIR}/.htconfig.php" console autoinstall -f .htconfig.php # TODO Workaround because of a strange permission issue @@ -186,21 +194,37 @@ update() { console dbstructure update } -sendmail() { - if [ ! -f /etc/init.d/sendmail ]; then - # If sendmail isn't installed, exit this method +configmail() { + if [ "$SMTP" = "localhost" ]; then + # SMTP is a required setting + # do nothing if it is "localhost" (= not changed) return fi - line=$(head -n 1 /etc/hosts) - line2=$(echo $line | awk '{print $2}') - echo "$line $line2.localdomain" >> /etc/hosts + sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd + sed -i "s/Linux\ User/${SITENAME}/g" /etc/passwd - log 'Starting sendmail for Mail-Support' - nohup /etc/init.d/sendmail start > /dev/null 2>&1 & + # add possible mail-senders + echo "www-data:$SMTP_FROM@$HOSTNAME:$SMTP" >> /etc/ssmtp/revaliases + echo "root:$SMTP_FROM@$HOSTNAME:$SMTP" >> /etc/ssmtp/revaliases + + # replace ssmtp.conf settings + cat << EOF > /etc/ssmtp/ssmtp.conf +# /etc/ssmtp/ssmtp.conf + +root=$SMTP_FROM@$HOSTNAME +hostname=$HOSTNAME +mailhub=$SMTP +FromLineOverride=YES +EOF + [ -z "$SMTP_TLS" ] || echo "UseTLS=$SMTP_TLS" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_STARTTLS" ] || echo "UseSTARTTLS=$SMTP_STARTTLS" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_AUTH_USER" ] || echo "AuthUser=$SMTP_AUTH_USER" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_AUTH_PASS" ] || echo "AuthPass=$SMTP_AUTH_PASS" >> /etc/ssmtp/ssmtp.conf + [ -z "$SMTP_AUTH_METHOD" ] || echo "AuthMethod=$SMTP_AUTH_METHOD" >> /etc/ssmtp/ssmtp.conf } -if [ $# -eq 0 ]; then +if [ "$#" -eq 0 ]; then friendica_help exit 0 fi @@ -210,6 +234,6 @@ case "$1" in update) shift; update $@ ;; console) shift; console $@ ;; composer) shift; composer $@ ;; - sendmail) shift; sendmail $@ ;; + configmail) shift; configmail $@ ;; *) friendica_help ;; esac diff --git a/2018.08-dev/fpm/config/htconfig.php b/2018.08-dev/fpm/config/htconfig.php index c94b94a..ccd86da 100644 --- a/2018.08-dev/fpm/config/htconfig.php +++ b/2018.08-dev/fpm/config/htconfig.php @@ -106,3 +106,8 @@ $a->config['system']['allowed_link_protocols'] = ['ftp', 'ftps', 'mailto', 'cid' // Authentication cookie lifetime, in days $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')); +} \ No newline at end of file diff --git a/2018.08-dev/fpm/entrypoint.sh b/2018.08-dev/fpm/entrypoint.sh index 4a0608c..8b75f8d 100644 --- a/2018.08-dev/fpm/entrypoint.sh +++ b/2018.08-dev/fpm/entrypoint.sh @@ -2,6 +2,6 @@ set -eu friendica install -q -friendica sendmail -q +friendica configmail -q exec "$@" \ No newline at end of file diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index c8ee2ec..49d07c9 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -3,10 +3,11 @@ LABEL maintainer="Philipp Holzer " # entrypoint.sh and cron.sh dependencies RUN set -ex; \ - \ apk add --no-cache \ rsync \ - git; + git \ + # For mail() support + ssmtp; # install the PHP extensions we need # see https://friendi.ca/resources/requirements/ @@ -73,10 +74,11 @@ RUN {\ } > /usr/local/etc/php/conf.d/sendmail.ini; ENV AUTOINSTALL false +ENV VALIDATION true +ENV SITENAME "Friendica Social Network" ENV FRIENDICA_VERSION %%VERSION%% ENV FRIENDICA_ADDONS %%VERSION%% -%%INSTALL_EXTRAS%% COPY bin/* /usr/local/bin/ COPY config/* /usr/src/config/ @@ -84,5 +86,7 @@ COPY *.sh / RUN chmod +x /*.sh RUN chmod +x /usr/local/bin/* +%%INSTALL_EXTRAS%% + ENTRYPOINT ["/entrypoint.sh"] CMD ["%%CMD%%"] \ No newline at end of file diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template index 40ae16a..7d4d400 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-debian.template @@ -10,7 +10,7 @@ RUN set -ex; \ bzip2 \ git \ # For mail() support - sendmail \ + ssmtp \ ; \ rm -rf /var/lib/apt/lists/*; @@ -84,10 +84,11 @@ RUN {\ } > /usr/local/etc/php/conf.d/sendmail.ini; ENV AUTOINSTALL false +ENV VALIDATION true +ENV SITENAME "Friendica Social Network" ENV FRIENDICA_VERSION %%VERSION%% ENV FRIENDICA_ADDONS %%VERSION%% -%%INSTALL_EXTRAS%% COPY bin/* /usr/local/bin/ COPY config/* /usr/src/config/ @@ -95,5 +96,7 @@ COPY *.sh / RUN chmod +x /*.sh RUN chmod +x /usr/local/bin/* +%%INSTALL_EXTRAS%% + ENTRYPOINT ["/entrypoint.sh"] CMD ["%%CMD%%"] diff --git a/README.md b/README.md index 5ea87e0..225b099 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,14 @@ You can preconfigure everything that is asked on the install page on first run. - `AUTOINSTALL` if `true`, the automatic configuration will start (Default: `false`) +**SMTP/Mail Settings**: + +- `SMTP` **required** address of the SMTP Mail-Gateway (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) + **MYSQL/MariaDB**: - `MYSQL_USERNAME` Username for the database user using mysql. @@ -133,9 +141,10 @@ You can preconfigure everything that is asked on the install page on first run. You can also predefine the following `.htconfig.php` values: - `MAILNAME` E-Mail address of the administrator -- `TZ` The default localization of the Friendica server -- `LANGUAGE` The default language of the Friendica server -- `SITENAME` The default name of the Friendica server +- `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`) ## Updating to a newer version diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 4a0608c..8b75f8d 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -2,6 +2,6 @@ set -eu friendica install -q -friendica sendmail -q +friendica configmail -q exec "$@" \ No newline at end of file diff --git a/stack.yml b/stack.yml index 1dda286..39a135e 100644 --- a/stack.yml +++ b/stack.yml @@ -27,6 +27,8 @@ services: - MYSQL_PASSWORD=friendica - MYSQL_DATABASE=friendica - MAILNAME=root@friendica.local + - SITENAME=Friendica PWD Test Node + - VALIDATION=false hostname: friendica.local depends_on: - db @@ -44,6 +46,7 @@ services: - MYSQL_PASSWORD=friendica - MYSQL_DATABASE=friendica - MAILNAME=root@friendica.local + - SITENAME=Friendica PWD Test Node depends_on: - db diff --git a/update.sh b/update.sh index 7035ba1..cab5d63 100755 --- a/update.sh +++ b/update.sh @@ -28,7 +28,7 @@ declare -A pecl_versions=( ) declare -A install_extras=( - ['stable']='\nRUN set -ex; \\\n curl -fsSL -o friendica.tar.gz \\\n "https://github.com/friendica/friendica/archive/${FRIENDICA_VERSION}.tar.gz"; \\\n tar -xzf friendica.tar.gz -C /usr/src/; \\\n rm friendica.tar.gz; \\\n mv -f /usr/src/friendica-${FRIENDICA_VERSION}/ /usr/src/friendica; \\\n chmod 777 /usr/src/friendica/view/smarty3; \\\n curl -fsSL -o friendica_addons.tar.gz \\\n "https://github.com/friendica/friendica-addons/archive/${FRIENDICA_ADDONS}.tar.gz"; \\\n mkdir /usr/src/friendica/addon; \\\n tar -xzf friendica_addons.tar.gz -C /usr/src/friendica/addon --strip-components=1; \\\n rm friendica_addons.tar.gz;' + ['stable']='\nRUN set -ex; \\\n curl -fsSL -o friendica.tar.gz \\\n "https://github.com/friendica/friendica/archive/${FRIENDICA_VERSION}.tar.gz"; \\\n tar -xzf friendica.tar.gz -C /usr/src/; \\\n rm friendica.tar.gz; \\\n mv -f /usr/src/friendica-${FRIENDICA_VERSION}/ /usr/src/friendica; \\\n chmod 777 /usr/src/friendica/view/smarty3; \\\n curl -fsSL -o friendica_addons.tar.gz \\\n "https://github.com/friendica/friendica-addons/archive/${FRIENDICA_ADDONS}.tar.gz"; \\\n mkdir /usr/src/friendica/addon; \\\n tar -xzf friendica_addons.tar.gz -C /usr/src/friendica/addon --strip-components=1; \\\n rm friendica_addons.tar.gz; \\\n friendica composer install;' ['develop']='' )