1

Topic: Upgrade with remote MySQL?

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version: 0.9.9
- Deployed with downloadable installer
- FreeBSD
- MySQL backend
- Nginx
- iRedAdmin-Pro? No
====

Hi. I have a working 0.9.9 server. All is well. I am going to move it to a new server. I use a separate MySQL server. I don't run MySQL server on the mail server. So when the new mail server is running, it will use the same database server.

I want to run the iRedMail.sh script on my new mail server, because it installs, compiles, and configures all the daemons. If I run the iRedMail.sh script, it will connect to the database server. Will it update/rewrite/change the MySQL tables there? I have a lot of users, domains, aliases, etc. I want to keep the MySQL tables the way they are.

I read the migration instructions and I don't see how to migrate to a new server without building the MySQL server from scratch. The instructions talk about how to export and reload the SQL tables, but I don't need to do that. I don't really want to do that unless I must.

What's the right way to do it?

Thanks,
Paco

----

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

2

Re: Upgrade with remote MySQL?

You need this tutorial:
https://docs.iredmail.org/install.iredm … erver.html

Pay attention to argument "INITIALIZE_SQL_DATA".

I suppose no need to remind you to backup sql databases before you perform the installation. smile

3

Re: Upgrade with remote MySQL?

ZhangHuangbin wrote:

You need this tutorial. Pay attention to argument "INITIALIZE_SQL_DATA".

Thank you very much. That was the option I was missing.

My last challenge is iredadmin. I have the open source version and when I go to the web page at https://server/iredadmin/ I just see "internal server error". I suspect it might be a python dependency (I didn't just run your script, I installed a lot of things like Python and PHP using FreeBSD packages instead of compiling).

Question: What's the easiest way to debug iredadmin with nginx?. If I run iredadmin.py I just see

http://0.0.0.0:8080/

I need to get iredadmin.py to try to do something so that I can get an error from it and debug further. If I run curl http://localhost:7791/, for example, I just see

curl: (52) Empty reply from server

How can I get some more diagnostic messages for iredadmin?

Thanks.
Paco

4

Re: Upgrade with remote MySQL?

pacohope wrote:

If I run curl http://localhost:7791/, for example, I just see

curl: (52) Empty reply from server

Port 7791 is uwsgi protocol, not http, you can access it with curl directly.

pacohope wrote:

when I go to the web page at https://server/iredadmin/ I just see "internal server error".

Check Nginx log file, also default syslog file (/var/log/messages, or /var/log/syslog).

5

Re: Upgrade with remote MySQL?

So the error was (as usual) my own mistake. The iredadmin user could not authenticate to the MySQL server. The mistake was a problem with the password for the iredadmin user on my MySQL server and once I discovered that, I knew what to fix.

In case anyone finds this post and has a similar problem, here's what I did to get more diagnostic messages from iredadmin.

I ran sudo bash -x /usr/local/etc/rc.d/iredadmin start so that I could see what the correct uwsgi invocation command line was.

Then I invoked uwsgi by hand, changing the command line slightly, so that the logs would go to a file I could see:

sudo uwsgi --ini /usr/local/www/iredadmin/rc_scripts/uwsgi/freebsd.ini --pidfile /var/run/iredadmin/iredadmin.pid --daemonize /tmp/logfile

Then I requested the file using curl -k https://localhost/iredadmin/ to invoke a failure. Then I looked at the /tmp/logfile.

I could see:

File "/usr/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 193, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (1045, "Access denied for user 'iredadmin'@'database-server' (using password: YES)")

Then I used the mysql client to verify that the password for iredadmin wasn't working. (Long story, some passwords got corrupted during a MySQL migration a few months ago). So when I went to the MySQL server and fixed the password for the iredadmin account, iredadmin started working on my new mail server.

6

Re: Upgrade with remote MySQL?

Thanks for sharing.