molekilla / rutha

Rutha - HapiJS AngularJS Stack
MIT License
48 stars 9 forks source link
angular frontend hapi

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

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)

Grunt Help - Frontend tasks

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.