Rutha - HapiJS AngularJS Stack
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
service
shared/config
ui
.gitignore
.travis.yml
README.md
changelog.md
contributors.txt
footer.css
license
package.json

README.md

rutha

an hapi/angular frontend and service stack

For an ES6 version: Take a look at rutha 2016

Build Status

Pure pragmatic NodeJS stack

Changelog: changelog

Last update: 2.1.0

Docs:

Main features

  • Rule Them All with a single environment: Both development and production environment are the same. We concat, annotate, mix some ingredients and offer you the same production environment for development.
  • AngularJS 1.5.x
  • Hapi 13.0.0
  • Jasmine NPM
  • Ionic: Try rutha-ionic

Additional features

Installing

  1. Clone repo
  2. Rename text containing rutha to your_app_name
  3. Be sure to have node 4.5.0 or greater (e.g. nvm use 4.5.0)
  4. Run npm install grunt-cli -g
  5. Change dir to ui and run npm install and then bower install
  6. Open a new tab and change dir to service and run npm install

Grunt Help (Service)

  • npm start: Serves API service
  • npm test: Runs Jasmine NPM specs
  • npm run nsp: Verifies modules that contains security issues
  • grunt migrate:create [--name]: Creates a migration task. Args: --name: migration name (optional)
  • grunt migrate:up [--revision]: Migrates up. Args: --revision: revision name (optional)
  • grunt migrate:down [--revision]: Migrates down. Args: --revision: revision name (optional)
  • grunt docs: Builds jsdoc3 documentation.

Grunt Help - Frontend tasks

  • npm start: Serves frontend
  • npm test: Runs Jasmine NPM specs
  • npm run nsp: Verifies modules that contains security issues
  • grunt test: Runs E2E/Functional tests (Angular)
  • grunt build: Prepares UI assets
  • grunt stagelocal: Provisions Vagrant VM
  • grunt staging: Provisions staging
  • grunt deploy: Provisions production
  • grunt jshinting: Verifies javascript using jshint

About Angular Tests

ui/src/test/lib contains libs require for testing. Scope.SafeApply can be added as optional (see yearofmoo blog post)

Nginx routes (Optional)

server { 
# simple reverse-proxy for Rutha (Very useful!)
    listen       80;
    server_name  localhost;
    access_log   dev.log;
    #error_page   http://here;

  location /api {
    proxy_pass      http://127.0.0.1:3002;
    proxy_redirect  default;
    proxy_set_header Host $host;
  }

  location / {
    proxy_pass      http://127.0.0.1:3005;
    proxy_redirect  default;
    proxy_set_header Host $host;
  }
}

Ansible deploy

Deploying rutha apps with rutha_deploy

  1. Run grunt build to generate frontend assets

  2. Add zip file to commit e.g. git add releases/v0.1.0.zip.

  3. In rutha-deploy, configure group_vars with your settings

    # devops
    domain: disrupting_app.com
    ssl_name: disrupting_app
    # rutha
    app_name: disrupting_app
    app_repo: git@github.com:molekilla/rutha.git
    app_branch: release0.1.0
    app_version: v0.1.0
    app_env: 
      NODE_ENV: production
  4. Add hosts to /etc/ansible/hosts

  5. Enable host in ui/Gruntfile.js by adding it to deploySettings.

  6. Configure cloud / server with SSH key to get repo (or customize rutha-deploy to fetch from somewhere else).

  7. Run grunt deploy

Deploying rutha frontend app

  1. Run grunt build to generate frontend assets
  2. Add zip file to commit e.g. git add releases/v0.1.0.zip (or customize rutha-deploy to fetch from somewhere else).
  3. In your devops workflow, unpack zip and run ui/lib/hapi/index.js

Deploying rutha service app

  1. Copy service directory or get from repo
  2. In your devops workflow, run service/lib/hapi/index.js

Maintainers, notes

Rogelio Morrell C.

Disclaimer

Feel free to fork.