Public | Automated Build

Last pushed: 2 years ago
Short Description
Short description is empty for this repo.
Full Description

APNS notifier

This docker container sends a notification to an iPhone through APNS

Building the Image

To create the image cloudspace/apns-send, execute the following command inside the docker-apns-send folder:

docker build -t cloudspace/apns-send ./

Running the Image

You run the image with the docker run command. Here is an example run command. You should use the --rm option to force the container to be removed after it completes running.

docker run --rm cloudspace/apns-send /

docker run --rm cloudspace/apns-send /.rbenv/versions/2.1.2/bin/ruby /run.rb '{ "certificate": "ABC123", "token": "abc123", "alert": "Take Notice!" }

Variables for the run.rb script

run takes one argrument a string that is a JSON object. The object is required to have values for certificate, token and alert.

  • certificate is a pem certificate pair for the Apple Push Notification Service. It should be prepared as specified for the pushmeup gem APNS support.
  • token is a device token supplied to the system by an iPhone application
  • alert is the text content of the notification

    Optional paramaters are badge, image, and other

  • image is the url of an image that will appear in the notification
  • badge is a string, typically a count, just one or two digits, that will be overlayed on the image.
  • other is another JSON object that carries application specific values.

Results

The service will return a JSON object with a result value.

  • If the required arguments were not provided the result will be "missing required parameter".
  • If your certificate is not accepted by apple the result will be "processing exception undefined method `close' for nil:NilClass", yes I know that's terrible, it's what we get back from the pushmeup gem, but we can make it better.
  • Other exeptions will return the message provided by the system.
  • When there are no errors the result will be "success".

Running the Image for Troubleshooting

If you need to troubleshoot problems, you don't want your container to disappear after it finishes running. Instead of running the container with the --rm option and having it disappear after it completes it's task, you can use this command to have the container set up sshd and run it under supervisor so that you can ssh in and poke around the container, just like you would troubleshoot any other server. Change the root password of the command below or you will be using 'dogecoin'.

docker run -d -p 22 -e "root _pw=dogecoin" cloudspace/apns-send
Docker Pull Command
Owner
cloudspace
Source Repository