Skip to content

Updating wildduck via git

bunyevacz edited this page Jun 23, 2018 · 15 revisions

Prerequisite

This page assumes you have installed the complete wildduck setup:

  • wildduck IMAP/POP3 server
  • zone-mta smtp server (outgoing emails)
  • haraka and haraka-wildduck plugin (incoming emails)
  • wildduck webmail interface (direct access to wildduck via REST api)
  • mongodb for emails and attachment
  • redis for communication between components (wildduck <-> haraka-wildduck <-> zone-mta) and also for multi-server setup

Via our /setup/get_install.sh script either on VPS or physical server (tested on ubuntu 16.04.4).

Filesystem

After installation .git directory is separated from the programs' folder:

  • /opt/haraka/plugins/wildduck <-> /var/opt/haraka-plugin-wildduck.git
  • /opt/wildduck <-> /var/opt/wildduck.git/
  • /opt/wildduck-webmail <-> /var/opt/wildduck-webmail.git/
  • /opt/zone-mta <-> /var/opt/zone-mta.git/
  • /opt/zone-mta/plugins/wildduck <-> /var/opt/zonemta-wildduck.git/

Precaution must be taken when updating git (git pull), as we need both specify the working director and also the git directory too.

Updating zone-mta

(root) $ sudo su deploy
(deploy) $ cd /var/opt/zone-mta.git
(deploy) $ git fetch origin f5f6a80ef6571c24afbb013eb18d74ec6e81ea1e
(deploy) $ git --git-dir=/var/opt/zone-mta.git --work-tree="/opt/zone-mta" checkout -- package.json
(deploy) $ git --git-dir=/var/opt/zone-mta.git --work-tree="/opt/zone-mta" checkout f5f6a80ef6571c24afbb013eb18d74ec6e81ea1e
(deploy) $ cd /opt/zone-mta/
(deploy) $ npm install --production 
(deploy) $ exit
(root) $ systemctl restart zone-mta

Check the status of zone-mta-wildduck

git --git-dir=/var/opt/zonemta-wildduck.git --work-tree="/opt/zone-mta/plugins/wildduck/" status

Update wildduck:

(deploy) $ git --git-dir=/var/opt/wildduck.git --work-tree=/opt/wildduck diff -- emails/00*json
diff --git a/emails/00-example.json b/emails/00-example.json
index 2e2f326..b056776 100644
--- a/emails/00-example.json
+++ b/emails/00-example.json
@@ -1,5 +1,5 @@
 {
-    "disabled": true,
+    "disabled": false,
 
     "flag": true,
 
(deploy) $ git fetch origin 538da537ca3cef0bbd714da70085cfd4cc734b49
(deploy) $ git --git-dir=/var/opt/wildduck.git --work-tree=/opt/wildduck checkout 538da537ca3cef0bbd714da70085cfd4cc734b49
fatal: reference is not a tree: 538da537ca3cef0bbd714da70085cfd4cc734b49
(deploy) $ git --git-dir=/var/opt/wildduck.git --work-tree=/opt/wildduck pull
(deploy) $ git --git-dir=/var/opt/wildduck.git --work-tree=/opt/wildduck checkout 538da537ca3cef0bbd714da70085cfd4cc734b49
(deploy) $ cd /opt/wildduck
(deploy) $ npm install --production 
(deploy) $ exit 
(userr)  $ systemctl restart wildduck

Update haraka-plugin-wildduck:

(deploy) $ cd haraka-plugin-wildduck.git/
(deploy) $ git --git-dir=/var/opt/haraka-plugin-wildduck.git --work-tree=/opt/haraka/plugins/wildduck checkout 174b29552188295c7eebb422af7837b20a6e61e6
(deploy) $ git --git-dir=/var/opt/haraka-plugin-wildduck.git --work-tree=/opt/haraka/plugins/wildduck checkout package.json
(deploy) $ git --git-dir=/var/opt/haraka-plugin-wildduck.git --work-tree=/opt/haraka/plugins/wildduck checkout 174b29552188295c7eebb422af7837b20a6e61e6
(deploy) $ cd /opt/haraka/plugins/wildduck/
(deploy) $ npm install --unsafe-perm --production --progress=false
(deploy) $ exit
(userr) $ systemctl restart haraka

Check Redis, and flushes all the keys in all databases:

$ redis-cli
127.0.0.1:6379> info keyspace
# Keyspace
db3:keys=341,expires=322,avg_ttl=159758700
db5:keys=14,expires=14,avg_ttl=16665217
127.0.0.1:6379> select 3
127.0.0.1:6379> keys "*"
...
168) "unseen:5b1efd14c2253c04a787ab8b"
169) "unseen:5b18469dc4acb0049beafddf"
170) "unseen:5b184638c4acb0049beafdbd"
171) "unseen:5b1efd15c2253c04a787abcd"
172) "total:5b1f8ac986d833049cb8feab"
...
127.0.0.1:6379> flushall
127.0.0.1:6379> exit
Clone this wiki locally