refactor: rename project to keepalive

This commit is contained in:
2026-06-27 21:24:17 +07:00
parent 2d16bb5ca6
commit f5218ea327
5 changed files with 19 additions and 17 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
.env
*.pem
ca.pem
/db-keepalive
/keepalive
/dist/
*.test
*.out
+3 -3
View File
@@ -3,9 +3,9 @@ WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /out/db-keepalive .
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /out/keepalive .
FROM gcr.io/distroless/static-debian12:nonroot
COPY --from=build /out/db-keepalive /db-keepalive
COPY --from=build /out/keepalive /keepalive
USER nonroot:nonroot
ENTRYPOINT ["/db-keepalive"]
ENTRYPOINT ["/keepalive"]
+12 -10
View File
@@ -1,10 +1,12 @@
# db-keepalive
# keepalive
Pluggable Go daemon that performs a periodic counter increment to prevent free-tier database clusters (Redis Cloud, Valkey, Aiven, Neon, Supabase, MongoDB Atlas, Couchbase Capella, etc.) from being auto-paused for inactivity.
Pluggable Go daemon that periodically touches external services to prevent idle shutdowns, pauses, or cold starts.
Successor to the `*-keepalive` family: one binary, one image, six adapters.
The current adapters perform cheap datastore writes for Redis Cloud, Valkey, Aiven, Neon, Supabase, MongoDB Atlas, Couchbase Capella, and similar hosted services.
## Supported drivers
Successor to the `*-keepalive` family: one binary, one image, six datastore adapters.
## Supported adapters
| `DB_TYPE` | Driver | Env vars |
| ------------ | ----------------------------------- | -------- |
@@ -20,17 +22,17 @@ Optional: `INTERVAL` (e.g. `30s`, `5m`; default `1m`), `COUNTER_KEY` (default `c
## Quick start (Docker)
```bash
docker run -d --name db-keepalive --restart unless-stopped \
docker run -d --name keepalive --restart unless-stopped \
-e DB_TYPE=redis \
-e REDIS_URL='redis://default@host:6379' \
ghcr.io/tiennm99/db-keepalive:latest
ghcr.io/tiennm99/keepalive:latest
```
## Quick start (local)
```bash
git clone https://github.com/tiennm99/db-keepalive
cd db-keepalive
git clone https://github.com/tiennm99/keepalive
cd keepalive
cp .env.example .env # then edit DB_TYPE + the driver's env vars
go run .
```
@@ -54,7 +56,7 @@ INSERT INTO keepalive (key, value) VALUES ('counter', 0);
(MySQL uses backticked identifiers — see `adapter/mysql.go`.)
## Adding a new database
## Adding a new adapter
1. Create `adapter/<name>.go`.
2. Implement the `Adapter` interface in `adapter/adapter.go` (`Connect`, `Increment`, `Close`).
@@ -66,7 +68,7 @@ INSERT INTO keepalive (key, value) VALUES ('counter', 0);
## Migrated from
This repo replaces six single-database repos. All are archived with a pointer here:
This repo replaces six single-datastore repos. All are archived with a pointer here:
- [redis-keepalive](https://github.com/tiennm99/redis-keepalive)
- [valkey-keepalive](https://github.com/tiennm99/valkey-keepalive)
+1 -1
View File
@@ -1,4 +1,4 @@
module github.com/tiennm99/db-keepalive
module github.com/tiennm99/keepalive
go 1.25.0
+2 -2
View File
@@ -10,7 +10,7 @@ import (
"time"
"github.com/joho/godotenv"
"github.com/tiennm99/db-keepalive/adapter"
"github.com/tiennm99/keepalive/adapter"
)
func main() {
@@ -44,7 +44,7 @@ func main() {
}
}()
log.Printf("db-keepalive: %s every %s", dbType, interval)
log.Printf("keepalive: %s every %s", dbType, interval)
go func() {
ticker := time.NewTicker(interval)