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

Added docker-compose example for maraidb, cron and smtp with apache

This commit is contained in:
Philipp Holzer 2018-05-22 15:05:47 +02:00
parent 9c954f4d6b
commit 6f5687f53b
No known key found for this signature in database
GPG key ID: 58160D7D6AF942B6
6 changed files with 172 additions and 0 deletions

View file

@ -0,0 +1,11 @@
FROM friendica:apache
# simple = using an smtp without any credentials (mostly in local networks)
# custom = you need to set host, port, auth_options, authinfo (e.g. for GMX support)
ENV SMTP_TYPE simple
ENV SMTP_HOST smtp.example.org
COPY *.sh /
RUN chmod +x /*.sh
RUN /smtp-config.sh

View file

@ -0,0 +1,45 @@
#!/bin/sh
set -eu
IFS=\n
SMTP_TYPE=${SMTP_TYPE:-simple}
# config options
SMTP_HOST=${SMTP_HOST:-'localhost'}
SMTP_PORT=${SMTP_PORT:-'25'}
SMTP_AUTH=${SMTP_AUTH:-'A p'}
SMTP_TRUST_AUTH_MECH=${SMTP_TRUST_AUTH_MECH:-'EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN'}
SMTP_AUTH_MECH=${SMTP_AUTH_MECH:-'EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN'}
SMTP_USERNAME=${SMTP_USERNAME:-''}
SMTP_PASSWORD=${SMTP_PASSWORD:-''}
smtp_simple() {
sed -i '/MAILER_DEFINITIONS/i define(`SMART_HOST'\'',`'$SMTP_HOST''\'')dnl/' /etc/mail/sendmail.mc
}
smtp_custom() {
cd /etc/mail
mkdir -m 700 authinfo
cd authinfo/
echo 'Authinfo: "U:www-data" "I:'$SMTP_USERNAME'" "P:'$SMTP_PASSWORD'"' > auth_file
makemap hash auth < auth_file
sed -i '/MAILER_DEFINITIONS/i \
define(`SMART_HOST'\'',`'$SMTP_HOST''\'')dnl \
define(`RELAY_MAILER_ARGS'\'', `TCP '$SMTP_HOST' '$SMTP_PORT''\'')dnl \
define(`ESMTP_MAILER_ARGS'\'', `TCP '$SMTP_HOST' '$SMTP_PORT''\'')dnl \
define(`confAUTH_OPTIONS'\'', `'$SMTP_AUTH''\'')dnl \
TRUST_AUTH_MECH(`'$SMTP_TRUST_AUTH_MECH''\'')dnl \
define(`confAUTH_MECHANISMS'\'', `'$SMTP_AUTH_MECH''\'')dnl \
FEATURE(`authinfo'\'',`hash -o /etc/mail/authinfo/auth.db'\'')dnl' /etc/mail/sendmail.mc
}
case $SMTP_TYPE in
simple) smtp_simple ;;
custom) smtp_custom ;;
*)
echo "Unknown SMTP-Type '$SMTP_TYPE'"
exit 1
esac

View file

@ -0,0 +1,3 @@
MYSQL_PASSWORD=
MYSQL_DATABASE=friendica
MYSQL_USER=friendica

View file

@ -0,0 +1,81 @@
version: '2.1'
services:
db:
image: mariadb
restart: always
volumes:
- db:/var/lib/mysql/
environment:
- MYSQL_RANDOM_ROOT_PASSWORD=yes
env_file:
- db.env
app:
build: ./app
restart: always
volumes:
- friendica:/var/www/html
environment:
- MYSQL_HOST=db
- MYSQL_PORT=3306
- MAILNAME=
- TZ=
- LANGUAGE=
env_file:
- db.env
depends_on:
- db
hostname: friendica.local
labels:
- "traefik.backend=friendica"
- "traefik.frontend.entryPoints=https"
- "traefik.frontend.headers.SSLRedirect=true"
- "traefik.frontend.headers.STSSeconds=15768000"
- "traefik.frontend.headers.STSIncludeSubdomains=false"
- "traefik.frontend.headers.forceSTSHeader=true"
- "traefik.friendica.frontend.rule=Host:friendica.local"
- "traefik.friendica.frontend.port=80"
- "traefik.enable=true"
- "traefik.docker.network=proxy-tier"
networks:
- proxy-tier
- default
cron:
build: ./app
restart: always
volumes:
- friendica:/var/www/html
entrypoint: /cron.sh
environment:
- MYSQL_HOST=db
- MYSQL_PORT=3306
- MAILNAME=
- TZ=
- LANGUAGE=
env_file:
- db.env
depends_on:
- db
hostname: friendica.local
proxy:
build: ./proxy
restart: always
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
container_name: traefik
networks:
- default
- proxy-tier
volumes:
db:
friendica:
networks:
proxy-tier:

View file

@ -0,0 +1,3 @@
FROM traefik
COPY ./traefik.toml /traefik.toml

View file

@ -0,0 +1,29 @@
debug = false
logLevel = "ERROR"
defaultEntryPoints = ["https","http"]
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
entryPoint = "https"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[retry]
[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "example.org"
watch = true
exposedByDefault = false
[acme]
email = "root@example.org"
storage = "acme.json"
entryPoint = "https"
onHostRule = true
[acme.httpChallenge]
entryPoint = "http"