{"id":13602509,"url":"https://github.com/alexellis/expressjs-k8s","last_synced_at":"2025-04-04T10:07:57.871Z","repository":{"id":47496418,"uuid":"211529311","full_name":"alexellis/expressjs-k8s","owner":"alexellis","description":"Express.js microservice with a Dockerfile, Kubernetes YAMLs and a non-root user","archived":false,"fork":false,"pushed_at":"2024-10-14T09:46:55.000Z","size":58,"stargazers_count":167,"open_issues_count":2,"forks_count":58,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-28T09:07:44.293Z","etag":null,"topics":["express-js","javascript","kubernetes","node-js"],"latest_commit_sha":null,"homepage":"https://www.alexellis.io/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexellis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["alexellis"]}},"created_at":"2019-09-28T16:27:40.000Z","updated_at":"2025-03-23T10:52:38.000Z","dependencies_parsed_at":"2024-12-13T16:11:30.987Z","dependency_job_id":"bff435cf-df74-48fb-8066-c40c188af188","html_url":"https://github.com/alexellis/expressjs-k8s","commit_stats":{"total_commits":36,"total_committers":3,"mean_commits":12.0,"dds":0.05555555555555558,"last_synced_commit":"a76f20477beb26a5fb1023b786d9975c387ef380"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexellis%2Fexpressjs-k8s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexellis%2Fexpressjs-k8s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexellis%2Fexpressjs-k8s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexellis%2Fexpressjs-k8s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexellis","download_url":"https://codeload.github.com/alexellis/expressjs-k8s/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247157283,"owners_count":20893220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["express-js","javascript","kubernetes","node-js"],"created_at":"2024-08-01T18:01:25.825Z","updated_at":"2025-04-04T10:07:57.847Z","avatar_url":"https://github.com/alexellis.png","language":"JavaScript","funding_links":["https://github.com/sponsors/alexellis"],"categories":["JavaScript"],"sub_categories":[],"readme":"# Express.js Docker example\n\nExample to show how to build a microservice with Node.js and Express.js with instructions for: Kubernetes with YAML, [OpenFaaS](https://github.com/openfaas/faas), Docker and running locally with `node`\n\n## Endpoints\n\n* `/` - serves a HTML page\n* `/links` - serves a JSON response of links\n* `/health` - serves a health endpoint giving 200 OK\n\n## Clone the repository\n\n```bash\ngit clone https://github.com/alexellis/expressjs-docker --depth=1 \\\n  \u0026\u0026 cd expressjs-docker\n```\n\n## Install via Helm\n\nFirst install [Helm](https://helm.sh) via `arkade get helm`, or the Helm installation instructions.\n\nFor the published chart use:\n\n```bash\nhelm repo add expressjs-k8s https://alexellis.github.io/expressjs-k8s/\n\nhelm repo update\n\nhelm upgrade --install expressjs-k8s expressjs-k8s/expressjs-k8s\n```\n\nOr install via the local version, after cloning the repository:\n\n```bash\nhelm upgrade --install expressjs-k8s ./chart/expressjs-k8s/\n```\n\n## Try it with plain Kubernetes YAML files\n\nYou 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!\"\n\n```sh\nkubectl apply -f ./yaml\nkubectl port-forward deploy/expressjs 8080:8080 \u0026\n\ncurl 127.0.0.1:8080\n```\n\nConservative resource limits / requests values have been set in the YAML files:\n\n```yaml\n        resources:\n          limits:\n            cpu: 10m\n            memory: 128Mi\n          requests:\n            cpu: 10m\n            memory: 128Mi\n```\n\nClean up:\n\n```sh\nkubectl delete -f ./yaml\n```\n\nSee also: [/yaml](./yaml) - (optional) - YAML files to deploy to Kubernetes directly\n\n## Run it with [OpenFaaS](https://github.com/openfaas/faas)\n\nWatch [my latest video on OpenFaaS with the PLONK Stack](https://skillsmatter.com/skillscasts/14268-serverless-2-0-get-started-with-the-plonk-stack?utm_medium=social\u0026utm_source=twitter\u0026utm_campaign=bafdbc\u0026utm_content=skillscast), which is made up of Prometheus, Linkerd (optional), OpenFaaS, NATS, and Kubernetes.\n\nIf you don't already have OpenFaaS, then:\n\n* [Install faas-cli](https://docs.openfaas.com/cli/install/)\n* [Install OpenFaaS](https://docs.openfaas.com/deployment/)\n\nDeploy:\n\n```sh\nfaas-cli deploy\n```\n\nAccess using the gateway's URL found via `faas-cli describe service`\n\nEdit/rebuild:\n\nEdit `image: alexellis2` and replace with your own Docker Hub username in `stack.yml`, then run:\n\n```sh\nfaas-cli up\n```\n\nCleaning up:\n\n```\nfaas-cli rm\n```\n\nSee also: [stack.yml](./stack.yml) - (optional) - OpenFaaS deployment file\n\n### OpenFaaS Templates\n\nWith 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.\n\n* [Microservice for Node.js with express visible](https://github.com/openfaas-incubator/node10-express-service/)\n* [Function for Node.js with express hidden](https://github.com/openfaas-incubator/node10-express-service/)\n* [Legacy Node template without express](https://github.com/openfaas/templates/tree/master/template/node)\n\nTry one of the templates above:\n\n```\nfaas-cli template store list\n\nfaas-cli template store pull node10-express\n\nfaas-cli new --lang node10-express express-fn\n```\n\nThen edit `express-fn/hander.js` and `express-fn.yml`, before then running:\n\n```\nfaas-cli up -f express-fn.yml\n```\n\nWhat is different?\n\n* No Kubernetes YAML files to manage\n* No Dockerfile to worry about\n* No index.js, no port-bindings, no Prometheus metrics to add, and no auto-scaling rules. OpenFaaS automates all of this and more.\n\n## Run it with docker\n\n```sh\ndocker run --name expressjs -p 8081:8080 -ti alexellis2/service:0.3.2\n```\n\nAccess via http://localhost:8081\n\nClean up:\n\n```\ndocker rm -f expressjs\n```\n\n## Run it without Docker, locally\n\n* [Install Node.js](https://nodejs.org/en/)\n\n```sh\nnpm install\n\nhttp_port=3000 node index.js\n```\n\nAccess via http://localhost:3000\n\nClean up by hitting Control + C.\n\n## The parts\n\n* [Dockerfile](./Dockerfile)\n\n* [index.js](./index.js) - the entry-point for Express.js\n\n* [stack.yml](./stack.yml) - (optional) - OpenFaaS deployment file\n\n* [/yaml](./yaml) - (optional) - YAML files to deploy to Kubernetes directly\n\nOther links:\n\n* [Express.js docs](https://expressjs.com)\n\n* [OpenFaaS docs](https://www.openfaas.com/)\n\n## Contributing via GitHub\n\nBefore contributing code, please see the [CONTRIBUTING guide](https://github.com/alexellis/inlets/blob/master/CONTRIBUTING.md). This repo uses the same guide as [inlets.dev](https://inlets.dev/).\n\nBoth Issues and PRs have their own templates. Please fill out the whole template.\n\nAll commits must be signed-off as part of the [Developer Certificate of Origin (DCO)](https://developercertificate.org)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexellis%2Fexpressjs-k8s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexellis%2Fexpressjs-k8s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexellis%2Fexpressjs-k8s/lists"}