Skip to content

Setting up a development environment

Kieran Coldron edited this page May 21, 2015 · 49 revisions

OS X

  1. Install Homebrew
  2. Install Ruby 2.1.3 (we recommend using RVM)
  3. Install the following packages from homebrew: curl, v8, redis, imagemagick, and node
  4. Install Postgres.app
  5. Jump to "General Instructions"

Ubuntu/Debian Linux

  1. Set up the PGDG apt repository using their instructions

  2. Add the Postgresql package repository:

    $ echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" | sudo tee -a /etc/apt/sources.list.d/pgdg.list
    $ sudo apt-get update
    
  3. Install the dependencies:

    $ sudo apt-get install curl build-essential git libcurl4-openssl-dev libreadline-dev \
                           libssl-dev libxml2-dev libxslt1-dev zlib1g-dev libpq-dev libpq5 \
                           python-psycopg2 pgdg-keyring postgresql postgresql-contrib
    
  4. Install RVM:

    curl -L https://get.rvm.io | bash -s stable --ruby=2.1.3
    
  5. Create a new database user for your user with:

    $ echo 'CREATE USER username' | psql -U postgres
    
  6. Jump to "General Instructions"

Windows

  1. Make sure that you have VT-x or AMD-v enabled in your BIOS.
  2. Download a copy of Ubuntu
  3. Download and install VirtualBox
  4. Open VirtualBox and create a new Virtual Machine.
  • You can choose whatever name you want but make sure to set the type to other and the version to Other/Unknown (64bit).
  • All other settings don't need to be changed, you can however adjust the RAM and disk size for your need.
  1. Start your new VM, select the Ubuntu ISO you previously downloaded, and run through the setup.
  2. Open the VM's network settings (Machine > Settings > Network) and change the type of the adapter to bridge.
  3. (*1) Select Device > Insert medium with guest extension and run through the setup.
  • If this isn't working, navigate to /media/VBOXADDI... in a terminal (just hit tab to autocomplete the version number)
  • Install Guest module via sh VBoxLinuxAdditions.run
  1. Select Edit > Shared folders in the VirtualBox Overview and click the + icon to add a new shared folder
  2. Mount your shared folder in Linux by running the following in a terminal:
    sudo mount -t vboxsf name-of-the-folder path-to-folder-on-vm
    
  3. Jump to "Linux Instructions" and come back when you're done with those and the "General Instructions"
  4. Add your VM to your hosts file so you can access it at hummingbird.dev
  • In Linux, type ifconfig and copy the ip from your ethernet interface (usually named eth0)

  • In Windows, open %systemroot%\system32\drivers\etc and edit the file hosts

  • Add the ip you copied to the bottom of the file like:

    192.168.1.38 hummingbird.dev
    
  • Save the file and check if hummingbird.dev:3000 works in your browser

(*1) The following three steps describe a setup using the Virtual Box shared folders. However, the performance of shared folders is horrible. (Rendering the page can take up to one minute!) I guess they screwed up the filesystem handling since it worked all fine in earlier versions but for now, I'd suggest using a FTP based solution. Installing and configuring vsftpd and setting up WinSCP with Directory Sincing on the main machine works fine, although it's a pretty laborious workaround.

(*) If you're using a windows machine, pay attention to line endings. They can be really annoying since they call a lot of errors that seems to be random at first. Also, you might want to use git config core.autocrlf true to ignore CR+LF diffs in GitHub4Windows if you decide to go with that instead of using a git shell.

General Instructions

  1. git clone https://github.com/hummingbird-me/hummingbird.git
  2. Install ember-cli and bower from NPM with npm install -g ember-cli bower
  3. Run bundle install in the project root
  4. Run bundle exec rake db:create db:structure:load db:seed in the project root
  5. Download the database dump and load it in by running psql -d hummingbird_development < dump.sql — if there's errors, ask in the Slack chat, we may need to update it.
  6. cd frontend and run npm install and bower install (npm especially can take a while to run — I suggest grabbing a snack while it runs)
  7. Start the server with bundle exec foreman start
  8. Open http://localhost:3000/ in your browser (it may show nothing, mash reload if that happens)

Debugging

  • If redisoutputs an error while starting the bundle, navigate to /var/log/redis and check the log file via tail r... (autocomplete). It contains further instructions on how to solve the issue
  • If unicornfailed starting postgresql with the error no password supplied, edit the /etc/postgresql/9.2/main/pg_hba.conf and replace the peer / md5 in every uncommented line with trust, then reload the config by executing select pg_reload_conf(); from the database prompt
  • If the page itself displays database errors, check your user permissions or just ALTER USER yourname WITH SUPERUSER to bypass security
  • If something complains that the wrong Ruby version is being used, try rvm use 2.1.3. If it's not working, use rvm install 2.1.3 to install the ruby and rvm use 2.1.3 to start it. If the ruby is not available for install, follow this guide
Clone this wiki locally