-
Install Docker and Kitematic to run a MongoDB container.
-
Use git to clone the desired stackbutton development branch.
-
Install homebrew to get other packages.
brew install ruby
(Used for sass and gem installer.)brew install nodejs
(Used as the js app rendering engine)npm install sails -g
(the sails application engine)npm install grunt -g
(Install grunt globally. Grunt collects dependencies.)npm install @angular/cli -g
gem install sass
to install Syntactically awesome style sheets globally. Used for managing and creating interactive stylesheets.
-
Optionally add a config/local.js to the application folder that adds hooks to the sails project. Do not include this in git; for your eyes only.
module.exports.url = {
hooks: 'http://your-url-here.com'
};
-
Open terminal and navigate into the directory that contains the cloned repo.
-
In the stackbutton directory use the command
npm install
to install the sails application using the listed dependencies. -
Use docker and kitematic to deploy a mongodb container https://hub.docker.com/r/library/mongo/
-
To connect mongo:
-
Ensure you have the mongo sails adapter by running
npm install
in the stackbutton directory. -
Create a file config/local.js. Do not add this to git
-
Add the following block to your new local.js file:
module.exports.connections = {
stackbuttonMongo: {
host: 'blah', // defaults to `localhost` if omitted
port: blah, // defaults to 27017 if omitted
user: 'blah', // or omit if not relevant
password: 'blah', // or omit if not relevant
database: 'blah', // or omit if not relevant
adapter: 'sails-mongo'
}
};
module.exports.models = {
/***************************************************************************
* *
* Your app's default connection. i.e. the name of one of your app's *
* connections (see `config/connections.js`) *
* *
***************************************************************************/
connection: 'stackbuttonMongo'
};
/* increase timeout for mongo*/
module.exports.orm = {
_hookTimeout: 60000 // I used 60 seconds
};module.exports.permissions = {
_hookTimeout: 60000 // I used 60 seconds
};module.exports.pubsub = {
_hookTimeout: 60000 // I used 60 seconds
};
Replace 'blah' in the block above with a value appropriate for your database. All of the port data for the mongodb container should be available in kitematic.
- cd into the ng2 directory and
npm install
. Useng serve
to serve the angular content. Leave 'ng serve' running as you work. http://localhost:4200
Optionally launch the application as production by using these commands in the stackbutton directory:
npm install
sails lift
The above command should run the app at http://localhost:1337