Mention how to migrate/restore sogo.

This commit is contained in:
Zhang Huangbin 2019-07-26 12:01:20 +08:00
parent df2c2e6f18
commit 18d300e5cf
2 changed files with 143 additions and 0 deletions

View File

@ -128,6 +128,79 @@ the data must be owned by user/group `mlmmj:mlmmj` with permission `0700`.
Reference: <https://github.com/roundcube/roundcubemail/wiki/Upgrade> Reference: <https://github.com/roundcube/roundcubemail/wiki/Upgrade>
## Migrate SOGo Groupware data
### Solution 1: Export and import SQL database
If you run same version of SOGo on old and new server, it's ok to migrate
data by simply exporting the `sogo` SQL database and import to new server.
For SQL backends, you need to re-create SQL table `sogo.users` after restored
database:
* For MySQL, MariaDB backends:
```
USE sogo;
DROP VIEW users;
CREATE VIEW users (c_uid, c_name, c_password, c_cn, mail, domain)
AS SELECT username, username, password, name, username, domain
FROM vmail.mailbox WHERE enablesogo=1 AND active=1;
```
* For PostgreSQL backend. Please switch to PostgreSQL daemon user `_postgres`
first, then run `psql -d sogo` to connect to `sogo` database:
!!! warning
Please replace `<vmail_user_password>` by the real password for SQL user `vmail`.
```
\c sogo;
CREATE EXTENSION IF NOT EXISTS dblink;
DROP VIEW users;
CREATE VIEW users AS
SELECT * FROM dblink('host=127.0.0.1
port=5432
dbname=vmail
user=vmail
password=<vmail_user_password>',
'SELECT username AS c_uid,
username AS c_name,
password AS c_password,
name AS c_cn,
username AS mail,
domain AS domain
FROM mailbox
WHERE enablesogo=1 AND active=1')
AS users (c_uid VARCHAR(255),
c_name VARCHAR(255),
c_password VARCHAR(255),
c_cn VARCHAR(255),
mail VARCHAR(255),
domain VARCHAR(255));
ALTER TABLE users OWNER TO sogo;
```
### Solution 2: Backup and restore data
!!! attention
It's strongly recommended to practice with a testing machine and verify
the calendars, events and contacts after migrated.
iRedMail has daily cron job to backup SOGo data with script
`/var/vmail/backup/backup_sogo.sh`, you should run it manually
right before migration so that all recent data are exported.
Backup copies are stored under `/var/vmail/backup/sogo/<year>/<month>/` by
default.
Copy the latest backup file to new server, then follow this tutorial to
restore it: [How can I backup/restore my user data?](https://sogo.nu/support/faq/how-can-i-backuprestore-my-user-data.html)
## Migrate Amavisd, iRedAPD, iRedAdmin databases ## Migrate Amavisd, iRedAPD, iRedAdmin databases
Export those database on old server, then import them on new server. Export those database on old server, then import them on new server.

View File

@ -25,6 +25,11 @@
<li><a href="#migrate-mailboxes-maildir-format">Migrate mailboxes (Maildir format)</a></li> <li><a href="#migrate-mailboxes-maildir-format">Migrate mailboxes (Maildir format)</a></li>
<li><a href="#migrate-mlmmj-mailing-lists">Migrate (mlmmj) mailing lists</a></li> <li><a href="#migrate-mlmmj-mailing-lists">Migrate (mlmmj) mailing lists</a></li>
<li><a href="#migrate-roundcube-webmail-data">Migrate Roundcube webmail data</a></li> <li><a href="#migrate-roundcube-webmail-data">Migrate Roundcube webmail data</a></li>
<li><a href="#migrate-sogo-groupware-data">Migrate SOGo Groupware data</a><ul>
<li><a href="#solution-1-export-and-import-sql-database">Solution 1: Export and import SQL database</a></li>
<li><a href="#solution-2-backup-and-restore-data">Solution 2: Backup and restore data</a></li>
</ul>
</li>
<li><a href="#migrate-amavisd-iredapd-iredadmin-databases">Migrate Amavisd, iRedAPD, iRedAdmin databases</a></li> <li><a href="#migrate-amavisd-iredapd-iredadmin-databases">Migrate Amavisd, iRedAPD, iRedAdmin databases</a></li>
<li><a href="#migrate-dkim-keys">Migrate DKIM keys</a></li> <li><a href="#migrate-dkim-keys">Migrate DKIM keys</a></li>
<li><a href="#post-migration">Post-migration</a></li> <li><a href="#post-migration">Post-migration</a></li>
@ -166,6 +171,71 @@ the data must be owned by user/group <code>mlmmj:mlmmj</code> with permission <c
new version of Roundcube.</li> new version of Roundcube.</li>
</ul> </ul>
<p>Reference: <a href="https://github.com/roundcube/roundcubemail/wiki/Upgrade">https://github.com/roundcube/roundcubemail/wiki/Upgrade</a></p> <p>Reference: <a href="https://github.com/roundcube/roundcubemail/wiki/Upgrade">https://github.com/roundcube/roundcubemail/wiki/Upgrade</a></p>
<h2 id="migrate-sogo-groupware-data">Migrate SOGo Groupware data</h2>
<h3 id="solution-1-export-and-import-sql-database">Solution 1: Export and import SQL database</h3>
<p>If you run same version of SOGo on old and new server, it's ok to migrate
data by simply exporting the <code>sogo</code> SQL database and import to new server.</p>
<p>For SQL backends, you need to re-create SQL table <code>sogo.users</code> after restored
database:</p>
<ul>
<li>For MySQL, MariaDB backends:</li>
</ul>
<pre><code>USE sogo;
DROP VIEW users;
CREATE VIEW users (c_uid, c_name, c_password, c_cn, mail, domain)
AS SELECT username, username, password, name, username, domain
FROM vmail.mailbox WHERE enablesogo=1 AND active=1;
</code></pre>
<ul>
<li>For PostgreSQL backend. Please switch to PostgreSQL daemon user <code>_postgres</code>
first, then run <code>psql -d sogo</code> to connect to <code>sogo</code> database:</li>
</ul>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>Please replace <code>&lt;vmail_user_password&gt;</code> by the real password for SQL user <code>vmail</code>.</p>
</div>
<pre><code>\c sogo;
CREATE EXTENSION IF NOT EXISTS dblink;
DROP VIEW users;
CREATE VIEW users AS
SELECT * FROM dblink('host=127.0.0.1
port=5432
dbname=vmail
user=vmail
password=&lt;vmail_user_password&gt;',
'SELECT username AS c_uid,
username AS c_name,
password AS c_password,
name AS c_cn,
username AS mail,
domain AS domain
FROM mailbox
WHERE enablesogo=1 AND active=1')
AS users (c_uid VARCHAR(255),
c_name VARCHAR(255),
c_password VARCHAR(255),
c_cn VARCHAR(255),
mail VARCHAR(255),
domain VARCHAR(255));
ALTER TABLE users OWNER TO sogo;
</code></pre>
<h3 id="solution-2-backup-and-restore-data">Solution 2: Backup and restore data</h3>
<div class="admonition attention">
<p class="admonition-title">Attention</p>
<p>It's strongly recommended to practice with a testing machine and verify
the calendars, events and contacts after migrated.</p>
</div>
<p>iRedMail has daily cron job to backup SOGo data with script
<code>/var/vmail/backup/backup_sogo.sh</code>, you should run it manually
right before migration so that all recent data are exported.</p>
<p>Backup copies are stored under <code>/var/vmail/backup/sogo/&lt;year&gt;/&lt;month&gt;/</code> by
default.</p>
<p>Copy the latest backup file to new server, then follow this tutorial to
restore it: <a href="https://sogo.nu/support/faq/how-can-i-backuprestore-my-user-data.html">How can I backup/restore my user data?</a></p>
<h2 id="migrate-amavisd-iredapd-iredadmin-databases">Migrate Amavisd, iRedAPD, iRedAdmin databases</h2> <h2 id="migrate-amavisd-iredapd-iredadmin-databases">Migrate Amavisd, iRedAPD, iRedAdmin databases</h2>
<p>Export those database on old server, then import them on new server.</p> <p>Export those database on old server, then import them on new server.</p>
<h2 id="migrate-dkim-keys">Migrate DKIM keys</h2> <h2 id="migrate-dkim-keys">Migrate DKIM keys</h2>