Back to topic list


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.

Under the hood, this just sets keys to /enduro_secret.json file.

And bucket and region into the /enduro.json file.

    "project_name": "Cool project",
    "project_slug": "cp",
    "s3": {
        "bucket": "your.bucketname",
        "region": "eu-west-1"

Cli tools

Fetching changes

$ enduro juice pull will fetch all the changes from server. Only the files will be replaced. Similar to git commit.

$ enduro juice pull -f will replace local content structure will remote, overwriting newer files which files are newer.

Pushing changes

$ enduro juice pack will first pull the newer files and then send the newer local files to juicebox.

$ enduro juice pack -f will replace remote content structure with local one even if remote is newer.

Querying status

$ enduro juice log displays history of most recent edits

$ enduro juice diff compares local content structure with remote one.

$ enduro juice diff :hash will compare specified version with the local version.

$ enduro juice diff :hash :file – will display diff between specified file in specified version.

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.

Back to topic list

Shout out to pexels and freepik