Skip to content
chergert edited this page Dec 4, 2012 · 8 revisions

Postal is a Push Notification Server written in C.

Postal manages and stores information about your customers mobile devices in MongoDB. Using the REST API you can notify these devices from your application without needing to manage connections to Apple and Google inside of your application. Additionally, there is no need to check those services for device removal as Postal will handle that for you.

Additionally, Postal can connect to your metrics system using Redis PUBSUB so that you can monitor its use.

Quick Start

Install Dependencies

# Assuming Fedora 17
sudo yum install json-glib-devel libsoup-devel hiredis-devel mongodb-server redis
service mongod start
service redis start

Install Postal

git clone git://github.com/catch/postal.git
cd postal
./autogen.sh --prefix=/usr --libdir=/usr/lib64 --enable-silent-rules --enable-debug=minimum --enable-trace=no --enable-redis --sysconfdir=/etc/postal
make
sudo make install

Configure Postal

The configuration file will be located at /etc/postal/postald.conf if you have configured as the command above exemplifies. You will need to copy your Apple APNS certificate and private key in PEM format to /etc/postal. Update postald.conf to point to these files. If you would like to use a MongoDB server that is not running on the Postal server (for durability, for example), that can also be configured in postald.conf.

Running Postal

Fedora or other systems with SystemD

Postal supports systemd through the use of service units. You can start the postald service like any other service.

sudo service postald start

Ubuntu or other systems with UpStart!

Postal does not yet provide scripts for UpStart! You may run it on the command line directly until these are provided.

postald -c /etc/postal/postald.conf

SysV Init

You can use start-stop-daemon or whatever else the neckbeards are using these days.

Monitoring

Postal provides a JSON encoded status page via the embedded HTTP server.

GET /status HTTP/1.0

HTTP/1.0 200 OK
Server: Postal/0.1.0
Date: Tue, 04 Dec 2012 01:17:39 GMT
Content-Type: application/json
Content-Length: 144

{
  "devices_added": 0,
  "devices_removed": 0,
  "devices_updated": 0,
  "devices_notified": {
    "aps": 0,
    "c2dm": 0,
    "gcm": 0
  }
}