Skip to content

Commit 63fd2ab

Browse files
committed
docs: add README.md
1 parent f4a4b86 commit 63fd2ab

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

LICENSE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2024 Degu Labs, Inc
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# PodKeeper
2+
3+
PodKeeper is an open-source library for starting and stopping Docker containers in a way that ensures they won’t linger if the host program crashes or exits unexpectedly without properly stopping them.
4+
5+
## How It Works
6+
7+
Each Docker container has a primary process, known as the "entrypoint," which keeps the container running. For example, when you start a PostgreSQL container, it runs the `postgres` binary. When this binary exits, the container stops as well.
8+
9+
PodKeeper wraps the entrypoint in a special binary called `deadmanswitch`, which not only starts the entrypoint but also launches a WebSocket server. The client that initiated the container must connect to this WebSocket server; otherwise, the container will self-terminate after 10 seconds.
10+
11+
This setup creates a connection between the launched container and its owner. Whenever this WebSocket disconnects, the `deadmanswitch` program automatically stops the container.
12+
13+
## PodKeeper vs. TestContainers
14+
15+
Both PodKeeper and [TestContainers](https://testcontainers.com/) address the problem of starting, stopping, and cleaning up Docker containers:
16+
17+
- **TestContainers** uses a dedicated Docker container called "Ryuk" to handle cleanup.
18+
- **PodKeeper** manages cleanup using a [dead man's switch](https://en.wikipedia.org/wiki/Dead_man%27s_switch) mechanism.
19+
20+
While TestContainers is a well-established solution with a solid industry record, PodKeeper is an experimental approach exploring an alternative cleanup method.

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "deadmanswitch",
2+
"name": "podkeeper",
33
"type": "module",
44
"version": "0.2.5",
55
"description": "",
@@ -14,9 +14,14 @@
1414
"scripts": {
1515
"test": "echo \"Error: no test specified\" && exit 1"
1616
},
17+
"repository": {
18+
"type": "git",
19+
"url": "https://github.com/flakiness/podkeeper.git"
20+
},
21+
"homepage": "https://github.com/flakiness/podkeeper",
1722
"keywords": [],
1823
"author": "",
19-
"license": "ISC",
24+
"license": "MIT",
2025
"devDependencies": {
2126
"@degulabs/build": "^0.0.1",
2227
"@playwright/test": "^1.48.2",

0 commit comments

Comments
 (0)