Docker

Running from DockerHub

We provide prebuilt MongoosePush images. Configuration requires either an FCM token, APNS certificates or an APNS token. Depending on your usecase, you can have some or all of them in a standalone MongoosePush instance or using a docker container. For the full configuration you need to set up the following directory structure:

  • priv/
    • ssl/
      • rest_cert.pem - The HTTP endpoint certificate
      • rest_key.pem - private key for the HTTP endpoint certificate (has to be unencrypted)
    • apns/
      • prod_cert.pem - Production APNS app certificate
      • prod_key.pem - Production APNS app certificate's private key (has to be unencrypted)
      • dev_cert.pem - Development APNS app certificate
      • dev_key.pem - Development APNS app certificate's private key (has to be unencrypted)
      • token.p8 - APNS authentication token
    • fcm/
      • token.json - FCM service account JSON file

If you want to use the APNS token authentication you need to provide the token and set both key_id and team_id environment variables. To see how to obtain the token and key_id read this. To see how to obtain team_id read this.

The FCM JSON file can be generated by the Firebase console (https://console.firebase.google.com). Go to your project -> Project Settings -> Service accounts -> Generate new private key. Assuming that you have the priv directory with all certificates and the fcm token in the current directory, you may start MongoosePush with the following command:

docker run -v `pwd`/priv:/opt/app/priv \
  -e PUSH_HTTPS_CERTFILE="/opt/app/priv/ssl/rest_cert.pem" \
  -e PUSH_HTTPS_KEYFILE="/opt/app/priv/ssl/rest_key.pem" \
  -it --rm mongooseim/mongoose-push:latest

Building

Building a docker image is really easy, just type:

docker build . -t mpush:latest

As a result of this command you get access to the mpush:latest docker image. You may run it by typing:

docker run -it --rm mpush:latest foreground

The docker image that you have just built, exposes the port 8443 for the HTTP API of MongoosePush. It contains a VOLUME for path /opt/app/priv - it is handy for injecting APNS and HTTP API certificates since by default the docker image comes with test, self-signed certificates.

Configuration (basic)

The docker image of MongoosePush contains common, basic configuration that is generated from config/prod.exs. All useful options may be overridden via environment variables. However, if there's something you feel you need to change other than that, then you need to prepare your own config/prod.exs before image build.