Skip to content

Instantly share code, notes, and snippets.

@mfjohansson
Last active August 29, 2015 14:05
Show Gist options
  • Save mfjohansson/4f7fc9999921798cb87c to your computer and use it in GitHub Desktop.
Save mfjohansson/4f7fc9999921798cb87c to your computer and use it in GitHub Desktop.
mean.io production
##### Install node.js
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install nodejs
##### Add repo
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
##### Install
sudo apt-get install mongodb-org
##### Start
sudo service mongod start
##### Remote access
sudo nano /etc/mongod.conf
# Comment out bind_ip
sudo service mongod restart
##### Make sure that the environment variable is set
sudo visudo
# Add:
Defaults env_keep +="NODE_ENV"
##### Set environment to production
export NODE_ENV=production
sudo -E bash -c 'echo $NODE_ENV'
##### Prepare resources
grunt uglify
grunt cssmin
##### Start server
sudo forever start server.js
##### Install Git
sudo apt-get install git
##### Install bzip2 (req. by phantomjs)
sudo apt-get install bzip2
##### NPM install
sudo npm install
##### Global modules
sudo npm install -g forever
sudo npm install -g grunt-cli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment