diff --git a/.examples/dockerfiles/cron/apache/Dockerfile b/.examples/dockerfiles/cron/apache/Dockerfile new file mode 100644 index 0000000..5875232 --- /dev/null +++ b/.examples/dockerfiles/cron/apache/Dockerfile @@ -0,0 +1,17 @@ +FROM friendica:apache + +ENV AUTOINSTALL true +ENV MARIADB_VERSION 10.3 + +RUN set -ex; \ + ; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + supervisor \ + ; \ + rm -rf /var/lib/apt/lists/*; \ + mkdir /var/log/supervisord /var/run/supervisord + +COPY ./supervisord.conf /etc/supervisor/supervisord.conf + +CMD ["/usr/bin/supervisord"] \ No newline at end of file diff --git a/.examples/dockerfiles/cron/apache/supervisord.conf b/.examples/dockerfiles/cron/apache/supervisord.conf new file mode 100644 index 0000000..40757b2 --- /dev/null +++ b/.examples/dockerfiles/cron/apache/supervisord.conf @@ -0,0 +1,22 @@ +[supervisord] +nodaemon=true +logfile=/var/log/supervisord/supervisord.log +pidfile=/var/run/supervisord/supervisord.pid +childlogdir=/var/log/supervisord/ +logfile_maxbytes=50MB ; maximum size of logfile before rotation +logfile_backups=10 ; number of backed up logfiles +loglevel=error + +[program:apache2] +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 +command=apache2-foreground + +[program:cron] +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 +command=/cron.sh \ No newline at end of file diff --git a/.examples/dockerfiles/cron/fpm/Dockerfile b/.examples/dockerfiles/cron/fpm/Dockerfile new file mode 100644 index 0000000..34f42cf --- /dev/null +++ b/.examples/dockerfiles/cron/fpm/Dockerfile @@ -0,0 +1,17 @@ +FROM friendica:fpm + +ENV AUTOINSTALL true +ENV MARIADB_VERSION 10.3 + +RUN set -ex; \ + ; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + supervisor \ + ; \ + rm -rf /var/lib/apt/lists/*; \ + mkdir /var/log/supervisord /var/run/supervisord + +COPY ./supervisord.conf /etc/supervisor/supervisord.conf + +CMD ["/usr/bin/supervisord"] \ No newline at end of file diff --git a/.examples/dockerfiles/cron/fpm/supervisord.conf b/.examples/dockerfiles/cron/fpm/supervisord.conf new file mode 100644 index 0000000..40757b2 --- /dev/null +++ b/.examples/dockerfiles/cron/fpm/supervisord.conf @@ -0,0 +1,22 @@ +[supervisord] +nodaemon=true +logfile=/var/log/supervisord/supervisord.log +pidfile=/var/run/supervisord/supervisord.pid +childlogdir=/var/log/supervisord/ +logfile_maxbytes=50MB ; maximum size of logfile before rotation +logfile_backups=10 ; number of backed up logfiles +loglevel=error + +[program:apache2] +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 +command=apache2-foreground + +[program:cron] +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 +command=/cron.sh \ No newline at end of file diff --git a/.examples/dockerfiles/smtp/README.md b/.examples/dockerfiles/smtp/README.md new file mode 100644 index 0000000..3bf9a6d --- /dev/null +++ b/.examples/dockerfiles/smtp/README.md @@ -0,0 +1,24 @@ +# 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/Dockerfile b/.examples/dockerfiles/smtp/apache/Dockerfile new file mode 100644 index 0000000..fd442d1 --- /dev/null +++ b/.examples/dockerfiles/smtp/apache/Dockerfile @@ -0,0 +1,9 @@ +FROM friendica:apache + +# 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 + +COPY *.sh / +RUN chmod +x /*.sh +RUN /smtp-config.sh \ No newline at end of file diff --git a/.examples/dockerfiles/smtp/apache/smtp-config.sh b/.examples/dockerfiles/smtp/apache/smtp-config.sh new file mode 100644 index 0000000..9fa076d --- /dev/null +++ b/.examples/dockerfiles/smtp/apache/smtp-config.sh @@ -0,0 +1,45 @@ +#!/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 new file mode 100644 index 0000000..7942bbe --- /dev/null +++ b/.examples/dockerfiles/smtp/fpm-alpine/Dockerfile @@ -0,0 +1,15 @@ +FROM friendica:develop-fpm-alpine + +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=${:-localhost}" >> /etc/ssmtp/ssmtp.conf;SMTP_HOST + +# 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/Dockerfile b/.examples/dockerfiles/smtp/fpm/Dockerfile new file mode 100644 index 0000000..99a6f24 --- /dev/null +++ b/.examples/dockerfiles/smtp/fpm/Dockerfile @@ -0,0 +1,9 @@ +FROM friendica:develop-fpm + +# 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 + +COPY *.sh / +RUN chmod +x /*.sh +RUN /smtp-config.sh \ No newline at end of file diff --git a/.examples/dockerfiles/smtp/fpm/smtp-config.sh b/.examples/dockerfiles/smtp/fpm/smtp-config.sh new file mode 100644 index 0000000..9fa076d --- /dev/null +++ b/.examples/dockerfiles/smtp/fpm/smtp-config.sh @@ -0,0 +1,45 @@ +#!/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/README.md b/README.md index e89ef01..bea235b 100644 --- a/README.md +++ b/README.md @@ -4,19 +4,25 @@ This repository holds the official Docker Image for [Friendica](https://friendi. # What is Friendica? -Friendica is a decentralised communications platform that integrates social communication. Our platform links to independent social projects and corporate services. +Friendica is a decentralised communications platform that integrates social communication. +Our platform links to independent social projects and corporate services. ![logo](https://cdn.rawgit.com/nupplaphil/friendica-docker/c59f235f/friendica.svg) # How to use this image -The images are designed to be used in a micro-service environment. There are two types of the image you can choose from. +The images are designed to be used in a micro-service environment. +There are two types of the image you can choose from. -The `apache` tag contains a full Friendica installation including an apache web server. It is designed to be easy to use and gets you running pretty fast. This is also the default for the `latest` tag and version tags that are not further specified. +The `apache` tag contains a full Friendica installation including an apache web server. +It is designed to be easy to use and gets you running pretty fast. +This is also the default for the `latest` tag and version tags that are not further specified. -The second option is a `fpm` container. It is based on the [php-fpm](https://hub.docker.com/_/php/) image and runs a fastCGI-Process that serves your Friendica server. To use this image it must be combined with any Webserver that can proxy the http requests to the FastCGI-port of the container. +The second option is a `fpm` container. +It is based on the [php-fpm](https://hub.docker.com/_/php/) image and runs a fastCGI-Process that serves your Friendica server. +To use this image it must be combined with any Webserver that can proxy the http requests to the FastCGI-port of the container. ## Using the apache image -You need at least one other mariadb/mysql-container to link it to Friendica +You need at least one other mariadb/mysql-container to link it to Friendica. The apache image contains a webserver and exposes port 80. To start the container type: ```console @@ -26,23 +32,53 @@ $ docker run -d -p 8080:80 --link some-mysql:mysql friendica Now you can access the Friendica installation wizard at http://localhost:8080/ from your host system. ## Using the fpm image -To use the fpm image you need an additional web server that can proxy http-request to the fpm-port of the container. For fpm connection this container exposes port 9000. In most cases you might want use another container or your host as proxy. -If you use your host you can address your Friendica container directly on port 9000. If you use another container, make sure that you add them to the same docker network (via `docker run --network ...` or a `docker-compose` file). +To use the fpm image you need an additional web server that can proxy http-request to the fpm-port of the container. For fpm connection this container exposes port 9000. +In most cases you might want use another container or your host as proxy. +If you use your host you can address your Friendica container directly on port 9000. +If you use another container, make sure that you add them to the same docker network (via `docker run --network ...` or a `docker-compose` file). In both cases you don't want to map the fpm port to you host. ```console $ docker run -d friendica:fpm ``` -As the fastCGI-Process is not capable of serving static files (style sheets, images, ...) the webserver needs access to these files. This can be achieved with the `volumes-from` option. You can find more information in the docker-compose section. +As the fastCGI-Process is not capable of serving static files (style sheets, images, ...) the webserver needs access to these files. +This can be achieved with the `volumes-from` option. +You can find more information in the docker-compose section. + +## Using the cron job + +There are three options to enable the cron-job for Friendica: +- Using the default Image and activate the cron-job (see [Installation](https://friendi.ca/resources/installation/), sector `Activating scheduled tasks`) +- Using the default image (apache, fpm, fpm-alpine) and use **two** container (one for cron and one for the main app) +- Using one of the additional, prepared [`dockerfiles`](https://github.com/friendica/docker/tree/master/.examples/dockerfiles) + +## Using sendmail for E-Mail support + +You have to set the `--hostname/-h` parameter correctly to make the `mail()` command use the right domainname of it's e-mail. +Currently, the command `sendmail` will be used for the `mail()` support of Friendica. + +Be aware that in production environment, you normally have an external MTA (or a SmartHost) for correctly signing and routing your e-mails. +See the Dockerfiles at [`smtp`](https://github.com/friendica/docker/tree/master/.examples/dockerfiles/smtp) for examples how to configure it. + +### `apache` and `fpm` image +`sendmail` is used as a SMTP MTA for standalone usage and it works out-of-the-box. + +### `fpm-alpine` image +For alpine, there is no "standalone" mail-service available. +Therefore you **have** to setup a SMTP MTA. ## Using an external database -By default the `latest` container uses a local MySQL-Database for data storage, but the Friendica setup wizard (appears on first run) allows connecting to an existing MySQL/MariaDB database. You can also link a database container, e. g. `--link my-mysql:mysql`, and then use `mysql` as the database host on setup. More info is in the docker-compose section. +By default the `latest` container uses a local MySQL-Database for data storage, but the Friendica setup wizard (appears on first run) allows connecting to an existing MySQL/MariaDB database. +You can also link a database container, e. g. `--link my-mysql:mysql`, and then use `mysql` as the database host on setup. ## Persistent data -The Friendica installation and all data beyond what lives in the database (file uploads, etc) is stored in the [unnamed docker volume](https://docs.docker.com/engine/tutorials/dockervolumes/#adding-a-data-volume) volume `/var/www/html`. The docker daemon will store that data within the docker directory `/var/lib/docker/volumes/...`. That means your data is saved even if the container crashes, is stopped or deleted. +The Friendica installation and all data beyond what lives in the database (file uploads, etc) is stored in the [unnamed docker volume](https://docs.docker.com/engine/tutorials/dockervolumes/#adding-a-data-volume) volume `/var/www/html`. +The docker daemon will store that data within the docker directory `/var/lib/docker/volumes/...`. +That means your data is saved even if the container crashes, is stopped or deleted. -To make your data persistent to upgrading and get access for backups is using named docker volume or mount a host folder. To achieve this you need one volume for your database container and Friendica. +To make your data persistent to upgrading and get access for backups is using named docker volume or mount a host folder. +To achieve this you need one volume for your database container and Friendica. Friendica: - `/var/www/html/` folder where all Friendica data lives @@ -61,7 +97,8 @@ mariadb ``` ## Auto configuration via environment variables -The Friendica image supports auto configuration via environment variables. You can preconfigure everything that is asked on the install page on first run. +The Friendica image supports auto configuration via environment variables. +You can preconfigure everything that is asked on the install page on first run. - `AUTOINSTALL` if `true`, the automatic configuration will start (Default: `false`) diff --git a/develop/apache/Dockerfile b/develop/apache/Dockerfile index caa4387..9de57f1 100644 --- a/develop/apache/Dockerfile +++ b/develop/apache/Dockerfile @@ -13,6 +13,8 @@ RUN set -ex; \ bzip2 \ busybox-static \ git \ +# For mail() support + sendmail \ ; \ rm -rf /var/lib/apt/lists/*; \ \ @@ -93,6 +95,10 @@ RUN a2enmod rewrite remoteip ;\ } > /etc/apache2/conf-available/remoteip.conf;\ a2enconf remoteip +RUN {\ + echo sendmail_path = "/usr/sbin/sendmail -t -i" ;\ + } > /usr/local/etc/php/conf.d/sendmail.ini; + ENV FRIENDICA_VERSION develop ENV ADDONS_VERSION develop diff --git a/develop/apache/bin/friendica b/develop/apache/bin/friendica index 3bc63e7..8deda9e 100644 --- a/develop/apache/bin/friendica +++ b/develop/apache/bin/friendica @@ -30,6 +30,9 @@ clone_develop() { echo "Cloning Friendica '${friendica}' with Addons '${addons}' into '${dir}'" + # Removing the whole directory first + rm -fr ${dir}/friendica + git clone -b ${friendica} https://github.com/friendica/friendica ${dir}/friendica chmod 777 ${dir}/friendica/view/smarty3 mkdir ${dir}/friendica/addon @@ -139,6 +142,20 @@ update() { console "dbstructure update" } +sendmail() { + if [ ! -f /etc/init.d/sendmail ]; then + # If sendmail isn't installed, exit this method + return + fi + + line=$(head -n 1 /etc/hosts) + line2=$(echo $line | awk '{print $2}') + echo "$line $line2.localdomain" >> /etc/hosts + + echo "Starting sendmail for Mail-Support" + /etc/init.d/sendmail start +} + if [ $# -eq 0 ]; then friendica_help fi @@ -148,5 +165,6 @@ case "$1" in update) shift; update "$@" ;; console) shift; console "$@" ;; composer) shift; composer "$@" ;; + sendmail) shift; sendmail "$@" ;; *) friendica_help ;; esac diff --git a/develop/apache/cron.sh b/develop/apache/cron.sh index b368336..4dfa411 100644 --- a/develop/apache/cron.sh +++ b/develop/apache/cron.sh @@ -1,4 +1,4 @@ #!/bin/sh set -eu -exec busybox crond -f -l 0 -L /dev/stdout \ No newline at end of file +exec busybox crond -f -l 0 -L /dev/stdout diff --git a/develop/apache/entrypoint.sh b/develop/apache/entrypoint.sh index 90d6839..1f03315 100644 --- a/develop/apache/entrypoint.sh +++ b/develop/apache/entrypoint.sh @@ -3,5 +3,6 @@ set -eu # Check if Friendica needs to get installed friendica install +friendica sendmail -exec "$@" \ No newline at end of file +exec "$@" diff --git a/develop/fpm-alpine/Dockerfile b/develop/fpm-alpine/Dockerfile index c36fdbe..3083d43 100644 --- a/develop/fpm-alpine/Dockerfile +++ b/develop/fpm-alpine/Dockerfile @@ -73,6 +73,10 @@ RUN chown -R www-data:root /var/www; \ VOLUME /var/www/html +RUN {\ + echo sendmail_path = "/usr/sbin/sendmail -t -i" ;\ + } > /usr/local/etc/php/conf.d/sendmail.ini; + ENV FRIENDICA_VERSION develop ENV ADDONS_VERSION develop diff --git a/develop/fpm-alpine/bin/friendica b/develop/fpm-alpine/bin/friendica index 3bc63e7..8deda9e 100644 --- a/develop/fpm-alpine/bin/friendica +++ b/develop/fpm-alpine/bin/friendica @@ -30,6 +30,9 @@ clone_develop() { echo "Cloning Friendica '${friendica}' with Addons '${addons}' into '${dir}'" + # Removing the whole directory first + rm -fr ${dir}/friendica + git clone -b ${friendica} https://github.com/friendica/friendica ${dir}/friendica chmod 777 ${dir}/friendica/view/smarty3 mkdir ${dir}/friendica/addon @@ -139,6 +142,20 @@ update() { console "dbstructure update" } +sendmail() { + if [ ! -f /etc/init.d/sendmail ]; then + # If sendmail isn't installed, exit this method + return + fi + + line=$(head -n 1 /etc/hosts) + line2=$(echo $line | awk '{print $2}') + echo "$line $line2.localdomain" >> /etc/hosts + + echo "Starting sendmail for Mail-Support" + /etc/init.d/sendmail start +} + if [ $# -eq 0 ]; then friendica_help fi @@ -148,5 +165,6 @@ case "$1" in update) shift; update "$@" ;; console) shift; console "$@" ;; composer) shift; composer "$@" ;; + sendmail) shift; sendmail "$@" ;; *) friendica_help ;; esac diff --git a/develop/fpm-alpine/cron.sh b/develop/fpm-alpine/cron.sh index b368336..4dfa411 100644 --- a/develop/fpm-alpine/cron.sh +++ b/develop/fpm-alpine/cron.sh @@ -1,4 +1,4 @@ #!/bin/sh set -eu -exec busybox crond -f -l 0 -L /dev/stdout \ No newline at end of file +exec busybox crond -f -l 0 -L /dev/stdout diff --git a/develop/fpm-alpine/entrypoint.sh b/develop/fpm-alpine/entrypoint.sh index 90d6839..1f03315 100644 --- a/develop/fpm-alpine/entrypoint.sh +++ b/develop/fpm-alpine/entrypoint.sh @@ -3,5 +3,6 @@ set -eu # Check if Friendica needs to get installed friendica install +friendica sendmail -exec "$@" \ No newline at end of file +exec "$@" diff --git a/develop/fpm/Dockerfile b/develop/fpm/Dockerfile index d56a1ca..eee77ed 100644 --- a/develop/fpm/Dockerfile +++ b/develop/fpm/Dockerfile @@ -13,6 +13,8 @@ RUN set -ex; \ bzip2 \ busybox-static \ git \ +# For mail() support + sendmail \ ; \ rm -rf /var/lib/apt/lists/*; \ \ @@ -84,6 +86,10 @@ RUN chown -R www-data:root /var/www; \ VOLUME /var/www/html +RUN {\ + echo sendmail_path = "/usr/sbin/sendmail -t -i" ;\ + } > /usr/local/etc/php/conf.d/sendmail.ini; + ENV FRIENDICA_VERSION develop ENV ADDONS_VERSION develop diff --git a/develop/fpm/bin/friendica b/develop/fpm/bin/friendica index 3bc63e7..8deda9e 100644 --- a/develop/fpm/bin/friendica +++ b/develop/fpm/bin/friendica @@ -30,6 +30,9 @@ clone_develop() { echo "Cloning Friendica '${friendica}' with Addons '${addons}' into '${dir}'" + # Removing the whole directory first + rm -fr ${dir}/friendica + git clone -b ${friendica} https://github.com/friendica/friendica ${dir}/friendica chmod 777 ${dir}/friendica/view/smarty3 mkdir ${dir}/friendica/addon @@ -139,6 +142,20 @@ update() { console "dbstructure update" } +sendmail() { + if [ ! -f /etc/init.d/sendmail ]; then + # If sendmail isn't installed, exit this method + return + fi + + line=$(head -n 1 /etc/hosts) + line2=$(echo $line | awk '{print $2}') + echo "$line $line2.localdomain" >> /etc/hosts + + echo "Starting sendmail for Mail-Support" + /etc/init.d/sendmail start +} + if [ $# -eq 0 ]; then friendica_help fi @@ -148,5 +165,6 @@ case "$1" in update) shift; update "$@" ;; console) shift; console "$@" ;; composer) shift; composer "$@" ;; + sendmail) shift; sendmail "$@" ;; *) friendica_help ;; esac diff --git a/develop/fpm/cron.sh b/develop/fpm/cron.sh index b368336..4dfa411 100644 --- a/develop/fpm/cron.sh +++ b/develop/fpm/cron.sh @@ -1,4 +1,4 @@ #!/bin/sh set -eu -exec busybox crond -f -l 0 -L /dev/stdout \ No newline at end of file +exec busybox crond -f -l 0 -L /dev/stdout diff --git a/develop/fpm/entrypoint.sh b/develop/fpm/entrypoint.sh index 90d6839..1f03315 100644 --- a/develop/fpm/entrypoint.sh +++ b/develop/fpm/entrypoint.sh @@ -3,5 +3,6 @@ set -eu # Check if Friendica needs to get installed friendica install +friendica sendmail -exec "$@" \ No newline at end of file +exec "$@" diff --git a/stable/apache/Dockerfile b/stable/apache/Dockerfile index b78dcfb..87e88b1 100644 --- a/stable/apache/Dockerfile +++ b/stable/apache/Dockerfile @@ -13,6 +13,8 @@ RUN set -ex; \ bzip2 \ busybox-static \ git \ +# For mail() support + sendmail \ ; \ rm -rf /var/lib/apt/lists/*; \ \ @@ -93,6 +95,10 @@ RUN a2enmod rewrite remoteip ;\ } > /etc/apache2/conf-available/remoteip.conf;\ a2enconf remoteip +RUN {\ + echo sendmail_path = "/usr/sbin/sendmail -t -i" ;\ + } > /usr/local/etc/php/conf.d/sendmail.ini; + ENV FRIENDICA_VERSION 3.6 ENV ADDONS_VERSION 3.6 @@ -116,4 +122,4 @@ RUN chmod +x /*.sh RUN chmod +x /usr/local/bin/* ENTRYPOINT ["/entrypoint.sh"] -CMD ["apache2-foreground"] \ No newline at end of file +CMD ["apache2-foreground"] diff --git a/stable/apache/bin/friendica b/stable/apache/bin/friendica index 3bc63e7..8deda9e 100644 --- a/stable/apache/bin/friendica +++ b/stable/apache/bin/friendica @@ -30,6 +30,9 @@ clone_develop() { echo "Cloning Friendica '${friendica}' with Addons '${addons}' into '${dir}'" + # Removing the whole directory first + rm -fr ${dir}/friendica + git clone -b ${friendica} https://github.com/friendica/friendica ${dir}/friendica chmod 777 ${dir}/friendica/view/smarty3 mkdir ${dir}/friendica/addon @@ -139,6 +142,20 @@ update() { console "dbstructure update" } +sendmail() { + if [ ! -f /etc/init.d/sendmail ]; then + # If sendmail isn't installed, exit this method + return + fi + + line=$(head -n 1 /etc/hosts) + line2=$(echo $line | awk '{print $2}') + echo "$line $line2.localdomain" >> /etc/hosts + + echo "Starting sendmail for Mail-Support" + /etc/init.d/sendmail start +} + if [ $# -eq 0 ]; then friendica_help fi @@ -148,5 +165,6 @@ case "$1" in update) shift; update "$@" ;; console) shift; console "$@" ;; composer) shift; composer "$@" ;; + sendmail) shift; sendmail "$@" ;; *) friendica_help ;; esac diff --git a/stable/apache/cron.sh b/stable/apache/cron.sh index b368336..4dfa411 100644 --- a/stable/apache/cron.sh +++ b/stable/apache/cron.sh @@ -1,4 +1,4 @@ #!/bin/sh set -eu -exec busybox crond -f -l 0 -L /dev/stdout \ No newline at end of file +exec busybox crond -f -l 0 -L /dev/stdout diff --git a/stable/apache/entrypoint.sh b/stable/apache/entrypoint.sh index 90d6839..1f03315 100644 --- a/stable/apache/entrypoint.sh +++ b/stable/apache/entrypoint.sh @@ -3,5 +3,6 @@ set -eu # Check if Friendica needs to get installed friendica install +friendica sendmail -exec "$@" \ No newline at end of file +exec "$@" diff --git a/stable/fpm-alpine/Dockerfile b/stable/fpm-alpine/Dockerfile index 75a66d6..793bc75 100644 --- a/stable/fpm-alpine/Dockerfile +++ b/stable/fpm-alpine/Dockerfile @@ -73,6 +73,10 @@ RUN chown -R www-data:root /var/www; \ VOLUME /var/www/html +RUN {\ + echo sendmail_path = "/usr/sbin/sendmail -t -i" ;\ + } > /usr/local/etc/php/conf.d/sendmail.ini; + ENV FRIENDICA_VERSION 3.6 ENV ADDONS_VERSION 3.6 diff --git a/stable/fpm-alpine/bin/friendica b/stable/fpm-alpine/bin/friendica index 3bc63e7..8deda9e 100644 --- a/stable/fpm-alpine/bin/friendica +++ b/stable/fpm-alpine/bin/friendica @@ -30,6 +30,9 @@ clone_develop() { echo "Cloning Friendica '${friendica}' with Addons '${addons}' into '${dir}'" + # Removing the whole directory first + rm -fr ${dir}/friendica + git clone -b ${friendica} https://github.com/friendica/friendica ${dir}/friendica chmod 777 ${dir}/friendica/view/smarty3 mkdir ${dir}/friendica/addon @@ -139,6 +142,20 @@ update() { console "dbstructure update" } +sendmail() { + if [ ! -f /etc/init.d/sendmail ]; then + # If sendmail isn't installed, exit this method + return + fi + + line=$(head -n 1 /etc/hosts) + line2=$(echo $line | awk '{print $2}') + echo "$line $line2.localdomain" >> /etc/hosts + + echo "Starting sendmail for Mail-Support" + /etc/init.d/sendmail start +} + if [ $# -eq 0 ]; then friendica_help fi @@ -148,5 +165,6 @@ case "$1" in update) shift; update "$@" ;; console) shift; console "$@" ;; composer) shift; composer "$@" ;; + sendmail) shift; sendmail "$@" ;; *) friendica_help ;; esac diff --git a/stable/fpm-alpine/cron.sh b/stable/fpm-alpine/cron.sh index b368336..4dfa411 100644 --- a/stable/fpm-alpine/cron.sh +++ b/stable/fpm-alpine/cron.sh @@ -1,4 +1,4 @@ #!/bin/sh set -eu -exec busybox crond -f -l 0 -L /dev/stdout \ No newline at end of file +exec busybox crond -f -l 0 -L /dev/stdout diff --git a/stable/fpm-alpine/entrypoint.sh b/stable/fpm-alpine/entrypoint.sh index 90d6839..1f03315 100644 --- a/stable/fpm-alpine/entrypoint.sh +++ b/stable/fpm-alpine/entrypoint.sh @@ -3,5 +3,6 @@ set -eu # Check if Friendica needs to get installed friendica install +friendica sendmail -exec "$@" \ No newline at end of file +exec "$@" diff --git a/stable/fpm/Dockerfile b/stable/fpm/Dockerfile index 779b621..b99361a 100644 --- a/stable/fpm/Dockerfile +++ b/stable/fpm/Dockerfile @@ -13,6 +13,8 @@ RUN set -ex; \ bzip2 \ busybox-static \ git \ +# For mail() support + sendmail \ ; \ rm -rf /var/lib/apt/lists/*; \ \ @@ -84,6 +86,10 @@ RUN chown -R www-data:root /var/www; \ VOLUME /var/www/html +RUN {\ + echo sendmail_path = "/usr/sbin/sendmail -t -i" ;\ + } > /usr/local/etc/php/conf.d/sendmail.ini; + ENV FRIENDICA_VERSION 3.6 ENV ADDONS_VERSION 3.6 @@ -107,4 +113,4 @@ RUN chmod +x /*.sh RUN chmod +x /usr/local/bin/* ENTRYPOINT ["/entrypoint.sh"] -CMD ["php-fpm"] \ No newline at end of file +CMD ["php-fpm"] diff --git a/stable/fpm/bin/friendica b/stable/fpm/bin/friendica index 3bc63e7..8deda9e 100644 --- a/stable/fpm/bin/friendica +++ b/stable/fpm/bin/friendica @@ -30,6 +30,9 @@ clone_develop() { echo "Cloning Friendica '${friendica}' with Addons '${addons}' into '${dir}'" + # Removing the whole directory first + rm -fr ${dir}/friendica + git clone -b ${friendica} https://github.com/friendica/friendica ${dir}/friendica chmod 777 ${dir}/friendica/view/smarty3 mkdir ${dir}/friendica/addon @@ -139,6 +142,20 @@ update() { console "dbstructure update" } +sendmail() { + if [ ! -f /etc/init.d/sendmail ]; then + # If sendmail isn't installed, exit this method + return + fi + + line=$(head -n 1 /etc/hosts) + line2=$(echo $line | awk '{print $2}') + echo "$line $line2.localdomain" >> /etc/hosts + + echo "Starting sendmail for Mail-Support" + /etc/init.d/sendmail start +} + if [ $# -eq 0 ]; then friendica_help fi @@ -148,5 +165,6 @@ case "$1" in update) shift; update "$@" ;; console) shift; console "$@" ;; composer) shift; composer "$@" ;; + sendmail) shift; sendmail "$@" ;; *) friendica_help ;; esac diff --git a/stable/fpm/cron.sh b/stable/fpm/cron.sh index b368336..4dfa411 100644 --- a/stable/fpm/cron.sh +++ b/stable/fpm/cron.sh @@ -1,4 +1,4 @@ #!/bin/sh set -eu -exec busybox crond -f -l 0 -L /dev/stdout \ No newline at end of file +exec busybox crond -f -l 0 -L /dev/stdout diff --git a/stable/fpm/entrypoint.sh b/stable/fpm/entrypoint.sh index 90d6839..1f03315 100644 --- a/stable/fpm/entrypoint.sh +++ b/stable/fpm/entrypoint.sh @@ -3,5 +3,6 @@ set -eu # Check if Friendica needs to get installed friendica install +friendica sendmail -exec "$@" \ No newline at end of file +exec "$@"