Skip to content

Commit c151725

Browse files
authored
feat(db): Split prod and dev db, default to dev (#1359)
* feat(db): Split prod and dev db, default to dev * Fix deployment configs to use prod db * Rename feature to prod-db, passthrough feature from tabby crate
1 parent 789d3ea commit c151725

File tree

6 files changed

+20
-8
lines changed

6 files changed

+20
-8
lines changed

.github/workflows/release.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ jobs:
3535
target: x86_64-unknown-linux-gnu
3636
binary: x86_64-manylinux2014
3737
container: quay.io/pypa/manylinux2014_x86_64
38-
build_args: --features static-ssl
38+
build_args: --features static-ssl,prod-db
3939
- os: ubuntu-latest
4040
target: x86_64-unknown-linux-gnu
4141
binary: x86_64-manylinux2014-cuda117
4242
container: sameli/manylinux2014_x86_64_cuda_11.7
43-
build_args: --features static-ssl --features cuda
43+
build_args: --features static-ssl --features cuda,prod-db
4444
- os: ubuntu-latest
4545
target: x86_64-unknown-linux-gnu
4646
binary: x86_64-manylinux2014-cuda122
4747
container: sameli/manylinux2014_x86_64_cuda_12.2
48-
build_args: --features static-ssl --features cuda
48+
build_args: --features static-ssl --features cuda,prod-db
4949
- os: windows-latest
5050
target: x86_64-pc-windows-msvc
5151
binary: x86_64-windows-msvc
@@ -54,19 +54,19 @@ jobs:
5454
target: x86_64-pc-windows-msvc
5555
binary: x86_64-windows-msvc-cuda117
5656
ext: .exe
57-
build_args: --features cuda
57+
build_args: --features cuda,prod-db
5858
windows_cuda: '11.7.1'
5959
- os: windows-latest
6060
target: x86_64-pc-windows-msvc
6161
binary: x86_64-windows-msvc-cuda122
6262
ext: .exe
63-
build_args: --features cuda
63+
build_args: --features cuda,prod-db
6464
windows_cuda: '12.2.0'
6565
- os: ubuntu-latest
6666
target: x86_64-unknown-linux-gnu
6767
binary: x86_64-manylinux2014-rocm57
6868
container: ghcr.io/cromefire/hipblas-manylinux/2014/5.7:latest
69-
build_args: --features static-ssl --features rocm
69+
build_args: --features static-ssl,rocm,prod-db
7070

7171
env:
7272
SCCACHE_GHA_ENABLED: true

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ COPY . .
3838

3939
RUN --mount=type=cache,target=/usr/local/cargo/registry \
4040
--mount=type=cache,target=/root/workspace/target \
41-
cargo build --features cuda --release --package tabby && \
41+
cargo build --features cuda,prod-db --release --package tabby && \
4242
cp target/release/tabby /opt/tabby/bin/
4343

4444
FROM ${BASE_CUDA_RUN_CONTAINER} as runtime

crates/tabby/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ experimental-http = ["dep:http-api-bindings"]
1313
# architecture, enable this feature to compile OpenSSL as part of the build.
1414
# See https://docs.rs/openssl/#vendored for more.
1515
static-ssl = ['openssl/vendored']
16+
prod-db = ['tabby-webserver/prod-db']
1617

1718
[dependencies]
1819
tabby-common = { path = "../tabby-common" }

ee/tabby-db/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ homepage.workspace = true
77

88
[features]
99
testutils = []
10+
prod-db = []
1011

1112
[dependencies]
1213
anyhow.workspace = true

ee/tabby-db/src/path.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,12 @@ fn tabby_ee_root() -> PathBuf {
77
}
88

99
pub fn db_file() -> PathBuf {
10-
tabby_ee_root().join("db.sqlite")
10+
#[cfg(feature = "prod-db")]
11+
{
12+
tabby_ee_root().join("db.sqlite")
13+
}
14+
#[cfg(not(feature = "prod-db"))]
15+
{
16+
tabby_ee_root().join("dev-db.sqlite")
17+
}
1118
}

ee/tabby-webserver/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ edition.workspace = true
55
authors.workspace = true
66
homepage.workspace = true
77

8+
[features]
9+
prod-db = ['tabby-db/prod-db']
10+
811
[dependencies]
912
anyhow.workspace = true
1013
argon2 = "0.5.1"

0 commit comments

Comments
 (0)