Juicebox

Juicebox provides versioning/backup for enduro.js projects. It's optional to use, but if you decide to host your project on infrastructure without a persistent file storage(such as (heroku)[/docs/heroku]), juicebox in combination with a remote filesystem is necessary to store all your cms content.

Setting up juicebox

All you need to do is run enduro setup juicebox and confirm enabling of the juicebox. Under the hood, this just sets juicebox_enabled variable in /enduro.json to true.

Enduro.js juicebox is now enabled. Your content files are versioned and backed up in the /remote/juicebox folder

Remote Filesystem

Juicebox makes a lot of sense when hosting the page on an infrastructure without persistent file-system, such as heroku. To enable using aws s3 as filesystem, just use enduro setup s3 and input keys, bucket name and preferred region.

How juicebox works internally

Enduro.js uses flat-file database stored in local file system for content. This works great, it's fast, simple and lightweight. However the problem is when you want to run your project in cloud-like environment like Heroku, which does not have persistent file-storage. For this purpose, enduro.js uses a remote file-system through the use of juicebox. Still flat-file, still simple, still fast. On top of this there is a versioning functionality and you can run multiple instances of your project and enduro.js will still work nicely and the content will be beautifully synced.

On each $ enduro juice pack or press of a 'publish' button, enduro.js tarballs and gzips all the content files. These files are just text files, so they tend to be quite compressible and small. This compressed archive file is sent to remote file-system, alongside updating juice.json in the same place. This way, all your content is securely backed up and never overwritten.

On $ enduro juice pull or press of a update button, enduro.js downloads the juice.json file, finds out which archive is the latest, downloads it and if it has newer files, overwrites the local files.