Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

Setting up your development environment

Jack Thomson edited this page Nov 22, 2020 · 23 revisions

Recommended Setup

Setting-up much of this requires many dependencies and a lot of screwing around with MySQL. We recommend you use Vagrant to set it all up. It's more clean (all dependencies go in a VM, not your local machine), and enforces consistency across all development environments (free reproducability).

System Dependencies

Make sure you have Ruby 2, Rails 4, node.js (or some JS runtime), and MySQL installed. If not, follow one of the below!

Mac OS X

  1. Follow this, skipping SQLite and stopping once you've installed Rails.
  2. Install MySQL.
  3. Install node.js: brew install node

Windows

Use Vagrant.

GNU/Linux

If you're using Ubuntu or a Debian-based system, you can more or less run the bootstrap.sh file that sets up Vagrant. Otherwise, the commands should be very similar. Follow along, and you should generally get it right. Do note that the Oracle MySQL setup may be different (e.g. where to put certain configuration files, etc.), so you may want to look up setup for your exact distribution.

Vagrant

What is Vagrant? It's a headless (no UI), virtual development environment. You can run Vagrant in VirtualBox on pretty much any machine, so this is a good option if you want to skip the OS-specific stuff.

  1. Install Vagrant and VirtualBox.
  2. git clone [email protected]:wrekatlanta/wrektranet.git
  3. Grab the Oracle InstantClient files from Oracle for Linux, and move them into the top-level Wrektranet directory
  4. Run vagrant up to set up the virtual machine.
  5. Run vagrant ssh to ssh into your virtual machine.
  6. cd /vagrant/wrektranet to get to the project directory.
  7. Set up the database by following the instructions under the Database section
  8. Run rails s and see if it all starts up

Dependencies

  • bundle to install all the dependencies for this project.
  • If you don't plan on using any of the playlist/music data (from the Oracle database) locally, you can run: bundle install --without=oracle
  • If you need to install Oracle drivers, follow this guide and run bundle normally.

Database

  1. cp config/database.example.yml config/database.yml
  2. Set a username and password in your database.yml if necessary.
  3. cp config/application.example.yml config/application.yml

The Rails Vagrant box might have a username and password. Try looking it up or looking through its source. Someone should udpate this if they figure it out.

Now you can run the commands to set the database up (creating it, loading the database schema, setting up the separate testing database, creating seed data):

bundle exec rake db:create:all
bundle exec rake db:schema:load
bundle exec rake db:test:prepare
bundle exec rake db:seed
  • Start the app with rails server or rails s
  • Go to localhost:3000 to see the app. You can login with [email protected] and password, which was specified in db/seeds.rb.
  • Optionally, you can run the app using guard to watch for updates to tests and changes that require restarting the server.

FAQ and Cheat Sheet

  • Need to nuke the database? bundle exec rake db:drop:all
  • Need to run database migrations? bundle exec rake db:migrate
  • Need to install gems? bundle install
  • Here's a cheat sheet.