How to Install Nucleoid on Ubuntu 18.04

Can Mingir
Jul 2 · 3 min read
Image for post
Image for post

Nucleoid is an open source (Apache 2.0), a declarative runtime that enables declarative programming in ES6 (JavaScript) syntax and runs as a runtime and database at the same time.

On Linux, Nucleoid runs a service with accepting HTTP request, and dependent on a configuration, it creates process tree with sub-processes as multiprocessing.

Install

First, it requires to add official PPA repository into local APT package list:

install as APT package:

This installs Nucleoid with its dependencies, and automatically starts at startup.

Terminal

Once the installation is complete, Nucleoid starts its terminal, which is available at IP address of the server on a browser.

Image for post
Image for post

At the same time, it accepts POST request over the same IP with Content-Type: application/javascript. This entry is mostly used for interaction with API Gateways.

Image for post
Image for post

Configuration

/etc/nucleoid/configuration.json keeps configurations and it requires to restart after any changes.

/opt/nucleoid/ is for configuration scripts, which pointed in configuration.json.

Authorization: It takes Node.js script with optional imported modules and decides whether authorized the request, this is commonly used for integrating with Oauth server like Amazon Cognito, JWT, Active Directory etc.

Process: Nucleoid is a multiprocess runtime environment. So, each HTTP request has to be directed to dedicated process(es). This parameter takes Node.js script to decide or alternatively authorization server may provide this information, and the default process is main process.

Example:

/etc/nucleoid/configuration.json:

/opt/nucleoid/jwt-process.js:

It looks at JWT token of username and redirects to process to users/[USERNAME].

Port: Port number of Nucleoid. Default is 80 with sudo privileges.

Processes

Nucleoid is a multiprocess environment with flexible deployment structure, which means processes can be created in-flight based on desired model. Once requested, Nucleoid spawns a brand new process with including storage reservation.

Processes are lazy initialized in Nucleoid, so that, after reboot or manually killed, processes won’t start unless needed.

Image for post
Image for post

Data Location

Nucleoid runs a programming runtime and database, so each statement is stored at /var/lib/nucleoid/ folder, and each process has own storage space with Single-lined JSON format.

Single-lined JSON

Nucleoid stores declarative statements as appending data file, which provides ubiquitous human-readable files and faster disk operation.

Learn more at nucleoid.org/tutorial

Nucleoid

Declarative Runtime System

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store