github.com/status-im/status-go@v1.1.0/MAILSERVER.md (about)

     1  # Description
     2  
     3  A poorly named "Mailserver" is essentially a Whisper node that stores message history in either a LevelDB or PostgreSQL database.
     4  
     5  A Status app user can run their own Mailserver for faster message retrieval or additional security.
     6  
     7  # Service Ports
     8  
     9  * `30303` TCP/UDP - [DevP2P](https://github.com/ethereum/devp2p) wire protocol port. Must __ALWAYS__ be public.
    10  * `8545` TCP - [JSON RPC](https://github.com/ethereum/wiki/wiki/json-rpc) management port. Must __NEVER__ be public.
    11  * `9090` TCP - [Prometheus](https://prometheus.io/docs/concepts/data_model/) metrics port. Should not be public.
    12  
    13  # Setup methods
    14  
    15  This document describes the two alternative ways to start a Status Mailserver:
    16  
    17  * [Docker Compose](https://docs.docker.com/compose/) - More self-contained and portable
    18  * [Systemd Service](https://www.freedesktop.org/wiki/Software/systemd/) - More local and configurable
    19  
    20  ## Docker Compose
    21  
    22  The simplest way is to just use:
    23  ```
    24  make run-mailserver-docker
    25  ```
    26  This will generate the necessary config, compose and then start the container.
    27  
    28  For more details read the [README](_assets/compose/mailserver/README.md).
    29  
    30  ## Systemd Service
    31  
    32  The other way is to run the `mailserver` under `systemd`:
    33  ```
    34  make run-mailserver-systemd
    35  ```
    36  This will generate the necessary config, define and then start a user service.
    37  Use `sudo` if you want it to be a system service.
    38  
    39  For more details read the [README](_assets/systemd/mailserver/README.md).
    40  
    41  # Service Healthcheck
    42  
    43  There's two simple ways to verify your Mailserver is up and running.
    44  
    45  ## Query Metrics
    46  
    47  By making an HTTP request to the metrics port(`9090` by default) you can check if you Mailserver is receiving envelopes:
    48  ```sh
    49   > curl -sS localhost:9090/metrics | grep '^waku_envelopes_received_total'
    50  waku_envelopes_received_total 123
    51  ```
    52  Or numbers and types of peers connected:
    53  ```sh
    54   > curl -sS localhost:9090/metrics | grep '^p2p_peers_count'
    55  p2p_peers_count{platform="linux-amd64",type="Statusd",version="v0.79.0"} 3
    56  ```
    57  
    58  ## JSON RPC Calls
    59  
    60  The JSON RPC port (`8545` by default) allows you to manage your node.
    61  You can list connected peers by doing:
    62  ```sh
    63   > export RPC_HOST=localhost RPC_PORT=8545
    64   > _assets/scripts/rpc.sh admin_peers | jq -r '.result[].network.remoteAddress'
    65  34.68.132.118:30305
    66  134.209.136.123:30305
    67  178.128.141.249:443
    68  ```
    69  Where [`rpc.sh`](./_assets/scripts/rpc.sh) is simply a thin wrapper around `curl`.
    70  
    71  You can use it to easily add peers too:
    72  ```sh
    73   > _assets/scripts/rpc.sh admin_addPeer enode://7aa648d6e855950b2e3d3bf220c496e0cae4adfddef3e1e6062e6b177aec93bc6cdcf1282cb40d1656932ebfdd565729da440368d7c4da7dbd4d004b1ac02bf8@178.128.142.26:443
    74  {"jsonrpc": "2.0", "id": 1, "result": true}
    75  ```