{"id":31580600,"url":"https://github.com/peteretelej/execapi","last_synced_at":"2025-10-05T21:15:29.476Z","repository":{"id":189720796,"uuid":"681108968","full_name":"peteretelej/execapi","owner":"peteretelej","description":"Run commands or scripts on your servers via HTTP APIs","archived":false,"fork":false,"pushed_at":"2024-04-21T15:22:22.000Z","size":20,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-22T01:37:33.855Z","etag":null,"topics":["automation","devops","remote-execution"],"latest_commit_sha":null,"homepage":"","language":"Go","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/peteretelej.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}},"created_at":"2023-08-21T09:31:15.000Z","updated_at":"2024-10-25T02:40:33.000Z","dependencies_parsed_at":"2023-08-21T14:21:57.245Z","dependency_job_id":null,"html_url":"https://github.com/peteretelej/execapi","commit_stats":null,"previous_names":["peteretelej/execapi"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/peteretelej/execapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peteretelej%2Fexecapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peteretelej%2Fexecapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peteretelej%2Fexecapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peteretelej%2Fexecapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peteretelej","download_url":"https://codeload.github.com/peteretelej/execapi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peteretelej%2Fexecapi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278520554,"owners_count":26000504,"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","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["automation","devops","remote-execution"],"created_at":"2025-10-05T21:15:27.658Z","updated_at":"2025-10-05T21:15:29.468Z","avatar_url":"https://github.com/peteretelej.png","language":"Go","readme":"# Exec API\n\nExecute commands and run scripts via HTTP APIs.\n\nExec API enables the execution of predefined commands and scripts remotely on your servers via HTTP APIs. Please use with caution; see [Best Practice](./#Best-Practice) section below for recommend usage.\n\nSome use-cases I use this for: \n- CI/CD automation \u0026 automated deployments, IoT commands, health checks, running scheduled tasks across nodes\n\n## Running ExecAPI\n\n- Copy `config.json.sample` to `config.json`\n- Update the key value (used for authorizing API requests), and the `commands` as necessary\n- Run execapi. Either by,\n    - Grabbing the latest release from the [Releases page](https://github.com/peteretelej/execapi/releases)\n    - Or, building and running `execapi`\n\nBuilding and running\n``` sh\ngo build -o execapi .\n\n./execapi\n```\n\nArguments:\n\n```\n./execapi --config /apps/execapi.config.json --listen 0.0.0.0:8081\n```\n\n- `config`: path to config.json (default \"config.json\")\n- `listen`: address to listen on (default \"localhost:8080\")\n\nRun Exec API on the server you'd like to execute commands or scripts.\n\n## Usage\n\nAssuming you have an application at `/home/user/apps/appx` that has a script `deploy.sh` in the directory, you can use the [./config.json.sample](./config.json.sample) as the config.json.\n\nUpdate `commands` to add different options as desired.\n\n### Requesting command execution\n\n```sh\ncurl -X POST http://localhost:8080/run/appx -H \"Authorization: Bearer EXECAPI_KEY\"\n```\nThis will attempt to run the script for the app named \"appx\".\n\nResponds with http 200 (success) if command execution succeeds, or http 400 (with failure error) on failure.\n\nRequest full execution logs with `?verbose=1`, for example:\n\n```sh\ncurl -X POST http://localhost:8080/run/appx?verbose=1 -H \"Authorization: Bearer EXECAPI_KEY\"\n```\n\n### Windows?\nYes, this also works on Windows, simply provide the directory path in the config.json eg `\"dir\": \"C:\\\\myapps\\\\appx\"`, and the executable as the script eg `\"script\": \"commandx.exe\"`.\n\n## Best Practice\nPlease consider configuring Exec API to only be accessible by intended clients. While using pre-defined commands via `config.json` restricts what can be done, it still allows a client to initiate process execution (even though intended) on your servers.\n\n- Access control: For example, using tailscale and ufw to only allow desired access:\n  - [Secure your Ubuntu server with Tailscale](https://tailscale.com/kb/1077/secure-server-ubuntu-18-04/)\n  - [Tailscale GitHub Action](https://github.com/tailscale/github-action)\n- Logging and Monitoring: Set up logging and monitoring to keep track of access\n- Use HTTPS: Secure communication between the client and server with HTTPS\n\n# License\n[MIT](./LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeteretelej%2Fexecapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeteretelej%2Fexecapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeteretelej%2Fexecapi/lists"}