§2024-09-25

installation

試作機器: hc4Noble.yushei.net, Ubuntu 24.04.1 LTS

alexlai@hc4Noble:~$ which node npm
/run/user/1026/fnm_multishells/40540_1727241687778/bin/node
/run/user/1026/fnm_multishells/40540_1727241687778/bin/npm
alexlai@hc4Noble:~$ npm --version
6.14.18
alexlai@hc4Noble:~$ node --version
v14.21.3
  1. git clone
alexlai@hc4Noble:~/build$ git clone https://github.com/nodemailer/wildduck.git

$ cd wildduck
$ git checkout v1.45.0 -b v1.45.0 
Switched to a new branch 'v1.45.0'
alexlai@hc4Noble:~/build/wildduck$ git branch
  master
* v1.45.0
$ npm install --production
npm WARN config production Use `--omit=dev` instead.
npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated npmlog@7.0.1: This package is no longer supported.
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated are-we-there-yet@4.0.2: This package is no longer supported.
npm WARN deprecated glob@8.0.3: Glob versions prior to v9 are no longer supported
npm WARN deprecated formidable@1.2.6: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
npm WARN deprecated mongodb-extended-json@1.11.1: Use EJSON from the `bson` package instead
npm WARN deprecated gauge@5.0.2: This package is no longer supported.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

added 518 packages, and audited 519 packages in 52s

47 packages are looking for funding
  run `npm fund` for details

13 vulnerabilities (3 moderate, 6 high, 4 critical)

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.
  1. configure wildduck not to use default mongodb server running on Localhost
$ pwd 
/home/build/wildduck/config
$ grep mongo *.toml
dbs.toml:# mongodb connection string for the main database
dbs.toml:mongo="mongodb://127.0.0.1:27017/wildduck"
test.toml:# mongodb connection string for the main database
test.toml:mongo = "mongodb://127.0.0.1:27017/wildduck-test"

2.1. check the replicationSet we are going to use

alexlai@mail:~/build/WildDuck$ mongosh mongodb://siteRootAdmin:b23258585@redisMongo03.yushei.com.tw:27017,redisMongo04.yushei.com.tw:27017,redisMongo05.yushei.com.tw:27017
Current Mongosh Log ID:	6721753b2677404c6e59139d
Connecting to:		mongodb://<credentials>@redisMongo03.yushei.com.tw:27017,redisMongo04.yushei.com.tw:27017,redisMongo05.yushei.com.tw:27017/?appName=mongosh+2.3.2
Using MongoDB:		5.0.8
Using Mongosh:		2.3.2

For mongosh info see: https://www.mongodb.com/docs/mongodb-shell/

------
   The server generated these startup warnings when booting
   2024-05-09T17:37:42.790+08:00: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem   <--!! should be fixed !!!
------

ys20220318 [primary] test> show dbs
Dragonfly28        2.51 GiB
LaiKos           129.70 MiB
YuSheiDB           3.20 GiB
YuSheiFAB        752.00 KiB
YuSheiReactTest    4.34 MiB
admin              2.67 MiB
config           332.00 KiB
local             29.81 GiB
syslog_ng_db       1.09 MiB
yusheiDBTest     122.14 MiB
yusheiMotorDB     36.97 MiB
yusheiRedisTest   59.95 MiB
ys20220318 [primary] test> 

2.2 modify config/dbs.toml

alexlai@hc4Noble:~/build/wildduck/config$ cp -v dbs.toml dbs.toml.backup
'dbs.toml' -> 'dbs.toml.backup'
alexlai@hc4Noble:~/build/wildduck/config$ nano dbs.toml
alexlai@hc4Noble:~/build/wildduck/config$ diff dbs.toml dbs.toml.backup 
2,3c2
< # mongo="mongodb://127.0.0.1:27017/wildduck"
< mongo = "mongodb://siteRootAdmin:b23258585@redisMongo03.yushei.com.tw:27017,redisMongo04.yushei.com.tw:27017,redisMongo05.yushei.com.tw:27017/YuSheiWildduck?authSource=admin&replicaSet=ys20220318"
---
> mongo="mongodb://127.0.0.1:27017/wildduck"

2.3. modify so that it will server on all interfaces

alexlai@hc4Noble:~/build/wildduck/config$ cp -v api.toml api.toml.backup
'api.toml' -> 'api.toml.backup'
$ diff api.toml api.toml.backup 
4,5c4
< # host = "127.0.0.1"
< host = "0.0.0.0"
---
> host = "127.0.0.1"
  1. startup node server.js
