Skip to content

Commit 40b67f3

Browse files
authored
feat: add standalone SQLite backed denokv server (#14)
This is a standalone Deno KV server backed by SQLite. It exposes a HTTP API that implements the KV Connect protocol and can be used from the Deno CLI. The server can be connected to from multiple clients at the same time, which enables a simple way to self host a production ready Deno KV database.
1 parent 5fc6a0a commit 40b67f3

14 files changed

+1584
-74
lines changed

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
target/

.github/workflows/ci.yml

+65-10
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,93 @@ env:
1313

1414
jobs:
1515
test:
16-
runs-on: ubuntu-latest
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
matrix:
19+
os: [ubuntu-latest, macos-latest, windows-latest]
1720

1821
steps:
1922
- uses: actions/checkout@v3
2023

2124
- name: Install Rust
2225
uses: dsherret/rust-toolchain-file@v1
2326

27+
- uses: Swatinem/rust-cache@v2
28+
2429
- name: Install protoc
2530
uses: arduino/setup-protoc@v2
2631
with:
2732
version: "21.12"
33+
token: ${{ secrets.GITHUB_TOKEN }}
2834

2935
- name: Check formatting
3036
run: cargo fmt -- --check
3137

3238
- name: Check linting
33-
run: cargo clippy --all-targets --all-features -- -D clippy::all
39+
run: cargo clippy --release --all-targets --all-features -- -D clippy::all
3440

3541
- name: Build
36-
run: cargo build --all-targets --all-features --tests -v
42+
run: cargo build --release --all-targets --all-features --tests -v
3743

3844
- name: Test
39-
run: cargo test
45+
run: cargo test --release -- --nocapture
46+
47+
- name: Prepare artifact (Linux)
48+
if: runner.os == 'Linux'
49+
run: |-
50+
cd target/release
51+
zip -r denokv-x86_64-unknown-linux-gnu.zip denokv
52+
53+
- name: Prepare artifact (macOS)
54+
if: runner.os == 'macOS'
55+
run: |-
56+
cd target/release
57+
zip -r denokv-x86_64-apple-darwin.zip denokv
58+
59+
- name: Prepare artifact (Windows)
60+
if: runner.os == 'Windows'
61+
run: |-
62+
Compress-Archive -CompressionLevel Optimal -Force -Path target/release/denokv.exe -DestinationPath target/release/denokv-x86_64-pc-windows-msvc.zip
63+
64+
- name: Upload artifact (Linux)
65+
if: runner.os == 'Linux'
66+
uses: actions/upload-artifact@v3
67+
with:
68+
name: denokv-x86_64-unknown-linux-gnu.zip
69+
path: target/release/denokv-x86_64-unknown-linux-gnu.zip
70+
71+
- name: Upload artifact (macOS)
72+
if: runner.os == 'macOS'
73+
uses: actions/upload-artifact@v3
74+
with:
75+
name: denokv-x86_64-apple-darwin.zip
76+
path: target/release/denokv-x86_64-apple-darwin.zip
77+
78+
- name: Upload artifact (Windows)
79+
if: runner.os == 'Windows'
80+
uses: actions/upload-artifact@v3
81+
with:
82+
name: denokv-x86_64-pc-windows-msvc.zip
83+
path: target/release/denokv-x86_64-pc-windows-msvc.zip
84+
85+
- name: Upload release to GitHub
86+
uses: softprops/action-gh-release@v0.1.15
87+
if: github.repository == 'denoland/denokv' && startsWith(github.ref, 'refs/tags/')
88+
env:
89+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
90+
with:
91+
files: |-
92+
target/release/denokv-x86_64-pc-windows-msvc.zip
93+
target/release/denokv-x86_64-unknown-linux-gnu.zip
94+
target/release/denokv-x86_64-apple-darwin.zip
95+
draft: true
4096

41-
- name: Publish
42-
if: |
43-
runner.os == 'Linux' &&
44-
github.repository == 'denoland/denokv' &&
45-
startsWith(github.ref, 'refs/tags/')
97+
- name: Publish to crates.io
98+
if: runner.os == 'Linux' && github.repository == 'denoland/denokv' && startsWith(github.ref, 'refs/tags/')
4699
env:
47100
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
48-
run: |
101+
run: |-
49102
cargo publish -vv -p denokv_proto
50103
cargo publish -vv -p denokv_sqlite
104+
cargo publish -vv -p denokv_remote
105+
cargo publish -vv -p denokv

.github/workflows/docker.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: docker
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
tags: ["*"]
7+
pull_request:
8+
branches: ["main"]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
packages: write
15+
contents: read
16+
17+
steps:
18+
- name: Clone repository
19+
uses: actions/checkout@v3
20+
21+
- name: Build image
22+
run: |
23+
docker build -f Dockerfile -t denokv .
24+
25+
- name: Smoke test image
26+
run: |
27+
docker run -i --init denokv --help
28+
29+
- name: Login to ghcr.io
30+
if: github.repository == 'denoland/denokv' && startsWith(github.ref, 'refs/tags/')
31+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
32+
33+
- name: Push images
34+
if: github.repository == 'denoland/denokv' && startsWith(github.ref, 'refs/tags/')
35+
run: |
36+
docker tag denokv ghcr.io/denoland/denokv:${GITHUB_REF#refs/*/}
37+
docker push ghcr.io/denoland/denokv:${GITHUB_REF#refs/*/}
38+
docker tag denokv ghcr.io/denoland/denokv:latest
39+
docker push ghcr.io/denoland/denokv:latest

0 commit comments

Comments
 (0)