Wanted to start a roadmap for docpad server plugin best practices.
Feel free to add more features, and I'll probably add more later.
Plugins
Servers should be included in Docpad as a plugin. Otherwise, Docpad configuration should allow default server to be disabled
Fault Tolerance
Servers should not listen to the same folder that Docpad generates to. This leads to high risk of a site crash if regeneration fails. Files should be copied via NCP to a 'public_html' folder on the 'writeAfter' event. This ensure the folder being served always contains all files. This also solves the delay in serving files during regeneration
404s
Right now assets that return a 404 trigger a regeneration. Not sure the reasoning behind it, but this is an instant DDOS opening and an attacker could easily expend process memory. This should not be the case.
Dynamic Pages
As regeneration currently stands, regenerating the entire site for one Dynamic page is also a severe DDOS risk. File specific regeneration would need to be possible for this to be a feasible feature.
Abstraction and other plugins using Express
Non-Express servers would currently need to parse existing plugins using the Express router or method override. This may be acceptable.
This could also lead to server specific plugins, which is possible okay
Router in config
At least for a plugin I'm planning, I would include a route in the plugin config for easily adding custom routes. Would make for rapid development
Want to back this issue? Place a bounty on it! We accept bounties via Bountysource.
Wanted to start a roadmap for docpad server plugin best practices.
Feel free to add more features, and I'll probably add more later.
Plugins
Servers should be included in Docpad as a plugin. Otherwise, Docpad configuration should allow default server to be disabled
Fault Tolerance
Servers should not listen to the same folder that Docpad generates to. This leads to high risk of a site crash if regeneration fails. Files should be copied via NCP to a 'public_html' folder on the 'writeAfter' event. This ensure the folder being served always contains all files. This also solves the delay in serving files during regeneration
404s
Right now assets that return a 404 trigger a regeneration. Not sure the reasoning behind it, but this is an instant DDOS opening and an attacker could easily expend process memory. This should not be the case.
Dynamic Pages
As regeneration currently stands, regenerating the entire site for one Dynamic page is also a severe DDOS risk. File specific regeneration would need to be possible for this to be a feasible feature.
Abstraction and other plugins using Express
Non-Express servers would currently need to parse existing plugins using the Express router or method override. This may be acceptable.
This could also lead to server specific plugins, which is possible okay
Router in config
At least for a plugin I'm planning, I would include a route in the plugin config for easily adding custom routes. Would make for rapid development
Want to back this issue? Place a bounty on it! We accept bounties via Bountysource.