GithubHelp home page GithubHelp logo

musixmatch / nodefu Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chrismatthieu/nodefu

1.0 1.0 0.0 2.85 MB

NodeFu is an experimental node.js hosting service

Home Page: http://nodefu.com

nodefu's Introduction

NodeFu (http://nodefu.com) = Node.js Hosting Platform

This is an *experimental* service for managing hosted nodejs apps.  It consists of an API that allows developers to create and manage nodejs apps.  Node apps are assigned subdomains that proxy to ports with an assigned address.  Instances (dynos) are launched using Forever so that they run until you stop them or using Nodemon where they run until a file changes from a git update.

Dependencies:
Node.js and the following NPM modules: http-proxy, express, node-base64, couch-client, nodemon (https://github.com/substack/node-base64)
CouchDB instance or CouchOne account
Git

Get Started:
ruby launchnodefu.rb 
This small Ruby script launches proxy.js to start services and it will launch app.js 
- proxy.js launches proxy server redirecting port 8080 traffic to appropriate node app
- proxy launches app.js on port 4000 for creating and managing node apps


API Documentation:

COUPON
/coupon - creates coupon request for early access (pass in email) - <b>Note: This resource does not use base api url
curl -X POST -d "[email protected]" http://localhost:8080/coupon

STATUS
/status - returns status of the platform and number of nodejs apps running
// curl http://api.localhost:8080/status

USER
/user - creates user account (pass in user and password and email) - Note: This resource does not use the api subdomain
curl -X POST -d "user=testuser&password=123&[email protected]" http://localhost:8080/user

/user - delete user account (requires basic auth)
curl -X DELETE -u "testuser:123" http://api.localhost:8080/user

APP
/app - create nodejs app for hosting (requires basic auth and returns the port address required for use along with a git repo to push to)
curl -X POST -u "testuser:123" -d "appname=a&start=hello.js" http://api.localhost:8080/app

/app - update nodejs app for hosting (requires basic auth, appname, and starting page and returns the port address required for use along with a git repo to push to)
curl -X PUT -u "testuser:123" -d "appname=a&start=hello1.js" http://api.localhost:8080/app

/app - delete nodejs app (requires basic auth and appname)
curl -X DELETE -u "testuser:123" -d "appname=test" http://api.localhost:8080/app



Testing:
Subdomains can be tested by editing /etc/hosts like this:
127.0.0.1	localhost a.localhost b.localhost c.localhost
save etc/hosts and flush DNS like this: sudo dscacheutil -flushcache

http://localhost:8080 = Homepage
http://a.localhost:8080 = Runs app associated with subdomain a on couch-configured port
http://b.localhost:8080 = Runs app associated with subdomain b on couch-configured port
http://chris:[email protected]:8080/status = API to list status of all node apps
http://chris:[email protected]:8080/list/2.json = API TBD


Maintenance:
Run "ruby installmodules.rb" periodically to install and update all NPM modules on system. 


Todos:
- add rsa keys for git?
- add ability to control number of instances
- Add Command Line Interface
- Add SSL support

Considerations:
- 64k port limitation per IP address on Linux - how do we scale horizontally?
- sandbox node instances?

- Push apps to local git repos
git remote add nodefu /usr/local/src/nodefu/apps/7-46e95eaa00d2785e6c73e5a4fc25d88c.git
git push nodefu master


Contribute:
If this project inspires you, please feel free to help out by forking this project and sending me pull requests.

License:
Apache 2 - Have fun! :)

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.