All Projects → alexellis → leaderboard-app

alexellis / leaderboard-app

Licence: MIT license
GitHub leaderboard for your organisation or repo (Serverless SPA)

Programming Languages

go
31211 projects - #10 most used programming language
Vue
7211 projects
PLpgSQL
1095 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to leaderboard-app

node10-express-template
Node.js 10 Express Template for OpenFaaS
Stars: ✭ 26 (-59.37%)
Mutual labels:  lambda, openfaas
website-honestly
🦄 The Red Badger website. Honestly.
Stars: ✭ 26 (-59.37%)
Mutual labels:  lambda
White-Jotter-Vue
Front end of White Jotter.
Stars: ✭ 114 (+78.13%)
Mutual labels:  single-page-app
workshop-serverless-graphql
[AWSKRUG Serverless Group 2019] Serverless GraphQL Workshop
Stars: ✭ 80 (+25%)
Mutual labels:  lambda
webogram
Telegram web application, GPL v3
Stars: ✭ 7,752 (+12012.5%)
Mutual labels:  single-page-app
docker-selenium-lambda
The simplest demo of chrome automation by python and selenium in AWS Lambda
Stars: ✭ 172 (+168.75%)
Mutual labels:  lambda
hoffnung3000
Platform for decentralized, anonymized, self-curated festivals
Stars: ✭ 27 (-57.81%)
Mutual labels:  single-page-app
github-task-manager
receive github hook, notify agent, receive task results, notify github
Stars: ✭ 13 (-79.69%)
Mutual labels:  lambda
aws-lambda-scheduler
aws-lambda-scheduler is EventBridge Rule manager that lets you call any existing AWS Lambda Function you have in a set future time with pre-set parameters. Allows more rule creation than AWS limit.
Stars: ✭ 58 (-9.37%)
Mutual labels:  lambda
yake
A Rake-like DSL for writing AWS Lambda handlers
Stars: ✭ 146 (+128.13%)
Mutual labels:  lambda
url
Build and parse URLs. Useful for HTTP and "routing" in single-page apps (SPAs)
Stars: ✭ 69 (+7.81%)
Mutual labels:  single-page-app
active-directory-b2c-javascript-hellojs-singlepageapp
A single page app, implemented with an ASP.NET Web API backend, that signs up & signs in users using Azure AD B2C and calls the web API using OAuth 2.0 access tokens.
Stars: ✭ 63 (-1.56%)
Mutual labels:  single-page-app
mira
A place for notes, but for the people I keep in touch with
Stars: ✭ 99 (+54.69%)
Mutual labels:  single-page-app
nuxt-cordova-app
📱 Nuxt JS (Vue JS) + Vuetify 2 SPA hybrid demo app built using Cordova
Stars: ✭ 48 (-25%)
Mutual labels:  vue-js
launchlet
Make the web yours.
Stars: ✭ 34 (-46.87%)
Mutual labels:  single-page-app
SPA-With-Blazor
Creating a Single Page Application with Razor pages in Blazor using Entity Framework Core database first approach.
Stars: ✭ 27 (-57.81%)
Mutual labels:  single-page-app
zappa-ffmpeg
Run ffmpeg inside a lambda for serverless transformations.
Stars: ✭ 14 (-78.12%)
Mutual labels:  lambda
IMO-Maritime-Single-Window
An IMO coordinated project developing a generic Maritime Single Window.
Stars: ✭ 18 (-71.87%)
Mutual labels:  single-page-app
go-localstack
Go Wrapper for using localstack
Stars: ✭ 56 (-12.5%)
Mutual labels:  lambda
shelvery-aws-backups
Automating EBS RDS EC2 backups on lambda
Stars: ✭ 31 (-51.56%)
Mutual labels:  lambda

leaderboard-app - a serverless application

OpenFaaS

This application is an example of how to write a Single Page App (SPA) with a Serverless approach. It provides a live leaderboard for your GitHub organisation or repos showing comments made and issues opened by your community and contributors.

  • The front-end is written with Vue.js
  • The backing data-store data is Postgres with a remote DBaaS or in-cluster deployment

See a live example tracking the openfaas/openfaas-incubator organizations: https://alexellis.o6s.io/leaderboard-page

To test out the functionality comment on this issue: Issue: Let's test the leaderboard!

Here's a preview of the app when the dark theme is enabled:

Dark Leaderboard example

Subscribe to events by adding a webhook to the github-sub function:

Subscribe

Blog post / tutorial

Read all the details here on how to build a portable Serverless Single Page App for any cloud:

See also: Blog: How to build a Serverless Single Page App

Functions

  • github-sub

Receives webhooks from GitHub via an organization or repo subscription. Secured with HMAC by Alex Ellis

  • leaderboard

Retrieves the current leaderboard in JSON by Alex Ellis

  • leaderboard-page

Renders the leaderboard itself as a Vue.js app by Ken Fukuyama

Schema

Secrets

You can seal your secrets for use with OpenFaaS Cloud:

faas-cli cloud seal \
  --name teamserverless-leaderboard-app-secrets \
  --literal=password="$PASS" \
  --literal=username="$USER" \
  --literal=host="$HOST" \
  --literal=webhook-secret="${WEBHOOK}"

Running locally

  • Deploy OpenFaaS

The quickest/easiest option is to use Swarm.

  • Grab custom templates
faas-cli template store pull node8-express
faas-cli template store pull golang-middleware
  • Create the required secrets
export PASS=""
export USER=""
export HOST=""
export WEBHOOK="secret"   # As set on the webhook page on GitHub

# Kubernetes
faas-cli secret create leaderboard-app-secrets-password \
  --from-literal=password="$PASS" \
  --from-literal=username="$USER" \
  --from-literal=host="$HOST" \
  --from-literal=webhook-secret="${WEBHOOK}"

# Swarm

faas-cli secret create password --from-literal="$PASS"
faas-cli secret create username --from-literal="$USER"
faas-cli secret create host --from-literal="$HOST"
faas-cli secret create webhook-secret --from-literal="${WEBHOOK}"

# Then apply each secret to the required function in local.yml
  • Rename the stack.yml to local.yml

Edit local.yml and rename the functions:

leaderboard => alexellis-leaderboard
github-sub => alexellis-github-sub
leaderboard-page => alexellis-leaderboard-page

Then add a prefix for each function's Docker image name and run faas-cli build -f local.yml

  • Deploy of-router:

Via: https://github.com/openfaas/openfaas-cloud/tree/master/router

Deploy a fake auth function:

faas-cli store deploy figlet

Deploy the router:

TAG=0.6.0
docker service rm of-router

docker service create --network=func_functions \
 --env upstream_url=http://gateway:8080 \
 --env auth_url=http://figlet:8080 \
 --publish 8081:8080 \
 --name of-router \
 -d openfaas/cloud-router:$TAG
  • Create entries in: /etc/hosts
127.0.0.1 alexellis.local-o6s.io
  • Initialize Postgres

Provision Postgres 10 and set up your initial table schema and function:

export CONNECTION_STRING=""
docker run -ti postgres:10 psql ${CONNECTION_STRING}

Copy/paste from schema-1.0.sql

  • Test the JSON function:

http://127.0.0.1:8080/function/alexellis-leaderboard

  • Test the Vue.js page:

http://alexellis.local-o6s.io:8081/leaderboard-page

Contributing & license

Please feel free to fork and star this repo and use it as a template for your own applications. The license is MIT.

To contribute see CONTRIBUTING.md

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].