Skip to content

Instantly share code, notes, and snippets.

@digitaldesigndj
Created May 30, 2014 00:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save digitaldesigndj/851ec91859e7aed13250 to your computer and use it in GitHub Desktop.
Save digitaldesigndj/851ec91859e7aed13250 to your computer and use it in GitHub Desktop.
starbound_provision.sh
#/bin/bash
apt-get update && apt-get -q -y install curl build-essential openssl libssl-dev git-core python python-software-properties
sudo add-apt-repository ppa:nginx/stable -y
apt-get update && apt-get -q -y install curl build-essential openssl libssl-dev git python lib32gcc1 nginx
mkdir steamcmd
cd steamcmd
wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz
tar -xvzf steamcmd_linux.tar.gz
./steamcmd
# login username
# password prompt
# force_install_dir /root/starbound
# app_update 211820
# exit
cd /root/starbound
rm -r linux32 win32 Starbound.app
cd /root/
#/bin/bash
DOMAIN="apeflu.boundstar.com"
# NVM Install
git clone git://github.com/creationix/nvm.git ~/.nvm
printf "\n\n# NVM\nif [ -s ~/.nvm/nvm.sh ]; then\n\tNVM_DIR=~/.nvm\n\tsource ~/.nvm/nvm.sh\nfi" >> ~/.bashrc
NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
# NVM Setup
nvm install v0.10.16
nvm alias default 0.10
nvm use 0.10
npm install forever -g
# nginx
mkdir -p /var/www/$DOMAIN
chown -R www-data:www-data /var/www/$DOMAIN
chmod 755 /var/www
# copy config
# cp /etc/nginx/sites-available/default /etc/nginx/sites-available/$DOMAIN
# nano /etc/nginx/sites-available/$DOMAIN
# remove exisiting nginx config
rm /etc/nginx/sites-available/boundstar.com
# create config
echo -e 'upstream app_commandstar {
server 127.0.0.1:88;
}
upstream app_boundstar {
server 127.0.0.1:3000;
}
server {
server_name furious.boundstar.com;
location / {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://app_boundstar/;
proxy_redirect off;
}
location /status/ {
rewrite ^/starbound/(.*) /$1 break;
proxy_pass http://app_commandstar/;
include proxy.conf;
}
}' >> /etc/nginx/sites-available/boundstar.com
ln -s /etc/nginx/sites-available/boundstar.com /etc/nginx/sites-enabled/boundstar.com
cd ~/commandstar/
bash forever.sh
echo 'started commandstar'
cd ~/boundstar/
export WEBHOOK_KEY=TDY721
forever start app.js
echo 'started boundstar'
# create config
echo -e "cd ~/commandstar/
bash forever.sh
echo 'started commandstar'
cd ~/boundstar/
export WEBHOOK_KEY=TDY721
forever start app.js
echo 'started boundstar'
" >> /root/web_start.sh
rm /etc/nginx/sites-enabled/default
# echo -e "hello world :) - This is $DOMAIN" >> /var/www/$DOMAIN/public_html/index.html
NPM INSTALL !!
git clone https://github.com/digitaldesigndj/commandstar.git
cd /root/commandstar
git clone https://github.com/digitaldesigndj/boundstar.git
rm /root/boundstar/src/documents
cd /root/boundstar
npm install
cd /root/boundstar/src
git clone https://github.com/digitaldesigndj/boundstar-content.git documents
cd /root
service nginx restart
bash web_start.sh
## Add upstart config /etc/init/starbound.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment