After spending the better part of two weeks trying to get the Rocket + Tera version of peach-web to compile, I eventually gave up and decided it was a better use of my time to simply complete the refactor. I did this as a last resort.
Having more-or-less completed the refactor, I'm happy to report that the Rouille + Maud version reduces total build-time dependencies by approximately 200 (that means it's roughly 40% lighter). I'm able to compile a release build on my Pi 3 B+ in 30 minutes; I'm really happy with that, especially considering I wasn't able to compile the previous version at all. The compiled binary is less than 25% of the size of the previous version (4.3 MB when stripped). When running on my Pi, peach-web uses 0.0 % CPU and 0.1 % RAM.
Changes
The layout of the code has changed to reflect the different approach of Rouille and Maud.
We now have a one-file-per-route architecture, with each file containing a template builder and (sometimes) a form handler. Routes are located in src/routes, common templates are located in src/templates and utilities are located in /src/utils. All sbot interactions have been moved to src/utils/sbot.rs.
The application has two routers: one with publically-accessible routes (/src/public_router.rs) and one with routes which require the visitor to be authenticated (/src/private_router.rs).
Configuration has been moved from Rocket.toml to environment variables (DISABLE_AUTH, STANDALONE_MODE, ADDR, PORT). Default values are assigned when the program starts and are only updated if the the environment variables are set.
Remaining Work
I have not implemented all the changes required to have the complete version working (ie. not PeachPub but PeachCloud). I will do that in the weeks and months to come. I also need to convert all the old Rocket-specific test code to Rouille.
## Context
After spending the better part of two weeks trying to get the Rocket + Tera version of `peach-web` to compile, I eventually gave up and decided it was a better use of my time to simply complete the refactor. I did this as a last resort.
Having more-or-less completed the refactor, I'm happy to report that the [Rouille](https://crates.io/crates/rouille) + [Maud](https://maud.lambda.xyz/) version reduces total build-time dependencies by approximately 200 (that means it's roughly 40% lighter). I'm able to compile a release build on my Pi 3 B+ in 30 minutes; I'm really happy with that, especially considering I wasn't able to compile the previous version at all. The compiled binary is less than 25% of the size of the previous version (4.3 MB when stripped). When running on my Pi, `peach-web` uses 0.0 % CPU and 0.1 % RAM.
## Changes
The layout of the code has changed to reflect the different approach of Rouille and Maud.
We now have a one-file-per-route architecture, with each file containing a template builder and (sometimes) a form handler. Routes are located in `src/routes`, common templates are located in `src/templates` and utilities are located in `/src/utils`. All sbot interactions have been moved to `src/utils/sbot.rs`.
The application has two routers: one with publically-accessible routes (`/src/public_router.rs`) and one with routes which require the visitor to be authenticated (`/src/private_router.rs`).
Configuration has been moved from `Rocket.toml` to environment variables (`DISABLE_AUTH`, `STANDALONE_MODE`, `ADDR`, `PORT`). Default values are assigned when the program starts and are only updated if the the environment variables are set.
## Remaining Work
I have not implemented all the changes required to have the complete version working (ie. not PeachPub but PeachCloud). I will do that in the weeks and months to come. I also need to convert all the old Rocket-specific test code to Rouille.
glyph
changed title from Refactor: Replace Rocket and Tera with Rouille and Maud to Replace Rocket and Tera with Rouille and Maud2022-03-24 17:08:16 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Context
After spending the better part of two weeks trying to get the Rocket + Tera version of
peach-webto compile, I eventually gave up and decided it was a better use of my time to simply complete the refactor. I did this as a last resort.Having more-or-less completed the refactor, I'm happy to report that the Rouille + Maud version reduces total build-time dependencies by approximately 200 (that means it's roughly 40% lighter). I'm able to compile a release build on my Pi 3 B+ in 30 minutes; I'm really happy with that, especially considering I wasn't able to compile the previous version at all. The compiled binary is less than 25% of the size of the previous version (4.3 MB when stripped). When running on my Pi,
peach-webuses 0.0 % CPU and 0.1 % RAM.Changes
The layout of the code has changed to reflect the different approach of Rouille and Maud.
We now have a one-file-per-route architecture, with each file containing a template builder and (sometimes) a form handler. Routes are located in
src/routes, common templates are located insrc/templatesand utilities are located in/src/utils. All sbot interactions have been moved tosrc/utils/sbot.rs.The application has two routers: one with publically-accessible routes (
/src/public_router.rs) and one with routes which require the visitor to be authenticated (/src/private_router.rs).Configuration has been moved from
Rocket.tomlto environment variables (DISABLE_AUTH,STANDALONE_MODE,ADDR,PORT). Default values are assigned when the program starts and are only updated if the the environment variables are set.Remaining Work
I have not implemented all the changes required to have the complete version working (ie. not PeachPub but PeachCloud). I will do that in the weeks and months to come. I also need to convert all the old Rocket-specific test code to Rouille.
Refactor: Replace Rocket and Tera with Rouille and Maudto Replace Rocket and Tera with Rouille and Maud