@orientesh/frontend
v1.0.25
Published
A eggjs frontend for bulb project
Downloads
29
Readme
@orientesh/frontend
A frontend framework for bulb-project**[WIP]**.
Table of Contents
- Motivation
- [Design Goals](#design\ goals)
- Implementation
- Webpack
- Seaweedfs
- CDN(TODO)
Motivation
To get our hands dirty in server-side rendering, it's quite obvious we'd need a Node.js layer. Alas, adding an extra layer for server-side rendering simply brings more complexity to the whole system and more chores for deployment.
Design Goals
Bulb is uniform. By "uniform", we mean we'd want to free application developers from managing fragmented chores.
Bulb is extensible. Bulb is bult on top of Egg.js, which is plugable. In fact, any existing plugins work directly in Bulb.
Bulb is distributed. Any serious softwares are distributed. This is the only way to robustness.
Bulb is fast.
Implementation
Hence, we've built a frontend on top of eggjs to take care of some fragile tasks:
Transpilation & bundling.
Preserve transpiled assets:
- Store server-side assets to remote distributed file system(in our case, seaweedfs)
- Push static client-side assets to CDN(TODO)
These tasks are handled by bulb online and yes, the build step is performed online.
Nonetheless, duplications of above tasks occur when deploying more than a single bulb application. In order to resolve this problem, we've chosen Zookeeper for distributed synchronization:
Take the above tasks as a whole single mono task, let's say,
pack
, which succeeds when all sub tasks succeed. It doesn't matter if it's halfway done, since those emitted/synced files will either be obsoleted or overwritten.Each bulb server will be likely to execute
pack
. But before it does, it first proposes pack to a Zookeeper server, if it is the chosen leader, then it starts packing; otherwise it becomes a follower and waits.Emitted server-side assets are fetched on demand, by other followers.
When pack
is done, every server is ready.
Webpack
TODO
SeaweedFS
TODO
CDN
TODO