/pinteresting

Saint-Gobain Fab Lab Hub

Primary LanguageRuby

Saint-Gobain Fab Lab Hub

Where makers from our network of Fab Labs can share their projects.

by Chloe Echikson

Set-up for Development environment.

Installing required software:

  1. Download and Install Vagrant

  2. Download and Install Virtualbox

  3. Download and open/install the appropriate VM Virtualbox Extension Pack

  4. Ensure git CLI on host machine

  5. If you are on Windows, see the Set-Up Instructions For Windows section below, then return here.

Set-up and run this app:

Git Clone the repo wherever you'd like it.

$ git clone https://github.com/cloworm/pinteresting.git
$ cd pinteresting

Access your Vagrant box.

Start up your Vagrant VM (provisioning may take a while the first time you up)

$ vagrant up

Log into your Vagrant VM (via ssh)

  1. ssh into your Vagrant VM (see windows instructions if you are on Windows)
$ vagrant ssh

You should notice your command prompt has changed to something like this:

vagrant@pinteresting:~$

Enter the project directory

  1. Change directory into the shared project folder (shared meaning the files are shared between your Vagrant and your Host machine)
$ cd pinteresting

Install gems.

  1. Make sure all the required gems are installed:
$ bundle install

Set up database.

  1. Make sure the database is migrated to latest:
$ rake db:migrate
  1. Seed your database with some required values:
$ rake db:seed

Run the app!

  1. Start your rails server (specifying IP 0.0.0.0 so it works from Vagrant)
$ rails s -b 0.0.0.0
  1. Visit localhost:3000 in your favorite web browser!

Set-Up Instructions For Windows:

  1. Download and Install PuTTy putty.exe

  2. Download and Install PuTTYgen puttygen.exe

1) Generate SSH Keys With PuTTyGen (You only do this once)

  • Open puttygen.exe

  • Click the "Load" button

  • To the right of Filename at the bottom change the drop down from "PuTTy Private Key Files (.ppk)" to "All Files ()"

  • Navigate to the cloned repo folder (example 'Desktop/Websites/pinteresting')

  • Navigate to the "private_key" file in ".vagrant/machines/default/virtualbox/private_key" and click open on this file.

  • Click 'Ok' to the PuTTyGen alert window

  • Click "Save Private Key"

  • Click 'Yes' to the PuTTyGen alert window

  • Name the .ppk file "private_key" without quotes

  • Save it in the same directory as putty for organization

  • Close PuTTyGen

To SSH in to the VM:

2) SSH into Vagrant with PuTTy (This is how you will vagrant-ssh)

  • Open putty.exe
IN SESSION:
  • Set "Host Name (or IP address)" to "127.0.0.1"
  • Set "Port" to "2222"
  • Set "Connection Type" to "SSH"
IN CONNECTION/SSH/AUTH:
  • Check "Display pre-authentication banner (SSH-2 only)"
  • Check "Attempt authenticating using Pageant"
  • Check "Attempt "keyboard-interactive" auth (SSH-2)"
  • Check "Allow agent forwarding"
  • Check "Allow attempted changes of username in SSH-2"
  • Click Browse and navigate to the "private_key.ppk" file you generated in the putty directory
IN SESSION:
  • Type "vagrant" (no quotes) in the Saved Sessions input
  • Click Save

To open the vagrant box from this point on you may skip the putty setup. You will only need to open the putty.exe file and double click "vagrant" in the saved sessions list after running "vagrant up" in cmd or powershell.

Navigate to synced folders directory:

$ cd /vagrant

Common Vagrant commands.

For a full list of commands type:

vagrant -h

Stop Vagrant

To suspend (sleep):

vagrant suspend

To halt (shutdown):

vagrant halt

Useful Tips

If you need to confirm your user's email address in development

Run this command in the rails console ($ rails c) after creating the user:

User.where(:confirmed_at => nil).update_all(:confirmed_at => Time.now.utc)

Want to contribute?

See CONTRIBUTING.md to learn how.