Serverless containerized social arcade built on Knative.
Try a deployed version here!
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
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.
This application is written in Node.js and is tested on Node v10.16.0+.
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.
Running the service
The application's source code is written in TypeScript. You have 2 ways to run the application locally.
ts-node-devto run the source TypeScript. Note: This enables hot-reloading and might be easier for development.
npm run dev
- Compile the TypeScript code and run Node on the output. Note: This is how a production container should run the application.
Running the tests
To run tests using
mocha, use the test script. Note: This uses
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
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.
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.
- Express.js - Fast, unopinionated, minimalist web framework for Node.js
- PostgreSQL - Open Source Relational Database
- GitHub - Development platform for open source
- Chai.js - BDD/TDD assertion library for node and the browser
- Circle CI - Automated CI/CD job running platform
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
See also the list of contributors who participated in this project.
This project is licensed under the Apache 2.0 License - see the LICENSE.md file for details.