Hot Reloading 🌶️🌶️🌶️ #387

Merged
jevolk merged 11 commits from main into main 2024-05-22 00:22:17 +00:00
jevolk commented 2024-05-18 04:31:39 +00:00 (Migrated from github.com)

updated docs are now available: docs/development/hot_reload.md


To enable hot-reloading:

  1. Have patience. Understand this is a fringe mode of operation for the Rust toolchain and its ecosystem, not the beaten path you're used to. Follow these steps and please report any issues.

  2. Use a supporting platform capable of runtime dynamic shared-linking:
    ELF/glibc platforms.
    ELF/musl - does not support unloading.
    Mach/macOS - does not unload in our case (possibly due to specific thread-local complexities).

  3. Uncomment the profile-rustflags in Cargo.toml. This means you need +nightly.

  4. Uncomment the dylib crate-type in src/*/Cargo.toml and deps/rust-rocksdb/Cargo.toml

  5. Due to https://github.com/rust-lang/cargo/issues/12746 you will have to export LD_LIBRARY_PATH before running to something like: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/

  6. Run the server and edit code in any src/ directory other than src/core or src/bin. The deeper the change the harder it is to reload, so try sticking to src/router or src/admin or src/api rather than src/service or src/database.

  7. Strike ctrl-c to reload. It might take a moment if your server is under a lot of load. We're working on that too.

To actually shutdown without reloading, strike ctrl-\. Note both ctrl-c and ctrl-\ will shutdown normally in release-mode or whenever reloading is disabled.

modules
unload

--- updated docs are now available: `docs/development/hot_reload.md` --- To enable hot-reloading: 0. Have patience. Understand this is a fringe mode of operation for the Rust toolchain and its ecosystem, not the beaten path you're used to. Follow these steps and please report any issues. 1. Use a supporting platform capable of runtime dynamic shared-linking: ✅ ELF/glibc platforms. ❌ ELF/musl - does not support unloading. ❌ Mach/macOS - does not unload in our case (possibly due to specific thread-local complexities). 2. Uncomment the profile-rustflags in Cargo.toml. This means you need +nightly. 3. Uncomment the `dylib` crate-type in `src/*/Cargo.toml` and `deps/rust-rocksdb/Cargo.toml` 4. Due to https://github.com/rust-lang/cargo/issues/12746 you will have to export `LD_LIBRARY_PATH` before running to something like: `export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/` 5. Run the server and edit code in any `src/` directory other than `src/core` or `src/bin`. The deeper the change the harder it is to reload, so try sticking to `src/router` or `src/admin` or `src/api` rather than `src/service` or `src/database`. 6. Strike ctrl-c to reload. It might take a moment if your server is under a lot of load. We're working on that too. To actually shutdown without reloading, strike `ctrl-\`. Note both `ctrl-c` and `ctrl-\` will shutdown normally in release-mode or whenever reloading is disabled. ![modules](https://github.com/girlbossceo/conduwuit/assets/4682706/96ffe309-6461-4ea8-93d1-2410808d1d11) ![unload](https://github.com/girlbossceo/conduwuit/assets/4682706/056d7952-59d1-4257-8b36-fd826f5531df)
girlbossceo (Migrated from github.com) approved these changes 2024-05-22 00:21:51 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: continuwuation/continuwuity#387
No description provided.