mirror of
https://github.com/friendica/docker
synced 2025-02-08 00:41:44 +01:00
commit
6ba4108d3d
54 changed files with 445 additions and 487 deletions
|
@ -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
|
||||
|
|
|
@ -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'));
|
||||
}
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
# Based on .exmples/dockerfiles/smtp/apache
|
||||
FROM friendica/server: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
|
||||
|
||||
ENV SMTP_HOST smtp.example.org
|
||||
|
||||
COPY *.sh /
|
||||
RUN chmod +x /*.sh
|
||||
RUN /smtp-config.sh
|
|
@ -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
|
|
@ -1,18 +0,0 @@
|
|||
# Based on .exmples/dockerfiles/smtp/fpm-alpine
|
||||
FROM friendica/server:fpm-alpine
|
||||
|
||||
ENV SMTP_HOST smtp.example.org
|
||||
|
||||
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
|
|
@ -1,12 +0,0 @@
|
|||
# Based on .exmples/dockerfiles/smtp/fpm
|
||||
FROM friendica/server: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
|
||||
|
||||
ENV SMTP_HOST smtp.example.org
|
||||
|
||||
COPY *.sh /
|
||||
RUN chmod +x /*.sh
|
||||
RUN /smtp-config.sh
|
|
@ -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
|
|
@ -12,7 +12,7 @@ services:
|
|||
- db.env
|
||||
|
||||
app:
|
||||
build: ./app
|
||||
image: friendica/server:apache
|
||||
restart: always
|
||||
volumes:
|
||||
- friendica:/var/www/html
|
||||
|
@ -21,6 +21,7 @@ services:
|
|||
- MAILNAME=
|
||||
- TZ=
|
||||
- LANGUAGE=
|
||||
- SMTP=
|
||||
env_file:
|
||||
- db.env
|
||||
depends_on:
|
||||
|
@ -30,7 +31,7 @@ services:
|
|||
- "80:80"
|
||||
|
||||
cron:
|
||||
build: ./app
|
||||
image: friendica/server:apache
|
||||
restart: always
|
||||
volumes:
|
||||
- friendica:/var/www/html
|
||||
|
@ -39,6 +40,7 @@ services:
|
|||
- MAILNAME=
|
||||
- TZ=
|
||||
- LANGUAGE=
|
||||
- SMTP=
|
||||
env_file:
|
||||
- db.env
|
||||
depends_on:
|
|
@ -12,7 +12,7 @@ services:
|
|||
- db.env
|
||||
|
||||
app:
|
||||
build: ./app
|
||||
image: friendica/server:fpm-alpine
|
||||
restart: always
|
||||
volumes:
|
||||
- friendica:/var/www/html
|
||||
|
@ -21,6 +21,7 @@ services:
|
|||
- MAILNAME=
|
||||
- TZ=
|
||||
- LANGUAGE=
|
||||
- SMTP=
|
||||
env_file:
|
||||
- db.env
|
||||
depends_on:
|
||||
|
@ -28,7 +29,7 @@ services:
|
|||
hostname: friendica.local
|
||||
|
||||
cron:
|
||||
build: ./app
|
||||
image: friendica/server:fpm-alpine
|
||||
restart: always
|
||||
volumes:
|
||||
- friendica:/var/www/html
|
||||
|
@ -37,6 +38,7 @@ services:
|
|||
- MAILNAME=
|
||||
- TZ=
|
||||
- LANGUAGE=
|
||||
- SMTP=
|
||||
env_file:
|
||||
- db.env
|
||||
depends_on:
|
|
@ -12,7 +12,7 @@ services:
|
|||
- db.env
|
||||
|
||||
app:
|
||||
build: ./app
|
||||
image: friendica/server:fpm
|
||||
restart: always
|
||||
volumes:
|
||||
- friendica:/var/www/html
|
||||
|
@ -28,7 +28,7 @@ services:
|
|||
hostname: friendica.local
|
||||
|
||||
cron:
|
||||
build: ./app
|
||||
image: friendica/server:fpm
|
||||
restart: always
|
||||
volumes:
|
||||
- friendica:/var/www/html
|
|
@ -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"]
|
|
@ -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"]
|
|
@ -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`)
|
|
@ -1,9 +0,0 @@
|
|||
FROM friendica/server: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
|
|
@ -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
|
|
@ -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
|
|
@ -1,9 +0,0 @@
|
|||
FROM friendica/server: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
|
|
@ -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
|
|
@ -11,7 +11,7 @@ RUN set -ex; \
|
|||
bzip2 \
|
||||
git \
|
||||
# For mail() support
|
||||
sendmail \
|
||||
ssmtp \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*;
|
||||
|
||||
|
@ -93,10 +93,18 @@ 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 +116,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"]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'));
|
||||
}
|
|
@ -2,6 +2,6 @@
|
|||
set -eu
|
||||
|
||||
friendica install -q
|
||||
friendica sendmail -q
|
||||
friendica configmail -q
|
||||
|
||||
exec "$@"
|
|
@ -4,10 +4,11 @@ LABEL maintainer="Philipp Holzer <admin@philipp.info>"
|
|||
|
||||
# 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,18 @@ 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 +98,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"]
|
|
@ -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
|
||||
|
|
|
@ -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'));
|
||||
}
|
|
@ -2,6 +2,6 @@
|
|||
set -eu
|
||||
|
||||
friendica install -q
|
||||
friendica sendmail -q
|
||||
friendica configmail -q
|
||||
|
||||
exec "$@"
|
|
@ -11,7 +11,7 @@ RUN set -ex; \
|
|||
bzip2 \
|
||||
git \
|
||||
# For mail() support
|
||||
sendmail \
|
||||
ssmtp \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*;
|
||||
|
||||
|
@ -85,10 +85,18 @@ 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 +108,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"]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'));
|
||||
}
|
|
@ -2,6 +2,6 @@
|
|||
set -eu
|
||||
|
||||
friendica install -q
|
||||
friendica sendmail -q
|
||||
friendica configmail -q
|
||||
|
||||
exec "$@"
|
|
@ -11,7 +11,7 @@ RUN set -ex; \
|
|||
bzip2 \
|
||||
git \
|
||||
# For mail() support
|
||||
sendmail \
|
||||
ssmtp \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*;
|
||||
|
||||
|
@ -93,16 +93,18 @@ 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"]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'));
|
||||
}
|
|
@ -2,6 +2,6 @@
|
|||
set -eu
|
||||
|
||||
friendica install -q
|
||||
friendica sendmail -q
|
||||
friendica configmail -q
|
||||
|
||||
exec "$@"
|
|
@ -4,10 +4,11 @@ LABEL maintainer="Philipp Holzer <admin@philipp.info>"
|
|||
|
||||
# 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,18 @@ 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"]
|
|
@ -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
|
||||
|
|
|
@ -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'));
|
||||
}
|
|
@ -2,6 +2,6 @@
|
|||
set -eu
|
||||
|
||||
friendica install -q
|
||||
friendica sendmail -q
|
||||
friendica configmail -q
|
||||
|
||||
exec "$@"
|
|
@ -11,7 +11,7 @@ RUN set -ex; \
|
|||
bzip2 \
|
||||
git \
|
||||
# For mail() support
|
||||
sendmail \
|
||||
ssmtp \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*;
|
||||
|
||||
|
@ -85,16 +85,18 @@ 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"]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'));
|
||||
}
|
|
@ -2,6 +2,6 @@
|
|||
set -eu
|
||||
|
||||
friendica install -q
|
||||
friendica sendmail -q
|
||||
friendica configmail -q
|
||||
|
||||
exec "$@"
|
|
@ -3,10 +3,11 @@ LABEL maintainer="Philipp Holzer <admin@philipp.info>"
|
|||
|
||||
# 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,16 +74,18 @@ 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/
|
||||
COPY *.sh /
|
||||
RUN chmod +x /*.sh
|
||||
RUN chmod +x /usr/local/bin/*
|
||||
%%INSTALL_EXTRAS%%
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["%%CMD%%"]
|
|
@ -10,7 +10,7 @@ RUN set -ex; \
|
|||
bzip2 \
|
||||
git \
|
||||
# For mail() support
|
||||
sendmail \
|
||||
ssmtp \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*;
|
||||
|
||||
|
@ -84,16 +84,18 @@ 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/
|
||||
COPY *.sh /
|
||||
RUN chmod +x /*.sh
|
||||
RUN chmod +x /usr/local/bin/*
|
||||
%%INSTALL_EXTRAS%%
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["%%CMD%%"]
|
||||
|
|
17
README.md
17
README.md
|
@ -23,7 +23,7 @@ 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.
|
||||
|
||||
[![Try in PWD](https://github.com/play-with-docker/stacks/raw/cff22438cb4195ace27f9b15784bbb497047afa7/assets/images/button.png)](http://play-with-docker.com?stack=https://raw.githubusercontent.com/friendica/docker/b9ed3e8ce68eaf89b08269a15f6360abc2fce544/stack.yml)
|
||||
[![Try in PWD](https://github.com/play-with-docker/stacks/raw/cff22438cb4195ace27f9b15784bbb497047afa7/assets/images/button.png)](http://play-with-docker.com?stack=https://raw.githubusercontent.com/nupplaphil/friendica-docker/fec33c98be957436279b7074ca08068b18622627/stack.yml)
|
||||
|
||||
## Using the apache image
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
set -eu
|
||||
|
||||
friendica install -q
|
||||
friendica sendmail -q
|
||||
friendica configmail -q
|
||||
|
||||
exec "$@"
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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']=''
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue