Compare commits

...

7 Commits

15 changed files with 185 additions and 76 deletions

View File

@ -8,6 +8,20 @@ backups_folder_path: "/Backups/" # Path to the backups folder
administrator_username: "administrator" # Username of the administrator
administrator_email: "{{administrator_username}}@{{top_domain}}" # Email of the administrator
# Email Configuration
system_email_local: no-reply
system_email_domain: "{{top_domain}}"
system_email_username: "{{system_email_local}}@{{system_email_domain}}"
system_email_host: "mail.{{top_domain}}"
system_email_smtp_port: 465
system_email_tls: true
system_email_start_tls: false
system_email_from: "{{system_email_username}}"
system_email_smtp: true
# Test Email
test_email: "test@{{top_domain}}"
# Mode
# The following modes can be combined with each other
@ -134,7 +148,7 @@ domain_gitea: "git.{{top_domain}}"
domain_gitlab: "gitlab.{{top_domain}}"
domain_landingpage: "{{top_domain}}"
domain_listmonk: "newsletter.{{top_domain}}"
domain_mailu: "mail.{{top_domain}}"
domain_mailu: "{{system_email_host}}"
domain_mastodon: "microblog.{{top_domain}}"
domains_mastodon_alternates: ["mastodon.{{top_domain}}"]
domain_matomo: "matomo.{{top_domain}}"

View File

@ -187,7 +187,9 @@ LDAP_AUTH=
LDAP_PASSWORD=
LDAP_ROLE_FIELD=
LDAP_FILTER=
# ====================================
# GREENLIGHT CONFIGURATION
# ====================================
# Set this to true if you want GreenLight to support user signup and login without
# Omniauth. For more information, see:
#
@ -195,6 +197,10 @@ LDAP_FILTER=
#
ALLOW_GREENLIGHT_ACCOUNTS=true
### SMTP CONFIGURATION
# Emails are required for the basic features of Greenlight to function.
# Please refer to your SMTP provider to get the values for the variables below
SMTP_SERVER={{system_email_host}}
SMTP_DOMAIN={{domain}}
SMTP_PORT={{system_email_smtp_port}}
@ -202,9 +208,12 @@ SMTP_USERNAME={{system_email_username}}
SMTP_PASSWORD={{system_email_password}}
SMTP_AUTH=plain
SMTP_OPENSSL_VERIFY_MODE=none
SMTP_STARTTLS_AUTO={{system_email_start_tls}}
SMTP_SENDER={{system_email_username}}
SMTP_SENDER_EMAIL={{system_email_username}}
SMTP_STARTTLS_AUTO={{system_email_start_tls | lower}}
SMTP_STARTTLS={{system_email_start_tls | lower}}
SMTP_TLS={{system_email_tls | lower}}
SMTP_SSL_VERIFY=true
SMTP_SENDER={{system_email_from}}
SMTP_SENDER_EMAIL={{system_email_from}}
# Prefix for the applications root URL.
# Useful for deploying the application to a subdirectory, which is highly recommended

View File

@ -57,11 +57,11 @@ env:
# WARNING the char '#' in SMTP password can cause problems!
DISCOURSE_SMTP_ADDRESS: {{ system_email_host }}
DISCOURSE_SMTP_PORT: {{ system_email_smtp_port }}
DISCOURSE_SMTP_USER_NAME: {{ system_email }}
DISCOURSE_SMTP_USER_NAME: {{system_email_username}}
DISCOURSE_SMTP_PASSWORD: {{ system_email_password }}
DISCOURSE_SMTP_ENABLE_START_TLS: {{ system_email_start_tls | upper }}
DISCOURSE_SMTP_DOMAIN: {{ system_email_domain }}
DISCOURSE_NOTIFICATION_EMAIL: {{ system_email }}
DISCOURSE_NOTIFICATION_EMAIL: {{system_email_from}}
# Database Configuration
DISCOURSE_DB_USERNAME: {{ database_username }}

View File

@ -1,61 +1,118 @@
# role friendica
# Friendica Docker Role
## Delete all
docker exec -i central-mariadb mariadb -u root -p"${DB_ROOT_PASSWORD}" -e "DROP DATABASE IF EXISTS friendica; CREATE DATABASE friendica;"; docker compose down; rm -rv /mnt/hdd/data/docker/volumes/friendica_data; docker volume rm friendica_data
This role manages the setup, reset, and maintenance of a Friendica instance running with Docker.
## Reset Database
### Manual
## Overview 🚀
Friendica is a decentralized social networking platform. This role helps manage Friendica in a containerized environment with Docker and provides tools for debugging, resetting, and maintaining the installation.
## Prerequisites 🛠️
Ensure you have the following:
- Docker and Docker Compose installed
- A central MariaDB instance running
- Necessary permissions to manage Docker and database configurations
## Usage 📚
### Full Reset 🚫➡️✅
The following environment variables need to be defined for successful operation:
- `DB_ROOT_PASSWORD`: The root password for the MariaDB instance
To completely reset Friendica, including its database and volumes, run:
```bash
docker exec -i central-mariadb mariadb -u root -p"${DB_ROOT_PASSWORD}" -e "DROP DATABASE IF EXISTS friendica; CREATE DATABASE friendica;"
docker compose down
rm -rv /mnt/hdd/data/docker/volumes/friendica_data
docker volume rm friendica_data
```
### Reset Database 🗄️
#### Manual Method:
1. Connect to the MariaDB instance:
```bash
docker exec -it central-mariadb mariadb -u root -p
```
2. Run the following commands:
```sql
DROP DATABASE friendica;
CREATE DATABASE friendica;
exit;
```
### Automatic
#### Automatic Method:
```bash
DB_ROOT_PASSWORD="your_root_password"
docker exec -i central-mariadb mariadb -u root -p"${DB_ROOT_PASSWORD}" -e "DROP DATABASE IF EXISTS friendica; CREATE DATABASE friendica;"
```
## Enter application
### Enter the Application Container 🔍
docker compose exec -it application sh
## debugging
## Check environment variables
docker compose exec -it application printenv
ls -la /var/lib/docker/volumes/friendica_data/_data/
## autoinstall
docker compose exec --user www-data -it application bin/console autoinstall
## reinitialisation
### docker
### full
docker-compose up -d --force-recreate && sleep 2; docker compose exec --user www-data -it application bin/console autoinstall;
### info
To access the application container:
```bash
docker compose exec -it application sh
```
### Debugging Tools 🛠️
#### Check Environment Variables
```bash
cat /var/lib/docker/volumes/friendica_data/_data/config/local.config.php
## Check environment variables
docker compose exec -it application printenv
```
## create user
INSERT INTO user (guid, username, email, password, verified, register_date, account_expires_on, account_expired)
VALUES (
UUID(), -- Generiert eine eindeutige Benutzer-ID
'newusername', -- Benutzername
'newuser@example.com', -- E-Mail-Adresse
MD5('newpassword'), -- Passwort (kann durch Bcrypt ersetzt werden, siehe unten)
1, -- Verifizierungsstatus (1 = verifiziert)
NOW(), -- Registrierungsdatum
'0001-01-01 00:00:00', -- Kontodauer unbegrenzt
0 -- Konto ist nicht abgelaufen
);
#### Inspect Volume Data
```bash
ls -la /var/lib/docker/volumes/friendica_data/_data/
```
### Autoinstall 🌟
Run the following command to autoinstall Friendica:
```bash
docker compose exec --user www-data -it application bin/console autoinstall
```
### Reinitialization 🔄
#### Docker Only:
```bash
docker-compose up -d --force-recreate
```
#### Full Reinitialization:
```bash
docker-compose up -d --force-recreate && sleep 2; docker compose exec --user www-data -it application bin/console autoinstall;
```
### Configuration Information
#### General Configuration:
```bash
cat /var/lib/docker/volumes/friendica_data/_data/config/local.config.php
```
#### Email Configuration:
```bash
docker compose exec -it application cat /etc/msmtprc
```
### Email Debugging ✉️
To send a test email:
```bash
docker compose exec -it application msmtp --account=system_email -t test@test.de
```
## Additional Resources 📖
- [Friendica Docker Hub](https://hub.docker.com/_/friendica)
- [Friendica Installation Docs](https://wiki.friendi.ca/docs/install)
- [Friendica GitHub Repository](https://github.com/friendica/docker)
---
📜 Created by [Kevin Veen-Birkenbach](https://www.veen.world/)
## More information
- https://hub.docker.com/_/friendica
- https://wiki.friendi.ca/docs/install

View File

@ -3,14 +3,18 @@ services:
{% include 'templates/docker/services/' + database_type + '.yml.j2' %}
application:
image: friendica/server
image: friendica
restart: {{docker_restart_policy}}
volumes:
- data:/var/www/html
ports:
- "127.0.0.1:{{http_port}}:80"
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:80"]
test:
[
"CMD-SHELL",
"(echo 'Subject: testmessage from {{domain}}\n\nSUCCESSFULL' | msmtp -t {{test_email}} && curl -f http://127.0.0.1:80) || exit 1"
]
interval: 1m
timeout: 10s
retries: 3
@ -21,20 +25,25 @@ services:
# Debugging
FRIENDICA_DEBUGGING: false
FRIENDICA_LOGLEVEL: 5
FRIENDICA_LOGGER: stream
FRIENDICA_LOGFILE: php://stdout
# Database Configuration
MYSQL_HOST: {{database_host}}:3306
MYSQL_DATABASE: {{database_name}}
MYSQL_USER: {{database_username}}
MYSQL_PASSWORD: {{database_password}}
SMTP: {{system_email_host}}
# Email Configuration
SMTP_DOMAIN: {{ system_email_host }}
SMTP: {{system_email_host}}
SMTP_DOMAIN: {{system_email_domain}}
SMTP_PORT: {{system_email_smtp_port}}
SMTP_AUTH_USER: {{system_email_username}}
SMTP_AUTH_PASS: {{system_email_password}}
SMTP_STARTTLS: {{system_email_start_tls}}
SMTP_FROM: {{system_email_username}}
SMTP_TLS: {{ 'on' if system_email_tls else 'off' }}
SMTP_STARTTLS: {{ 'on' if system_email_start_tls else 'off' }}
SMTP_FROM: {{system_email_local}}
# Administrator Credentials
FRIENDICA_ADMIN_MAIL: {{administrator_email}}

View File

@ -23,7 +23,7 @@ SMTP_PASSWORD={{system_email_password}}
SMTP_AUTH_METHOD=plain
SMTP_OPENSSL_VERIFY_MODE=none
SMTP_ENABLE_STARTTLS=auto
SMTP_FROM_ADDRESS=Mastodon <{{system_email_username}}>
SMTP_FROM_ADDRESS=Mastodon <{{system_email_from}}>
ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY= {{mastodon_active_record_encryption_deterministic_key}}
ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT={{mastodon_active_record_encryption_key_derivation_salt}}

View File

@ -33,12 +33,12 @@ admin_contact: 'mailto:{{administrator_email}}'
email:
smtp_host: "{{system_email_host}}"
smtp_port: "{{system_email_smtp_port}}"
smtp_user: "{{system_email_username}}"
smtp_user: "{{system_email_from}}"
smtp_pass: "{{system_email_password}}"
#force_tls: true
#require_transport_security: true
enable_tls: "{{ system_email_tls | upper }}"
notif_from: "Your Friendly %(app)s homeserver <{{system_email}}>"
notif_from: "Your Friendly %(app)s homeserver <{{system_email_from}}>"
app_name: "Matrix on {{synapse_domain}}"
enable_notifs: true
notif_for_new_users: false

View File

@ -50,7 +50,7 @@ If nextcloud stays in the maintenance mode after the update try the following:
If the update process fails execute
```bash
docker-compose exec -it -u www-data application /var/www/html/occ maintenance:repair
docker-compose exec -it -u www-data application /var/www/html/occ maintenance:repair --include-expensive
```
and disable the not functioning apps.

View File

@ -13,11 +13,28 @@ services:
volumes:
- data:/var/www/html
environment:
# See https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html
# Database Configuration
MYSQL_DATABASE: "{{database_name}}"
MYSQL_USER: "{{database_username}}"
MYSQL_PASSWORD: "{{database_password}}"
MYSQL_HOST: {{database_host}}:3306
# Memory
PHP_MEMORY_LIMIT: 1G # Required for plugin duplicate finder
# Email Configuration
SMTP_HOST: {{system_email_host}}
SMTP_SECURE: {{ 'ssl' if system_email_tls else '' }}
SMTP_PORT: {{system_email_smtp_port}}
SMTP_NAME: {{system_email_username}}
SMTP_PASSWORD: {{system_email_password}}
# Email from configuration
MAIL_FROM_ADDRESS: no-reply
MAIL_DOMAIN: {{system_email_domain}}
{% include 'templates/docker/container/depends-on-database-redis.yml.j2' %}
{% include 'templates/docker/container/networks.yml.j2' %}

View File

@ -18,7 +18,7 @@ PEERTUBE_SMTP_USERNAME={{system_email_username}}
PEERTUBE_SMTP_PASSWORD={{system_email_password}}
PEERTUBE_SMTP_HOSTNAME={{system_email_host}}
PEERTUBE_SMTP_PORT={{system_email_smtp_port}}
PEERTUBE_SMTP_FROM={{system_email}}
PEERTUBE_SMTP_FROM={{system_email_from}}
PEERTUBE_SMTP_TLS={{ system_email_tls | lower }}
PEERTUBE_SMTP_DISABLE_STARTTLS={{ 'false' if system_email_start_tls else 'true' }}
PEERTUBE_ADMIN_EMAIL={{system_email}}
PEERTUBE_ADMIN_EMAIL={{system_email_from}}

View File

@ -48,11 +48,13 @@ RESTRICTED_INSTANCE=false
MAIL_DRIVER=log
MAIL_HOST={{system_email_host}}
MAIL_PORT={{system_email_smtp_port}}
MAIL_FROM_ADDRESS="{{system_email_username}}"
MAIL_FROM_ADDRESS="{{system_email_from}}"
MAIL_FROM_NAME="Pixelfed"
MAIL_USERNAME={{system_email_username}}
MAIL_PASSWORD={{system_email_password}}
MAIL_ENCRYPTION=tls
# Not sure if the following is correct
# Checkout: https://github.com/pixelfed/pixelfed/blob/dev/.env.docker
MAIL_ENCRYPTION={{ 'ssl' if system_email_start_tls else 'tls' }}
## Databases (MySQL)
DB_CONNECTION=mysql

View File

@ -17,7 +17,7 @@ EMAIL_HOST = {{system_email_host}} # SMTP server address
EMAIL_PORT = {{system_email_smtp_port}} # default SMTP port
EMAIL_HOST_USER = {{system_email_username}} # user to connect the SMTP server
EMAIL_HOST_PASSWORD = {{system_email_password}} # SMTP user's password
EMAIL_DEFAULT_FROM = {{system_email}} # default email address for the automated emails
EMAIL_DEFAULT_FROM = {{system_email_from}} # default email address for the automated emails
# EMAIL_USE_TLS/EMAIL_USE_SSL are mutually exclusive (only set one of those to True)
EMAIL_USE_TLS={{ system_email_tls | lower | capitalize }} # use TLS (secure) connection with the SMTP server
EMAIL_USE_SSL={{ 'False' if system_email_start_tls else 'True' }} # use implicit TLS (secure) connection with the SMTP server

View File

@ -2,6 +2,7 @@
defaults
auth on
logfile ~/.msmtp.log
tls_starttls {{ 'on' if system_email_start_tls else 'off' }}
{% if system_email_tls %}
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
@ -12,7 +13,7 @@ tls off
account system_email
host {{system_email_host}}
port {{system_email_smtp_port}}
from {{system_email}}
from {{system_email_from}}
user {{system_email_username}}
password {{system_email_password}}

View File

@ -2,7 +2,7 @@
/usr/bin/sendmail -t <<ERRMAIL
To: {{administrator_email}}
From: systemd <{{system_email}}>
From: systemd <{{system_email_from}}>
Subject: $1
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=UTF-8