Skip to content
Serverless containerized social arcade built on Knative.
TypeScript JavaScript CSS HTML Dockerfile TSQL
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
public/images
src
tests
vendor
views
.dockerignore
.gitignore
CONTRIBUTING.md
Dockerfile
LICENSE
README.md
app.json
cloudbuild.yaml
package-lock.json
package.json
prettier.config.js
tsconfig.json
tslint.json

README.md

Kubercade

CircleCI

Code Style: Google

Serverless containerized social arcade built on Knative.

Try a deployed version here!

Introduction

An app built as demonstration of portability for Knative that extends some open-source arcade games with social functionality. This social functionality includes:

  • Forum-style live chat.
  • Separate chat rooms for each game and a general chat.
  • High-score submission for each game.
  • High-score leaderboards.
  • Social media sharing.

The requirements for the portability of this app include:

  • A PostgresSQL database.
  • A Knative installation where you have permission to deploy a Service in at least one namespace.
  • Ability to connect to the Service via a web browser.

This app is built as part of a demonstration of portability project for Knative. It is meant to show the key features of Knative, test the conformance across various cloud product implementations of Knative, and document with functioning sample code how one might develop, build, and deploy with Knative. Key features of Knative this app demonstrates include:

  • Develop services independently that can be individually deployed, updated, and auto-scaled
  • Deploy containerized code with minimal configuration, allowing the developer to focus on features rather than infrastructure
  • Run serverless, stateful containers that enable pay-for-use billing

Getting Started

These instructions will get you a branch of the project code up and running on your local machine for development and testing purposes. See deployment for notes on how to containerize and deploy the project on a live system.

Prerequisites

This application is written in Node.js and is tested on Node v10.16.0+.

Installing

How to install the application for local development.

Install dependencies using npm.

npm install --save-dev

Provision a PostgreSQL instance, initialize it by executing src/.schema.sql, then provide the app with its connection string via an environment variable.

export DB_URL="postgres://{username}:{password}@{host}/{database}"

Running the service

The application's source code is written in TypeScript. You have 2 ways to run the application locally.

  1. Use ts-node-dev to run the source TypeScript. Note: This enables hot-reloading and might be easier for development.
npm run dev
  1. Compile the TypeScript code and run Node on the output. Note: This is how a production container should run the application.
npm start

Running the tests

To run tests using mocha, use the test script. Note: This uses ts-node/register to run against the source TypeScript, not the compiled JavaScript.

npm run test

To generate a coverage report with Istanbul, run the coverage script.

npm run coverage

This project follows the Google TypeScript Style guide. Use the check and fix scripts to have gts fix style errors.

npm run check
npm run fix

Deployment

Where it can run

This project is built for Knative and should be able to be deployed on any cloud product built on Knative or on any Kubernetes cluster.

It has been tested on Google Cloud Run and is set up for automatic continuous deployment via Cloud Build on pushes to the master branch of this repository.

Try it now

You can try deploying it on Google Cloud Run using the button below.

First, you need to setup a PostgreSQL database and initialize it by executing src/.schema.sql. Once you've done that, enter its connection string when prompted by Google Cloud Shell. I.e. postgres://{username}:{password}@{host}/{database}

Run on Google Cloud

Built With

Development

  • Node.js - JavaScript runtime built on Chrome's V8 JavaScript engine
  • Express.js - Fast, unopinionated, minimalist web framework for Node.js
  • TypeScript - Typed superset of JavaScript that compiles to plain JavaScript.
  • PostgreSQL - Open Source Relational Database
  • GitHub - Development platform for open source

Testing

  • Mocha - Feature-rich JavaScript test framework running on Node.js and in the browser
  • Chai.js - BDD/TDD assertion library for node and the browser
  • Circle CI - Automated CI/CD job running platform

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

  • Gabriel Mukobi - Initial work - mukobi
  • Carolyn Mei - Initial work - cmei4444

See also the list of contributors who participated in this project.

License

This project is licensed under the Apache 2.0 License - see the LICENSE.md file for details.

You can’t perform that action at this time.