Skip to content
Jean-Pierre Bernard edited this page Feb 16, 2016 · 13 revisions

Installation commands

To create a Cloud9 workspace to run LocalSupport:

  1. Fork the http://github.com/AgileVentures/LocalSupport repo (fork button at top right of github web interface)

  2. Create a workspace in Cloud9. Fill in the fields:

    • Workspace name: LocalSupport (or anything else that fits you)
    • Clone from Git or Mercurial URL: the url of your forked repository, e.g. https://github.com/your-git-id/LocalSupport.git
    • Choose a template: Select the Rails / Ruby icon
    • Click the Create workspace button

    If you get a message: ruby-2.x.y is not installed., see next section to install that version of ruby.

  3. Change branch for development: git checkout develop

  4. Install Qt webkit (source):

    sudo apt-get install qt5-default libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x

    (Note: for some reason, I could not get it to pass on the first try.)

  5. Configure the pre-installed postgreSQL. Check which version is installed with ls /etc/postgresql/. If the version is not 9.3, the sed commands must be edited to reflect the current version.

    # Change conf files to map your user to postgres user
    sudo sed -i 's/local[ ]*all[ ]*postgres[ ]*peer/local all postgres peer map=basic/' /etc/postgresql/9.3/main/pg_hba.conf
    sudo sed -i "$ a\basic $USER postgres" /etc/postgresql/9.3/main/pg_ident.conf
    # Start the service
    sudo service postgresql start
    # Make the default database template encoded in unicode
    psql -U postgres -c "update pg_database set encoding = 6, datcollate = 'C', datctype = 'C' where datname = 'template1';"
    sudo /etc/init.d/postgresql restart
  6. Install X virtual frame buffer

    sudo apt-get install xvfb

  7. Run bundle install to get the gems

  8. Run selenium install to download jars that this gem needs

  9. Run bower install to get the javascript dependencies

  10. (optional) Update the heroku tools : wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh

  11. Run the following to get the database set up and import seed data

    bundle exec rake db:create
    bundle exec rake db:migrate
    bundle exec rake db:categories                                          
    bundle exec rake db:seed
    bundle exec rake db:cat_org_import
    bundle exec rake db:pages
    bundle exec rake db:import:emails[db/emails.csv]
  12. Run locally with rails s -b $IP -p $PORT (in either a terminal or a run configuration window)

  13. Run the test (note the explicit call to xvfb when executing cucumber -- Cloud9 does not run an X-server)

    bundle exec rake db:migrate RAILS_ENV=test  
    bundle exec rake spec
    xvfb-run -a bundle exec cucumber

You can also activate the feature flags.

Installing another version of ruby in Cloud9

If the ruby version specified in the LocalSupport gemfile does not match one of the preinstalled version on Cloud9, the following message is outputted:

```
ruby-2.x.y is not installed.
To install do: 'rvm install ruby-2.x.y'
```

Execute the suggested command to install the proper version (the compilation of ruby may take some time). After completion, execute:

`gem install bundler`

You should also make that ruby version your default version, with the command:

rvm --default use 2.x.y