Skip to content

Technical Architecture

Owen Buckley edited this page Nov 1, 2018 · 3 revisions

Overview

This wiki will cover the high-level architecture for the Contributary website project, focusing on how the services are deployed and organized.

For information on the particular stacks used for developing the front and backend, see the Onboarding Guide.

Infrastructure

The Contributary website will be hosted in Amazon Web Services (AWS), utilizing a number of its most popular and practical services to manage the application's overall operations.

AWS Services

  • Route 53 - Managed Domain Name System (DNS) and hosted zone service, the main entry point into the production environment
  • CloudFront - Content Delivery Network (CDN) service
  • Simple Storage Service (S3) - Object (file) storage for hosting the frontend (leveraging S3's capabilities to act as a webhost) and data fetched from external services
  • API Gateway - Service to manage "entry points" / endpoints to the backend APIs
  • Elastic Cloud Compute (EC2) - Virtualized servers in the cloud that can scale as needed
  • Lambda - "Functions" as a service, providing the capability to execute specific code only when needed, without having to provision a server

Network Diagram

Contributary Network Diagram

Development Environment

The development environment will comprise of two principal services, GitHub and CircleCI.

GitHub

GitHub (the site you're on right now!) has many beneficial services in addition to code hosting that can be used for project management and facilitating collaboration and contributions. Issue Tracker, Wiki, Release Notes and code reviews are just a few of the key features the Providence Geeks website will use. More details will be available in each project's Contributing Guidelines. For an overview of some of the GitHub features that will be used, check out this deck!

CircleCI

Continuous Integration (CI) is the practice of continually building a project on each commit or merge into a specific branch (like master). Best practice is to additionally have all code reviews (pull requests) be built using a CI server, that will checkout the PR's branch and run the project's build against it.

CircleCI is a managed CI service that aims to make setting up CI easy. Projects will use a YAML file to version control the build configuration including the build environment (Operating System, build runtime, installing dependencies) and the build steps to execute (linting, packaging, unit testing, etc).

CircleCI will also be used to deploy code into S3 and EC2 for continuous delivery. For more information on this, see the Release Management documentation.

Production Environment

Referencing the above network diagram, this is the general flow of data starting from the top

  1. User loads the website URL https://www.contributary.community
  2. DNS will route the request to Route 53
  3. Route 53 will forward the request to CloudFront (prod distribution)
  4. CloudFront will route requests one of two ways: ** Requests for static assets will route to a bucket (www.pvdgeeks.org) in S3 hosting the static assets deployed from CircleCI ** Requests to api/* will be routed to API Gateway production staging.

S3 will be responsible for:

  1. Hosting the frontend web application's built / bundled static assets (HTML, CSS, JS, etc), acting as the origin server for CloudFront
  2. Hosting data pulled out of external services (stored as .json files)

API Gateway will be responsible for:

  1. Routing specific API Requests to the appropriate micro service based on a domain responsibility, e.g. /api/events

API Gateway is setup with two stages, one as a stage environment, and one for the production environment. In this way, new endpoints can be tested in stage before they are made public in production.

EC2 will be responsible for:

  1. Serving as a reverse proxy to the GitHub API, available as /api/github/

It might make sense to front this by a memcache server

Lambda will be responsible for two things:

  1. Executing on a cron to fetch latest topology data from the repository dedicated repository in GitHub and put it in S3
  2. Acting as an endpoint (/api/topology) for API Gateway to return data put into S3

Staging Environment

Staging will essentially be a second UI / frontend environment running on top of the same production infrastucture and services. Referencing the network diagram:

  1. User loads the website domain URL https://stage.contributary.community
  2. DNS will route the request to Route 53
  3. Route 53 will forward the request to CloudFront (stage distribution)
  4. CloudFront will route requests one of two ways: ** Requests for static assets will route to a bucket (stage.contributary.community) in S3 hosting the static assets deployed from CircleCI ** Requests to api/* will be routed to API Gateway stage staging.

Frontend Webapp

The frontend webapp will be a simple static site intended to interact with backend APIs to get data to populate components with data to drive the user search expoerience. For more information of the actual features of the frontend webapp, please see the Application Design

Backend API(s) / Lmabda

The backend API(s) will be responsible for managing access to data needed for client browsers and devices, using a RESTful URL scheme. The intent is for clients to interact with these APIs only, instead of having to access external data sources directly. For more information on the APIs available and how they work and how to use them, please see the API Design docs.

  • Language: JavaScript
  • Library / Framework: Express
  • Build Tool: Docker

External Services

External services will be responsible for being the primary data sources for the services managed by API Gateway.

GitHub (website / topology repo)

To start, the data topology (language / project selection) will live as a JSON object in GitHub at this repo. It will periodically get pulled into S3 so that it can be consumed by the frontend via API Gateway -> Lambda.

GitHub (API)

The GitHub API will be used to facilitate searching of repositories and issues in real time for users. The frontend won't interact with the API directly, it will be reverse proxied through a NodeJS server that will contain the needed credentials and business logic for commuincating with the GitHub API.