2
0
Fork 0
mirror of https://github.com/friendica/docker synced 2024-05-12 04:09:38 +02:00

Move SSMTP to image again & just exclude local.ini.php from rsync

This commit is contained in:
Philipp Holzer 2018-10-05 20:05:27 +02:00
parent 836f275fee
commit 2e71bd0c90
No known key found for this signature in database
GPG key ID: 517BE60E2CE5C8A5
31 changed files with 304 additions and 269 deletions

View file

@ -16,25 +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 SMTP support to the Friendica container (necessary if you want to have mail support in Friendica).
### SMTP settings <a id="smtpsetting"></a>
The binary `ssmtp` is used for the `mail()` support of Friendica.
You have to set the `--hostname/-h` parameter correctly to use the right domainname for the `mail()` command.
You have to set a valid SMTP-MTA for the `SMTP` environment variable to enable mail support in Friendica.
A valid SMTP-MTA would be, for example, `mx.example.org`.
The following environment variables are possible for the SMTP examples.
- `SITENAME` The name of the Friendica node. (**required** - Default: `Testsite`)
- `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)
## docker-compose

View file

@ -1,41 +1,4 @@
FROM friendica/server:apache
# entrypoint.sh and cron.sh dependencies
RUN set -ex; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
# For mail() support
ssmtp \
; \
rm -rf /var/lib/apt/lists/*;
ENV SMTP localhost
ENV SMTP_FROM no-reply
ENV SITENAME "Testsite"
# Setup SSMTP
RUN set -ex; \
sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd ;\
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd ;\
# add possible mail-senders
{\
echo "www-data:$SMTP_FROM@$HOSTNAME:$SMTP" ;\
echo "root:$SMTP_FROM@$HOSTNAME:$SMTP" ;\
} > /etc/ssmtp/revaliases;\
# replace ssmtp.conf settings
{\
echo "root=$SMTP_FROM@$HOSTNAME" ;\
echo "hostname=$HOSTNAME" ;\
echo "mailhub=$SMTP" ;\
echo "FromLineOverride=YES" ;\
[ -z "$SMTP_TLS" ] || echo "UseTLS=$SMTP_TLS" ;\
[ -z "$SMTP_STARTTLS" ] || echo "UseSTARTTLS=$SMTP_STARTTLS" ;\
[ -z "$SMTP_AUTH_USER" ] || echo "AuthUser=$SMTP_AUTH_USER" ;\
[ -z "$SMTP_AUTH_PASS" ] || echo "AuthPass=$SMTP_AUTH_PASS" ;\
[ -z "$SMTP_AUTH_METHOD" ] || echo "AuthMethod=$SMTP_AUTH_METHOD" ;\
} > /etc/ssmtp/ssmtp.conf;
RUN mkdir -p /usr/src/config
COPY addon.ini.php /usr/src/config/

View file

@ -1,4 +1,4 @@
MYSQL_PASSWORD=
MYSQL_PASSWORD=test
MYSQL_DATABASE=friendica
MYSQL_USER=friendica
MYSQL_HOST=db

View file

@ -22,10 +22,10 @@ services:
- friendica:/var/www/html
environment:
- FRIENDICA_ADMIN_MAIL=
- FRIENDICA_TZ=
- FRIENDICA_LANG=
- SITENAME=
- SMTP=
- FRIENDICA_TZ=Europe/Berlin
- FRIENDICA_LANG=de
- SITENAME=Testsite
- SMTP=smtp.philipp.info
env_file:
- db.env
depends_on:
@ -40,9 +40,6 @@ services:
volumes:
- friendica:/var/www/html
entrypoint: /cron.sh
environment:
- SITENAME=
- SMTP=
depends_on:
- db
hostname: friendica.local

View file

@ -1,37 +0,0 @@
FROM friendica/server:apache
# entrypoint.sh and cron.sh dependencies
RUN set -ex; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
# For mail() support
ssmtp \
; \
rm -rf /var/lib/apt/lists/*;
ENV SMTP localhost
ENV SMTP_FROM no-reply
ENV SITENAME "Testsite"
# Setup SSMTP
RUN sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd ;\
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd ;\
# add possible mail-senders
{\
echo "www-data:$SMTP_FROM@$HOSTNAME:$SMTP" ;\
echo "root:$SMTP_FROM@$HOSTNAME:$SMTP" ;\
} > /etc/ssmtp/revaliases;\
# replace ssmtp.conf settings
{\
echo "root=$SMTP_FROM@$HOSTNAME" ;\
echo "hostname=$HOSTNAME" ;\
echo "mailhub=$SMTP" ;\
echo "FromLineOverride=YES" ;\
[ -z "$SMTP_TLS" ] || echo "UseTLS=$SMTP_TLS" ;\
[ -z "$SMTP_STARTTLS" ] || echo "UseSTARTTLS=$SMTP_STARTTLS" ;\
[ -z "$SMTP_AUTH_USER" ] || echo "AuthUser=$SMTP_AUTH_USER" ;\
[ -z "$SMTP_AUTH_PASS" ] || echo "AuthPass=$SMTP_AUTH_PASS" ;\
[ -z "$SMTP_AUTH_METHOD" ] || echo "AuthMethod=$SMTP_AUTH_METHOD" ;\
} > /etc/ssmtp/ssmtp.conf;

View file

@ -1,32 +0,0 @@
FROM friendica/server:fpm-alpine
RUN set -ex; \
apk add --no-cache \
# For mail() support
ssmtp;
ENV SMTP localhost
ENV SMTP_FROM no-reply
ENV SITENAME "Testsite"
# Setup SSMTP
RUN sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd ;\
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd ;\
# add possible mail-senders
{\
echo "www-data:$SMTP_FROM@$HOSTNAME:$SMTP" ;\
echo "root:$SMTP_FROM@$HOSTNAME:$SMTP" ;\
} > /etc/ssmtp/revaliases;\
# replace ssmtp.conf settings
{\
echo "root=$SMTP_FROM@$HOSTNAME" ;\
echo "hostname=$HOSTNAME" ;\
echo "mailhub=$SMTP" ;\
echo "FromLineOverride=YES" ;\
[ -z "$SMTP_TLS" ] || echo "UseTLS=$SMTP_TLS" ;\
[ -z "$SMTP_STARTTLS" ] || echo "UseSTARTTLS=$SMTP_STARTTLS" ;\
[ -z "$SMTP_AUTH_USER" ] || echo "AuthUser=$SMTP_AUTH_USER" ;\
[ -z "$SMTP_AUTH_PASS" ] || echo "AuthPass=$SMTP_AUTH_PASS" ;\
[ -z "$SMTP_AUTH_METHOD" ] || echo "AuthMethod=$SMTP_AUTH_METHOD" ;\
} > /etc/ssmtp/ssmtp.conf;

View file

@ -1,37 +0,0 @@
FROM friendica/server:fpm
# entrypoint.sh and cron.sh dependencies
RUN set -ex; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
# For mail() support
ssmtp \
; \
rm -rf /var/lib/apt/lists/*;
ENV SMTP localhost
ENV SMTP_FROM no-reply
ENV SITENAME "Testsite"
# Setup SSMTP
RUN sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd ;\
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd ;\
# add possible mail-senders
{\
echo "www-data:$SMTP_FROM@$HOSTNAME:$SMTP" ;\
echo "root:$SMTP_FROM@$HOSTNAME:$SMTP" ;\
} > /etc/ssmtp/revaliases;\
# replace ssmtp.conf settings
{\
echo "root=$SMTP_FROM@$HOSTNAME" ;\
echo "hostname=$HOSTNAME" ;\
echo "mailhub=$SMTP" ;\
echo "FromLineOverride=YES" ;\
[ -z "$SMTP_TLS" ] || echo "UseTLS=$SMTP_TLS" ;\
[ -z "$SMTP_STARTTLS" ] || echo "UseSTARTTLS=$SMTP_STARTTLS" ;\
[ -z "$SMTP_AUTH_USER" ] || echo "AuthUser=$SMTP_AUTH_USER" ;\
[ -z "$SMTP_AUTH_PASS" ] || echo "AuthPass=$SMTP_AUTH_PASS" ;\
[ -z "$SMTP_AUTH_METHOD" ] || echo "AuthMethod=$SMTP_AUTH_METHOD" ;\
} > /etc/ssmtp/ssmtp.conf;

View file

@ -10,6 +10,8 @@ RUN set -ex; \
rsync \
bzip2 \
git \
# mail() support
ssmtp \
; \
rm -rf /var/lib/apt/lists/*;
@ -119,7 +121,7 @@ RUN set -ex; \
mkdir /usr/src/friendica/addon; \
tar -xzf friendica_addons.tar.gz -C /usr/src/friendica/addon --strip-components=1; \
rm friendica_addons.tar.gz; \
/usr/src/friendica/bin/composer.phar install --no-plugins --no-scripts --no-dev -d /usr/src/friendica;
/usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica;
ENTRYPOINT ["/entrypoint.sh"]
CMD ["apache2-foreground"]

View file

@ -15,10 +15,6 @@ version_greater() {
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
}
directory_empty() {
[ -z "$(ls -A "$1/")" ]
}
# clones the whole develop branch (Friendica and Addons)
clone_develop() {
friendica_git="${FRIENDICA_VERSION}"
@ -43,7 +39,40 @@ clone_develop() {
echo "Download finished"
/usr/src/friendica/bin/composer.phar install --no-dev --no-plugins --no-scripts -d /usr/src/friendica
/usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica
}
setup_ssmtp() {
if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."
smtp_from=${SMTP_FROM:-no-reply}
# Setup SSMTP
sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd
# add possible mail-senders
{
echo "www-data:$smtp_from@$HOSTNAME:$SMTP" ;
echo "root::$smtp_from@$HOSTNAME:$SMTP" ;
} > /etc/ssmtp/revaliases;
# replace ssmtp.conf settings
{
echo "root=:$smtp_from@$HOSTNAME" ;
echo "hostname=$HOSTNAME" ;
echo "mailhub=$SMTP" ;
echo "FromLineOverride=YES" ;
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "UseSTARTTLS=$SMTP_STARTTLS"; fi
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "AuthUser=$SMTP_AUTH_USER"; fi
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "AuthPass=$SMTP_AUTH_PASS";fi
if [ -n "${SMTP_AUTH_METHOD+x}" ]; then echo "AuthMethod=$SMTP_AUTH_METHOD"; fi
} > /etc/ssmtp/ssmtp.conf
echo "Setup finished"
fi
}
# just check if we execute apache or php-fpm
@ -77,6 +106,8 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
fi
fi
setup_ssmtp
if [ "$check" = true ]; then
echo "Initializing Friendica $image_version ..."
@ -92,13 +123,6 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/
# copy every *.ini.php from the config directory except they are already copied (in case of an upgrade)
for dir in config; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
rsync $rsync_options --include="/$dir/" --exclude="/*" /usr/src/friendica/ /var/www/html/
fi
done
# In case there is no .htaccess, copy it from the default dist file
if [ ! -f "/var/www/html/.htaccess" ]; then
cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess"

View file

@ -4,4 +4,4 @@
.htconfig.php
.htaccess
home.*
/config/
/config/local.ini.php

View file

@ -6,7 +6,9 @@ LABEL maintainer="Philipp Holzer <admin@philipp.info>"
RUN set -ex; \
apk add --no-cache \
rsync \
git;
git \
# mail() support
ssmtp;
# install the PHP extensions we need
# see https://friendi.ca/resources/requirements/
@ -102,7 +104,7 @@ RUN set -ex; \
mkdir /usr/src/friendica/addon; \
tar -xzf friendica_addons.tar.gz -C /usr/src/friendica/addon --strip-components=1; \
rm friendica_addons.tar.gz; \
/usr/src/friendica/bin/composer.phar install --no-plugins --no-scripts --no-dev -d /usr/src/friendica;
/usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica;
ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-fpm"]

View file

@ -15,10 +15,6 @@ version_greater() {
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
}
directory_empty() {
[ -z "$(ls -A "$1/")" ]
}
# clones the whole develop branch (Friendica and Addons)
clone_develop() {
friendica_git="${FRIENDICA_VERSION}"
@ -43,7 +39,40 @@ clone_develop() {
echo "Download finished"
/usr/src/friendica/bin/composer.phar install --no-dev --no-plugins --no-scripts -d /usr/src/friendica
/usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica
}
setup_ssmtp() {
if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."
smtp_from=${SMTP_FROM:-no-reply}
# Setup SSMTP
sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd
# add possible mail-senders
{
echo "www-data:$smtp_from@$HOSTNAME:$SMTP" ;
echo "root::$smtp_from@$HOSTNAME:$SMTP" ;
} > /etc/ssmtp/revaliases;
# replace ssmtp.conf settings
{
echo "root=:$smtp_from@$HOSTNAME" ;
echo "hostname=$HOSTNAME" ;
echo "mailhub=$SMTP" ;
echo "FromLineOverride=YES" ;
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "UseSTARTTLS=$SMTP_STARTTLS"; fi
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "AuthUser=$SMTP_AUTH_USER"; fi
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "AuthPass=$SMTP_AUTH_PASS";fi
if [ -n "${SMTP_AUTH_METHOD+x}" ]; then echo "AuthMethod=$SMTP_AUTH_METHOD"; fi
} > /etc/ssmtp/ssmtp.conf
echo "Setup finished"
fi
}
# just check if we execute apache or php-fpm
@ -77,6 +106,8 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
fi
fi
setup_ssmtp
if [ "$check" = true ]; then
echo "Initializing Friendica $image_version ..."
@ -92,13 +123,6 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/
# copy every *.ini.php from the config directory except they are already copied (in case of an upgrade)
for dir in config; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
rsync $rsync_options --include="/$dir/" --exclude="/*" /usr/src/friendica/ /var/www/html/
fi
done
# In case there is no .htaccess, copy it from the default dist file
if [ ! -f "/var/www/html/.htaccess" ]; then
cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess"

View file

@ -4,4 +4,4 @@
.htconfig.php
.htaccess
home.*
/config/
/config/local.ini.php

View file

@ -10,6 +10,8 @@ RUN set -ex; \
rsync \
bzip2 \
git \
# mail() support
ssmtp \
; \
rm -rf /var/lib/apt/lists/*;
@ -111,7 +113,7 @@ RUN set -ex; \
mkdir /usr/src/friendica/addon; \
tar -xzf friendica_addons.tar.gz -C /usr/src/friendica/addon --strip-components=1; \
rm friendica_addons.tar.gz; \
/usr/src/friendica/bin/composer.phar install --no-plugins --no-scripts --no-dev -d /usr/src/friendica;
/usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica;
ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-fpm"]

View file

@ -15,10 +15,6 @@ version_greater() {
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
}
directory_empty() {
[ -z "$(ls -A "$1/")" ]
}
# clones the whole develop branch (Friendica and Addons)
clone_develop() {
friendica_git="${FRIENDICA_VERSION}"
@ -43,7 +39,40 @@ clone_develop() {
echo "Download finished"
/usr/src/friendica/bin/composer.phar install --no-dev --no-plugins --no-scripts -d /usr/src/friendica
/usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica
}
setup_ssmtp() {
if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."
smtp_from=${SMTP_FROM:-no-reply}
# Setup SSMTP
sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd
# add possible mail-senders
{
echo "www-data:$smtp_from@$HOSTNAME:$SMTP" ;
echo "root::$smtp_from@$HOSTNAME:$SMTP" ;
} > /etc/ssmtp/revaliases;
# replace ssmtp.conf settings
{
echo "root=:$smtp_from@$HOSTNAME" ;
echo "hostname=$HOSTNAME" ;
echo "mailhub=$SMTP" ;
echo "FromLineOverride=YES" ;
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "UseSTARTTLS=$SMTP_STARTTLS"; fi
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "AuthUser=$SMTP_AUTH_USER"; fi
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "AuthPass=$SMTP_AUTH_PASS";fi
if [ -n "${SMTP_AUTH_METHOD+x}" ]; then echo "AuthMethod=$SMTP_AUTH_METHOD"; fi
} > /etc/ssmtp/ssmtp.conf
echo "Setup finished"
fi
}
# just check if we execute apache or php-fpm
@ -77,6 +106,8 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
fi
fi
setup_ssmtp
if [ "$check" = true ]; then
echo "Initializing Friendica $image_version ..."
@ -92,13 +123,6 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/
# copy every *.ini.php from the config directory except they are already copied (in case of an upgrade)
for dir in config; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
rsync $rsync_options --include="/$dir/" --exclude="/*" /usr/src/friendica/ /var/www/html/
fi
done
# In case there is no .htaccess, copy it from the default dist file
if [ ! -f "/var/www/html/.htaccess" ]; then
cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess"

View file

@ -4,4 +4,4 @@
.htconfig.php
.htaccess
home.*
/config/
/config/local.ini.php

View file

@ -10,6 +10,8 @@ RUN set -ex; \
rsync \
bzip2 \
git \
# mail() support
ssmtp \
; \
rm -rf /var/lib/apt/lists/*;

View file

@ -15,10 +15,6 @@ version_greater() {
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
}
directory_empty() {
[ -z "$(ls -A "$1/")" ]
}
# clones the whole develop branch (Friendica and Addons)
clone_develop() {
friendica_git="${FRIENDICA_VERSION}"
@ -43,7 +39,40 @@ clone_develop() {
echo "Download finished"
/usr/src/friendica/bin/composer.phar install --no-dev --no-plugins --no-scripts -d /usr/src/friendica
/usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica
}
setup_ssmtp() {
if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."
smtp_from=${SMTP_FROM:-no-reply}
# Setup SSMTP
sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd
# add possible mail-senders
{
echo "www-data:$smtp_from@$HOSTNAME:$SMTP" ;
echo "root::$smtp_from@$HOSTNAME:$SMTP" ;
} > /etc/ssmtp/revaliases;
# replace ssmtp.conf settings
{
echo "root=:$smtp_from@$HOSTNAME" ;
echo "hostname=$HOSTNAME" ;
echo "mailhub=$SMTP" ;
echo "FromLineOverride=YES" ;
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "UseSTARTTLS=$SMTP_STARTTLS"; fi
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "AuthUser=$SMTP_AUTH_USER"; fi
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "AuthPass=$SMTP_AUTH_PASS";fi
if [ -n "${SMTP_AUTH_METHOD+x}" ]; then echo "AuthMethod=$SMTP_AUTH_METHOD"; fi
} > /etc/ssmtp/ssmtp.conf
echo "Setup finished"
fi
}
# just check if we execute apache or php-fpm
@ -77,6 +106,8 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
fi
fi
setup_ssmtp
if [ "$check" = true ]; then
echo "Initializing Friendica $image_version ..."
@ -92,13 +123,6 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/
# copy every *.ini.php from the config directory except they are already copied (in case of an upgrade)
for dir in config; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
rsync $rsync_options --include="/$dir/" --exclude="/*" /usr/src/friendica/ /var/www/html/
fi
done
# In case there is no .htaccess, copy it from the default dist file
if [ ! -f "/var/www/html/.htaccess" ]; then
cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess"

View file

@ -4,4 +4,4 @@
.htconfig.php
.htaccess
home.*
/config/
/config/local.ini.php

View file

@ -6,7 +6,9 @@ LABEL maintainer="Philipp Holzer <admin@philipp.info>"
RUN set -ex; \
apk add --no-cache \
rsync \
git;
git \
# mail() support
ssmtp;
# install the PHP extensions we need
# see https://friendi.ca/resources/requirements/

View file

@ -15,10 +15,6 @@ version_greater() {
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
}
directory_empty() {
[ -z "$(ls -A "$1/")" ]
}
# clones the whole develop branch (Friendica and Addons)
clone_develop() {
friendica_git="${FRIENDICA_VERSION}"
@ -43,7 +39,40 @@ clone_develop() {
echo "Download finished"
/usr/src/friendica/bin/composer.phar install --no-dev --no-plugins --no-scripts -d /usr/src/friendica
/usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica
}
setup_ssmtp() {
if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."
smtp_from=${SMTP_FROM:-no-reply}
# Setup SSMTP
sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd
# add possible mail-senders
{
echo "www-data:$smtp_from@$HOSTNAME:$SMTP" ;
echo "root::$smtp_from@$HOSTNAME:$SMTP" ;
} > /etc/ssmtp/revaliases;
# replace ssmtp.conf settings
{
echo "root=:$smtp_from@$HOSTNAME" ;
echo "hostname=$HOSTNAME" ;
echo "mailhub=$SMTP" ;
echo "FromLineOverride=YES" ;
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "UseSTARTTLS=$SMTP_STARTTLS"; fi
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "AuthUser=$SMTP_AUTH_USER"; fi
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "AuthPass=$SMTP_AUTH_PASS";fi
if [ -n "${SMTP_AUTH_METHOD+x}" ]; then echo "AuthMethod=$SMTP_AUTH_METHOD"; fi
} > /etc/ssmtp/ssmtp.conf
echo "Setup finished"
fi
}
# just check if we execute apache or php-fpm
@ -77,6 +106,8 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
fi
fi
setup_ssmtp
if [ "$check" = true ]; then
echo "Initializing Friendica $image_version ..."
@ -92,13 +123,6 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/
# copy every *.ini.php from the config directory except they are already copied (in case of an upgrade)
for dir in config; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
rsync $rsync_options --include="/$dir/" --exclude="/*" /usr/src/friendica/ /var/www/html/
fi
done
# In case there is no .htaccess, copy it from the default dist file
if [ ! -f "/var/www/html/.htaccess" ]; then
cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess"

View file

@ -4,4 +4,4 @@
.htconfig.php
.htaccess
home.*
/config/
/config/local.ini.php

View file

@ -10,6 +10,8 @@ RUN set -ex; \
rsync \
bzip2 \
git \
# mail() support
ssmtp \
; \
rm -rf /var/lib/apt/lists/*;

View file

@ -15,10 +15,6 @@ version_greater() {
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
}
directory_empty() {
[ -z "$(ls -A "$1/")" ]
}
# clones the whole develop branch (Friendica and Addons)
clone_develop() {
friendica_git="${FRIENDICA_VERSION}"
@ -43,7 +39,40 @@ clone_develop() {
echo "Download finished"
/usr/src/friendica/bin/composer.phar install --no-dev --no-plugins --no-scripts -d /usr/src/friendica
/usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica
}
setup_ssmtp() {
if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."
smtp_from=${SMTP_FROM:-no-reply}
# Setup SSMTP
sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd
# add possible mail-senders
{
echo "www-data:$smtp_from@$HOSTNAME:$SMTP" ;
echo "root::$smtp_from@$HOSTNAME:$SMTP" ;
} > /etc/ssmtp/revaliases;
# replace ssmtp.conf settings
{
echo "root=:$smtp_from@$HOSTNAME" ;
echo "hostname=$HOSTNAME" ;
echo "mailhub=$SMTP" ;
echo "FromLineOverride=YES" ;
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "UseSTARTTLS=$SMTP_STARTTLS"; fi
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "AuthUser=$SMTP_AUTH_USER"; fi
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "AuthPass=$SMTP_AUTH_PASS";fi
if [ -n "${SMTP_AUTH_METHOD+x}" ]; then echo "AuthMethod=$SMTP_AUTH_METHOD"; fi
} > /etc/ssmtp/ssmtp.conf
echo "Setup finished"
fi
}
# just check if we execute apache or php-fpm
@ -77,6 +106,8 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
fi
fi
setup_ssmtp
if [ "$check" = true ]; then
echo "Initializing Friendica $image_version ..."
@ -92,13 +123,6 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/
# copy every *.ini.php from the config directory except they are already copied (in case of an upgrade)
for dir in config; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
rsync $rsync_options --include="/$dir/" --exclude="/*" /usr/src/friendica/ /var/www/html/
fi
done
# In case there is no .htaccess, copy it from the default dist file
if [ ! -f "/var/www/html/.htaccess" ]; then
cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess"

View file

@ -4,4 +4,4 @@
.htconfig.php
.htaccess
home.*
/config/
/config/local.ini.php

View file

@ -5,7 +5,9 @@ LABEL maintainer="Philipp Holzer <admin@philipp.info>"
RUN set -ex; \
apk add --no-cache \
rsync \
git;
git \
# mail() support
ssmtp;
# install the PHP extensions we need
# see https://friendi.ca/resources/requirements/

View file

@ -9,6 +9,8 @@ RUN set -ex; \
rsync \
bzip2 \
git \
# mail() support
ssmtp \
; \
rm -rf /var/lib/apt/lists/*;

View file

@ -89,7 +89,23 @@ Because Friendica links the administrator account to a specific mail address, yo
## Mail settings
see the [example](https://github.com/friendica/docker/tree/master/.examples/dockerfiles/README.md#smtpsetting)
The binary `ssmtp` is used for the `mail()` support of Friendica.
You have to set the `--hostname/-h` parameter correctly to use the right domainname for the `mail()` command.
You have to set a valid SMTP-MTA for the `SMTP` environment variable to enable mail support in Friendica.
A valid SMTP-MTA would be, for example, `mx.example.org`.
The following environment variables are possible for the SMTP examples.
- `SITENAME` The name of the Friendica node. (**required**)
- `SMTP` Address of the SMTP Mail-Gateway. (**required**)
- `SMTP_FROM` Sender user-part of the address. (Default: `no-reply` - e.g. no-reply@friendica.local)
- `SMTP_TLS` Use TLS for connecting the SMTP Mail-Gateway. (Default: empty)
- `SMTP_STARTTLS` Use STARTTLS for connecting the SMTP Mail-Gateway. (Default: empty)
- `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 settings

