iRedMail icon indicating copy to clipboard operation
iRedMail copied to clipboard

Use packages instead of ports ?

Open bozhinov opened this issue 1 year ago • 80 comments

REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER:

  • iRedMail version (check /etc/iredmail-release): 1.7.1
  • Deployed with iRedMail Easy or the downloadable installer? No
  • Linux/BSD distribution name and version: Freebsd 14.2
  • Store mail accounts in which backend (LDAP/MySQL/PGSQL): LDAP
  • Web server (Apache or Nginx): Nginx
  • Manage mail accounts with iRedAdmin-Pro? No
  • [IMPORTANT] Related original log or error message is required if you're experiencing an issue.

Hello,

I have not used ports in ages. I did not used to mind it but

  • 3 Gb of ports take a while to compile
  • I chose LDAP for a backend and it ended up downloading MySQL & PGSQL any way along with all of their dependencies

If all is going to be installed anyway - wouldn't it be much better to use packages ?

bozhinov avatar Dec 20 '24 09:12 bozhinov

We tried years ago, but pre-built packages don't have required compile options. e.g. LDAP support, MySQL support, etc. Not sure how it works nowadays.

iredmail avatar Dec 21 '24 02:12 iredmail

the same say it should be possible to install cmake, mariadb and rust at least from pkg. that will save like couple of hours and my disks.

bozhinov avatar Dec 21 '24 05:12 bozhinov

Mixing ports and packages is not good idea. if you don't want to wait for compile, try Linux or OpenBSD instead. :(

iredmail avatar Dec 21 '24 06:12 iredmail

I have considered OpenBSD but there is a lot more running on that machine and who has the time to patch Linux boxes as often as needed.

I m sure most admins would deploy iRedMail in a jail that will be used for that purpose alone. Long term maintenance using ports is no picnic either

bozhinov avatar Dec 21 '24 08:12 bozhinov

Hi @bozhinov

Would you like to give it a try? Update functions/packages_freebsd.sh to install packages with pkg instead of ports tree.

iredmail avatar Dec 24 '24 00:12 iredmail

Hi,

I have it all setup for trying out the packages and the sequence is done and tested. Post new years I just ve got few things to take care of first.

bozhinov avatar Jan 06 '25 11:01 bozhinov

I have added you to my private repo. apart from that stupid SSL bug it is OK says fixed in FreeBSD 15-dev branch

bozhinov avatar Jan 10 '25 20:01 bozhinov

Hi @bozhinov

could you fork the iRedMail repo directly instead of copying repo and make it private? So that we can easily create pull request after finished.

iredmail avatar Jan 10 '25 23:01 iredmail

Hi, I m definitely doing that. Need few days. My schedule is hectic these days.

bozhinov avatar Jan 18 '25 04:01 bozhinov

Hello there, On ports there is now flavors. As a FreeBSD ports commiter I can adapt (if needed) the ports to have such flavors already done. Also I can help to have a mail/iredmail port as well. What do you think of that? Kind regards

xbeaudouin avatar Jan 21 '25 09:01 xbeaudouin

Hi @xbeaudouin

That's wonderful.

Flavors should be enough. We need few packages with MySQL, PostgreSQL, OpenLDAP support. For example, postfix, Dovecot, Amavisd. If you can help make it happen, we can work together. :)

iredmail avatar Jan 21 '25 11:01 iredmail

Well dovecot has already flavors. I am trying to understand functions/packages_freebsd.sh and have a check about current port tree. Really I would like this project works to replace my old mail server.

xbeaudouin avatar Jan 21 '25 15:01 xbeaudouin

By the way why should you need openssl from ports? Since on FreeBSD 14.2 we already have openssl v3.0.15:

$ openssl version
OpenSSL 3.0.15 3 Sep 2024 (Library: OpenSSL 3.0.15 3 Sep 2024)

xbeaudouin avatar Jan 21 '25 15:01 xbeaudouin

Hi @xbeaudouin,

Do you mean we should remove ssl=openssl from /etc/make.conf? https://github.com/iredmail/iRedMail/blob/master/functions/packages_freebsd.sh#L54

iredmail avatar Jan 22 '25 00:01 iredmail

Hi @xbeaudouin,

According to functions/packages_freebsd.sh, these ports requires flavors:

  • mail/spamassassin: need flavors for mysql and postgresql support.
  • mail/roundcube: need flavors for openldap, mysql, postgresql. Note: for iRedMail OpenLDAP backend, it requires both openldap and mysql support.
  • mail/postfix: need flavors for openldap, mysql, postgresql. Note: for iRedMail OpenLDAP backend, it requires both openldap and mysql support.
  • security/amavisd-new: need flavors for openldap, mysql, postgresql. Note: for iRedMail OpenLDAP backend, it requires both openldap and mysql support.
  • devel/apr1: need flavors for openldap, mysql, postgresql. Note: for iRedMail OpenLDAP backend, it requires both openldap and mysql support.
  • devel/sope: need flavors for openldap, mysql, postgresql. Note: for iRedMail OpenLDAP backend, it requires both openldap and mysql support.
  • databases/py-sqlalchemy14: need flavors for mysql, postgresql.

