added npm, forever, and start and stop scripts
This commit is contained in:
parent
5592c4710a
commit
65e70d8b6d
3 changed files with 9 additions and 0 deletions
5
Vagrantfile
vendored
5
Vagrantfile
vendored
|
@ -13,6 +13,7 @@ su - vagrant -c 'curl -sSL https://get.rvm.io | bash -s stable --ruby=2.1.3'
|
||||||
|
|
||||||
# install some other deps
|
# install some other deps
|
||||||
sudo apt-get install nodejs -y
|
sudo apt-get install nodejs -y
|
||||||
|
sudo apt-get install npm -y
|
||||||
sudo apt-get install postgresql -y
|
sudo apt-get install postgresql -y
|
||||||
sudo apt-get install libpq-dev -y
|
sudo apt-get install libpq-dev -y
|
||||||
sudo apt-get install redis-server -y
|
sudo apt-get install redis-server -y
|
||||||
|
@ -20,6 +21,9 @@ sudo apt-get install redis-server -y
|
||||||
# Install node
|
# Install node
|
||||||
ln -fs /usr/bin/nodejs /usr/bin/node
|
ln -fs /usr/bin/nodejs /usr/bin/node
|
||||||
|
|
||||||
|
# install forever for running the node server
|
||||||
|
sudo npm install forever -g
|
||||||
|
|
||||||
# set the postgres password
|
# set the postgres password
|
||||||
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD '3112';"
|
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD '3112';"
|
||||||
|
|
||||||
|
@ -31,6 +35,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||||
config.vm.box = "trusty64"
|
config.vm.box = "trusty64"
|
||||||
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
|
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
|
||||||
config.vm.network :forwarded_port, guest: 3000, host: 3000
|
config.vm.network :forwarded_port, guest: 3000, host: 3000
|
||||||
|
config.vm.network :forwarded_port, guest: 5001, host: 5001
|
||||||
config.vm.network "private_network", ip: "10.0.1.11"
|
config.vm.network "private_network", ip: "10.0.1.11"
|
||||||
config.vm.synced_folder ".", "/vagrant", :nfs => true
|
config.vm.synced_folder ".", "/vagrant", :nfs => true
|
||||||
|
|
||||||
|
|
2
bin/start
Executable file
2
bin/start
Executable file
|
@ -0,0 +1,2 @@
|
||||||
|
#start rails server and realtime node server
|
||||||
|
vagrant ssh --command "cd /vagrant; rails s -d; forever start ./realtime/realtime-server.js"
|
2
bin/stop
Executable file
2
bin/stop
Executable file
|
@ -0,0 +1,2 @@
|
||||||
|
# stop rails server and node server
|
||||||
|
vagrant ssh --command "cd /vagrant; kill -9 $(cat tmp/pids/server.pid); forever stopall"
|
Loading…
Reference in a new issue