View file

@ -15,10 +15,6 @@ version_greater() {
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
}
directory_empty() {
[ -z "$(ls -A "$1/")" ]
}
# clones the whole develop branch (Friendica and Addons)
clone_develop() {
friendica_git="${FRIENDICA_VERSION}"
@ -43,7 +39,40 @@ clone_develop() {
echo "Download finished"
/usr/src/friendica/bin/composer.phar install --no-dev --no-plugins --no-scripts -d /usr/src/friendica
/usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica
}
setup_ssmtp() {
if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."
smtp_from=${SMTP_FROM:-no-reply}
# Setup SSMTP
sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd
# add possible mail-senders
{
echo "www-data:$smtp_from@$HOSTNAME:$SMTP" ;
echo "root::$smtp_from@$HOSTNAME:$SMTP" ;
} > /etc/ssmtp/revaliases;
# replace ssmtp.conf settings
{
echo "root=:$smtp_from@$HOSTNAME" ;
echo "hostname=$HOSTNAME" ;
echo "mailhub=$SMTP" ;
echo "FromLineOverride=YES" ;
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "UseSTARTTLS=$SMTP_STARTTLS"; fi
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "AuthUser=$SMTP_AUTH_USER"; fi
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "AuthPass=$SMTP_AUTH_PASS";fi
if [ -n "${SMTP_AUTH_METHOD+x}" ]; then echo "AuthMethod=$SMTP_AUTH_METHOD"; fi
} > /etc/ssmtp/ssmtp.conf
echo "Setup finished"
fi
}
# just check if we execute apache or php-fpm
@ -77,6 +106,8 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
fi
fi
setup_ssmtp
if [ "$check" = true ]; then
echo "Initializing Friendica $image_version ..."
@ -92,13 +123,6 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/
# copy every *.ini.php from the config directory except they are already copied (in case of an upgrade)
for dir in config; do
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
rsync $rsync_options --include="/$dir/" --exclude="/*" /usr/src/friendica/ /var/www/html/
fi
done
# In case there is no .htaccess, copy it from the default dist file
if [ ! -f "/var/www/html/.htaccess" ]; then
cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess"

View file

@ -30,7 +30,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; \\\n /usr/src/friendica/bin/composer.phar install --no-plugins --no-scripts --no-dev -d /usr/src/friendica;'
['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 /usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica;'
['develop']=''
)

View file

@ -4,4 +4,4 @@
.htconfig.php
.htaccess
home.*
/config/
/config/local.ini.php