Code Monkey home page Code Monkey logo

jakhu's Introduction

jakhu Dep Status Coverage Status Dependency Status devDependency Status

Jakhu is a simple, nodejs based, app for managing your web-app(s). It has a modern dashboard, lets you run, test and deploy apps to your favourite service provider (coming soon) and - most importantly - keeps a backup of your web-apps.

One of my really early projects in JS when I was just starting.

Goals

I need to:

  • Create a way to manage web-apps
  • Test the code (get ~90% test coverage for cli and browser tests)
  • The dashboard should be modern, attractive and informative The status of this is available in CHANGELOG.md and ROADMAP.md

Building

Unix (Debian, Ubuntu, CentOS) and Mac OSX

Simple install coming soon! Prerequisites:

  • gcc and g++ 4.8 or newer, or
  • clang and clang++ 3.4 or newer (for node-gyp)
  • Nodejs v4.0.0 or newer (v5.3.0 reccommended) & npm
  • Python
  • Ruby
  • Docker
  • Vagrant (if you want to run and test web-apps in vagrant boxes or run the database in vagrant)
  • Virtual box (for vagrant)
  • Mongodb (if you don't want to use docker or vagrant)
Building:
``` $ [sudo] npm install -g coffee-script grunt-cli node-gyp $ [sudo] gem install bundle $ npm install $ bundle install $ grunt sass:dist ```
Getting started:
``` $ export NODE_ENV=development $ ./bin/jakhu server ```

Windows

Prerequisites:

  • Microsoft Visual Studio C++ 2013
  • Nodejs v4.0.0 or newer (v5.3.0 reccommended) & npm
  • Python
  • Ruby
  • Docker with docker-machine
  • Vagrant (if you want to run and test web-apps in vagrant boxes or run the database in vagrant)
  • Virtual box (for vagrant & docker)
  • Mongodb (if you don't want to use docker or vagrant)
  • A bash enviroment (git-bash, mingw, cygwin, msys) with git
Building:
``` $ npm install -g coffee-script grunt-cli node-gyp $ gem install bundle $ npm install $ bundle install $ grunt sass:dist ```
Getting started:
``` $ export NODE_ENV=development $ ./bin/jakhu server ```

To run in a Vagrant box (from host): bin/jakhu vagrant

Tests:

mocha test/**/*.js

jakhu's People

Contributors

gum-joe avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

gitter-badger

jakhu's Issues

Create dashboard

Dashboard files are in views/dashboard. Sass is in views/css/dashboard.scss
We need it to be responsive (works on mobiles, tablet, and PCs without looking awkward).
It must have:

A hamburger menu ๐Ÿ” โœ”๏ธ
A navbar to jump to places on screen
Notifications area #40
Stats
Ability to start, stop and restart web-apps/tubs

Checking out files prints undefined even though the file is checked out

File: boot/libs/checks/checkFile.js
Code:

var fs = require('fs')
var path = require('path')
var clicolour = require('cli-color')
var error = require('../../../libs/error/bsod.js')

var files = ["app.js", "node_modules", "libs"];

var i;

exports.checkFiles = function checkFiles(x){
  // TODO: Fix issue where files[i] is undefined
  console.log(clicolour.yellowBright("ALPHA:")+"Checking out files need fixing, does in fact check out files correctly");
  for (var i = 0; i < files.length; i++) {
    fs.stat(files[i], function(err, stat){
      if(err === null){
          return console.log('Checked out file '+files[i]+"..."+clicolour.greenBright("OK"));
          console.log(i);
        }
        else if( err.code == 'ENOENT'){
          console.log('Checked out file '+files[i]+"..."+clicolour.redBright("ERROR!"));
          throw error.throwError("BOOT_"+err.code+"_CHECKS_NOT_FOUND:"+files[i], err, err.code);
        }
        else{
          console.log('Checked out file '+files[i]+"..."+clicolour.redBright("ERROR!"));
          throw error.throwError("BOOT_CHECKS_FILES_"+err.code+":"+files[i], err, err.code);
            }
          });
  }
});
};

