diff --git a/Cargo.lock b/Cargo.lock index 8919f3ca..5d12c1f8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -564,9 +564,9 @@ dependencies = [ [[package]] name = "aws-credential-types" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e16838e6c9e12125face1c1eff1343c75e3ff540de98ff7ebd61874a89bcfeb9" +checksum = "60e8f6b615cb5fc60a98132268508ad104310f0cfb25a1c22eee76efdf9154da" dependencies = [ "aws-smithy-async", "aws-smithy-runtime-api", @@ -576,15 +576,16 @@ dependencies = [ [[package]] name = "aws-runtime" -version = "1.4.0" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f42c2d4218de4dcd890a109461e2f799a1a2ba3bcd2cde9af88360f5df9266c6" +checksum = "2424565416eef55906f9f8cece2072b6b6a76075e3ff81483ebe938a89a4c05f" dependencies = [ "aws-credential-types", "aws-sigv4", "aws-smithy-async", "aws-smithy-eventstream", "aws-smithy-http", + "aws-smithy-runtime", "aws-smithy-runtime-api", "aws-smithy-types", "aws-types", @@ -601,9 +602,9 @@ dependencies = [ [[package]] name = "aws-sdk-s3" -version = "1.46.0" +version = "1.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4abf69a87be33b6f125a93d5046b5f7395c26d1f449bf8d3927f5577463b6de0" +checksum = "00a545b16c05af9302b0b4b38a7584f6f323749e407169aa3e9b210e7c0a808d" dependencies = [ "ahash 0.8.11", "aws-credential-types", @@ -636,9 +637,9 @@ dependencies = [ [[package]] name = "aws-sdk-sso" -version = "1.39.0" +version = "1.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11822090cf501c316c6f75711d77b96fba30658e3867a7762e5e2f5d32d31e81" +checksum = "af0a3f676cba2c079c9563acc9233998c8951cdbe38629a0bef3c8c1b02f3658" dependencies = [ "aws-credential-types", "aws-runtime", @@ -658,9 +659,9 @@ dependencies = [ [[package]] name = "aws-sdk-ssooidc" -version = "1.40.0" +version = "1.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78a2a06ff89176123945d1bbe865603c4d7101bea216a550bb4d2e4e9ba74d74" +checksum = "c91b6a04495547162cf52b075e3c15a17ab6608bf9c5785d3e5a5509b3f09f5c" dependencies = [ "aws-credential-types", "aws-runtime", @@ -680,9 +681,9 @@ dependencies = [ [[package]] name = "aws-sdk-sts" -version = "1.39.0" +version = "1.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20a91795850826a6f456f4a48eff1dfa59a0e69bdbf5b8c50518fd372106574" +checksum = "99c56bcd6a56cab7933980a54148b476a5a69a7694e3874d9aa2a566f150447d" dependencies = [ "aws-credential-types", "aws-runtime", @@ -775,9 +776,9 @@ dependencies = [ [[package]] name = "aws-smithy-http" -version = "0.60.9" +version = "0.60.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9cd0ae3d97daa0a2bf377a4d8e8e1362cae590c4a1aad0d40058ebca18eb91e" +checksum = "01dbcb6e2588fd64cfb6d7529661b06466419e4c54ed1c62d6510d2d0350a728" dependencies = [ "aws-smithy-eventstream", "aws-smithy-runtime-api", @@ -815,9 +816,9 @@ dependencies = [ [[package]] name = "aws-smithy-runtime" -version = "1.6.3" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0abbf454960d0db2ad12684a1640120e7557294b0ff8e2f11236290a1b293225" +checksum = "d1ce695746394772e7000b39fe073095db6d45a862d0767dd5ad0ac0d7f8eb87" dependencies = [ "aws-smithy-async", "aws-smithy-http", @@ -859,9 +860,9 @@ dependencies = [ [[package]] name = "aws-smithy-types" -version = "1.2.2" +version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cee7cadb433c781d3299b916fbf620fea813bf38f49db282fb6858141a05cc8" +checksum = "273dcdfd762fae3e1650b8024624e7cd50e484e37abdab73a7a706188ad34543" dependencies = [ "base64-simd", "bytes 1.5.0", @@ -1236,9 +1237,9 @@ checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" [[package]] name = "bytemuck" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773d90827bc3feecfb67fab12e24de0749aad83c74b9504ecde46237b5cd24e2" +checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" [[package]] name = "byteorder" @@ -3596,9 +3597,9 @@ dependencies = [ [[package]] name = "libwebp-sys" -version = "0.9.5" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "829b6b604f31ed6d2bccbac841fe0788de93dbd87e4eb1ba2c4adfe8c012a838" +checksum = "54cd30df7c7165ce74a456e4ca9732c603e8dc5e60784558c1c6dc047f876733" dependencies = [ "cc", "glob", diff --git a/Dockerfile b/Dockerfile index 0127c0a5..57ef759e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build Stage -FROM --platform="${BUILDPLATFORM}" rust:1.80.1-slim-bookworm +FROM --platform="${BUILDPLATFORM}" rust:1.77.2-slim-bookworm USER 0:0 WORKDIR /home/rust/src diff --git a/Dockerfile.useCurrentArch b/Dockerfile.useCurrentArch index 90aa754c..a6605093 100644 --- a/Dockerfile.useCurrentArch +++ b/Dockerfile.useCurrentArch @@ -1,5 +1,5 @@ # Build Stage -FROM rust:1.80.1-slim-bookworm +FROM rust:1.77.2-slim-bookworm USER 0:0 WORKDIR /home/rust/src diff --git a/README.md b/README.md index a18d80ff..73ef6cee 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,9 @@ Note: `january`, `autumn`, and `vortex` are yet to be moved into this monorepo. Rust 1.76 or higher. +> [!CAUTION] +> The events server has a significant performance regression between Rust 1.77.2 and 1.78.0 onwards, see [issue #341](https://github.com/revoltchat/backend/issues/341). + ## Development Guide Before contributing, make yourself familiar with [our contribution guidelines](https://developers.revolt.chat/contrib.html) and the [technical documentation for this project](https://revoltchat.github.io/backend/). @@ -33,6 +36,20 @@ Before getting started, you'll want to install: > A **default.nix** is available for Nix users! > Just run `nix-shell` and continue. +As a heads-up, the development environment uses the following ports: + +| Service | Port | +| ------------------------- | :------------: | +| MongoDB | 14017 | +| Redis | 14079 | +| MinIO | 14009 | +| Maildev | 14025
14080 | +| Revolt Web App | 14701 | +| `crates/delta` | 14702 | +| `crates/bonfire` | 14703 | +| `crates/services/autumn` | 14704 | +| `crates/services/january` | 14705 | + Now you can clone and build the project: ```bash @@ -41,33 +58,14 @@ cd revolt-backend cargo build ``` -If you want to run the API and event servers: +A default configuration `Revolt.toml` is present in this project that is suited for development. + +If you'd like to change anything, create a `Revolt.overrides.toml` file to overwrite it. + +You may need to configure the legacy environment options: ```bash -# create environment file (will be deprecated in future) cp .env.example .env - -# (optionally) copy the default configuration file -cp crates/core/config/Revolt.toml Revolt.toml -# configure as necessary... -``` - -You may want to copy the following configuration: - -```toml -# Revolt.toml -[database] -mongodb = "mongodb://localhost" -redis = "redis://localhost" - -[hosts] -app = "http://local.revolt.chat" -api = "http://local.revolt.chat:8000" -events = "ws://local.revolt.chat:9000" -autumn = "http://local.revolt.chat:3000" -january = "http://local.revolt.chat:7000" -voso_legacy = "" -voso_legacy_ws = "" ``` Then continue: @@ -80,6 +78,10 @@ docker compose up -d cargo run --bin revolt-delta # run the events server cargo run --bin revolt-bonfire +# run the file server +cargo run --bin revolt-autumn +# run th proxy server +cargo run --bin revolt-january # hint: # mold -run @@ -96,10 +98,10 @@ git clone --recursive https://github.com/revoltchat/revite cd revite yarn yarn build:deps -yarn dev --port 3001 +yarn dev --port 14701 ``` -Then go to https://local.revolt.chat:3001 +Then go to https://local.revolt.chat:14701 ## Deployment Guide diff --git a/crates/bonfire/Dockerfile b/crates/bonfire/Dockerfile index 0190f2ef..af828d2b 100644 --- a/crates/bonfire/Dockerfile +++ b/crates/bonfire/Dockerfile @@ -7,4 +7,5 @@ COPY --from=builder /home/rust/src/target/release/revolt-bonfire ./ EXPOSE 9000 USER nonroot +ENV HOST=0.0.0.0:9000 CMD ["./revolt-bonfire"] diff --git a/scripts/publish-debug-image.sh b/scripts/publish-debug-image.sh index 089d7f10..1da8a31e 100755 --- a/scripts/publish-debug-image.sh +++ b/scripts/publish-debug-image.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# fail asap +set -e + # Check if an argument was provided if [ $# -eq 0 ]; then echo "No arguments provided" @@ -10,8 +13,10 @@ if [ $# -eq 0 ]; then fi DEBUG=$2 -echo "[profile.release]" >> Cargo.toml -echo "debug = $2" >> Cargo.toml +if [ "$DEBUG" = "true" ]; then + echo "[profile.release]" >> Cargo.toml + echo "debug = true" >> Cargo.toml +fi TAG=$1-debug echo "Building images, will tag for ghcr.io with $TAG!" @@ -19,7 +24,9 @@ docker build -t ghcr.io/revoltchat/base:latest -f Dockerfile.useCurrentArch . docker build -t ghcr.io/revoltchat/server:$TAG - < crates/delta/Dockerfile docker build -t ghcr.io/revoltchat/bonfire:$TAG - < crates/bonfire/Dockerfile -git restore Cargo.toml +if [ "$DEBUG" = "true" ]; then + git restore Cargo.toml +fi docker push ghcr.io/revoltchat/server:$TAG docker push ghcr.io/revoltchat/bonfire:$TAG