{"id":18136269,"url":"https://github.com/purarue/foreverjs-list","last_synced_at":"2025-03-30T23:32:39.652Z","repository":{"id":94610151,"uuid":"248695940","full_name":"purarue/foreverjs-list","owner":"purarue","description":"API to get information about forever.js processes, used to monitor processes on my server","archived":true,"fork":false,"pushed_at":"2024-10-27T20:03:09.000Z","size":40,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-08T23:34:07.497Z","etag":null,"topics":["expressjs","foreverjs","javascript","server-management"],"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/purarue.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}},"created_at":"2020-03-20T07:42:09.000Z","updated_at":"2024-10-27T20:03:12.000Z","dependencies_parsed_at":"2023-04-18T13:47:14.035Z","dependency_job_id":null,"html_url":"https://github.com/purarue/foreverjs-list","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/purarue%2Fforeverjs-list","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purarue%2Fforeverjs-list/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purarue%2Fforeverjs-list/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purarue%2Fforeverjs-list/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/purarue","download_url":"https://codeload.github.com/purarue/foreverjs-list/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246395573,"owners_count":20770239,"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":["expressjs","foreverjs","javascript","server-management"],"created_at":"2024-11-01T14:41:35.301Z","updated_at":"2025-03-30T23:32:39.628Z","avatar_url":"https://github.com/purarue.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# foreverjs-list\n\nAn express server that serves information about [`forever.js`](https://github.com/foreversd/forever) processes\n\nUses a secret token to authenticate requests, exposes the `forever.js` `list` command output as JSON.\n\n# Install\n\n```shell\ngit clone https://github.com/purarue/foreverjs-list\ncd foreverjs-list\nnpm install\n# set required token somewhere (put in some environment file (e.g. ~/.bashrc))\nexport FOREVER_LIST_TOKEN=v1E074hIiW0WJ2vv3G1S\n# you may set the FOREVER_LIST_PORT to change the default port from 8084\nnode app.js\n```\n\nEndpoints:\n\n* `/`: The base endpoint which returns information regarding processes.\n* `/:id/logs`: Return the logs for a process, `:id` is the UID of the forever process.\n\n## Example\n\nI run this on my server which runs my applications as `forever.js` processes (see [here](https://github.com/purarue/vps/blob/d53ac1e76303c5b0d34b88d04101c3feff06420e/restart)):\n\n```shell\nFOREVER_LIST_TOKEN=secret_token_here node app.js\n```\n... and then I can query the status of the running applications from anywhere, to notify me of any issues going on:\n\n```python\nimport requests\n\n# I reverse proxy this to /forever-list, see below\nresp = requests.get(\"https://mywebsite.com/forever-list\",\n                    headers={\"token\": \"secret_token_here\"})\n\n# make sure server is running\nresp.raise_for_status()\nassert len(resp.json()) == 5  # however many processes you expect to be running with forever.js\n```\n\nFor a more extensive example (the one that runs on my system as a\n[i3block](https://github.com/vivien/i3blocks) blocket (runs every 5 minutes and\nupdates my status bar)), see [`monitor.py`](./monitor.py).\n\n### Sample output:\n\nReturns a list of JSON objects:\n\n```\n[\n...\n{'args': [],\n  'command': '/snap/node/2310/bin/node',\n  'ctime': 1584691385266,\n  'file': 'app.js',\n  'id': False,\n  'isMaster': True,\n  'logFile': '/home/user/logs/foreverjs-list/forever.log',\n  'pid': 12936,\n  'restarts': 13,\n  'running': True,\n  'silent': False,\n  'sourceDir': '/home/user/code/foreverjs-list',\n  'spawnWith': {'cwd': '/home/user/code/foreverjs-list'},\n  'uid': 'forever-list-api'}\n  ...\n  ]\n\n```\n\n### nginx\n\nI route this to a path on my server so that the token in the header is encrypted with HTTPS:\n\n```\nserver {\n  listen 443 ssl ...\n  ....\n\n  location /forever-list/ {\n    proxy_pass http://127.0.0.1:8084/;\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurarue%2Fforeverjs-list","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpurarue%2Fforeverjs-list","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurarue%2Fforeverjs-list/lists"}