Giter VIP home page Giter VIP logo

spark's Introduction

Spark

A simple messenger based on WebSockets

Getting Started

Implementation Notes

Spark relies on the support provided by the default S2I builder for deploying a WSGI application using the gunicorn WSGI server. The requirements which need to be satisfied for this to work are:

  • The WSGI application code file needs to be named wsgi.py.
  • The WSGI application entry point within the code file needs to be named application.
  • The gunicorn package must be listed in the requirements.txt file for pip.

In addition, the .s2i/environment file has been created to allow environment variables to be set to override the behaviour of the default S2I builder for Python.

  • The environment variable APP_CONFIG has been set to declare the name of the config file for gunicorn.
  • The environment variable GUNICORN_CMD_ARGS has been set worker_class to tornado for gunicorn.

Requirements

To run the project you will need:

  • Python 3.5.2 or later
  • Tornado 4.5.2
  • Gunicorn 19.7.1
  • virtualenv - optional

Setting up a virtual environment:

Creating a virtual environment:

virtualenv -p python3 ~/envs/env #choose a suitable place for a new environment

Activation of the virtual environment:

source ~/envs/env/bin/activate

Requirements installation:

cd PROJECT_PATH
pip install -r requirements.txt

Running development server

Preparatory actions:

  • In the file spark_app.py change the variable HOST to http://127.0.0.1:8000
  • In the file static/scripts/main.js also change the variable wsHOST to ws://127.0.0.1:8000/ws

Run development server:

cd PROJECT_PATH
gunicorn -k tornado wsgi:application

For check, go to the address http://127.0.0.1:8000 in your browser on several tabs and try to send yourself a message

Deployment Steps (OpenShift)

To deploy from the OpenShift web console, you should select python:3.5 or python:latest, when using Add to project. Use of python:latest is the same as having selected the most up to date Python version available, which at this time is python:3.5.

The HTTPS URL of this code repository which should be supplied to the Git Repository URL field when using Add to project is:

If using the oc command line tool instead of the OpenShift web console, to deploy, you can run:

oc new-app https://github.com/melnik-ivan/spark.git

In this case, because no language type was specified, OpenShift will determine the language by inspecting the code repository. Because the code repository contains a requirements.txt, it will subsequently be interpreted as including a Python application. When such automatic detection is used, python:latest will be used.

If needing to select a specific Python version when using oc new-app, you should instead use the form:

oc new-app python:3.5~https://github.com/melnik-ivan/spark.git

See more:

Built With

  • Tornado - The non-blocking web server and web application framework

Authors

spark's People

Contributors

melnik-ivan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.