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

Some steps was missing in install

This commit is contained in:
ljf 2022-07-15 22:51:40 +02:00
parent 7d23fd3ef1
commit 5d1eb88a2e
4 changed files with 33 additions and 53 deletions

View file

@ -6,58 +6,9 @@
* Users can also just sign up themselves to manage details * Users can also just sign up themselves to manage details
* Users can use mailing lists without signing up? * Users can use mailing lists without signing up?
## Post-installation steps Classical admin is available on the page: https://myyunohost.org/
### Setup Admin User Django admin on: https://myyunohost.org/admin/
You must [configure the admin user](http://docs.mailman3.org/en/latest/config-web.html#setting-up-admin-account):
```bash
$ cd /usr/share/mailman3-web
$ python3 manage.py createsuperuser
```
You should then attempt to log in with this user account in the web UI. Once you've logged in, a confirmation mail will be sent to your email address that you specified. Therefore, you should have something like [Rainloop](https://github.com/YunoHost-Apps/rainloop_ynh) installed to view mail on your YunoHost installation.
### Setup your main domain
You'll need to log in as administrator and visit the `/admin/site/site`.
If you're Mailman3 is setup on `https://myyunohost.org` then that would be the following:
> https://myyunohost.org/admin/site/site
### Configure incoming mail
Mailman3 implements an LMTP server for receiving mail from Postfix. This means that Mailman3 doesn't need anything from Dovecot. This is important to understand because Dovecot is the default YunoHost local delivery agent. Therefore, the default YunoHost Postfix configuration uses Dovecot. So, in order to deliver incoming mail, we need to override which delivery agent handles which mails based on the addresses. In other words, if you create a mailing list "mylist@myyunohost.org" you want Mailman3's LMTP server to receive this, *not* Dovecot, becaues Dovecot only delivers to LDAP created user accounts.
You'll need to add this to your Postfix configuration:
```bash
owner_request_special = no
transport_maps =
hash:/var/lib/mailman3/data/postfix_lmtp
local_recipient_maps =
hash:/var/lib/mailman3/data/postfix_lmtp
virtual_mailbox_maps = ldap:/etc/postfix/ldap-accounts.cf, hash:/var/lib/mailman3/data/postfix_lmtp
```
And then run:
```bash
$ sudo -su list mailman aliases
```
This is unfortunately a manual step at this point because the package remains experimental. Once it matures, this will be integrated into a hook or the default Postfix configuration. For now, remember that when you run `yunohost tools regen-conf postfix` or if any installation invokes `regen-conf`, your Postfix configuration will not be changed because it has diverged from the default configuration. This may cause you problems if YunoHost core expects that there is some new value in your Postfix configuration.
### Configure outgoing mail
Postfix relies on using SMTP which should be configured in your `/etc/postfix/main.cf`.
You should make sure that you have outgoing mail working before getting started with Mailman 3.
## General Configuration ## General Configuration

View file

@ -6,7 +6,7 @@
"en": "Electronic mailing lists manager", "en": "Electronic mailing lists manager",
"fr": "Un gestionnaire de liste de discussion par email" "fr": "Un gestionnaire de liste de discussion par email"
}, },
"version": "1.0~ynh1", "version": "1.0~ynh2",
"url": "http://www.list.org/", "url": "http://www.list.org/",
"upstream": { "upstream": {
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
@ -39,6 +39,14 @@
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",
"default": true "default": true
},
{
"name": "admin",
"type": "user"
},
{
"name": "password",
"type": "password"
} }
] ]
} }

View file

@ -26,6 +26,8 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url="/" path_url="/"
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
admin=$YNH_APP_ARG_ADMIN
password=$YNH_APP_ARG_PASSWORD
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -48,6 +50,8 @@ ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=admin
ynh_app_setting_set --app=$app --key=password --value=password
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
@ -140,6 +144,22 @@ pushd /usr/share/mailman3-web
python3 manage.py migrate || ynh_die --message="Mailman3 migrations failed!" python3 manage.py migrate || ynh_die --message="Mailman3 migrations failed!"
popd popd
#=================================================
# CREATE SUPERUSER
#=================================================
ynh_script_progression --message="Creating superuser..."
pushd /usr/share/mailman3-web
echo "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('$admin', '$email', '$password')" | python manage.py shell
popd
#=================================================
# CONFIGURE MAINDOMAIN
#=================================================
ynh_script_progression --message="Configuring maindomain..."
pushd /usr/share/mailman3-web
echo "UPDATE django_site SET domain='$domain',name='$domain' WHERE domain='example.com';" | python3 manage.py dbshell
popd
#================================================= #=================================================
# POSTFIX CONFIGURATION # POSTFIX CONFIGURATION
#================================================= #=================================================
@ -148,6 +168,7 @@ ynh_script_progression --message="Configuring postfix mail server..."
# Add postfix configuration hook and regen postfix conf # Add postfix configuration hook and regen postfix conf
cp -R ../sources/hooks/conf_regen/98-postfix_mailman3 /usr/share/yunohost/hooks/conf_regen/ cp -R ../sources/hooks/conf_regen/98-postfix_mailman3 /usr/share/yunohost/hooks/conf_regen/
yunohost tools regen-conf postfix yunohost tools regen-conf postfix
sudo -su list mailman aliases
ynh_systemd_action --service_name=postfix --action="restart" ynh_systemd_action --service_name=postfix --action="restart"
#================================================= #=================================================

View file

@ -10,7 +10,7 @@ do_pre_regen() {
# FIXME : check this file actually exists to not crash when only running this # FIXME : check this file actually exists to not crash when only running this
# hook alone # hook alone
sed -i 's@virtual_mailbox_maps = ldap:/etc/postfix/ldap-accounts.cf@virtual_mailbox_maps = ldap:/etc/postfix/ldap-accounts.cf, hash:/var/lib/mailman3/data/postfix_lmtp@' $postfix_main_cf
cat << EOT >> $postfix_main_cf cat << EOT >> $postfix_main_cf
unknown_local_recipient_reject_code = 550 unknown_local_recipient_reject_code = 550
owner_request_special = no owner_request_special = no