status-go/mailserver
frank 38308d48f2
feat_: log on panic (#5849)
* feat_: log error and stacktrace when panic in goroutine

* test_: add test TestSafeGo

* chore_: rename logAndCall to call

* chore_: rename SafeGo to Go

* chore_: make lint-fix

* chore_: use t.Cleanup

* chore_: Revert "chore_: use t.Cleanup"

This reverts commit 4eb420d179.

* chore_: Revert "chore_: make lint-fix"

This reverts commit fcc995f157.

* chore_: Revert "chore_: rename SafeGo to Go"

This reverts commit a6d73d6df5.

* chore_: Revert "chore_: rename logAndCall to call"

This reverts commit 8fbe993bed.

* chore_: Revert "test_: add test TestSafeGo"

This reverts commit a1fa91839f.

* chore_: Revert "feat_: log error and stacktrace when panic in goroutine"

This reverts commit f612dd828f.

* feat_: log error and stacktrace when panic in goroutine

* chore_: make lint-fix

* chore_: rename logAndCall to call

* chore_: renaming LogOnPanic

* chore_: update rest goroutine function calls

* chore_: make lint-fix
2024-09-27 06:37:32 +08:00
..
migrations chore_: rename shards.test to status.prod (#5571) 2024-07-29 17:19:48 -04:00
README.md
cleaner.go feat_: log on panic (#5849) 2024-09-27 06:37:32 +08:00
cleaner_test.go
db_key.go
db_key_test.go
limiter.go feat_: log on panic (#5849) 2024-09-27 06:37:32 +08:00
limiter_test.go
mailserver.go feat_: log on panic (#5849) 2024-09-27 06:37:32 +08:00
mailserver_db.go
mailserver_db_leveldb.go feat_: log on panic (#5849) 2024-09-27 06:37:32 +08:00
mailserver_db_leveldb_test.go
mailserver_db_postgres.go feat_: log on panic (#5849) 2024-09-27 06:37:32 +08:00
mailserver_db_postgres_test.go
mailserver_test.go chore_: bump go to 1.20 (#5027) 2024-04-18 18:48:02 +02:00
metrics.go
request.go

README.md

MailServer

This document is meant to collect various information about our MailServer implementation.

Syncing between mail servers

It might happen that one mail server is behind other due to various reasons like a machine being down for a few minutes etc.

There is an option to fix such a mail server:

  1. SSH to a machine where this broken mail server runs,
  2. Add a mail server from which you want to sync:
# sudo might be not needed in your setup
$ echo '{"jsonrpc":"2.0","method":"admin_addPeer", "params": ["enode://c42f368a23fa98ee546fd247220759062323249ef657d26d357a777443aec04db1b29a3a22ef3e7c548e18493ddaf51a31b0aed6079bd6ebe5ae838fcfaf3a49@206.189.243.162:30504"], "id":1}' | \
    sudo socat -d -d - UNIX-CONNECT:/docker/statusd-mail/data/geth.ipc
  1. Mark it as a trusted peer:
# sudo might be not needed in your setup
$ echo '{"jsonrpc":"2.0","method":"shh_markTrustedPeer", "params": ["enode://c42f368a23fa98ee546fd247220759062323249ef657d26d357a777443aec04db1b29a3a22ef3e7c548e18493ddaf51a31b0aed6079bd6ebe5ae838fcfaf3a49@206.189.243.162:30504"], "id":1}' | \
    sudo socat -d -d - UNIX-CONNECT:/docker/statusd-mail/data/geth.ipc
  1. Finally, trigger the sync command:
# sudo might be not needed in your setup
$ echo '{"jsonrpc":"2.0","method":"shhext_syncMessages","params":[{"mailServerPeer":"enode://c42f368a23fa98ee546fd247220759062323249ef657d26d357a777443aec04db1b29a3a22ef3e7c548e18493ddaf51a31b0aed6079bd6ebe5ae838fcfaf3a49@206.189.243.162:30504", "to": 1550479953, "from": 1550393583, "limit": 1000}],"id":1}' | \
    sudo socat -d -d - UNIX-CONNECT:/docker/statusd-mail/data/geth.ipc

You can add "followCursor": true if you want it to automatically download messages until the cursor is empty meaning all data was synced.

Debugging

To verify that your mail server received any responses, watch logs and seek for logs like this:

INFO [02-18|09:08:54.257] received sync response count=217 final=false err= cursor=[]

And it should finish with:

INFO [02-18|09:08:54.431] received sync response count=0 final=true err= cursor=[]