Installing

System Requirements

Autopush requires the following to be installed. Since each system has different methods and package names, it’s best to search for each package.

  • Python 2.7.7 (or later 2.7.x), either
    • PyPy 5.0.1 or later or
    • CPython compiled with the following flags:
      • –enable-unicode=usc4 –enable-ipv6
  • build-essential (a meta package that includes):
    • autoconf
    • automake
    • gcc
    • make
  • pypy or python (CPython) development (header files)
  • libffi development
  • openssl development
  • python virtualenv
  • git

For instance, if installing on a Fedora or RHEL-like Linux (e.g. an Amazon EC2 instance):

$ sudo yum install autoconf automake gcc make libffi-devel \
openssl-devel pypy pypy-devel python-virtualenv git -y

Or a Debian based system (like Ubuntu):

$ sudo apt-get install build-essential libffi-dev \
libssl-dev pypy-dev python-virtualenv git --assume-yes

Autopush uses the Boto python library. Be sure to properly set up your boto config file.

Notes on OS X

autopush depends on the Python cryptography library, which requires OpenSSL. If you’re installing autopush on OS X with a custom version of OpenSSL, you’ll need to set the ARCHFLAGS environment variable, and add your OpenSSL library path to LDFLAGS and CFLAGS before running make:

export ARCHFLAGS="-arch x86_64"
# Homebrew installs OpenSSL to `/usr/local/opt/openssl` instead of
# `/usr/local`.
export LDFLAGS="-L/usr/local/lib" CFLAGS="-I/usr/local/include"

Check-out the Autopush Repository

You should now be able to check-out the autopush repository.

$ git clone https://github.com/mozilla-services/autopush.git

Alternatively, if you’re planning on submitting a patch/pull-request to autopush then fork the repo and follow the Github Workflow documented in Mozilla Push Service - Code Development.

Python 2.7.7+ w/virtualenv

You will need virtualenv installed per the above requirements. Set up your virtual environment by running the following (if using PyPy, you’ll likely need to specify the -p <path to pypy> option):

$ virtualenv -p `which pypy` .

Then run the Makefile with make to setup the application.

Scripts

After installation of autopush the following command line utilities are available in the virtualenv bin/ directory:

autopush Runs a Connection Node
autoendpoint Runs an Endpoint Node
endpoint_diagnostic Runs Endpoint diagnostics
autokey Endpoint encryption key generator

You will need to have a boto config file file or AWS environment keys setup before the first 3 utilities will run properly.

Building Documentation

To build the documentation, you will need additional packages installed:

$ pip install -r doc-requirements.txt

You can then build the documentation:

$ cd docs
$ make html

Using a Local DynamoDB Server

Amazon supplies a Local DynamoDB Java server to use for local testing that implements the complete DynamoDB API. This is used for automated unit testing on Travis and can be used to run autopush locally for testing.

You will need the Java JDK 6.x or newer.

To setup the server locally:

$ mkdir ddb
$ curl -sSL http://dynamodb-local.s3-website-us-west-2.amazonaws.com/dynamodb_local_latest.tar.gz | tar xzvC ddb/
$ java -Djava.library.path=./ddb/DynamoDBLocal_lib -jar ./ddb/DynamoDBLocal.jar -sharedDb -inMemory

An example boto config file is provided in automock/boto.cfg that directs autopush to your local DynamoDB instance.