Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
# libcurl4-openssl-dev: librdkafka is built from source and links against libcurl,
# whose headers are not on the runner by default.
# Workaround: rdkafka-sys requires always curl headers, fixed with librdkafka >=2.15.0.
sudo apt-get install -y llvm libcurl4-openssl-dev

- name: Install sentry-cli
Expand All @@ -51,7 +50,7 @@ jobs:

- name: Build Binary
run: |
cargo build --release --locked --target=${{ matrix.target }} --bin objectstore --features profiling
cargo build --release --locked --target=${{ matrix.target }} --bin objectstore --features profiling,storage-cogs
cp target/${{ matrix.target }}/release/objectstore ./objectstore

- name: Split Debug Info
Expand Down
16 changes: 3 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ jobs:
runs-on: ubuntu-latest

steps:
# librdkafka is built from source and links against libcurl, whose headers are not
# on the runner by default. Needed by anything that builds the `kafka` feature.
# Workaround: rdkafka-sys requires always curl headers, fixed with librdkafka >=2.15.0.
- name: Install libcurl-dev
run: |
sudo apt-get update
Expand Down Expand Up @@ -77,8 +76,7 @@ jobs:
runs-on: ubuntu-latest

steps:
# librdkafka is built from source and links against libcurl, whose headers are not
# on the runner by default. Needed by anything that builds the `kafka` feature.
# Workaround: rdkafka-sys requires always curl headers, fixed with librdkafka >=2.15.0.
- name: Install libcurl-dev
run: |
sudo apt-get update
Expand Down Expand Up @@ -146,13 +144,6 @@ jobs:
runs-on: ubuntu-latest

steps:
# librdkafka is built from source and links against libcurl, whose headers are not
# on the runner by default. Needed by anything that builds the `kafka` feature.
- name: Install libcurl-dev
run: |
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev

- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Install Rust Toolchain
Expand Down Expand Up @@ -189,8 +180,7 @@ jobs:
id-token: write

steps:
# librdkafka is built from source and links against libcurl, whose headers are not
# on the runner by default. Needed by anything that builds the `kafka` feature.
# Workaround: rdkafka-sys requires always curl headers, fixed with librdkafka >=2.15.0.
- name: Install libcurl-dev
run: |
sudo apt-get update
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile.cross
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ FROM rust:slim-bookworm
RUN dpkg --add-architecture amd64 \
&& apt-get update -qq \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends make pkg-config git libssl-dev:amd64 libcurl4-openssl-dev:amd64 gcc-x86-64-linux-gnu g++-x86-64-linux-gnu \
&& apt-get install -y --no-install-recommends make git libssl-dev:amd64 gcc-x86-64-linux-gnu \
&& rm -rf /var/lib/apt/lists/*

Comment thread
lcian marked this conversation as resolved.
Resolved
RUN rustup target add x86_64-unknown-linux-gnu

ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-linux-gnu-gcc
ENV CC=x86_64-linux-gnu-gcc
ENV PKG_CONFIG_ALLOW_CROSS=1
ENV OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu
ENV OPENSSL_INCLUDE_DIR=/usr/include

Expand Down
5 changes: 4 additions & 1 deletion objectstore-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ num_cpus = { workspace = true }
objectstore-log = { workspace = true, features = ["init", "sentry"] }
objectstore-metrics = { workspace = true }
objectstore-options = { workspace = true }
objectstore-service = { workspace = true, features = ["storage-cogs"] }
objectstore-service = { workspace = true }
objectstore-types = { workspace = true }
papaya = { workspace = true }
pin-project-lite = { workspace = true }
Expand All @@ -59,6 +59,9 @@ tikv-jemalloc-ctl = { workspace = true }

[features]
profiling = ["dep:jemalloc_pprof", "tikv-jemallocator/profiling"]
# Publishes the storage COGS change stream to Kafka. Off by default because it builds
# librdkafka from source; release builds enable it.
storage-cogs = ["objectstore-service/storage-cogs"]

[dev-dependencies]
nix = { workspace = true, features = ["signal"] }
Expand Down
3 changes: 2 additions & 1 deletion objectstore-server/docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ Key configuration sections:
- `service` — storage service parameters (backend concurrency limit)
- `killswitches` — traffic blocking rules
- `storage_cogs` — where backends publish their cost-tracking change stream; corresponds
to config on each backend. See [`change_stream`](objectstore_service::change_stream).
to config on each backend. Requires the `storage-cogs` Cargo feature. See
[`change_stream`](objectstore_service::change_stream).
- `usecases` — per-use-case properties (expiration policy constraints)
- `runtime` — worker threads, metrics interval
- `sentry` / `metrics` / `logging` — observability
Expand Down
8 changes: 8 additions & 0 deletions objectstore-server/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ use anyhow::Result;
use bytes::Bytes;
use figment::providers::{Env, Format, Serialized, Yaml};
use objectstore_service::backend::local_fs::FileSystemConfig;
#[cfg(feature = "storage-cogs")]
use objectstore_service::change_stream::CostTrackerConfig;
use objectstore_service::encryption::Cipher;
use objectstore_types::auth::Permission;
Expand Down Expand Up @@ -543,6 +544,9 @@ pub struct Config {
/// - `OS__STORAGE_COGS__TOPIC=shared-resources-inventory`
/// - `OS__STORAGE_COGS__BOOTSTRAP_SERVERS=kafka:9092`
/// - `OS__STORAGE_COGS__OVERRIDE_PARAMS__<PROPERTY>=<value>`
///
/// Requires the `storage-cogs` Cargo feature.
#[cfg(feature = "storage-cogs")]
Comment thread
sentry-junior[bot] marked this conversation as resolved.
Resolved
#[serde(default)]
pub storage_cogs: Option<CostTrackerConfig>,

Expand Down Expand Up @@ -852,6 +856,7 @@ impl Default for Config {
cogs: None,
}),

#[cfg(feature = "storage-cogs")]
storage_cogs: None,
runtime: Runtime::default(),
logging: LoggingConfig::default(),
Expand Down Expand Up @@ -1166,6 +1171,7 @@ mod tests {
}

#[test]
#[cfg(feature = "storage-cogs")]
fn storage_cogs_via_env() {
figment::Jail::expect_with(|jail| {
jail.set_env("OS__STORAGE__TYPE", "bigtable");
Expand Down Expand Up @@ -1213,6 +1219,7 @@ mod tests {
};
let stream = storage.cogs.as_ref().expect("change stream");
assert_eq!(stream.sample_rate, 1.0, "reports everything by default");
#[cfg(feature = "storage-cogs")]
assert!(
config.storage_cogs.is_none(),
"no transport is configured by default"
Expand All @@ -1223,6 +1230,7 @@ mod tests {
}

#[test]
#[cfg(feature = "storage-cogs")]
fn serde_var_yaml_references() {
let secrets = tempfile::tempdir().unwrap();
let absolute_secret = secrets.path().join("kafka-password");
Expand Down
3 changes: 3 additions & 0 deletions objectstore-server/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,14 @@ impl Services {
tokio::spawn(track_allocator_metrics(config.runtime.metrics_interval));

// Absent config means no transport, and therefore no reporting.
#[cfg(feature = "storage-cogs")]
let streams = config
.storage_cogs
.as_ref()
.map(ChangeStreamFactory::new)
.unwrap_or_default();
#[cfg(not(feature = "storage-cogs"))]
let streams = ChangeStreamFactory::default();
let cipher = match config.service.cipher()? {
Some(cipher) => cipher,
None => {
Expand Down
Loading