A (simplistic, coffeescript, docker, rabbitmq, amqp, promise)-based push notification micrservice for ios and android applications.
docker build -t push-notification-service .
docker run -it --rm=true \
-v push-notification-service-data:/data \
-e CERTS_PATH=/data \
-e RABBITMQ_URL="amqp://localhost:5672//?heartbeat=10" \
-e GOOGLE_API_KEY="your-google-gcm-api-key" \
-e NODE_ENV=development \
push-notification-service coffee src/service.coffee
Look at push-notification-service-data/
to understand how to place your
certificates. I mount a separate container volume to keep them private.
Continuous integration style
docker-compose build
docker-compose run test
docker-compose stop -t1
docker-compose rm -f
In your backend or application instances you can send messages to rabbitmq using the great amqp-as-promised RPC package
The RPC interface includes both functions to store and retrieve deviceTokens
Look at src/client_example.coffee
and test/service.coffee
to better understand how it works
Calls will be queued by rabbitmq and executed by any of the available service instances. You can launch many instances of this micro-service to increase capacity.
As a test client there is also a cli
(command line interface).
You can user the cli like this (example without docker in this case)
export RABBITMQ_URL="amqp://localhost:5672//?heartbeat=10" \
coffee src/cli --help