Replace Rocket and Tera with Rouille and Maud #88
No reviewers
Labels
No Label
bug
documentation
duplicate
enhancement
help wanted
invalid
maintenance
peach-lib
peach-network
peach-oled
peach-stats
peach-web
question
refactor
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: PeachCloud/peach-workspace#88
Loading…
Reference in New Issue
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-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 insrc/templates
and 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.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.
Refactor: Replace Rocket and Tera with Rouille and Maudto Replace Rocket and Tera with Rouille and Maud