Skip to content
Warwick Stone edited this page Oct 9, 2016 · 2 revisions

Linux dev setup

This is a guide to preparing a dev environment for the local linguist server app. Developed on Ubuntu 15.10.

Install prerequisites

This takes ~10 minutes. Install ruby using your package manager, then rails using gem. Alternatively, you can use RVM to get later versions of ruby, and switch between versions for testing.

sudo apt-get update
sudo apt-get install ruby ruby-dev ruby-bundler postgresql libpq-dev
sudo gem update --system

Configure postgresql

Add a password for the default user, otherwise rails/postgres complains later.

$ sudo -u postgres psql
postgres=# \password postgres

Enter your password & confirm. I used 'postgres' for this guide. \q quits postgres:

postgres=# \q

Configure local linguist app

Clone/download the linguist server app.

Find the following sections in config/database.yml and add lines:

development:
  <<: *default
  database: linguist_development
  username: postgres            # <--- Add this line
  password: postgres            # <--- Add this line
  host: localhost               # <--- Add this line

test:
  <<: *default
  database: linguist_test
  username: postgres            # <--- Add this line
  password: postgres            # <--- Add this line
  host: localhost               # <--- Add this line

Don't commit the above changes, as this is for your local dev environment.

Install required bundles:

bundle install --path vendor/bundle

Configure database:

./bin/rake db:create
./bin/rake db:migrate
./bin/rake db:seed
./bin/rake db:test:prepare

Run tests:

./bin/rake

Hopefully you see zero failures.

Run the dev server

./bin/rails server --binding=0.0.0.0

Bind to 0.0.0.0 to allow connections from external IPs, such as the local linguist Android app.

If everything has worked, then the server should now be listening on port 3000. Open a browser and go to http://localhost:3000!

References