New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
General Server Roadmap #768
Comments
Edited original post. Copying files to public_html folder should happen on writeAfter event |
Plugin and helper routesroutes handled by the server outside the static site - ie. contactify plugin - should have a /api prefix api/myPluginRoute |
Sounds exciting. This could really speed up development process as it could allow the use of different server architectures. Would also allow DocPad to be used in a number of production facilities too. |
Here is a alpha release of a server plugin. http://github.com/stongo/docpad-plugin-hapi |
2.1.0 version released of docpad-plugin-hapi. The plugin works with "docpad run" and by running it's bin file in a cloud hosted environment. To further the development of server plugins, I think two things are necessary. Action APIA server plugin needs a way to create an action similar to "server" to properly integrate with docpad Event APIA server plugin should be able to register an event that can be extended by other plugins |
I was able to make due with the lack of these APIs by harnessing the Hapi plugin system, and assigning |
I had a quick look over this with @balupton and it looks pretty neat. You're killing DocPad's internal Express server before creating the HAPI one. Pushing this forwards into DocPad, we could:
A number of methods around this. |
Sounds like a great plan for Docpad. The current implementation of docpad-plugin-hapi was definitely a bit of a
|
Route configuration to avoid pauses in serving files during regenerationIn production NODE_ENV, static file route should attempt to serve files in the following sequence to avoid pausing or returning 404s due to regeneration: serve from in-memory database > serve from /public_html > serve from /out Implemented here Development and Production envThe 'out' folder should only be copied to 'public_html' in production NODE_ENV. The static route should serve from 'out' in development for fast regenerations |
Closed in favour of #1081 |
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.
The text was updated successfully, but these errors were encountered: