Replace Rocket and Tera with Rouille and Maud #88
Reference in New Issue
Block a user
No description provided.
Delete Branch "rouille_maud"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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