Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save versvs/5386336 to your computer and use it in GitHub Desktop.
Save versvs/5386336 to your computer and use it in GitHub Desktop.
// Install Ruby Version Manager along with Ruby + Rails
$ \curl -L https://get.rvm.io | bash -s stable --autolibs=3 --rails
//fetch the latest code from the CVUT team, that is more up-to-date in terms of dependencies
//and works like a charm, btw
$ git clone https://github.com/crewmate/crewmate.git
$ cd crewmate
// install ruby 1.9.3
$ rvm install 1.9.3
$ rvm use 1.9.3
// install bundler
$ gem install bundler
// install multi_json -v '1.0.4', as it needs to be installed before bundling
$ gem install multi_json -v '1.0.4'
// mysql2 fails to bundle if you don't have development libraries for mysql, install them before.
$ sudo apt-get install libmysql-ruby libmysqlclient-dev
$ gem install mysql2 -v '0.2.20'
// libxml2 v2.7.0 also fails if proper development libraries are not installed
$ sudo apt-get install libxml2-dev
// dependency to install the `pg` gem
$ sudo apt-get install libpq-dev
// now, bundle install all needed gems
$ bundle install
// now you can configure crewmate.yml (filename needs to be changed yet) to set app_domain to whatever domain you'll be using
// copy crewmate.example.yml to crewmate.yml and edit the file
$ nano config/crewmate.yml
// also copy and edit database.yml to connect to your database server
$ cp config/database.example.yml config/database.yml
$ nano config/database.yml
// To bootstrap your application the bundler will ask you to provide a JS interpreter, one of the most used engines is NodeJS.
// You can install the latest stable version from PPA repositories
sudo apt-get update
sudo apt-get install -y python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
// at this point you can bootstrap the database schema
$ bundle exec rake db:create db:schema:load RAILS_ENV=production
// and see if the app is able to start
$ rails server -e production
// visit http://localhost:3000 (assuming you didn't change the port) to check if the login screen appears at all
// here I made an alternative install route, not using passenger and instead using proxy_http from Apache to proxy every petition in the standard :80 port for your domain to the desired port that your app is using to listen.
// See this for info on how to use the ProxyPass directive inside your vhost (assuming you want to restrict the proxy to this vhost only) in this URL: http://boriskuzmanovic.wordpress.com/2006/10/20/apaches-proxypass-on-ubuntu/
// remember that both `mod_proxy` and `mod_proxy_http` need to be enabled if you are forwarding and reversing proxy pass.
Restart the Apache server and you have it made.
$ sudo service apache2 restart
// to get the app running whenever you reboot your server just add a cronjob that executes @reboot
// I made an small bash script and called my script in the cronjob, that i'm running as the user for which I installed ruby/rvm/everything
// the content of the bash script is something like this
#!/bin/bash
source ~/.rvm/scripts/rvm
rvm use 1.9.3
cd /change/to/root/dir/for/your/crewmate/app/
/change/to/root/dir/for/your/crewmate/app/script/rails server -e production
#end of bash script
// final step is to configure your backup script
// Save the app content and dump de database and send it to another remote server.
// many ways of achieving this. Choose the one you feel more comfortable with
REF:
https://github.com/teambox/teambox/wiki/Installing-on-Ubuntu
https://github.com/teambox/teambox/wiki/Installing-locally
https://gist.github.com/nukeador/5383583
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment