Last active
August 29, 2015 13:55
-
-
Save detj/8708512 to your computer and use it in GitHub Desktop.
Deployment script. Installs latest nodejs and mongodb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Set up a fresh system | |
#NODE_VERSION="0.10.31" | |
#MONGO_VERSION="2.6.4" | |
ENVIRONMENT="production" | |
#Set up a base tmp directory for installation | |
mkdir -p ~/tmp | |
cd ~/tmp | |
# Set Environment variables | |
export LANGUAGE=en_US.UTF-8 | |
export LANG=en_US.UTF-8 | |
export LC_ALL=en_US.UTF-8 | |
export NODE_ENV=$ENVIRONMENT | |
# Add this to ~/.bash_profile | |
echo "export LANGUAGE=en_US.UTF-8" >> ~/.bash_profile | |
echo "export LANG=en_US.UTF-8" >> ~/.bash_profile | |
echo "export LC_ALL=en_US.UTF-8" >> ~/.bash_profile | |
echo "export NODE_ENV=$ENVIRONMENT" >> ~/.bash_profile | |
sudo locale-gen UTF-8 | |
#Install mongodb | |
#Add the mongodb ppa | |
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 | |
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list | |
# Add the nodejs ppa, 0.10.x | |
curl -sL https://deb.nodesource.com/setup | sudo bash - | |
# For 0.12.x | |
#curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash - | |
sudo apt-get update | |
#Install dependencies | |
# NOTE: nginx 1.2 does not support forwarding WebSocket requests. Support for WebSockets is from v1.3 and above | |
# v1.3 hasn't yet landed on aptitude, so either install a WebSocket patch for nginx or try some other method | |
sudo apt-get -y install nginx mongodb-org nodejs git g++ make build-essential | |
# Remove tmp directory | |
cd .. | |
rm -rf ~/tmp | |
# Create ssh keys | |
ssh-keygen -f ~/.ssh/id_rsa -t rsa -N '' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment