Skip to content

Commit

Permalink
Replace HOSTNAME environment variable with SMTP_DOMAIN (fixes friendi…
Browse files Browse the repository at this point in the history
  • Loading branch information
nupplaphil committed Feb 25, 2020
1 parent 33c5e36 commit fbfa30b
Show file tree
Hide file tree
Showing 16 changed files with 36 additions and 55 deletions.
4 changes: 0 additions & 4 deletions .config/zz-docker.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,4 @@
}
}

if (!empty(getenv('HOSTNAME'))) {
$config['config']['hostname'] = getenv('HOSTNAME');
}

return $config;
1 change: 0 additions & 1 deletion .examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ Therefore you have to use adjust the `labels:` inside the `docker-compose.yml` t
To use this example complete the following steps:

1. open `docker-compose.yml`
1. insert your friendica domain behind `hostname:`
2. insert your friendica domain at `traefik.friendica.rule=Host:friendica.local`
2. choose a password for the database user in `db.env` behind `MYSQL_PASSWORD=`
3. open `proxy/traefik.toml`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ services:
- db.env
depends_on:
- db
hostname: friendica.local
ports:
- "80:80"

Expand All @@ -45,7 +44,6 @@ services:
- db
env_file:
- db.env
hostname: friendica.local

volumes:
db:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ services:
- db.env
depends_on:
- db
hostname: friendica.local

cron:
build: ./app
Expand All @@ -42,7 +41,6 @@ services:
depends_on:
- db
- app
hostname: friendica.local

web:
image: nginx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ services:
- db.env
depends_on:
- db
hostname: friendica.local

cron:
build: ./app
Expand All @@ -42,7 +41,6 @@ services:
depends_on:
- db
- app
hostname: friendica.local

web:
image: nginx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ services:
- db.env
depends_on:
- db
hostname: friendica.local
labels:
- "traefik.backend=friendica"
- "traefik.frontend.entryPoints=https"
Expand All @@ -53,7 +52,6 @@ services:
- db.env
depends_on:
- db
hostname: friendica.local

proxy:
build: ./proxy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ services:
- db.env
depends_on:
- db
hostname: friendica.local

cron:
build: ./app
Expand All @@ -40,7 +39,6 @@ services:
depends_on:
- db
- app
hostname: friendica.local

web:
image: nginx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ services:
- db.env
depends_on:
- db
hostname: friendica.local

cron:
build: ./app
Expand All @@ -40,7 +39,6 @@ services:
depends_on:
- db
- app
hostname: friendica.local

web:
image: nginx
Expand Down
10 changes: 5 additions & 5 deletions 2019.12/apache/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ version_greater() {
}

