Giter Site home page Giter Site logo

inadarei / nodebootstrap Goto Github PK

View Code? Open in Web Editor NEW
716.0 43.0 105.0 1.28 MB

NodeBootstrap - generates skeleton project for Node/Express.js with pre-configured best-practices. Kick-start your Node project development with tons of boilerplate taken care of, such as: clustering, Docker-support, database migrations, automated testing, error-handling, modularity, advanced logging, templated views, environments etc.

Home Page: http://www.nodebootstrap.io

License: MIT License

JavaScript 100.00%
nodejs javacript docker microservices scaffolding template example bootstrap

nodebootstrap's Introduction

NodeBootstrap

NPM Version Github Link Docker Hub Link TravisCI Build Status Codacy Badge FOSSA Status

Organize your Node project like a pro. Now supports a Microservice mode!

Right out of the gate N.B. gets a [metric] ton of boilerplate taken care of: microservice-style setup, clustering, Docker-support, database migrations, automated testing, error-handling, modularity, advanced logging, templated views, environments – you name it. And all of that without having to deal with a heavy or an opinionated framework!

Install Microservice

To learn more: http://nodebootstrap.io

Join the chat at https://gitter.im/inadarei/nodebootstrap

If you like Nodebootstrap, also check out: Microservices Workspace project to see how you can orchestrate multilingual (polyglot) microservices setup as a holistic and simple development environment.

Examples:

  # create a skeleton of a containerized microservice:
  > nodebootstrap ms-first
  # create a skeleton of an express MVC webapp:
  > nodebootstrap -m webapp nodeapp-first
  # create a skeleton of a console or client Node application
  > nodebootstrap -m cli client-first

License

MIT

nodebootstrap's People

Contributors

awinder avatar brookslyrette avatar dougharris avatar fossabot avatar gitter-badger avatar greenkeeperio-bot avatar inadarei avatar jhnlsn avatar kalenanson avatar kapv89 avatar randallsquared avatar snyk-bot avatar staff0rd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nodebootstrap's Issues

Asset management/minification

Have you ever implemented any asset management/minification/combination with this bootstrap? I've had a look at Piler, but it's difficult to see how to configure it using the sub-module approach.

Deprecated dependencies

You might want to mention at the to of the readme, that this project is unmaintained.

That it require root privileges not only to install the cli, but also to use.
That it rely on unmaintained and deprecated dependencies.
That is rely on software that npm warns against using.

Add Example .env file

You have several environment variables that can affect the state of the app, but there isn't an easy template for people to edit the ones they want to change -- and the scripts don't conveniently source the environment file for you, so if you set variables and then exit the console, you have to set them again when you come back.

I always include an example env file:

common.env.example

To start using it with all the defaults:

$ cp common.env.example common.env

Customize in your favorite editor, and launch.

npm run dev only works when executed using root

I am on Ubuntu 14.04.3 LTS.

$ npm -v
2.13.1
$ nodejs -v
v0.12.9

But I get the following error:

$ npm run dev
> nodebootstrap-based-app@ dev <my project path>
> npm install supervisor -g && ./bin/dev_start.sh

npm ERR! Linux 3.13.0-71-generic
npm ERR! argv "node" "/usr/local/bin/npm" "install" "supervisor" "-g"
npm ERR! node v0.12.9
npm ERR! npm  v2.13.1
npm ERR! path /usr/bin/node-supervisor
npm ERR! code EACCES
npm ERR! errno -13

npm ERR! Error: EACCES, unlink '/usr/bin/node-supervisor'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES, unlink '/usr/bin/node-supervisor'] errno: -13, code: 'EACCES', path: '/usr/bin/node-supervisor' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.
npm ERR! error rolling back Error: EACCES, unlink '/usr/bin/node-supervisor'
npm ERR! error rolling back     at Error (native)
npm ERR! error rolling back  { [Error: EACCES, unlink '/usr/bin/node-supervisor'] errno: -13, code: 'EACCES', path: '/usr/bin/node-supervisor' }

npm ERR! Please include the following file with any support request:
npm ERR!     <my project path>/npm-debug.log

