pns


Source link: https://github.com/Turksat/pns

PNS

Distributed Push Notification Service for GCM and APNS. Built on REST API. Requires RabbitMQ and PostgreSQL. Tested on Python v2.7.x

See Wiki for what PNS can do for you.

Generate REST API Documentation

git clone [email protected]:Turksat/pns.git npm install -g apidoc cd pns & apidoc -i ./ -o apidoc/ 

Requirements on Debian 7.x

echo "deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main" > /etc/apt/sources.list.d/pgdg.list wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
echo "deb http://www.rabbitmq.com/debian/ testing main" > /etc/apt/sources.list.d/rabbitmq.list wget --quiet -O - http://www.rabbitmq.com/rabbitmq-signing-key-public.asc | apt-key add -  apt-get update  apt-get install -y python-dev python-pip rabbitmq-server postgresql-9.4 postgresql-server-dev-9.4 \
  libffi-dev supervisor git-core 

Deployment

Make it sure PostgresSQL and RabbitMQ services are up and running;

service postgresql start service rabbitmq-server start 

Follow steps for deployment (or use Dockerfile [TODO]);

  • First of all setup PostgreSQL server and create an user and database. You can get help from Debian PostgreSQL Documentation.

      postgres=# CREATE USER mypguser WITH PASSWORD 'mypguserpass';
    postgres=# CREATE DATABASE mypgdatabase OWNER mypguser; 
  • It's recommended to install required python dependency packages by using virtualenv.

      virtualenv --no-site-packages env
    source env/bin/activate
    pip install -r pns/requirements.txt 
  • Copy and edit sample ini file and set environment variable PNSCONF according to path of config file.

      cp pns/config_sample.ini ~/config.ini
    vi ~/config.ini
    export PNSCONF="$HOME/config.ini" 
  • Create tables

      export PYTHONPATH=$PYTHONPATH:$HOME/pns
    python -c "from pns.models import *; db.create_all()" 
  • Now you can test your web service is running

     python pns/pns/run.py  * Running on http://localhost:5000/ 

Congrats! You are done. Now we have to daemonize workers and web service application.

  • Copy sample supervisor configuration file and edit executables and paths

      cp pns/supervisor_sample.conf /etc/supervisor/conf.d/pns.conf
    service supervisor restart 

    Look at Supervisor Documentation page for extra configuration options.

  • It's recommended to use nginx to proxying requests to gunicorn. pns/nginx_sample.conf file includes a basic setup for proxy_pass

APNS Feedback Service

The Apple Push Notification service includes a feedback service to give you information about failed remote notifications. When a remote notification cannot be delivered because the intended app does not exist on the device, the feedback service adds that device’s token to its list. Remote notifications that expire before being delivered are not considered a failed delivery and don’t impact the feedback service. By using this information to stop sending remote notifications that will fail to be delivered, you reduce unnecessary message overhead and improve overall system performance. APNS Documentation

To start benefit from feedback service you can setup a cron. Edit sample configuration file pns/pns_cron_sample.sh and copy under preferred cron folder (cron.hourly, cron.daily etc.).

cp pns/pns_cron_sample.sh /etc/cron.daily/pns chmod +x /etc/cron.daily/pns 

Running Database Migrations

Change username and password in alembic.ini and run following command in application root directory (be sure PYTHONPATH and PNSCONF environment variables are set);

alembic upgrade head 

Resources

SugarLoader is a small library that adds sugar to Android Loader API.

Even when you rotate screen, tap home button, or anything, there is no risk to crash it or miss the callback, data will be loaded only once, then rendered to the restored activity/fragment, because there is Android Loader API under the hood.

A simple progress indicator (or chart widget) for Android.

Simple, Tiny, Extendable Android MVP library. No complex Base Activity, Base Fragment or Base View. Just base Presenters and View interface for you to extend from.

Extension of Android standard ImageView that lets the user scale the represented image and drag it around a pivot point defined as a fraction or a percentage.

A clean and easy to use Animated Progress View in a Square.

This project aims to implement FloatingActionButton's speed dial animation in material design guideline.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes