1 (edited by ph7 2019-01-06 09:07:45)

Topic: Manual Upgrade iRedAdmin-PRO 2.9.0 -> 3.1

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.9
- Deployed with iRedMail Easy or the downloadable installer? No, manual
- Linux/BSD distribution name and version: FreeBSD 11.2
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx 1.14
- Manage mail accounts with iRedAdmin-Pro? Yes
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

For those - like me - who are for one reason or another not able to use the upgrade script I have this recipe, that may be of use to others:

1) I was unable to implement the new iredadmin service script so I fell back to the uwsgi service I had been using before.
2) My mailhost setup is behind a nginx proxy/firewall. I didn't want to open up a new port (7791) unnecessarily so sticked to the uwsgi socket I had been using before.
3) this recipe is mainly focused on UWSGI with some additional Nginx config

Prerequisites:
update devel/py-simplejson
update dns/py-dnspython
update ftp/py-pycurl
update www/py-requests
update lang/python27 with LIBFFI, PYMALLOC, THREADS and UCS4 enabled. IPV6, NLS and DEBUG are optional.
update www/uwsgi with JSON, PCRE and SSL enabled. DEBUG is optional

Preparations:
download, fetch, wget the latest iRedAdmin-Pro-SQL.tar.bz2 release to your web directory.
Mine is /var/www - yes, a debian legacy thingie on a FreeBSD install, but never mind.
tar -xjf the iRedAdmin-Pro-SQL.tar.bz2 file
chown -R iredadmin:iredadmin the iRedAdmin-Pro-SQL folder
cp -a your old settings.py to the new folder
rm the symlink to the old installation directory
ln -s iRedAdmin-Pro-SQL iredadmin
your web path should now read: [web root]/iredadmin
source iredadmin.mysql from iredadmin/SQL to get the latest updates

Configurations:
I did not need to modify the settings.py
here are the most relevant settings:
backend = 'mysql'
storage_base_directory =
default_mta_transport = 'dovecot'
iredadmin_db_host =
vmail_db_host =
amavisd_db_host =
iredapd_enabled = True
iredapd_db_host =
mlmmjadmin_api_auth_token = (I really dislike the mlmmj ->requirement<- since 0.9.8 but that's for another topic)

rc.conf rules for UWSGI:
uwsgi_enable="YES"
uwsgi_profiles="iredadmin"
uwsgi_iredadmin_flags="--ini /usr/local/etc/uwsgi/iredadmin.ini"

iredadmin.ini settings:
[uwsgi]

master = true
vhost = true

processes = 5
enable-threads = true

module=iredadmin
mountpoint=[web root]/iredadmin

#pidfile = /var/run/uwsgi_iredadmin.pid
#uwsgi-socket = 127.0.0.1:7791

uwsgi-socket = /var/tmp/uwsgi_iredadmin.socket
# my socket folder is /var/tmp yours may differ
chown-socket = [nginx user]:www
chmod-socket = 660
uid = [nginx user]
gid = iredadmin

debug=false
daemonize= /var/log/uwsgi-iredadmin.log

python-path=/usr/local/lib/python2.7/
python-path=/usr/local/bin/python2.7
python-path=[web root]/iredadmin
python-path=[web root]/iredadmin/libs/

settings of uwsgi-params file:
uwsgi_param  QUERY_STRING       $query_string;
uwsgi_param  REQUEST_METHOD     $request_method;
uwsgi_param  CONTENT_TYPE       $content_type;
uwsgi_param  CONTENT_LENGTH     $content_length;

uwsgi_param  REQUEST_URI        $request_uri;
uwsgi_param  PATH_INFO          $document_uri;
uwsgi_param  DOCUMENT_ROOT      $document_root;
uwsgi_param  SERVER_PROTOCOL    $server_protocol;
uwsgi_param  HTTPS              $https if_not_empty;

uwsgi_param  REMOTE_ADDR        $remote_addr;
uwsgi_param  REMOTE_PORT        $remote_port;
uwsgi_param  SERVER_PORT        $server_port;
uwsgi_param  SERVER_NAME        $server_name;

main nginx.conf settings:
# Upstream to backend connection(s) for Py.
    upstream uwsgi {
                server unix:/var/tmp/uwsgi_iredadmin.socket;
    }

    include /usr/local/etc/nginx/vhosts/*;

Nginx vhost settings for iredadmin using SSL:
server {
        listen [your malhost]:443 ssl http2;

        server_name [your mailadmin.example.com (sub)domain];

        root   [web root]/iredadmin;

        ssl_certificate   /etc/ssl/certs/[your SSL cert]
        ssl_certificate_key /etc/ssl/private/ [your SSL key]

        location / {
                error_page 404 403 =200 @backend;
                try_files $uri $uri/ @backend;
              }

        location /libs {
                error_page 404 403 =200 @backend;
                try_files $uri $uri/ @backend;
              }

        location /static/ {
                if (-f $request_filename) {
                   rewrite ^/static/(.*)$  /static/$1 break;
                  }
               }

        location @backend {                         

             include uwsgi_params;

             uwsgi_pass uwsgi;
             uwsgi_param UWSGI_CHDIR [web root]/iredadmin;
             uwsgi_param UWSGI_PYHOME [web root]/iredadmin;
             uwsgi_param UWSGI_SCRIPT iredadmin;
        }

}

(re-)start Nginx

/usr/local/etc/rc.d/nginx configtest
/usr/local/etc/rc.d/nginx start

(re-)start UWSGI
/usr/local/etc/rc.d/uwsgi start

check the logs!!
enjoy your new iRedAdmin-PRO!

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Manual Upgrade iRedAdmin-PRO 2.9.0 -> 3.1

Thanks for sharing.

ph7 wrote:

1) I was unable to implement the new iredadmin service script so I fell back to the uwsgi service I had been using before.
2) My mailhost setup is behind a nginx proxy/firewall. I didn't want to open up a new port (7791) unnecessarily so sticked to the uwsgi socket I had been using before.

If you don't mind me asking: why not open a new port (7791) which is listening on 127.0.0.1 by default?