iredmail avatar Jan 22 '25 00:01 iredmail

Currently the installation involves compiling Perl / Python / PHP / Rust / Go / LLVM, you can imagine how much time we waste.

iredmail avatar Jan 22 '25 07:01 iredmail

Hi, Well excepted if you need some special cyphers on openssl, I don't see any good reason to add this dependency. Postfix, nginx, dovecot can be run on freebsd stock openssl AFAIK. So I think we can remove ssl=openssl in make.conf.

About ports with flavors, I will try to push some of them. Issue will be "dual" flavors which is not supported by the port infrastructure

xbeaudouin avatar Jan 22 '25 08:01 xbeaudouin

If dual flavors is impossible, then we still have to install all packages from ports tree, to avoid mixing binary packages and ports. Is such mixing recommended or not?

I see Dovecot has LDAP flavor on by default, and you can choose additional MySQL or PGSQL flavor. Is it possible that we have LDAP flavor on by default too for other ports? For example, MySQL flavor of mail/postfix supports both LDAP and MySQL, PGSQL flavor of mail/postfix supports both LDAP and PGSQL.

iredmail avatar Jan 22 '25 08:01 iredmail

Or, besides standard ldap, mysql, pgsql flavers, can we create ldap-mysql, ldap-pgsql flavor? I mean, ldap-mysql is just one flavor name, except it enables two compile options instead of one.

  • in FLAVORS=, append ldap-mysql as a flavor name: https://cgit.freebsd.org/ports/tree/mail/postfix/Makefile?id=d4e949bafdb4e842868267d26a357c9921d3efeb#n25
  • Add ldap_mysql_PKGNAMESUFFIX= -ldap-mysql
  • and so on ...

iredmail avatar Jan 22 '25 08:01 iredmail

the '-' is used to sperate the flavors... I will discuss with other maintainer for that...

xbeaudouin avatar Jan 22 '25 11:01 xbeaudouin

I think we can mix both packages and compiled with port ones. There is no problems about that. Also the LDAP can be the exception. Maybe we should do a iredmail ports, that will handle that too.

xbeaudouin avatar Jan 22 '25 11:01 xbeaudouin

I think "dual" (or even more) favors is the key. I prefer waiting for you discussion with other maintainers. :)

OpenBSD has multi flavors support and it works well, no need to use ports tree at all for normal users.

iredmail avatar Jan 22 '25 13:01 iredmail

I think we can make some "special flavors" eg -mysqlldap -pgsqlldap for such ports.

xbeaudouin avatar Jan 22 '25 13:01 xbeaudouin

I will wait for your update. Thank you very much.

Special flavor might be a trick or temporary solution, for example, What if someone needs ldap + mysql + pgsql? I wish FreeBSD ports tree supports multi flavors like OpenBSD in the future. :)

iredmail avatar Jan 23 '25 00:01 iredmail

Not sure what happened here but I m not compiling this from ports ever again.

https://github.com/bozhinov/iRedMail-pub/commit/66bb775fc3861396a3d24d78dc65912e80aff102

Turned out MariaDb is not possible as a backend on FreeBSD There is no postfix-mariadb package

P.S. Tested using the latest packages and not the quarterly ones

bozhinov avatar Jan 25 '25 19:01 bozhinov

Got it working 100% with PGSQL via packages https://github.com/bozhinov/iRedMail-pub/commits/master/

bozhinov avatar Jan 27 '25 11:01 bozhinov

Got it working 100% with PGSQL via packages https://github.com/bozhinov/iRedMail-pub/commits/master/

Great news. 👍 Could you please use only one pkg install command to install all packages?

iredmail avatar Jan 27 '25 16:01 iredmail

Done! @iredmail I initially cloned the masted branch. at some point \n became \r\n could have been me though. I run on Windows.

@xbeaudouin adding support back for MariaDb does not seem like a lot of work these 3 packages could easily 3 turn into new ones for MariaDb: dovecot-MySQL dovecot-pigeonhole-MySQL postfix-mysql

bozhinov avatar Jan 28 '25 14:01 bozhinov

@bozhinov Nice :) Well did you made a PR ?

@iredmail if @bozhinov made a PR, can you merge it ? Then I will update for mysql/mariadb pkg ?

xbeaudouin avatar Jan 31 '25 09:01 xbeaudouin

How about I merge it in a new git branch then we continue in that branch instead of master?

iredmail avatar Feb 01 '25 02:02 iredmail