alexlai@hc4Noble:~/build/wildduck$ node server.js 
info App  --------------------------------------------------------------
info App 
info App   █     █░ ██▓ ██▓    ▓█████▄ ▓█████▄  █    ██  ▄████▄   ██ ▄█▀
info App  ▓█░ █ ░█░▓██▒▓██▒    ▒██▀ ██▌▒██▀ ██▌ ██  ▓██▒▒██▀ ▀█   ██▄█▒
info App  ▒█░ █ ░█ ▒██▒▒██░    ░██   █▌░██   █▌▓██  ▒██░▒▓█    ▄ ▓███▄░
info App  ░█░ █ ░█ ░██░▒██░    ░▓█▄   ▌░▓█▄   ▌▓▓█  ░██░▒▓▓▄ ▄██▒▓██ █▄
info App  ░░██▒██▓ ░██░░██████▒░▒████▓ ░▒████▓ ▒▒█████▓ ▒ ▓███▀ ░▒██▒ █▄
info App  ░ ▓░▒ ▒  ░▓  ░ ▒░▓  ░ ▒▒▓  ▒  ▒▒▓  ▒ ░▒▓▒ ▒ ▒ ░ ░▒ ▒  ░▒ ▒▒ ▓▒
info App   ▒ ░ ░   ▒ ░░ ░ ▒  ░ ░ ▒  ▒  ░ ▒  ▒ ░░▒░ ░ ░   ░  ▒   ░ ░▒ ▒░
info App   ░   ░   ▒ ░  ░ ░    ░ ░  ░  ░ ░  ░  ░░░ ░ ░ ░        ░ ░░ ░
info App     ░     ░      ░  ░   ░       ░       ░     ░ ░      ░  ░
info App                       ░       ░               ░
info App 
info App  ----------------------- wildduck@1.45.1 ----------------------
info App 
(node:10705) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
info Setup Setup 3 collections in MongoDB
info Setup Setup indexes for 89 collections
info IMAP Secure IMAP Server listening on 0.0.0.0:9993
info POP3 Secure POP3 Server listening on 0.0.0.0:9995
info API Server listening on 0.0.0.0:8080
verb Plugins Plugins loaded
info App All servers started, ready to process some mail

3.1. check YuSheiWildduck was created or not

ys20220318 [primary] test> show dbs
Dragonfly28        2.51 GiB
LaiKos           129.71 MiB
YuSheiDB           3.20 GiB
YuSheiFAB        752.00 KiB
YuSheiReactTest    4.34 MiB
YuSheiWildduck   572.00 KiB
admin              2.67 MiB
config           332.00 KiB
local             29.81 GiB
syslog_ng_db       1.16 MiB
yusheiDBTest     122.14 MiB   <---
yusheiMotorDB     36.97 MiB
yusheiRedisTest   59.95 MiB

3.2. Try to access

$ node server.js
....
info Setup Setup indexes for 89 collections
info IMAP Secure IMAP Server listening on 0.0.0.0:9993
info POP3 Secure POP3 Server listening on 0.0.0.0:9995
info API Server listening on 0.0.0.0:8080
verb Plugins Plugins loaded
info App All servers started, ready to process some mail
info Gelf {"short_message":"WILDDUCK HTTP [GET /] FAILED","_remote_ip":"192.168.2.133","_http_route":"/","_http_method":"GET","_api_response":"fail","_code":"Error","_size":66,"facility":"wildduck","host":"hc4Noble","timestamp":1730247489.154,"_component":"wildduck"}
info Gelf {"short_message":"WILDDUCK HTTP [GET /favicon.ico] FAILED","_remote_ip":"192.168.2.133","_http_route":"/favicon.ico","_http_method":"GET","_api_response":"fail","_code":"Error","_size":77,"facility":"wildduck","host":"hc4Noble","timestamp":1730247489.272,"_component":"wildduck"}
verb Tasks Starting task poll loop
verb Tasks type=acme-update id=acme-update-id data={}

3.2 http://hc4Noble.yushei.net

{
  "code": "ResourceNotFound",
  "message": "/ does not exist"
}

4.0 Wildduck API documentation

$ curl localhost:8080/addresses
{
  "success": true,
  "total": 0,
  "page": 1,
  "previousCursor": false,
  "nextCursor": false,
  "results": []
}
  1. wildduck configuration

  2. Install wildduck-www@hc4Noble.yushei.net

$ pwd
/home/alexlai/build
$ git clone --bare https://github.com/nodemailer/wildduck-webmail.git
# --bare option in the git clone command is used to create a bare repository. 
$ cd wildduck-webmail.git/
$ git tag
v1.0.0
v1.0.1
$ git checkout v1.0.1 -b v1.0.1 <-- Error!!
fatal: this operation must be run in a work tree
alexlai@hc4Noble:~/build$ git clone https://github.com/nodemailer/wildduck-webmail.git
Cloning into 'wildduck-webmail'...
remote: Enumerating objects: 2853, done.
remote: Counting objects: 100% (138/138), done.
remote: Compressing objects: 100% (82/82), done.
remote: Total 2853 (delta 68), reused 109 (delta 53), pack-reused 2715 (from 1)
Receiving objects: 100% (2853/2853), 3.87 MiB | 7.78 MiB/s, done.
Resolving deltas: 100% (1567/1567), done.
alexlai@hc4Noble:~/build$ cd wildduck-webmail
alexlai@hc4Noble:~/build/wildduck-webmail$ git tag
v1.0.0
v1.0.1
alexlai@hc4Noble:~/build/wildduck-webmail$ git checkout v1.0.1 -b v1.0.1
Switched to a new branch 'v1.0.1'