{"id":16473589,"url":"https://github.com/guumaster/poc-fast-watchdog-docker","last_synced_at":"2026-02-23T20:10:43.484Z","repository":{"id":67988990,"uuid":"157516079","full_name":"guumaster/poc-fast-watchdog-docker","owner":"guumaster","description":"A POC to try  faas-watchdong inside a docker container to run a serverless function.","archived":false,"fork":false,"pushed_at":"2018-11-14T09:07:52.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-11T02:26:53.572Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/guumaster.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2018-11-14T08:29:52.000Z","updated_at":"2018-11-14T09:07:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"2cdef9d0-ca2b-4cd0-aeed-b8174937a27a","html_url":"https://github.com/guumaster/poc-fast-watchdog-docker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guumaster%2Fpoc-fast-watchdog-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guumaster%2Fpoc-fast-watchdog-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guumaster%2Fpoc-fast-watchdog-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guumaster%2Fpoc-fast-watchdog-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guumaster","download_url":"https://codeload.github.com/guumaster/poc-fast-watchdog-docker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241111975,"owners_count":19911596,"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":[],"created_at":"2024-10-11T12:27:29.993Z","updated_at":"2025-10-29T20:33:16.182Z","avatar_url":"https://github.com/guumaster.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# poc-fast-watchdog-docker\n\nA POC to try faas-watchdong inside a docker container to run a serverless function.\n\n\n## Description\n\nIf you have troubles getting started with [OpenFaaS](https://github.com/openfaas/faas) and want to try a quick and dirty serverless function you can use this setup. \n\nThe idea is to only use [OpenFaaS Watchdog function](https://github.com/openfaas/faas/tree/master/watchdog) to fork and run your process/function.\n\n\n## Setup and build\n\nYou just need `docker` installed. Then run: \n\n```\ndocker build -t poc-watchdog .\n```\n\nAnd start your container:\n\n```\ndocker run -it -p4000 --rm poc-watchdog\n```\n\n## Usage\n\nOnce your container is running, send traffic to it with curl:\n\n\n```\ncurl -XPOST -d '{ \"test\": 1234 }' http://localhost:4000/\n# Output\n{\n  \"env\": {\n    \"PATH\": \"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\",\n    \"HOSTNAME\": \"645f70c25bc2\",\n    \"TERM\": \"xterm\",\n    \"NODE_VERSION\": \"10.12.0\",\n    \"YARN_VERSION\": \"1.10.1\",\n    \"fprocess\": \"/usr/local/bin/node index.js\",\n    \"content_type\": \"application/json\",\n    \"HOME\": \"/root\",\n    \"Http_User_Agent\": \"curl/7.58.0\",\n    \"Http_Accept\": \"*/*\",\n    \"Http_Content_Length\": \"16\",\n    \"Http_Content_Type\": \"application/x-www-form-urlencoded\",\n    \"Http_Method\": \"POST\",\n    \"Http_ContentLength\": \"16\",\n    \"Http_Path\": \"/\",\n    \"Http_Host\": \"localhost:4000\"\n  },\n  \"context\": {\n    \"body\": {\n      \"test\": 1234\n    }\n  }\n}\n```\n\n\n## Development \n\nYou can try the function locally by redirecting content through pipes:\n\n```\ncat example_body.json | node index.js\n```\n\nEdit `handler.js` to do any process you need.\n\n\n## Caveats\n\n- *Its slow in comparison to a server*: Each time you call it, the `watchdog` fork a process and start `node`. If you are ok with response times of 0.10s instead of ms, go for it.\n- *Not suitable for all kind of inputs*: Content is sent to your process through `process.stdin`, the parser is painfully simple.\n- *Any output is part of the response*: Take care of what you output to the console, because all is part of the response.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguumaster%2Fpoc-fast-watchdog-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguumaster%2Fpoc-fast-watchdog-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguumaster%2Fpoc-fast-watchdog-docker/lists"}