|
2 | 2 |
|
3 | 3 | [](https://travis-ci.org/runtimejs/runtime) [](https://www.npmjs.com/package/runtimejs) [](https://freenode.net/) [](https://gitter.im/runtimejs/runtime) |
4 | 4 |
|
5 | | -__runtime.js__ is an open-source library operating system for the cloud that runs JavaScript, could be bundled up with an application and deployed as a lightweight and immutable VM image. |
| 5 | +__runtime.js__ is an open-source library operating system (unikernel) for the cloud that runs JavaScript, can be bundled up with an application and deployed as a lightweight and immutable VM image. |
6 | 6 |
|
7 | 7 | It's built on [V8 JavaScript engine](https://code.google.com/p/v8/) and uses event-driven and non-blocking I/O model inspired by [Node.js](https://nodejs.org/). At the moment [KVM](http://www.linux-kvm.org/page/Main_Page) is the only supported hypervisor. |
8 | 8 |
|
9 | | -Example **index.js**: |
| 9 | +It tries to be compatible with npm module ecosystem and supports some of the Node.js API. |
10 | 10 |
|
11 | | -```js |
12 | | -var runtime = require('runtimejs') |
13 | | -console.log('Hello world!') |
14 | | -``` |
| 11 | +_WARNING: project is in development and not ready for production use._ |
15 | 12 |
|
16 | | -Let's bundle up and run it! |
| 13 | +### Installation |
17 | 14 |
|
18 | | -```bash |
19 | | -# install dependencies |
20 | | -npm install runtimejs |
21 | | -npm install runtimeify -g |
22 | | -npm install runtime-tools -g |
| 15 | +First thing is the command line tool `runtime-cli`, it will add `runtime` command to the shell. Type `runtime` to get full usage help. |
23 | 16 |
|
24 | | -# bundle up ramdisk image |
25 | | -runtimeify index.js -o initrd |
| 17 | +``` |
| 18 | +npm install runtime-cli -g |
| 19 | +``` |
26 | 20 |
|
27 | | -# make sure you have QEMU installed |
| 21 | +Make sure QEMU is installed, it enables running applications locally. |
| 22 | + |
| 23 | +``` |
28 | 24 | brew install qemu # OSX |
29 | 25 | sudo apt-get install qemu # Ubuntu |
| 26 | +``` |
| 27 | + |
| 28 | +### Getting Started |
| 29 | + |
| 30 | +Create new project and add `index.js` entry point file: |
30 | 31 |
|
31 | | -# run it in QEMU |
32 | | -runtime-qemu ./initrd |
| 32 | +``` |
| 33 | +mkdir project |
| 34 | +cd project |
| 35 | +npm init |
| 36 | +npm install runtimejs --save |
| 37 | +echo "console.log('ok')" > index.js |
33 | 38 | ``` |
34 | 39 |
|
35 | | -WARNING: project is in development and not ready for production use. Contributions are welcome. |
| 40 | +Run project locally in QEMU: |
36 | 41 |
|
37 | | -## How does it work? |
| 42 | +``` |
| 43 | +runtime start |
| 44 | +``` |
38 | 45 |
|
39 | | -There are two main components: operating system (OS) kernel and a <a href="https://www.npmjs.com/package/runtimejs"><nobr>core JavaScript library</nobr></a>. |
| 46 | +That's it, it should start and print `ok` in the console. |
40 | 47 |
|
41 | | -The kernel is the C++ program that manages low-level resources like CPU and memory, runs applications using embedded <a href="https://code.google.com/p/v8/"><nobr>V8 JavaScript engine</nobr></a>, and exposes raw hardware to JavaScript. |
| 48 | +Optionally you can let it watch directory for changes and restart QEMU automatically: |
42 | 49 |
|
43 | | -Application, its dependencies and the core library are bundled up using <a href="http://browserify.org/">Browserify</a>, then packed into ramdisk image for kernel to use. |
| 50 | +``` |
| 51 | +runtime watch |
| 52 | +``` |
44 | 53 |
|
45 | | -runtime.js is a library operating system, because application uses it as its own dependency (library). Internal architecture is similar to [exokernels](https://en.wikipedia.org/wiki/Exokernel), where system exposes the hardware to application code and forces as few abstractions as possible. |
| 54 | +## How does it work? |
| 55 | + |
| 56 | +There are two main components: operating system kernel and a <a href="https://www.npmjs.com/package/runtimejs"><nobr>JavaScript library</nobr></a>. |
| 57 | + |
| 58 | +The kernel is written in C++ and manages low-level resources like CPU and memory, runs JavaScript using embedded V8 engine. Library drives the entire system and manages hardware devices (usually virtualized by hypervisor). |
46 | 59 |
|
47 | 60 | ## Docs |
48 | 61 |
|
49 | 62 | [API docs](https://github.com/runtimejs/runtime/wiki/API-docs) |
50 | 63 |
|
| 64 | +## Community |
| 65 | + |
| 66 | +[Modules and projects developed by the community for runtime.js](https://github.com/runtimejs/runtime/wiki/Community) |
| 67 | + |
51 | 68 | License |
52 | 69 | ---- |
53 | 70 | Apache License, Version 2.0 |
0 commit comments