{"id":19658139,"url":"https://github.com/cdaringe/swaperooni","last_synced_at":"2025-07-07T15:34:09.903Z","repository":{"id":214825145,"uuid":"737448223","full_name":"cdaringe/swaperooni","owner":"cdaringe","description":"Hot swap a child process in response to user provided events with signal proxying","archived":false,"fork":false,"pushed_at":"2024-08-01T03:22:01.000Z","size":1145,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-31T07:48:27.083Z","etag":null,"topics":["docker","hot-reload","init","init-system"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/cdaringe.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":"2023-12-31T04:16:10.000Z","updated_at":"2024-08-01T03:22:04.000Z","dependencies_parsed_at":"2024-04-12T00:28:27.465Z","dependency_job_id":"a577f120-f9e2-4360-b74a-c2a6291e3938","html_url":"https://github.com/cdaringe/swaperooni","commit_stats":null,"previous_names":["cdaringe/swaperooni"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdaringe%2Fswaperooni","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdaringe%2Fswaperooni/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdaringe%2Fswaperooni/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdaringe%2Fswaperooni/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cdaringe","download_url":"https://codeload.github.com/cdaringe/swaperooni/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224130033,"owners_count":17260741,"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":["docker","hot-reload","init","init-system"],"created_at":"2024-11-11T15:36:13.656Z","updated_at":"2024-11-11T15:36:14.711Z","avatar_url":"https://github.com/cdaringe.png","language":"Rust","readme":"# swaperooni\n\nHot-reload a child process without tearing down the parent PID. Proxies signals\ninto the child process.\n\n\u003cimg src=\"./img/swaperooni.webp\" width=\"480px\" /\u003e\n\n[![Rust](https://github.com/cdaringe/swaperooni/actions/workflows/rust.yml/badge.svg)](https://github.com/cdaringe/swaperooni/actions/workflows/rust.yml)\n\n- if the child exits, `swaperooni` exits with the same code.\n- if a swap request is issued, the child is torn down, and new child brought up.\n\nSupports two hot-reload request options:\n\n- `ipc` - send a newline delimited command string from the child to the swaperooni socket. See [examples/ipc_bash_hopscotch/main.sh](examples/ipc_bash_hopscotch/main.sh).\n- `poll` - monitor the `mtime` of a file. on change, re-execute it.\n\n**swaperooni is not a supervisor.** `swaperooni` is similar to [tini](https://github.com/krallin/tini).\n\n## Why\n\nBecause you can. Generally, avoid using this, and use a supervisor/orchestrator.\nYou may have cases where swapping child PIDs is more desirable (e.g. oddball docker/k8s environments).\n\n## How\n\nSee the examples.\n\n- `SOCKET_PATH=demo.sock cargo run ipc -- bash examples/ipc_bash_hopscotch/a.sh`\n  - program `a` runs momentarily, then requests to be swapped for program `b`. `b` requests program `c`, and `c` gracefully exits.\n- `SOCKET_PATH=demo.sock cargo run ipc -- node examples/ipc_node_counter/index.mjs 0`\n  - run a node.js process. the process asks swaperooni to run itself again, but with different params (a counter)\n- `cargo run poll --poll-interval-ms=1000 -- examples/poll_countdown/main.sh 5`\n  - poll for entrypoint change and re-run it.\n\n## Performance\n\nWell, it is \u003c1MB and does nothing _most_ of the time.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdaringe%2Fswaperooni","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcdaringe%2Fswaperooni","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdaringe%2Fswaperooni/lists"}