setup_ssmtp() {
if [ -n "${HOSTNAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."

Expand All @@ -29,14 +29,14 @@ setup_ssmtp() {

# add possible mail-senders
{
echo "www-data:$smtp_from@$HOSTNAME:$SMTP"
echo "root::$smtp_from@$HOSTNAME:$SMTP"
echo "www-data:$smtp_from@$SMTP_DOMAIN:$SMTP"
echo "root::$smtp_from@$SMTP_DOMAIN:$SMTP"
} > /etc/ssmtp/revaliases

# replace ssmtp.conf settings
{
echo "root=:$smtp_from@$HOSTNAME"
echo "hostname=$HOSTNAME"
echo "root=:$smtp_from@$SMTP_DOMAIN"
echo "hostname=$SMTP_DOMAIN"
echo "mailhub=$SMTP"
echo "FromLineOverride=YES"
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi
Expand Down
10 changes: 5 additions & 5 deletions 2019.12/fpm-alpine/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ version_greater() {
}

setup_ssmtp() {
if [ -n "${HOSTNAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."

Expand All @@ -29,14 +29,14 @@ setup_ssmtp() {

# add possible mail-senders
{
echo "www-data:$smtp_from@$HOSTNAME:$SMTP"
echo "root::$smtp_from@$HOSTNAME:$SMTP"
echo "www-data:$smtp_from@$SMTP_DOMAIN:$SMTP"
echo "root::$smtp_from@$SMTP_DOMAIN:$SMTP"
} > /etc/ssmtp/revaliases

# replace ssmtp.conf settings
{
echo "root=:$smtp_from@$HOSTNAME"
echo "hostname=$HOSTNAME"
echo "root=:$smtp_from@$SMTP_DOMAIN"
echo "hostname=$SMTP_DOMAIN"
echo "mailhub=$SMTP"
echo "FromLineOverride=YES"
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi
Expand Down
10 changes: 5 additions & 5 deletions 2019.12/fpm/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ version_greater() {
}

setup_ssmtp() {
if [ -n "${HOSTNAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."

Expand All @@ -29,14 +29,14 @@ setup_ssmtp() {

# add possible mail-senders
{
echo "www-data:$smtp_from@$HOSTNAME:$SMTP"
echo "root::$smtp_from@$HOSTNAME:$SMTP"
echo "www-data:$smtp_from@$SMTP_DOMAIN:$SMTP"
echo "root::$smtp_from@$SMTP_DOMAIN:$SMTP"
} > /etc/ssmtp/revaliases

# replace ssmtp.conf settings
{
echo "root=:$smtp_from@$HOSTNAME"
echo "hostname=$HOSTNAME"
echo "root=:$smtp_from@$SMTP_DOMAIN"
echo "hostname=$SMTP_DOMAIN"
echo "mailhub=$SMTP"
echo "FromLineOverride=YES"
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi
Expand Down
10 changes: 5 additions & 5 deletions 2020.03-dev/apache/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ version_greater() {
}

setup_ssmtp() {
if [ -n "${HOSTNAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."

Expand All @@ -29,14 +29,14 @@ setup_ssmtp() {

# add possible mail-senders
{
echo "www-data:$smtp_from@$HOSTNAME:$SMTP"
echo "root::$smtp_from@$HOSTNAME:$SMTP"
echo "www-data:$smtp_from@$SMTP_DOMAIN:$SMTP"
echo "root::$smtp_from@$SMTP_DOMAIN:$SMTP"
} > /etc/ssmtp/revaliases

# replace ssmtp.conf settings
{
echo "root=:$smtp_from@$HOSTNAME"
echo "hostname=$HOSTNAME"
echo "root=:$smtp_from@$SMTP_DOMAIN"
echo "hostname=$SMTP_DOMAIN"
echo "mailhub=$SMTP"
echo "FromLineOverride=YES"
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi
Expand Down
10 changes: 5 additions & 5 deletions 2020.03-dev/fpm-alpine/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ version_greater() {
}

setup_ssmtp() {
if [ -n "${HOSTNAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."

Expand All @@ -29,14 +29,14 @@ setup_ssmtp() {

# add possible mail-senders
{
echo "www-data:$smtp_from@$HOSTNAME:$SMTP"
echo "root::$smtp_from@$HOSTNAME:$SMTP"
echo "www-data:$smtp_from@$SMTP_DOMAIN:$SMTP"
echo "root::$smtp_from@$SMTP_DOMAIN:$SMTP"
} > /etc/ssmtp/revaliases

# replace ssmtp.conf settings
{
echo "root=:$smtp_from@$HOSTNAME"
echo "hostname=$HOSTNAME"
echo "root=:$smtp_from@$SMTP_DOMAIN"
echo "hostname=$SMTP_DOMAIN"
echo "mailhub=$SMTP"
echo "FromLineOverride=YES"
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi
Expand Down
10 changes: 5 additions & 5 deletions 2020.03-dev/fpm/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ version_greater() {
}

setup_ssmtp() {
if [ -n "${HOSTNAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."

Expand All @@ -29,14 +29,14 @@ setup_ssmtp() {

# add possible mail-senders
{
echo "www-data:$smtp_from@$HOSTNAME:$SMTP"
echo "root::$smtp_from@$HOSTNAME:$SMTP"
echo "www-data:$smtp_from@$SMTP_DOMAIN:$SMTP"
echo "root::$smtp_from@$SMTP_DOMAIN:$SMTP"
} > /etc/ssmtp/revaliases

# replace ssmtp.conf settings
{
echo "root=:$smtp_from@$HOSTNAME"
echo "hostname=$HOSTNAME"
echo "root=:$smtp_from@$SMTP_DOMAIN"
echo "hostname=$SMTP_DOMAIN"
echo "mailhub=$SMTP"
echo "FromLineOverride=YES"
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ 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_DOMAIN` The sender domain. (**required** - e.g. `friendica.local`)
- `SMTP_FROM` Sender user-part of the address. (Default: `no-reply` - e.g. [email protected])
- `SMTP_TLS` Use TLS for connecting the SMTP Mail-Gateway. (Default: empty)
- `SMTP_STARTTLS` Use STARTTLS for connecting the SMTP Mail-Gateway. (Default: empty)
Expand Down Expand Up @@ -214,7 +214,6 @@ services:
- MYSQL_PASSWORD=
- MYSQL_DATABASE=friendica
- [email protected]
hostname: friendica.local
depends_on:
- db

Expand Down Expand Up @@ -269,7 +268,6 @@ services:
- MYSQL_PASSWORD=
- MYSQL_DATABASE=friendica
- [email protected]
hostname: friendica.local
networks:
- proxy-tier
- default
Expand Down
10 changes: 5 additions & 5 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ version_greater() {
}

setup_ssmtp() {
if [ -n "${HOSTNAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."

Expand All @@ -29,14 +29,14 @@ setup_ssmtp() {

# add possible mail-senders
{
echo "www-data:$smtp_from@$HOSTNAME:$SMTP"
echo "root::$smtp_from@$HOSTNAME:$SMTP"
echo "www-data:$smtp_from@$SMTP_DOMAIN:$SMTP"
echo "root::$smtp_from@$SMTP_DOMAIN:$SMTP"
} > /etc/ssmtp/revaliases

# replace ssmtp.conf settings
{
echo "root=:$smtp_from@$HOSTNAME"
echo "hostname=$HOSTNAME"
echo "root=:$smtp_from@$SMTP_DOMAIN"
echo "hostname=$SMTP_DOMAIN"
echo "mailhub=$SMTP"
echo "FromLineOverride=YES"
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi
Expand Down

0 comments on commit fbfa30b

Please sign in to comment.