Output:

Checked out file undefined...OK
Checked out file undefined...OK
Checked out file undefined...OK

Need to change the way config is loaded

I've found a bug which affects first-time start-up. When you test, or run boss,js through app.js's start() function, you may find you receive the following:

Error: ENOENT: no such file or directory, open 'tmp/config.yml'
     at Error (native)
     at Object.fs.openSync (fs.js:549:18)
     at /home/travis/build/Gum-Joe/boss.js/boot/libs/configure.js:79:8
     at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)
 #  Below this is any test exceptions

This is due to the fact that boss loads the config by merging all the YAML config files in ./config into one file, called config.yml, into ./tmp. Unfortunately, this file is not created when you first start boss up and the file is parsed before it is created. This throws an error.

We solved this problem, temporalily, by execSync()ing a file to load the config and create config.yml` during boot. Since this is not done in app.js, it crashes the tests

We will soon fix this!

Database needs better security

There appears to be a bug in mongodb, which causes use to be unable to set a username and password

Repo: Gum-Joe/Web-OS-cookbooks
Recipe: mongodb::default
Action: mongo web-os --eval 'db.addUser(admin, admin);'

Output:

==> default: STDOUT: MongoDB shell version: 2.4.9
==> default: connecting to: test
==> default: Sat Nov  7 14:30:23.439 SyntaxError: Unexpected identifier
==> default: MongoDB shell version: 2.4.9
==> default: connecting to: web-os
==> default: Sat Nov  7 14:30:23.493 ReferenceError: admin is not defined
==> default: STDERR:

Create dashboard framework

We need to make the framework for the runner and images.
Pull request:

Framework:

  • Github api framework + socket.io from browser
  • Runner for web-apps
  • Images (docker) + vms (Vagrant)

Dashboard needs develoment

Dashboard files are in views/dashboard. Sass is in views/css/dashboard.scss
We need it to be responsive (works on mobiles, tablet, and PCs without looking awkward).
It must have:

  • A hamburger menu ๐Ÿ” โœ”๏ธ
  • A navbar to jump to places on screen
  • Notifications area
  • Stats
  • Ability to start, stop and restart web-apps/tubs

Dashboard Authentication

The dashboard is still not secure! Dashboard should be auth based using passport strategies for local, github and remeber me.

Docker-compose up fails

When running docker-compose up on a tub directory, it fails with:

sample-tub-default   | /bin/sh: /runner/bin/jakhurun: Permission denied
sample-tub-def       | /bin/sh: /runner/bin/jakhurun: Permission denied

Full output:

Starting sample-tub-default
sample-service-mongo is up-to-date
Starting sample-tub-def
Attaching to sample-tub-default, sample-service-mongo, sample-tub-def
sample-tub-default   | /bin/sh: /runner/bin/jakhurun: Permission denied
sample-tub-def       | /bin/sh: /runner/bin/jakhurun: Permission denied
sample-tub-default exited with code 126
sample-service-mongo | 2016-01-30T17:34:34.834+0000 I CONTROL  [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=7e60c1f2d642
sample-service-mongo | 2016-01-30T17:34:34.834+0000 I CONTROL  [initandlisten] db version v3.2.1
sample-service-mongo | 2016-01-30T17:34:34.834+0000 I CONTROL  [initandlisten] git version: a14d55980c2cdc565d4704a7e3ad37e4e535c1b2
sample-service-mongo | 2016-01-30T17:34:34.834+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013
sample-service-mongo | 2016-01-30T17:34:34.834+0000 I CONTROL  [initandlisten] allocator: tcmalloc
sample-service-mongo | 2016-01-30T17:34:34.834+0000 I CONTROL  [initandlisten] modules: none
sample-service-mongo | 2016-01-30T17:34:34.834+0000 I CONTROL  [initandlisten] build environment:
sample-service-mongo | 2016-01-30T17:34:34.834+0000 I CONTROL  [initandlisten]     distmod: debian71
sample-service-mongo | 2016-01-30T17:34:34.834+0000 I CONTROL  [initandlisten]     distarch: x86_64
sample-service-mongo | 2016-01-30T17:34:34.834+0000 I CONTROL  [initandlisten]     target_arch: x86_64
sample-service-mongo | 2016-01-30T17:34:34.834+0000 I CONTROL  [initandlisten] options: {}
sample-service-mongo | 2016-01-30T17:34:34.845+0000 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=1G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
sample-service-mongo | 2016-01-30T17:34:34.941+0000 I CONTROL  [initandlisten]
sample-service-mongo | 2016-01-30T17:34:34.941+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
sample-service-mongo | 2016-01-30T17:34:34.941+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
sample-service-mongo | 2016-01-30T17:34:34.941+0000 I CONTROL  [initandlisten]
sample-service-mongo | 2016-01-30T17:34:34.941+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
sample-service-mongo | 2016-01-30T17:34:34.941+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
sample-service-mongo | 2016-01-30T17:34:34.941+0000 I CONTROL  [initandlisten]
sample-service-mongo | 2016-01-30T17:34:34.941+0000 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
sample-service-mongo | 2016-01-30T17:34:34.942+0000 I NETWORK  [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
sample-service-mongo | 2016-01-30T17:34:34.967+0000 I NETWORK  [initandlisten] waiting for connections on port 27017
sample-tub-def exited with code 126

Add notifications to dashboard using api

Currently, we don't have a notification api in place to receive notifications from modules and jakhu and show them on the dashboard using socket.io.
Files in need of this:

  • views/dashboard/templates/apps/status.ejs
  • views/dashboard/index.ejs
    Part of issue #39
    Should be part of jakhu object given to module INIT function.

ENOENT: no such file or directory, open 'C:\Users\Kishan Sambhi\Documents\Projects\boss\boss\tmp\config.yml'

Hi,
I have found an issue which causes the config to be unable to be opened
Here is the output:

$ bin/boss server
fs.js:549
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open 'C:\Users\Kishan Sambhi\Documents\Projects\boss\boss\tmp\config.yml'
    at Error (native)
    at Object.fs.openSync (fs.js:549:18)
    at Object.fs.readFileSync (fs.js:397:15)
    at Object.getdata (C:\Users\Kishan Sambhi\Documents\Projects\boss\boss\node_modules\boss-config\app.js:7:26)
    at Object.<anonymous> (C:\Users\Kishan Sambhi\Documents\Projects\boss\boss\boot\libs\certs.js:6:22)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)

Thanks in advanced!

There are 0 tests

The tests are mocha tests npm install -g mocha

  • They need to be reported to coveralls
  • They need to tests everything

Add api

We need an api to use for modules.
I think it should work like this:

  1. Jakhu looks at a list of modules and requires each entry file for each module package.json)
  2. INIT function is called on each module, using the params (app, jakhu, done). app is the express app object with some functions removed, jakhu is the jakhu api with tools for notifications, db, adding middleware, adding routes and pages and done(err, {function: function}) is a function to tell jakhu of errors and supply the RUN function.
  3. INIT function returns done to run on jakhu to add routes .etc
  4. done returns a err or function return value
  5. RUN function (and other functions such as module.hello()) in done is executed
  6. Module is running (i.e. watching for requests or using loaded express middleware)

When adding express middleware, the object in done includes an express function ({express: expressfunction}).

style tick boxes in views/options-standard.ejs

We are finding it difficult to style the tick boxes in views/options-standard.ejs to being 1cm x 1cm and different colour background

Simply insert the class into oobe.css and apply it to the .ejs

Add logging api

Here how it should work:

  1. User starts a web-app
  2. App is started
  3. When build/app logs are logged back, store the logs in the db and socket.io them to the user where they are added to the log
  4. When the user requests the page of logs, first show previous logs

Logs should be stored as an array of lines and appended as <li>s to /dashboard/apps/status on the appropriate well in the tub collapse. Moreover, there should also be a signal to collapse sections of logs (i.e. echo "_COLLAPSE_LOGS_")
Part of issue #39

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.