Skip to content

exitgames/photon.webhooks.turnbased.heroku

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Photon Heroku Realtime Webhooks Sample

Summary

This is the Photon Realtime Webhooks sample using a Python 3 Heroku application and Heroku Postgres addon.

Requirements

Requirements for local development

  • Local PostgreSQL server installed and running.
  • ngrok to forward requests to your PC

Setup and Run

Essential steps are:

  • $ heroku login
  • $ cd photon.webhooks.turnbased.heroku
  • $ pipenv install Flask gunicorn psycopg2

Running application locally

  • $ ./ngrok http 5000 (default Flask port is 5000)
  • go to the Photon Dashboard, create an application and set in the Webhooks tab the BaseUrl value to url from ngrok.
  • $ export DATABASE_URL=[local PostgreSQL database url]
  • $ python db_init.py (script destroys current database if it exists and creates new one)
  • $ foreman start
  • start client with appId set to your Photon application and check console for server logs

Deploying to Heroku Cloud and run

  • $ git init
  • $ git add .
  • $ git commit -m "init"
  • $ heroku create [new Heroku application name]
  • $ git push heroku master
  • go to the Photon Dashboard, create an application or choose already existing and set in the Webhooks tab the BaseUrl value to url of your Heroku web application (http://[Heroku application name].herokuapp.com).
  • $ heroku addons:create heroku-postgresql:hobby-dev
  • $ heroku run python db_init.py (script destroys current database if it exists and creates new one)
  • $ heroku ps:scale web=1
  • $ heroku logs --tail
  • start client with appId set to your Photon application and check console for server logs

About

Heroku/Python reference implementation for Webhooks.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published