1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mailman3_ynh.git synced 2024-09-03 19:36:17 +02:00

Apply example_ynh

This commit is contained in:
yalh76 2021-08-25 03:39:10 +02:00
parent f771ecbdd0
commit 03b0707a2f
11 changed files with 90 additions and 29 deletions

View file

@ -1,7 +1,7 @@
;; Test complet
; Manifest
domain="domain.tld" (DOMAIN)
is_public=1 (PUBLIC|public=1|private=0)
domain="domain.tld"
is_public=1
; Checks
pkg_linter=1
setup_sub_dir=0
@ -13,7 +13,7 @@
backup_restore=1
multi_instance=0
port_already_use=1
change_url=1
change_url=0
;;; Options
Email=
Notification=none

View file

@ -134,7 +134,7 @@ EMAILNAME = '__DOMAIN__'
# otherwise the emails may get rejected.
# https://docs.djangoproject.com/en/1.8/ref/settings/#default-from-email
# DEFAULT_FROM_EMAIL = "mailing-lists@you-domain.org"
DEFAULT_FROM_EMAIL = 'postorius@{}'.format(EMAILNAME)
DEFAULT_FROM_EMAIL = 'root@{}'.format(EMAILNAME)
# If you enable email reporting for error messages, this is where those emails
# will appear to be coming from. Make sure you set a valid domain name,

View file

@ -1,11 +1,11 @@
location / {
include /etc/nginx/uwsgi_params;
uwsgi_pass unix:/run/mailman3-web/uwsgi.sock;
include conf.d/yunohost_panel.conf.inc;
#include conf.d/yunohost_panel.conf.inc;
}
location /mailman3/static {
alias /var/lib/mailman3/web/static;
location /mailman3/static/ {
alias /var/lib/mailman3/web/static/;
}
location /mailman3/static/favicon.ico {

View file

@ -1,9 +1,5 @@
* Any known limitations, constrains or stuff not working, such as (but not limited to):
* requiring a full dedicated domain
* architectures not supported ?
* not-working single-sign on or LDAP integration ?
* the app requires an important amount of RAM / disk / .. to install or to work properly
* etc...
* Other infos that people should be aware of, such as:
* No LDAP support yet (apparently under development)

View file

@ -44,12 +44,15 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="/etc/$app"
ynh_backup --src_path="/etc/$app/mailman.cfg"
ynh_backup --src_path="/etc/$app/mailman-hyperkitty.cfg"
ynh_backup --src_path="/etc/$app/mailman-web.py"
ynh_backup --src_path="/usr/share/yunohost/hooks/conf_regen/98-postfix_mailman3"
#=================================================
# BACKUP THE POSTGRESQL DATABASE

View file

@ -1,3 +0,0 @@
#!/bin/bash
# TODO(decentral1se)

View file

@ -128,6 +128,9 @@ secret_key=$(head -n64 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c6
ynh_app_setting_set --app=$app --key=secret_key --value="$secret_key"
ynh_add_config --template="../conf/mailman-web.py" --destination="/etc/mailman3/mailman-web.py"
chmod 440 "/etc/mailman3/mailman-web.py"
chown list:www-data "/etc/mailman3/mailman-web.py"
#=================================================
# RUN DATABASE MIGRATIONS
#=================================================
@ -137,6 +140,25 @@ pushd /usr/share/mailman3-web
python3 manage.py migrate || ynh_die --message="Mailman3 migrations failed!"
popd
#=================================================
# POSTFIX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring postfix mail server..."
# Add postfix configuration hook and regen postfix conf
cp -R ../sources/hooks/conf_regen/98-postfix_mailman3 /usr/share/yunohost/hooks/conf_regen/
yunohost tools regen-conf postfix
ynh_systemd_action --service_name=postfix --action="restart"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..."
# Create a dedicated systemd config
systemctl enable $app.service --quiet
systemctl enable "$app-web".service --quiet
#=================================================
# GENERIC FINALIZATION
#=================================================
@ -144,8 +166,8 @@ popd
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description="Mailman3 daemon"
yunohost service add "$app-web" --description="Mailman3 web daemon"
yunohost service add $app --description="Mailman3 daemon" --log="/var/log/$app/mailman.log"
yunohost service add "$app-web" --description="Mailman3 web daemon" --log="/var/log/$app/web/mailman-web.log"
#=================================================
# START SYSTEMD SERVICE
@ -153,8 +175,8 @@ yunohost service add "$app-web" --description="Mailman3 web daemon"
ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start"
ynh_systemd_action --service_name="$app-web" --action="start"
ynh_systemd_action --service_name=$app --action="restart"
ynh_systemd_action --service_name="$app-web" --action="restart"
#=================================================
# SETUP SSOWAT

View file

@ -43,6 +43,17 @@ then
yunohost service remove "$app-web"
fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config
ynh_systemd_action --service_name=$app --action="stop"
systemctl disable $app.service --quiet
ynh_systemd_action --service_name="$app-web" --action="stop"
systemctl disable "$app-web".service --quiet
#=================================================
# REMOVE THE POSTGRESQL DATABASE
#=================================================
@ -80,6 +91,11 @@ ynh_secure_remove --file="/usr/share/mailman3-web"
# Remove a directory securely
ynh_secure_remove --file="/etc/$app"
# Remove hook for postfix conf
ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/98-postfix_mailman3"
yunohost tools regen-conf postfix
ynh_systemd_action --service_name=postfix --action="restart"
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -83,15 +83,34 @@ ynh_psql_execute_file_as_root --file="./db_web.sql" --database=$db_name_web
#=================================================
ynh_script_progression --message="Restoring various files..."
ynh_restore_file --origin_path="/etc/$app/"
ynh_restore_file --origin_path="/usr/share/yunohost/hooks/conf_regen/98-postfix_mailman3"
yunohost tools regen-conf postfix
ynh_systemd_action --service_name=postfix --action="restart"
ynh_secure_remove --file="/etc/$app/mailman.cfg"
ynh_restore_file --origin_path="/etc/$app/mailman.cfg"
ynh_secure_remove --file="/etc/$app/mailman-hyperkitty.cfg"
ynh_restore_file --origin_path="/etc/$app/mailman-hyperkitty.cfg"
ynh_secure_remove --file="/etc/$app/mailman-web.py"
ynh_restore_file --origin_path="/etc/$app/mailman-web.py"
#=================================================
# RESTORE SYSTEMD
#=================================================
ynh_script_progression --message="Restoring the systemd configuration..."
systemctl enable $app.service --quiet
systemctl enable "$app-web".service --quiet
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description="Mailman3 daemon"
yunohost service add "$app-web" --description="Mailman3 web daemon"
yunohost service add $app --description="Mailman3 daemon" --log="/var/log/$app/mailman.log"
yunohost service add "$app-web" --description="Mailman3 web daemon" --log="/var/log/$app/web/mailman-web.log"
#=================================================
# START SYSTEMD SERVICE
@ -99,16 +118,13 @@ yunohost service add "$app-web" --description="Mailman3 web daemon"
ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service
ynh_systemd_action --service_name=$app --action=enable
ynh_systemd_action --service_name="$app-web" --action=enable
ynh_systemd_action --service_name=$app --action=restart
ynh_systemd_action --service_name="$app-web" --action=restart
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."

View file

@ -36,6 +36,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_clean_check_starting
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
@ -79,6 +80,16 @@ ynh_script_progression --message="Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# POSTFIX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring postfix mail server..."
# Add postfix configuration hook and regen postfix conf
cp -R ../sources/hooks/conf_regen/98-postfix_mailman3 /usr/share/yunohost/hooks/conf_regen/
yunohost tools regen-conf postfix
ynh_systemd_action --service_name=postfix --action="reload"
#=================================================
# GENERIC FINALIZATION
#=================================================
@ -86,8 +97,8 @@ ynh_install_app_dependencies $pkg_dependencies
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description="Mailman3 daemon"
yunohost service add "$app-web" --description="Mailman3 web daemon"
yunohost service add $app --description="Mailman3 daemon" --log="/var/log/$app/mailman.log"
yunohost service add "$app-web" --description="Mailman3 web daemon" --log="/var/log/$app/web/mailman-web.log"
#=================================================
# START SYSTEMD SERVICE