npm ERR! Linux 3.13.0-71-generic
npm ERR! argv "node" "/usr/local/bin/npm" "run" "dev"
npm ERR! node v0.12.9
npm ERR! npm  v2.13.1
npm ERR! code ELIFECYCLE
npm ERR! nodebootstrap-based-app@ dev: `npm install supervisor -g && ./bin/dev_start.sh`
npm ERR! Exit status 243
npm ERR! 
npm ERR! Failed at the nodebootstrap-based-app@ dev script 'npm install supervisor -g && ./bin/dev_start.sh'.
npm ERR! This is most likely a problem with the nodebootstrap-based-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm install supervisor -g && ./bin/dev_start.sh
npm ERR! You can get their info via:
npm ERR!     npm owner ls nodebootstrap-based-app
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     <my project path>/npm-debug.log

Of course, I already installed supervisor using this command:

sudo npm install supervisor -g

Oh, and btw, it runs without problems when I run it with sudo:

$ sudo npm run dev

> nodebootstrap-based-app@ dev <my project path>
> npm install supervisor -g && ./bin/dev_start.sh

/usr/bin/node-supervisor -> /usr/lib/node_modules/supervisor/lib/cli-wrapper.js
/usr/bin/supervisor -> /usr/lib/node_modules/supervisor/lib/cli-wrapper.js
[email protected] /usr/lib/node_modules/supervisor

Running node-supervisor with
  program '<my project path>/server.js'
  --watch './lib,<my project path>/config,<my project path>/server.js'
  --extensions 'node,js'
  --exec 'node'

Starting child process with 'node <my project path>/server.js'
Watching directory '<my project path>/lib' for changes.
Press rs for restarting the process.
Watching directory '<my project path>/config' for changes.
Press rs for restarting the process.
Watching directory '<my project path>/server.js' for changes.
Press rs for restarting the process.
7 Dec 16:57:35 - NOTICE  [node_modules/nodebootstrap-server/app.js:35] Express server instance listening on port 3000

maxBuffer Exceeded Error

Not sure if this is an error specific to node or what. Here is the error:

/usr/local/lib/node_modules/nodebootstrap/bin/nodebootstrap:82
          if (err) { throw err; process.exit(); }
                     ^

Error: stderr maxBuffer exceeded.
    at Socket.<anonymous> (child_process.js:258:12)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at readableAddChunk (_stream_readable.js:146:16)
    at Socket.Readable.push (_stream_readable.js:110:10)
    at Pipe.onread (net.js:523:20)

Executing the command nodebootstrap build myApp.

Here is the point at which the build command died, from /usr/local/lib/node_modules/nodebootstrap/bin/nodebootstrap:

