Giter Club home page Giter Club logo

apollo-core's Introduction

apollo-core

Build Status

The backend of our shared space reservation platform.

Setup

pip

First, install pip. I don't think it matters whether pip2 or pip3 since we just need it to pull down virtualenv, then all other dependencies will live inside that virtual environment.

virtualenv

Install with

pip install virtualenv

I'm currently using virtualenv to make development consistent and manage dependencies. While not strictly required to develop, it's probably a Good Idea.

First, you'll need a python3 installation. On macOS this can be done via

brew install python3

(or various other ways). Next, in the root directory of the git repo, do

virtualenv --python=python3 env

to get an environment set up. Whenver you want to use the virtual environment (to develop), just do

source env/bin/activate

Installing and Managing Dependencies

Inside the virtual environment, just run

pip install -r requirements.txt

If a new dependency is needed, it can be installed with pip and then pip freeze will update the dependencies (requirements.txt).

Running

Before starting a local instance, environment variables must be set, and the SQL proxy must be started. (See Deployment section for additional details.)

source env_vars.sh
./start_sql_proxy

Like any django app, the server can be run with

python manage.py runserver

and a shell can be started to mess around with via

python manage.py shell

See the django docs for all the available options.

Deployment

Production deployment of this application is configured for use with Google Cloud Platform. The Apollo Application is served by a App Engine Python 3 Flexible Runtime, static content is served from Cloud Storage, and structured data is managed by a PostgresSQL database on Cloud SQL.

For latency optimization for a Expo Demo in Chicago, the application is hosted in the us-central1 region, which is one state West in Iowa.

Google Cloud Platform Dependencies

Working with GCP services requires the installation of the namesake SDK, and a proxy script for connecting to a hosted database.

Integration with Frontend Component.

Django is also used to serve frontend content found in the apollo-ui project via the django-webpack-loader module. Build the frontend via webpack, put the webpack-stats.json in the project root directory, and the bundles in /assets/bundles. If this is unclear, look at .gitignore for details.

Deploying to Production

Before deploying a new version of the application, static assets must be collected and uploaded. As with other django management commands, this will fail if environment variables have not been set.

python manage.py collectstatic
./sync_static.sh

Once static files are uploaded, the app itself can be deployed.

gcloud app deploy

apollo-core's People

Contributors

prestonhansen avatar

Watchers

Max Luebbe avatar

apollo-core's Issues

Tests

Aside from standard unit tests, I think it would be good to have tests which run some common user tasks on realistic environments - say a test organization with ~100 rooms with randomized features.

Ownership of Reservation objects

Simple ownership should be a one liner change to models.py, but need to think about whether/how to allow anonymous users to manage reservations.

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.