Extract reconcile #85
52 changed files with 101 additions and 50 deletions
|
|
@ -1,40 +0,0 @@
|
|||
[package]
|
||||
name = "sync_server"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
authors.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[dependencies]
|
||||
serde = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
|
||||
tokio = { version = "1.44.2", features = ["full"]}
|
||||
uuid = { version = "1.16.0", features = ["v4", "serde"] }
|
||||
log = { version = "0.4.27" }
|
||||
anyhow = { version = "1.0.98", features = ["backtrace"] }
|
||||
axum = { version = "0.7.4", features = ["ws", "macros", "tracing", "multipart"]}
|
||||
axum-extra = { version = "0.9.6", features = ["typed-header"] }
|
||||
axum_typed_multipart = "0.11.0"
|
||||
tower-http = { version = "0.6.1", features = ["cors", "trace", "limit", "timeout"] }
|
||||
tracing = "0.1.41"
|
||||
tracing-subscriber = { version = "0.3.19", features = ["fmt", "env-filter"]}
|
||||
sqlx = { version = "0.8.6", features = ["sqlite", "runtime-tokio", "uuid", "chrono"] }
|
||||
chrono = { version = "0.4.41", features = ["serde"] }
|
||||
rand = "0.9.0"
|
||||
sanitize-filename = "0.6.0"
|
||||
regex = "1.11.1"
|
||||
clap = { version = "4.5.38", features = ["derive"] }
|
||||
futures = "0.3.31"
|
||||
serde_yaml = "0.9.34"
|
||||
serde_json = "1.0.140"
|
||||
clap-verbosity-flag = "3.0.3"
|
||||
bimap = "0.6.3"
|
||||
ts-rs = { version = "10.1", features = ["uuid-impl", "chrono-impl"] }
|
||||
serde_with = "3.12.0"
|
||||
base64 = "0.22.1"
|
||||
reconcile-text = "0.4.10"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
0
backend/Cargo.lock → sync-server/Cargo.lock
generated
0
backend/Cargo.lock → sync-server/Cargo.lock
generated
|
|
@ -1,10 +1,5 @@
|
|||
[workspace]
|
||||
resolver = "2"
|
||||
members = [
|
||||
"sync_server",
|
||||
]
|
||||
|
||||
[workspace.package]
|
||||
[package]
|
||||
name = "sync_server"
|
||||
rust-version = "1.83"
|
||||
authors = ["Andras Schmelczer <andras@schmelczer.dev>"]
|
||||
edition = "2024"
|
||||
|
|
@ -12,9 +7,34 @@ license = "MIT"
|
|||
repository = "https://github.com/schmelczer/vault-link"
|
||||
version = "0.4.0"
|
||||
|
||||
[workspace.dependencies]
|
||||
[dependencies]
|
||||
serde = { version = "1.0.219", default-features = false, features = ["derive"] }
|
||||
thiserror = { version = "2.0.12", default-features = false }
|
||||
tokio = { version = "1.44.2", features = ["full"]}
|
||||
uuid = { version = "1.16.0", features = ["v4", "serde"] }
|
||||
log = { version = "0.4.27" }
|
||||
anyhow = { version = "1.0.98", features = ["backtrace"] }
|
||||
axum = { version = "0.7.4", features = ["ws", "macros", "tracing", "multipart"]}
|
||||
axum-extra = { version = "0.9.6", features = ["typed-header"] }
|
||||
axum_typed_multipart = "0.11.0"
|
||||
tower-http = { version = "0.6.1", features = ["cors", "trace", "limit", "timeout"] }
|
||||
tracing = "0.1.41"
|
||||
tracing-subscriber = { version = "0.3.19", features = ["fmt", "env-filter"]}
|
||||
sqlx = { version = "0.8.6", features = ["sqlite", "runtime-tokio", "uuid", "chrono"] }
|
||||
chrono = { version = "0.4.41", features = ["serde"] }
|
||||
rand = "0.9.0"
|
||||
sanitize-filename = "0.6.0"
|
||||
regex = "1.11.1"
|
||||
clap = { version = "4.5.38", features = ["derive"] }
|
||||
futures = "0.3.31"
|
||||
serde_yaml = "0.9.34"
|
||||
serde_json = "1.0.140"
|
||||
clap-verbosity-flag = "3.0.3"
|
||||
bimap = "0.6.3"
|
||||
ts-rs = { version = "10.1", features = ["uuid-impl", "chrono-impl"] }
|
||||
serde_with = "3.12.0"
|
||||
base64 = "0.22.1"
|
||||
reconcile-text = "0.4.10"
|
||||
|
||||
[profile.release]
|
||||
codegen-units = 1
|
||||
|
|
@ -22,12 +42,12 @@ lto = true
|
|||
opt-level = 3
|
||||
strip="debuginfo" # Keep some info for better panics
|
||||
|
||||
[workspace.lints.rust]
|
||||
[lints.rust]
|
||||
unsafe_code = "forbid"
|
||||
rust_2018_idioms = { level = "warn", priority = -1 }
|
||||
missing_debug_implementations = "warn"
|
||||
|
||||
[workspace.lints.clippy]
|
||||
[lints.clippy]
|
||||
await_holding_lock = "warn"
|
||||
dbg_macro = "warn"
|
||||
empty_enum = "warn"
|
||||
33
sync-server/Dockerfile
Normal file
33
sync-server/Dockerfile
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
FROM rust:1.87 AS builder
|
||||
|
||||
WORKDIR /usr/src/backend
|
||||
|
||||
RUN apt update && apt install -y musl-tools
|
||||
RUN cargo install sqlx-cli
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN sqlx database create --database-url sqlite://db.sqlite3
|
||||
RUN sqlx migrate run --source sync_server/src/app_state/database/migrations --database-url sqlite://db.sqlite3
|
||||
|
||||
RUN cargo build --package sync_server --release --target x86_64-unknown-linux-musl
|
||||
|
||||
# Runtime image
|
||||
FROM alpine:3.22.0
|
||||
|
||||
LABEL org.opencontainers.image.authors="andras@schmelczer.dev"
|
||||
|
||||
RUN apk add --no-cache curl
|
||||
|
||||
COPY --from=builder /usr/src/backend/target/x86_64-unknown-linux-musl/release/sync_server /app/sync_server
|
||||
|
||||
VOLUME /data
|
||||
EXPOSE 3000/tcp
|
||||
WORKDIR /data
|
||||
|
||||
HEALTHCHECK \
|
||||
--interval=30s \
|
||||
--timeout=5s \
|
||||
CMD curl -f http://localhost:3000/vaults/fake/ping || exit 1
|
||||
|
||||
ENTRYPOINT ["/app/sync_server"]
|
||||
26
sync-server/config-e2e.yml
Normal file
26
sync-server/config-e2e.yml
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
database:
|
||||
databases_directory_path: databases
|
||||
max_connections_per_vault: 12
|
||||
cursor_timeout_seconds: 60
|
||||
server:
|
||||
host: 0.0.0.0
|
||||
port: 3000
|
||||
max_body_size_mb: 512
|
||||
max_clients_per_vault: 256
|
||||
response_timeout_seconds: 60
|
||||
users:
|
||||
user_configs:
|
||||
- name: admin
|
||||
token: test-token-change-me
|
||||
vault_access:
|
||||
type: allow_access_to_all
|
||||
- name: other-admin
|
||||
token: test-token-change-me2
|
||||
vault_access:
|
||||
type: allow_access_to_all
|
||||
- name: test
|
||||
token: other-test-token
|
||||
vault_access:
|
||||
type: allow_list
|
||||
allowed:
|
||||
- default
|
||||
4
sync-server/rust-toolchain.toml
Normal file
4
sync-server/rust-toolchain.toml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[toolchain]
|
||||
channel = "nightly-2025-06-06"
|
||||
targets = [ "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl" ]
|
||||
profile = "default"
|
||||
8
sync-server/rustfmt.toml
Normal file
8
sync-server/rustfmt.toml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
imports_granularity = "crate"
|
||||
condense_wildcard_suffixes = true
|
||||
fn_single_line = true
|
||||
format_strings = true
|
||||
reorder_impl_items = true
|
||||
group_imports = "StdExternalCrate"
|
||||
use_field_init_shorthand = true
|
||||
wrap_comments=true
|
||||
Loading…
Add table
Add a link
Reference in a new issue