{"id":21638351,"url":"https://github.com/julie-ng/hello-welt","last_synced_at":"2025-04-11T16:42:35.197Z","repository":{"id":47382124,"uuid":"348594459","full_name":"julie-ng/hello-welt","owner":"julie-ng","description":"Simple containerized Node.js app for demos.","archived":false,"fork":false,"pushed_at":"2025-03-15T02:16:47.000Z","size":828,"stargazers_count":7,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-25T12:51:22.796Z","etag":null,"topics":["containers","docker","fastifyjs","nodejs"],"latest_commit_sha":null,"homepage":"","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/julie-ng.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2021-03-17T05:49:38.000Z","updated_at":"2025-03-23T04:44:22.000Z","dependencies_parsed_at":"2025-02-01T01:20:01.663Z","dependency_job_id":"aa959c21-b2a4-4fa7-9198-18d518c1a9f4","html_url":"https://github.com/julie-ng/hello-welt","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julie-ng%2Fhello-welt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julie-ng%2Fhello-welt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julie-ng%2Fhello-welt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julie-ng%2Fhello-welt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/julie-ng","download_url":"https://codeload.github.com/julie-ng/hello-welt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248442327,"owners_count":21104158,"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":["containers","docker","fastifyjs","nodejs"],"created_at":"2024-11-25T04:09:14.798Z","updated_at":"2025-04-11T16:42:35.179Z","avatar_url":"https://github.com/julie-ng.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hello Welt\n\nSimple Hello World [Fastify](https://www.fastify.io/) Node.js app with [JSON based logging](https://getpino.io/) incl. log levels, graceful shutdown, readiness probes and built-in crash triggers, etc. for container orchestration demos. \n\n\u003cimg src=\"https://raw.githubusercontent.com/julie-ng/hello-welt/main/preview.png\" alt=\"Hello Welt Preview\" width=\"600\"\u003e\n\n[![ci](https://github.com/julie-ng/hello-welt/actions/workflows/ci.yaml/badge.svg)](https://github.com/julie-ng/hello-welt/actions/workflows/ci.yaml)\u0026nbsp;\n[![docker](https://github.com/julie-ng/hello-welt/actions/workflows/docker.yaml/badge.svg)](https://github.com/julie-ng/hello-welt/actions/workflows/docker.yaml)\u0026nbsp;\n[![Known Vulnerabilities](https://snyk.io/test/github/julie-ng/hello-welt/badge.svg)](https://snyk.io/test/github/julie-ng/hello-welt)\n\n# Configuration\n\nThe following variables can be configured\n\n| Environment Variable | Default |\n|:--|:--|\n| `VERSION` | Version from `package.json` |\n| `HELLO_GREETING` | Hello |\n| `HELLO_NAME` | Welt |\n| `HELLO_COLOR` | `#ff5757` |\n| `EARTH_COLOR` | `#57ffd1` |\n| `PORT` | 3000 |\n| `HOST` | `localhost` in development and `0.0.0.0` in production |\n\n# Demo \n\nThis image can be used to demo the following for learning about **container orchestration**.\n\n\u003e [!NOTE]  \n\u003e These demo routes use `z-pages` covention based on Google's internal practices to indicate that these endpoints are not part of the app's expected functionality.\n\n### Best Practices\n\n| Best Practice | Route | Description |\n|:--|:--|:--|\n| Health Check | `/healthz` | Health check page with info for debugging. Returns 200. |\n| Graceful Shutdown | N/A | See [`app/server.js`](./app/server.js), which responds to `SIGINT` and `SIGTERM` to shutdown database, etc. |\n\n\n### Problems\n\n| Problem | Route | Description |\n|:--|:--|:--|\n| Error 500 | `/failz` | Returns 500 response and logs error to stdout. App continunes to run. |\n| Crash | `/crashz` | Simulate a crash. App needs to be restarted. |\n| Memory Leak | `/slowz` | Simulate a memory leak. App continues to function. |\n\n\n# Usage\n\n## Pull from Docker Hub\n\nPull the [julieio/hello](https://hub.docker.com/repository/docker/julieio/hello) public image from Docker Hub and then run it:\n\n```bash\ndocker pull julieio/hello:latest\ndocker run -p 3000:3000 julieio/hello:latest\n```\n\nOptionally - pass configuration via environment variables:\n\n```bash\ndocker run -p 3000:3000 -e HELLO_NAME=Julie julieio/hello:latest\n```\n\nor build from scratch\n\n```bash\ndocker build . -t hello-welt\ndocker run -p 3000:3000 hello-welt\n```\n\n## Local Development\n\nTo use this image locally, clone this repo, install dependencies and run the app:\n\n```bash\ngit clone https://github.com/julie-ng/hello-welt\nnpm install\nnpm start\n```\n\nThen open [http://localhost:3000](http://localhost:3000) in your browser.\n\n### Logging\n\nFor local development, we will use [pino-pretty](https://github.com/pinojs/pino-pretty) to format logs with color\n\n```bash\nnpm install -g pino-pretty\n```\n\nWe also also use [nodemon](https://nodemon.io/) to automatically restart the app when code changes. Use the `dev` command to put everything together\n\n```bash\nnpm run dev\n```\n\n# References\n\n- [Heroku Blog: Let It Crash: Best Practices for Handling Node.js Errors on Shutdown](https://blog.heroku.com/best-practices-nodejs-errors) by Julián Duque\n- [Snyk Blog: 10 best practices to containerize Node.js web applications with Docker](https://snyk.io/blog/10-best-practices-to-containerize-nodejs-web-applications-with-docker/) by \nLiran Tal and Yoni Goldberg\n\n# License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjulie-ng%2Fhello-welt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjulie-ng%2Fhello-welt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjulie-ng%2Fhello-welt/lists"}