diff --git a/.github/SQLX_AND_CROSS_COMPILATION.md b/.github/SQLX_AND_CROSS_COMPILATION.md new file mode 100644 index 0000000..87718cd --- /dev/null +++ b/.github/SQLX_AND_CROSS_COMPILATION.md @@ -0,0 +1,181 @@ +# SQLx Offline and Cross-Compilation Setup + +This document explains the configuration changes made to support SQLx offline builds and fix cross-compilation issues. + +## Problems Solved + +### 1. SQLx Offline Compilation +When `SQLX_OFFLINE=true`, each Rust project needs access to `.sqlx` query metadata files in their local directory. Previously, these files only existed at the workspace root, causing builds to fail outside Docker. + +### 2. Cross-Compilation OpenSSL Issues +Cross-compilation was failing due to OpenSSL dependencies being pulled in by various crates, which is notoriously difficult to cross-compile. + +## Solutions Implemented + +### SQLx Offline Setup + +#### Script: `scripts/setup-sqlx-offline.sh` +- Automatically copies `.sqlx` files from workspace root to each SQLx-dependent project +- Identifies projects that use SQLx by checking `Cargo.toml` files +- Projects that receive `.sqlx` files: + - `apps/aqua` + - `services/cadet` + - `services/satellite` + +#### CI Integration +The script is now called in all CI jobs that build Rust code: +- `setup-and-build` job +- `rust-cross-compile` job +- `rust-quality` job +- `security-audit` job + +### Cross-Compilation Fixes + +#### 1. Replaced OpenSSL with rustls +Updated workspace dependencies to use rustls instead of OpenSSL: + +```toml +# Root Cargo.toml +sqlx = { version = "0.8", features = [ + "runtime-tokio", + "postgres", + "uuid", + "tls-rustls", # Instead of default OpenSSL +] } + +reqwest = { version = "0.12", default-features = false, features = [ + "json", + "rustls-tls", # Instead of default native-tls + "stream", + "gzip", +] } + +tokio-tungstenite = { version = "*", default-features = false, features = [ + "rustls-tls-webpki-roots", # Instead of default native-tls +] } +``` + +#### 2. Fixed Workspace Dependency Conflicts +The `services/Cargo.toml` was overriding workspace dependencies with different configurations. Fixed by: +- Changing `reqwest = { version = "0.12", features = ["json"] }` to `reqwest.workspace = true` +- Changing `tokio-tungstenite = "0.24"` to `tokio-tungstenite.workspace = true` + +#### 3. Enhanced Cross.toml Configuration +Created comprehensive `Cross.toml` files for cross-compilation: + +```toml +[build.env] +passthrough = [ + "CARGO_HOME", + "CARGO_TARGET_DIR", + "SQLX_OFFLINE", + "PKG_CONFIG_ALLOW_CROSS", +] + +[target.aarch64-unknown-linux-gnu] +image = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main" + +[target.aarch64-unknown-linux-gnu.env] +passthrough = ["CARGO_HOME", "CARGO_TARGET_DIR", "SQLX_OFFLINE"] +PKG_CONFIG_ALLOW_CROSS = "1" +RUSTFLAGS = "-C target-feature=+crt-static -C link-arg=-s" +CC_aarch64_unknown_linux_gnu = "aarch64-linux-gnu-gcc" +CXX_aarch64_unknown_linux_gnu = "aarch64-linux-gnu-g++" +``` + +#### 4. Improved CI Cross-Compilation +- Uses latest `cross` from Git: `cargo install cross --git https://github.com/cross-rs/cross` +- Sets `PKG_CONFIG_ALLOW_CROSS=1` environment variable +- Copies `.sqlx` files to individual service directories during cross-compilation +- Improved executable collection with better filtering + +### Executable Collection + +Enhanced executable collection in CI: +- Filters out build artifacts (`.d` files and temporary files with `-` in names) +- Handles missing target directories gracefully +- Collects executables for both x86_64 and aarch64 targets +- Provides clear logging of collected executables + +## File Changes + +### Created +- `scripts/setup-sqlx-offline.sh` - SQLx offline setup script +- `Cross.toml` - Root cross-compilation config +- `services/Cross.toml` - Services cross-compilation config +- `apps/aqua/Cross.toml` - Aqua cross-compilation config + +### Modified +- `Cargo.toml` - Updated workspace dependencies to use rustls +- `services/Cargo.toml` - Fixed workspace dependency usage +- `.github/workflows/ci.yml` - Added SQLx setup and improved cross-compilation + +## Usage + +### Running SQLx Setup Locally +```bash +./scripts/setup-sqlx-offline.sh +``` + +### Cross-Compilation Locally +```bash +# Install cross if not already installed +cargo install cross --git https://github.com/cross-rs/cross + +# Add target +rustup target add aarch64-unknown-linux-gnu + +# Set environment +export PKG_CONFIG_ALLOW_CROSS=1 +export SQLX_OFFLINE=true + +# Run SQLx setup +./scripts/setup-sqlx-offline.sh + +# Cross-compile services +cd services +cross build --release --target aarch64-unknown-linux-gnu + +# Cross-compile apps +cd ../apps/aqua +cross build --release --target aarch64-unknown-linux-gnu +``` + +### Updating SQLx Queries +When you add or modify SQL queries: + +1. Generate new query metadata from the services directory: + ```bash + cd services + cargo sqlx prepare + ``` + +2. Update all project copies: + ```bash + ./scripts/setup-sqlx-offline.sh + ``` + +## Troubleshooting + +### Cross-Compilation Still Fails +- Ensure you're using the latest `cross` from Git +- Check that `PKG_CONFIG_ALLOW_CROSS=1` is set +- Verify no dependencies are pulling in OpenSSL (use `cargo tree | grep openssl`) + +### SQLx Offline Errors +- Run `./scripts/setup-sqlx-offline.sh` after any SQL query changes +- Ensure `.sqlx` directory exists in workspace root +- Check that `SQLX_OFFLINE=true` is set in CI environment + +### Missing Executables +- Check that build succeeded without errors +- Verify executable names match expected service/app names +- Look for executables in `artifacts/` directory structure + +## Dependencies Avoided +To maintain cross-compilation compatibility, avoid dependencies that: +- Default to OpenSSL (use rustls variants) +- Require system libraries not available in cross containers +- Have complex native build requirements + +Always test cross-compilation locally before pushing changes. \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e0dfc77..59e59e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,10 +37,29 @@ jobs: - name: Build Node packages run: pnpm build - - name: Build Rust (x86_64) + - name: Build Rust services (x86_64) run: | cargo build --release --all-features + - name: Build Rust apps (x86_64) + run: | + cd apps/aqua + cargo build --release --all-features + + - name: Collect executables (x86_64) + run: | + mkdir -p artifacts/x86_64 + # Copy service executables + if [ -d "services/target/release" ]; then + find services/target/release -maxdepth 1 -type f -executable ! -name "*.d" ! -name "*-*" -exec cp {} artifacts/x86_64/ \; + fi + # Copy app executables + if [ -d "apps/aqua/target/release" ]; then + find apps/aqua/target/release -maxdepth 1 -type f -executable ! -name "*.d" ! -name "*-*" -exec cp {} artifacts/x86_64/ \; + fi + echo "x86_64 executables:" + ls -la artifacts/x86_64/ || echo "No executables found" + - name: Upload Node build artifacts uses: actions/upload-artifact@v4 with: @@ -55,7 +74,7 @@ jobs: with: name: rust-builds-x86_64 path: | - target/release/ + artifacts/x86_64/ retention-days: 1 rust-cross-compile: @@ -82,18 +101,35 @@ jobs: - name: Install cross-compilation tools run: | - cargo install cross + cargo install cross --git https://github.com/cross-rs/cross rustup target add ${{ matrix.target }} + # Set up environment for cross-compilation + echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV + + - name: Cross-compile services + run: | + cross build --release --all-features --target ${{ matrix.target }} - - name: Cross-compile rust - run: cross build --release --all-features --target ${{ matrix.target }} + - name: Collect cross-compiled executables + run: | + mkdir -p artifacts/${{ matrix.target }} + # Copy service executables + if [ -d "services/target/${{ matrix.target }}/release" ]; then + find services/target/${{ matrix.target }}/release -maxdepth 1 -type f -executable ! -name "*.d" ! -name "*-*" -exec cp {} artifacts/${{ matrix.target }}/ \; + fi + # Copy app executables + if [ -d "apps/aqua/target/${{ matrix.target }}/release" ]; then + find apps/aqua/target/${{ matrix.target }}/release -maxdepth 1 -type f -executable ! -name "*.d" ! -name "*-*" -exec cp {} artifacts/${{ matrix.target }}/ \; + fi + echo "Cross-compiled executables for ${{ matrix.target }}:" + ls -la artifacts/${{ matrix.target }}/ || echo "No executables found" - name: Upload cross-compiled artifacts uses: actions/upload-artifact@v4 with: name: rust-builds-${{ matrix.target }} path: | - target/${{ matrix.target }}/release/ + artifacts/${{ matrix.target }}/ retention-days: 1 rust-quality: diff --git a/Cargo.lock b/Cargo.lock index 9d17570..4ce7592 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -165,6 +165,19 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +[[package]] +name = "async-compression" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddb939d66e4ae03cee6091612804ba446b12878410cfa17f785f4dd67d4014e8" +dependencies = [ + "flate2", + "futures-core", + "memchr", + "pin-project-lite", + "tokio", +] + [[package]] name = "async-lock" version = "3.4.0" @@ -811,16 +824,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" -[[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "core-foundation" version = "0.10.1" @@ -870,6 +873,15 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + [[package]] name = "crossbeam-channel" version = "0.5.15" @@ -1257,6 +1269,16 @@ dependencies = [ "subtle", ] +[[package]] +name = "flate2" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + [[package]] name = "flume" version = "0.11.1" @@ -1281,21 +1303,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.2.1" @@ -1655,22 +1662,6 @@ dependencies = [ "webpki-roots 1.0.2", ] -[[package]] -name = "hyper-tls" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" -dependencies = [ - "bytes", - "http-body-util", - "hyper", - "hyper-util", - "native-tls", - "tokio", - "tokio-native-tls", - "tower-service", -] - [[package]] name = "hyper-util" version = "0.1.16" @@ -1690,11 +1681,9 @@ dependencies = [ "percent-encoding", "pin-project-lite", "socket2 0.6.0", - "system-configuration", "tokio", "tower-service", "tracing", - "windows-registry", ] [[package]] @@ -2444,23 +2433,6 @@ dependencies = [ "getrandom 0.2.16", ] -[[package]] -name = "native-tls" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" -dependencies = [ - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework 2.11.1", - "security-framework-sys", - "tempfile", -] - [[package]] name = "nom" version = "7.1.3" @@ -2592,50 +2564,12 @@ version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" -[[package]] -name = "openssl" -version = "0.10.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8" -dependencies = [ - "bitflags 2.9.1", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", -] - [[package]] name = "openssl-probe" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" -[[package]] -name = "openssl-sys" -version = "0.9.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "option-ext" version = "0.2.0" @@ -3089,22 +3023,19 @@ version = "0.12.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cbc931937e6ca3a06e3b6c0aa7841849b160a90351d6ab467a8b9b9959767531" dependencies = [ + "async-compression", "base64", "bytes", - "encoding_rs", "futures-core", - "h2", + "futures-util", "http", "http-body", "http-body-util", "hyper", "hyper-rustls", - "hyper-tls", "hyper-util", "js-sys", "log", - "mime", - "native-tls", "percent-encoding", "pin-project-lite", "quinn", @@ -3115,14 +3046,15 @@ dependencies = [ "serde_urlencoded", "sync_wrapper", "tokio", - "tokio-native-tls", "tokio-rustls", + "tokio-util", "tower", "tower-http", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", + "wasm-streams", "web-sys", "webpki-roots 1.0.2", ] @@ -3279,7 +3211,7 @@ dependencies = [ "openssl-probe", "rustls-pki-types", "schannel", - "security-framework 3.2.0", + "security-framework", ] [[package]] @@ -3351,19 +3283,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "security-framework" -version = "2.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" -dependencies = [ - "bitflags 2.9.1", - "core-foundation 0.9.4", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - [[package]] name = "security-framework" version = "3.2.0" @@ -3371,7 +3290,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" dependencies = [ "bitflags 2.9.1", - "core-foundation 0.10.1", + "core-foundation", "core-foundation-sys", "libc", "security-framework-sys", @@ -3663,6 +3582,7 @@ dependencies = [ "memchr", "once_cell", "percent-encoding", + "rustls", "serde", "serde_json", "sha2", @@ -3674,6 +3594,7 @@ dependencies = [ "tracing", "url", "uuid", + "webpki-roots 0.26.11", ] [[package]] @@ -3942,27 +3863,6 @@ dependencies = [ "windows 0.57.0", ] -[[package]] -name = "system-configuration" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" -dependencies = [ - "bitflags 2.9.1", - "core-foundation 0.9.4", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "tagptr" version = "0.2.0" @@ -4139,16 +4039,6 @@ dependencies = [ "syn 2.0.104", ] -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - [[package]] name = "tokio-rustls" version = "0.26.2" @@ -4647,6 +4537,19 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "wasm-streams" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "web-sys" version = "0.3.77" @@ -4857,17 +4760,6 @@ dependencies = [ "windows-link", ] -[[package]] -name = "windows-registry" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a9ed28765efc97bbc954883f4e6796c33a06546ebafacbabee9696967499e" -dependencies = [ - "windows-link", - "windows-result 0.3.4", - "windows-strings", -] - [[package]] name = "windows-result" version = "0.1.2" diff --git a/Cargo.toml b/Cargo.toml index 0ded591..67cf2c1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,21 +12,33 @@ resolver = "2" tokio = { version = "1.0", features = ["rt-multi-thread", "macros"] } axum = { version = "0.8", features = ["macros"] } tower-http = { version = "0.6", features = ["cors"] } -sqlx = { version = "0.8", features = ["runtime-tokio", "postgres", "uuid"] } +sqlx = { version = "0.8", features = [ + "runtime-tokio", + "postgres", + "uuid", + "tls-rustls", +] } serde = { version = "1.0", features = ["derive"] } anyhow = "1.0" serde_json = "1.0" tracing = "0.1" tracing-subscriber = "0.3" metrics = "0.23" -reqwest = { version = "0.12", features = ["json", "rustls-tls"] } +reqwest = { version = "0.12", default-features = false, features = [ + "json", + "rustls-tls", + "stream", + "gzip", +] } url = "2.5" rand = "0.8" flume = "0.11" async-trait = "0.1" time = "0.3" dotenvy = "0.15" -tokio-tungstenite = { version = "*", features = ["rustls-tls-webpki-roots"] } +tokio-tungstenite = { version = "*", default-features = false, features = [ + "rustls-tls-webpki-roots", +] } atrium-api = "0.25" chrono = "0.4" uuid = { version = "1.0", features = ["v4", "serde"] } diff --git a/Cross.toml b/Cross.toml new file mode 100644 index 0000000..0a0706b --- /dev/null +++ b/Cross.toml @@ -0,0 +1,20 @@ +[build.env] +passthrough = [ + "CARGO_HOME", + "CARGO_TARGET_DIR", + "SQLX_OFFLINE", + "PKG_CONFIG_ALLOW_CROSS", +] + +[target.aarch64-unknown-linux-gnu] +image = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main" + +[target.aarch64-unknown-linux-gnu.env] +passthrough = ["CARGO_HOME", "CARGO_TARGET_DIR", "SQLX_OFFLINE"] +# Allow cross-compilation of native dependencies +PKG_CONFIG_ALLOW_CROSS = "1" +# Use static linking to reduce runtime dependencies +RUSTFLAGS = "-C target-feature=+crt-static -C link-arg=-s" +# Disable problematic features that might require OpenSSL +CC_aarch64_unknown_linux_gnu = "aarch64-linux-gnu-gcc" +CXX_aarch64_unknown_linux_gnu = "aarch64-linux-gnu-g++" diff --git a/apps/aqua/Cross.toml b/apps/aqua/Cross.toml new file mode 100644 index 0000000..0a0706b --- /dev/null +++ b/apps/aqua/Cross.toml @@ -0,0 +1,20 @@ +[build.env] +passthrough = [ + "CARGO_HOME", + "CARGO_TARGET_DIR", + "SQLX_OFFLINE", + "PKG_CONFIG_ALLOW_CROSS", +] + +[target.aarch64-unknown-linux-gnu] +image = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main" + +[target.aarch64-unknown-linux-gnu.env] +passthrough = ["CARGO_HOME", "CARGO_TARGET_DIR", "SQLX_OFFLINE"] +# Allow cross-compilation of native dependencies +PKG_CONFIG_ALLOW_CROSS = "1" +# Use static linking to reduce runtime dependencies +RUSTFLAGS = "-C target-feature=+crt-static -C link-arg=-s" +# Disable problematic features that might require OpenSSL +CC_aarch64_unknown_linux_gnu = "aarch64-linux-gnu-gcc" +CXX_aarch64_unknown_linux_gnu = "aarch64-linux-gnu-g++" diff --git a/services/Cargo.lock b/services/Cargo.lock index 5d96859..b10087a 100644 --- a/services/Cargo.lock +++ b/services/Cargo.lock @@ -2836,6 +2836,7 @@ checksum = "2491382039b29b9b11ff08b76ff6c97cf287671dbb74f0be44bda389fffe9bd1" dependencies = [ "aws-lc-rs", "once_cell", + "ring", "rustls-pki-types", "rustls-webpki", "subtle", @@ -3236,6 +3237,7 @@ dependencies = [ "memchr", "once_cell", "percent-encoding", + "rustls", "serde", "serde_json", "sha2", @@ -3247,6 +3249,7 @@ dependencies = [ "tracing", "url", "uuid", + "webpki-roots 0.26.11", ] [[package]] @@ -4171,6 +4174,24 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webpki-roots" +version = "0.26.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9" +dependencies = [ + "webpki-roots 1.0.2", +] + +[[package]] +name = "webpki-roots" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8983c3ab33d6fb807cfcdad2491c4ea8cbc8ed839181c7dfd9c67c83e261b2" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "which" version = "4.4.2" diff --git a/services/Cargo.toml b/services/Cargo.toml index 7e79b75..f7f3ae6 100644 --- a/services/Cargo.toml +++ b/services/Cargo.toml @@ -12,6 +12,7 @@ sqlx = { version = "0.8", features = [ "postgres", "uuid", "chrono", + "tls-rustls", ] } serde = { version = "1.0", features = ["derive"] } anyhow = "1.0" @@ -19,14 +20,14 @@ serde_json = "1.0" tracing = "0.1" tracing-subscriber = "0.3" metrics = "0.23" -reqwest = { version = "0.12", features = ["json"] } +reqwest.workspace = true url = "2.5" rand = "0.8" flume = "0.11" async-trait = "0.1" time = "0.3" dotenvy = "0.15" -tokio-tungstenite = "0.24" +tokio-tungstenite.workspace = true atrium-api = "0.25" chrono = { version = "0.4", features = ["serde"] } uuid = { version = "1.0", features = ["v4", "serde"] } diff --git a/services/Cross.toml b/services/Cross.toml new file mode 100644 index 0000000..0a0706b --- /dev/null +++ b/services/Cross.toml @@ -0,0 +1,20 @@ +[build.env] +passthrough = [ + "CARGO_HOME", + "CARGO_TARGET_DIR", + "SQLX_OFFLINE", + "PKG_CONFIG_ALLOW_CROSS", +] + +[target.aarch64-unknown-linux-gnu] +image = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main" + +[target.aarch64-unknown-linux-gnu.env] +passthrough = ["CARGO_HOME", "CARGO_TARGET_DIR", "SQLX_OFFLINE"] +# Allow cross-compilation of native dependencies +PKG_CONFIG_ALLOW_CROSS = "1" +# Use static linking to reduce runtime dependencies +RUSTFLAGS = "-C target-feature=+crt-static -C link-arg=-s" +# Disable problematic features that might require OpenSSL +CC_aarch64_unknown_linux_gnu = "aarch64-linux-gnu-gcc" +CXX_aarch64_unknown_linux_gnu = "aarch64-linux-gnu-g++"