All Projects → alexellis → Expressjs K8s

alexellis / Expressjs K8s

Licence: mit
Express.js microservice with a Dockerfile, Kubernetes YAMLs and a non-root user

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Expressjs K8s

TODO-List-Tech-Module
TODO List (in C#, Java, JS and PHP) - Exam Preparation for the Tech Module @ SoftUni (August 2017)
Stars: ✭ 13 (-91.22%)
Mutual labels:  node-js, express-js
roboserver
Control OpenComputers robots without writing any code!
Stars: ✭ 52 (-64.86%)
Mutual labels:  node-js, express-js
express-mvc-generator
Express' Model View Controller Application Generator.
Stars: ✭ 46 (-68.92%)
Mutual labels:  node-js, express-js
reddit-clone
A reddit clone written using node.js / express.js / mongodb / passport.js. https://seiya-beddit.herokuapp.com/
Stars: ✭ 84 (-43.24%)
Mutual labels:  node-js, express-js
Node Production
Take Your Node.js Project to The Production Environment (VPS/Dedicated Server).
Stars: ✭ 35 (-76.35%)
Mutual labels:  express-js, node-js
Backend-NodeJS-Golang-Interview QA
A collection of Node JS and Golang Backend interview questions please feel free to fork and contribute to this repository
Stars: ✭ 122 (-17.57%)
Mutual labels:  node-js, express-js
node-rest-api-scaffold
This project is an initial NodeJS Rest API scaffold for developers
Stars: ✭ 24 (-83.78%)
Mutual labels:  node-js, express-js
babyfoot
Simple CQRS/ES Node+Express+TypeScript REST API
Stars: ✭ 14 (-90.54%)
Mutual labels:  node-js, express-js
Wechatbynode
Use the Node.js development WeChat(使用Node.js 开发微信公众号)【 博客地址:https://cnodejs.org/user/SilenceHVK 】
Stars: ✭ 642 (+333.78%)
Mutual labels:  express-js, node-js
Serverless Express
Run Node.js web applications and APIs using existing application frameworks on AWS #serverless technologies such as Lambda, API Gateway, Lambda@Edge, and ALB.
Stars: ✭ 4,265 (+2781.76%)
Mutual labels:  express-js, node-js
ExpressJS-SocketIO-Boilerplate
📦 Simple Express.js & Socket.io Boilerplate
Stars: ✭ 31 (-79.05%)
Mutual labels:  node-js, express-js
Tinyhttp
🦄 0-legacy, tiny & fast web framework as a replacement of Express
Stars: ✭ 1,259 (+750.68%)
Mutual labels:  express-js, node-js
express-boilerplate
ExpressJS boilerplate with Socket.IO, Mongoose for scalable projects.
Stars: ✭ 83 (-43.92%)
Mutual labels:  node-js, express-js
MERN-BUS-APP
This is a MFRP (My first Real Project) assigned to me during my internship at Cognizant. Made with MERN Stack technology.
Stars: ✭ 92 (-37.84%)
Mutual labels:  node-js, express-js
BotBlock.org
BotBlock - The List of Discord Bot Lists and Services
Stars: ✭ 29 (-80.41%)
Mutual labels:  node-js, express-js
node-express-mongo-passport-jwt-typescript
A Node.js back end web application with REST API, user JWT authentication and MongoDB data storage using TypeScript
Stars: ✭ 51 (-65.54%)
Mutual labels:  node-js, express-js
express-file-upload
Node.js Express Upload/Download File Rest APIs example with Multer
Stars: ✭ 64 (-56.76%)
Mutual labels:  node-js, express-js
mern-ecommerce
MERN Stack ecommerce site
Stars: ✭ 122 (-17.57%)
Mutual labels:  node-js, express-js
Practicalnode
Practical Node.js, 1st and 2nd Editions [Apress] 📓
Stars: ✭ 3,694 (+2395.95%)
Mutual labels:  express-js, node-js
Node Express Postgresql Server
Basic Node with Express + PostgreSQL Server
Stars: ✭ 74 (-50%)
Mutual labels:  express-js, node-js

Express.js Docker example

Example to show how to build a microservice with Node.js and Express.js with instructions for: Kubernetes with YAML, OpenFaaS, Docker and running locally with node

Clone the repository

git clone https://github.com/alexellis/expressjs-docker \
&& cd expressjs-docker

Endpoints

  • / - serves a HTML page
  • /links - serves a JSON response of links
  • /health - serves a health endpoint giving 200 OK

Try it with Kubernetes

You can first try running the example with Kubernetes, then try it with OpenFaaS to compare the experience. OpenFaaS also adds optional templates and an API to remove boilerplate coding: "look ma', (almost) no YAML!"

kubectl apply -f ./yaml
kubectl port-forward deploy/expressjs 8080:8080 &

curl 127.0.0.1:8080

Conservative resource limits / requests values have been set in the YAML files:

        resources:
          limits:
            cpu: 10m
            memory: 128Mi
          requests:
            cpu: 10m
            memory: 128Mi

Clean up:

kubectl delete -f ./yaml

See also: /yaml - (optional) - YAML files to deploy to Kubernetes directly

Run it with OpenFaaS

Watch my latest video on OpenFaaS with the PLONK Stack, which is made up of Prometheus, Linkerd (optional), OpenFaaS, NATS, and Kubernetes.

If you don't already have OpenFaaS, then:

Deploy:

faas-cli deploy

Access using the gateway's URL found via faas-cli describe service

Edit/rebuild:

Edit image: alexellis2 and replace with your own Docker Hub username in stack.yml, then run:

faas-cli up

Cleaning up:

faas-cli rm

See also: stack.yml - (optional) - OpenFaaS deployment file

OpenFaaS Templates

With OpenFaaS Templates you don't need to bother with managing Dockerfiles and TCP-port bindings, unless you like that sort of thing, then you can do that too just like we did in this example.

Try one of the templates above:

faas-cli template store list

faas-cli template store pull node10-express

faas-cli new --lang node10-express express-fn

Then edit express-fn/hander.js and express-fn.yml, before then running:

faas-cli up -f express-fn.yml

What is different?

  • No Kubernetes YAML files to manage
  • No Dockerfile to worry about
  • No index.js, no port-bindings, no Prometheus metrics to add, and no auto-scaling rules. OpenFaaS automates all of this and more.

Run it with docker

docker run --name expressjs -p 8081:8080 -ti alexellis2/service:0.3.2

Access via http://localhost:8081

Clean up:

docker rm -f expressjs

Run it without Docker, locally

npm install

http_port=3000 node index.js

Access via http://localhost:3000

Clean up by hitting Control + C.

Install via Helm 3

First install Helm 3.

helm repo add expressjs-k8s https://alexellis.github.io/expressjs-k8s/

helm repo update

helm install expressjs-k8s-tester expressjs-k8s/expressjs-k8s

The parts

  • Dockerfile

  • index.js - the entry-point for Express.js

  • stack.yml - (optional) - OpenFaaS deployment file

  • /yaml - (optional) - YAML files to deploy to Kubernetes directly

Other links:

Contributing via GitHub

Before contributing code, please see the CONTRIBUTING guide. This repo uses the same guide as inlets.dev.

Both Issues and PRs have their own templates. Please fill out the whole template.

All commits must be signed-off as part of the Developer Certificate of Origin (DCO)

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].