var setupcli = cli.execFile("./setup.sh", [], {"cwd" : projectPath}, function(err, stdout, stderr) {
    if (err) { throw err; process.exit(); }

Running:
Node 4.0.0
npm 2.14.2
OS X 10.10.3

[Bug] layout.handlebars not picked up in production env

For some reason, res.render calls are not rendering the layout in production env. I have tried setting up the 'views' setting in runningApp to point to the top level 'views' folder, but that didn't work, So kinda stuck over there.

build Error - Firewall ?

Hi,

I'm getting a error running the build.

$ /opt/app/cloudstack/node/node-v0.12.5-linux-x64/bin/nodebootstrap build hello
Building new project under: hello
stream.js:94
      throw er; // Unhandled stream error in pipe.
            ^
Error: getaddrinfo ENOTFOUND github.com
    at errnoException (dns.js:44:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:94:26)

This is in a corporate environment with a proxy in place. running redhat.

Thanks

Express needs updating?

express deprecated res.send(status): Use res.sendStatus(status) instead node_modules/nodebootstrap-server/app.js:83:9

Nodejs version control for Dockerfile

Is it possible to move the setup of nodejs into the local Dockerfile? I'm not 100% sure how all the docker image extension stuff works so not sure if this is the right way.

Would like an easier way to control which version of node is setup in the docker image and it seems like it would be done by setting this up in the local Dockerfile.

NodeBootstrap Users

If you are using Node Bootstrap, appreciate it and would like your company to be mentioned on our website, please provide the following information:

  • Company name
  • Contact e-mail
  • URL of the logo you would like to be used.
  • Optionally: quote about your usage.

[Question] How would be the best way to integrate Socket.io?

As part of my project, I need to integrate socket.io.

The way I found the cleanest was to modify the nodebootstrap-server to use the http library when listening the port and exposing the http handle to the callback so I could use that http handler in the server.js file to bind socket.io.

Any ideas on how to do this better? To be honest I don't like to depend on the nodebootstrap-server module. Maybe it could be a better aproach to expose those files in the project folder so they could be modified when needed (like my case)?

Thank you for this great bootstrap project.
Carlos.

[Question] Creation of "Getting Started" in Wiki

As a new user to Node.JS, it would be awesome to see a quick "getting started" tutorial in the Wiki that outlines

  • The creation of a new route
  • The setup of a handlebar using Bootstrap styles

Thanks!

API mode vs. APP mode.

Rails 5.x has introduced an interesting concept of API Mode allowing developers to bootstrap a project with minimal settings required for just API development (vs. the whole thing). You can do it by:

> rails new backend --api

Based on user feedback, we need the same thing in Nodebootstrap. Except, considering the role and specificities of Node, I believe the default in this case should be "api mode" and "full mode" should be optional.

RFC Design modifications so nodebootstrap can be updated.

Currently Node Bootstrap is distributed as a node application. This is a bad idea. I like your choice of default tools (though I prefer to Jade to handlebars). However, I find that the current distribution mechanism will make it hard to keep up to date. Take for instance a new version of a HTML5 shim is released, how will you roll that out to the node-bootstrap users?

I think it'd be better if we moved to a real revision system and download the version online, installed them in into a node-bootstrap module, and version controllered/checksumed the manifest to see if it was tampered with.

I think this installer should be in js too. If you interested in these change, I'll write the patch.

Document Docker Dependencies?

Hi! This is a suggestion.

I'm evaluating node bootstrapping and this repo looks awesome except the Docker piece seems overkill for our immediate needs.

If the docker dependencies were documented or commented, removing the Docker elements would be a snap.

Errors on initial build

Hi
Looks like a very useful project, thanks in advance.
On my initial build and run I copied and pasted the output from the installation command:

======================= Installation Completed! ===================
You can now run your newly minted Node app by executing:
  > cd asset-review
  > ./bin/dev_starth.sh

There is a typo in the output's last line.
There is also a missing dependency when running ./bin/dev_start.sh:

module.js:340
    throw err;
          ^
Error: Cannot find module 'nodebootstrap-clustering'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.exports.setup (/Users/lee/src/www/mark-review/asset-review/node_modules/nodebootstrap-server/app.js:25:5)
    at Object.<anonymous> (/Users/lee/src/www/mark-review/asset-review/server.js:1:95)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
Program node ....../server.js exited with code 8

Put scripts in ./scripts/

npm expects to find its scripts in ./scripts by default. Several pre-defined scripts will just magically work with no configuration if you put your scripts there, and that configuration in common in many node applications.

Error shows up during project build on Windows PC

Hi,

I am using the NodeBootstrap composition v3.0.2 (https://github.com/inadarei/nodebootstrap) on my Windows PC (Window 7, 64-bit).

It installs correctly through NPM. But when I try to create a project (nodebootstrap build hello), it shows up the following error:
Executing installation of dependencies. This may take several minutes.
child_process.js:1162
throw errnoException(err, 'spawn');
^
Error: spawn UNKNOWN
at exports._errnoException (util.js:746:11)
at ChildProcess.spawn (child_process.js:1162:11)
at exports.spawn (child_process.js:995:9)
at Object.exports.execFile (child_process.js:689:15)
at c:\Users\pp\AppData\Roaming\npm\node_modules\nodebootstrap\bin\nodebootst
rap:81:32
at ChildProcess.exithandler (child_process.js:742:7)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Socket. (child_process.js:1183:11)
at Socket.emit (events.js:107:17)

Can you please help me with this? I am unable to find a solution to this error.

Node version: 0.12.4
NPM version: 2.10.1

Screenshot of the error is enclosed for your reference.

Looking forward to a quick response.

Thanks,
Kanishka

error

Tried to build new project, not so much...

Just installed, then tried:

nodebootstrap build val-backend
Building new project under: val-backend

/usr/local/lib/node_modules/nodebootstrap/bin/nodebootstrap:55
throw err;
^
Error: EXDEV, rename '/var/folders/bw/w312ywz17pv4k41b9wk2l9z00000gn/T/nodebootstrap-master'

node --version
v0.10.29

npm --version
2.0.0-alpha-5

while building the hello project throws error

Please find the complete error trace below.

child_process.js:1155
throw errnoException(err, 'spawn');
^
Error: spawn UNKNOWN
at exports._errnoException (util.js:746:11)
at ChildProcess.spawn (child_process.js:1155:11)
at exports.spawn (child_process.js:988:9)
at Object.exports.execFile (child_process.js:682:15)
at c:\Users\Manish.Upadhyay\AppData\Roaming\npm\node_modules\nodebootstrap\bin\nodebootstrap:81:32
at ChildProcess.exithandler (child_process.js:735:7)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1008:16)
at Socket. (child_process.js:1176:11)
at Socket.emit (events.js:107:17)

Unable to run container

Getting the following error when trying to run a docker container using the current master branch

I have both docker-machine and docker-compose installed locally

dev:~$ docker -v
Docker version 1.11.0-rc5, build 6178547

16:52 $ docker-compose -v
docker-compose version: 1.4.0

This is the error that i am getting

npm ERR! Linux 4.1.19-boot2docker
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "docker-start"
npm ERR! node v4.3.2
npm ERR! npm  v2.14.12
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! nodebootstrap-based-app@ docker-start: `docker-compose run -d -p 3000 app node server.js`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the nodebootstrap-based-app@ docker-start script 'docker-compose run -d -p 3000 app node server.js'.
npm ERR! This is most likely a problem with the nodebootstrap-based-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     docker-compose run -d -p 3000 app node server.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls nodebootstrap-based-app
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /opt/application/npm-debug.log

> nodebootstrap-based-app@ docker-start /opt/application
> docker-compose run -d -p 3000 app node server.js

sh: docker-compose: not found

For building the Docker image, i'm running the following command

docker build -t megaz/hello .

Then when running the container, I am running the following command

docker run -ti -p 5000:3000 megaz/hello

ENOENT error

Receiving the below error when creating a new webapp. If I try to run the app using start.sh everything executes; however, the page (localhost:3000) returns raw JSON. Any pointers?

`bootstrap#3.0.3 public/bower_components/bootstrap
└── jquery#2.0.3
added 327 packages in 12.432s
fs.js:1053
return binding.unlink(pathModule._makeLong(path));
^

Error: ENOENT: no such file or directory, unlink './setup.sh'
at Object.fs.unlinkSync (fs.js:1053:18)
at /usr/local/lib/node_modules/nodebootstrap/nodebootstrap:252:18
at ChildProcess.exithandler (child_process.js:244:7)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at maybeClose (internal/child_process.js:887:16)
at Socket.stream.socket.on (internal/child_process.js:340:11)
at emitOne (events.js:115:13)
at Socket.emit (events.js:210:7)
at Pipe._handle.close [as _onclose] (net.js:546:12)`

Thanks!

Fix to work with the latest Express.js

Latest Express.js (3.0.0rc2) seems to have broken bunch of stuff compared to the latest stable 2.x branch. Node Bootstrap code needs upgrade to make sure it works with 3.x by the time 3.x comes out of RC.

Run on https

How can we achieve this?

Apparently it's not as simple as:

  if (is_http_thread) {
    http = https.createServer(app);
    http.listen(443);
  }

Cleanup server.js

Move clustering code into a separate file and move app setup code into a separate file, as well.

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.