Skip to content

Commit

Permalink
feat(db): Split prod and dev db, default to dev (#1359)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
boxbeam authored Feb 2, 2024
1 parent 789d3ea commit c151725
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 8 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ jobs:
target: x86_64-unknown-linux-gnu
binary: x86_64-manylinux2014
container: quay.io/pypa/manylinux2014_x86_64
build_args: --features static-ssl
build_args: --features static-ssl,prod-db
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary: x86_64-manylinux2014-cuda117
container: sameli/manylinux2014_x86_64_cuda_11.7
build_args: --features static-ssl --features cuda
build_args: --features static-ssl --features cuda,prod-db
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary: x86_64-manylinux2014-cuda122
container: sameli/manylinux2014_x86_64_cuda_12.2
build_args: --features static-ssl --features cuda
build_args: --features static-ssl --features cuda,prod-db
- os: windows-latest
target: x86_64-pc-windows-msvc
binary: x86_64-windows-msvc
Expand All @@ -54,19 +54,19 @@ jobs:
target: x86_64-pc-windows-msvc
binary: x86_64-windows-msvc-cuda117
ext: .exe
build_args: --features cuda
build_args: --features cuda,prod-db
windows_cuda: '11.7.1'
- os: windows-latest
target: x86_64-pc-windows-msvc
binary: x86_64-windows-msvc-cuda122
ext: .exe
build_args: --features cuda
build_args: --features cuda,prod-db
windows_cuda: '12.2.0'
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary: x86_64-manylinux2014-rocm57
container: ghcr.io/cromefire/hipblas-manylinux/2014/5.7:latest
build_args: --features static-ssl --features rocm
build_args: --features static-ssl,rocm,prod-db

env:
SCCACHE_GHA_ENABLED: true
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ COPY . .

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

FROM ${BASE_CUDA_RUN_CONTAINER} as runtime
Expand Down
1 change: 1 addition & 0 deletions crates/tabby/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ experimental-http = ["dep:http-api-bindings"]
# architecture, enable this feature to compile OpenSSL as part of the build.
# See https://docs.rs/openssl/#vendored for more.
static-ssl = ['openssl/vendored']
prod-db = ['tabby-webserver/prod-db']

[dependencies]
tabby-common = { path = "../tabby-common" }
Expand Down
1 change: 1 addition & 0 deletions ee/tabby-db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ homepage.workspace = true

[features]
testutils = []
prod-db = []

[dependencies]
anyhow.workspace = true
Expand Down
9 changes: 8 additions & 1 deletion ee/tabby-db/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,12 @@ fn tabby_ee_root() -> PathBuf {
}

pub fn db_file() -> PathBuf {
tabby_ee_root().join("db.sqlite")
#[cfg(feature = "prod-db")]
{
tabby_ee_root().join("db.sqlite")
}
#[cfg(not(feature = "prod-db"))]
{
tabby_ee_root().join("dev-db.sqlite")
}
}
3 changes: 3 additions & 0 deletions ee/tabby-webserver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ edition.workspace = true
authors.workspace = true
homepage.workspace = true

[features]
prod-db = ['tabby-db/prod-db']

[dependencies]
anyhow.workspace = true
argon2 = "0.5.1"
Expand Down

0 comments on commit c151725

Please sign in to comment.