Skip to content

Commit

Permalink
chore: lock Rust version to 1.77.2 (related to #341)
Browse files Browse the repository at this point in the history
  • Loading branch information
insertish committed Sep 9, 2024
1 parent 70bdeec commit 2433fa6
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 53 deletions.
45 changes: 23 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.useCurrentArch
Original file line number Diff line number Diff line change
@@ -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

Expand Down
54 changes: 28 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/).
Expand All @@ -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<br>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
Expand All @@ -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.

```bash
# create environment file (will be deprecated in future)
cp .env.example .env
If you'd like to change anything, create a `Revolt.overrides.toml` file to overwrite it.

# (optionally) copy the default configuration file
cp crates/core/config/Revolt.toml Revolt.toml
# configure as necessary...
```
You may need to configure the legacy environment options:

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 = ""
```bash
cp .env.example .env
```

Then continue:
Expand All @@ -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 <cargo build, cargo run, etc...>
Expand All @@ -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

Expand Down
1 change: 1 addition & 0 deletions crates/bonfire/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
13 changes: 10 additions & 3 deletions scripts/publish-debug-image.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -10,16 +13,20 @@ 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!"
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

0 comments on commit 2433fa6

Please sign in to comment.