|
| 1 | +# Contributing |
| 2 | + |
| 3 | +There are a couple of steps you need to take before contributing: |
| 4 | + |
| 5 | +1. Go to [https://assemblymade.com](https://assemblymade.com) and sign up. |
| 6 | +2. Link your GitHub account to your Assembly account in your profile settings. |
| 7 | +3. Create a new WIP at [https://assemblymade.com/coderwall/wips](https://assemblymade.com/coderwall/wips). |
| 8 | + |
| 9 | +Then just go ahead, fork the repo & issue a pull request. You're on your way to having a stake in Helpful. |
| 10 | + |
| 11 | +## External Dependencies |
| 12 | + |
| 13 | +### Stripe configuration |
| 14 | + |
| 15 | +You'll need to set up a test account with Stripe for local development until this dependency is refactored out of development/test. |
| 16 | + |
| 17 | +## Github configuration |
| 18 | + |
| 19 | +You will need a Github application configured for local development until this dependency is refactored out of development/test. |
| 20 | + |
| 21 | +https://github.com/settings/applications/new |
| 22 | + |
| 23 | +## How to run Coderwall locally. |
| 24 | + |
| 25 | +We use Vagrant to isolate all of our dependencies without polluting your normal working environment. |
| 26 | + |
| 27 | +You're free to not use Vagrant but by the time you're done setting up you'll probably already have given up and installed Vagrant. |
| 28 | + |
| 29 | +### How to work on Coderwall using Vagrant on VirtualBox |
| 30 | + |
| 31 | +Sure you could download and install all the dependencies, services, and whatnot |
| 32 | +on to your local workstation but ain't nobody got time for that mess. |
| 33 | + |
| 34 | +To save time and headaches we use Vagrant. Vagrant is a automation tool for |
| 35 | +VirtualBox that will help you spin up a virtual environment with pretty much |
| 36 | +everything in place and ready for you to start hacking (even on Windows!) |
| 37 | + |
| 38 | +Here's everything you need to get started working on Coderwall with Vagrant TODAY! |
| 39 | + |
| 40 | +*At the time of writing this document we were using VirtualBox 4.3.10 and Vagrant 1.6.2.* |
| 41 | + |
| 42 | +#### Vagrant! I already know what to do. |
| 43 | + |
| 44 | +__If you're an experienced Vagrant user then you can fetch the base box and register it yourself.__ |
| 45 | + |
| 46 | +There's only a VirtualBox basebox right now. |
| 47 | + |
| 48 | + vagrant box add coderwall http://cdn.coderwall.com/vagrant/coderwall.box |
| 49 | + |
| 50 | +#### Vagrant? VirtualBox? Let's take this one step at a time. |
| 51 | + |
| 52 | +1. **Install VirtualBox** |
| 53 | + |
| 54 | + Grab the VirtualBox installer from **[here](https://www.virtualbox.org/wiki/Downloads)**. |
| 55 | + |
| 56 | + _At the time of writing this documentation the current version is VirtualBox 4.3.10._ |
| 57 | + |
| 58 | + You don't have to install the VirtualBox 4.3.10 Oracle VM VirtualBox Extension Pack |
| 59 | + but I recommend installing it for the extra drivers. |
| 60 | + |
| 61 | +2. **Install Vagrant** |
| 62 | + |
| 63 | + Grab the Vagrant installer from **[here](http://www.vagrantup.com/downloads.html)**. |
| 64 | + |
| 65 | + _At the time of writing this documentation the current version is Vagrant 1.6.2._ |
| 66 | + |
| 67 | + Follow the installation instructions for your platform on the Vagrant download page. |
| 68 | + |
| 69 | + After installing Vagrant we need to add a couple plugins. |
| 70 | + |
| 71 | + If you're on a OS X/Linux system you can install the plugins by running: |
| 72 | + |
| 73 | + vagrant plugin install vagrant-vbguest |
| 74 | + |
| 75 | + The vagrant-vbguest plugin will each help with keeping the VirtualBox Guest Additions up-to-date. |
| 76 | + |
| 77 | +3. **Git assemblymade/coderwall** |
| 78 | + |
| 79 | + mkdir -p ~/assemblymade |
| 80 | + cd ~/assemblymade |
| 81 | + git clone git@github.com:assemblymade/coderwall.git |
| 82 | + |
| 83 | + I am going to assume that the project is cloned into your home directory in |
| 84 | + and into a directory structure like `~/assemblymade/coderwall`. |
| 85 | + |
| 86 | +4. **Fire it up! Fire it up! Fire it up!** |
| 87 | + |
| 88 | + Now that you've got VirtualBox and Vagrant installed with the source code |
| 89 | + cloned in `~/assemblymade/coderwall` we can start up the Vagrant instance. |
| 90 | + |
| 91 | + cd ~/assemblymade/coderwall |
| 92 | + vagrant up |
| 93 | + |
| 94 | + You will likely be prompted for your `sudo` password to allow VirtualBox |
| 95 | + to mount the shared folder using NFS. |
| 96 | + |
| 97 | + Since this is probably the first time you're running this command it's going |
| 98 | + to take a VERY long time (bandwidth willing) to run. This is because Vagrant |
| 99 | + needs to fetch the Coderwall base box from the Internet and it's about 1GB. |
| 100 | + Fortunately that really only has to be done once (unless the base box get's |
| 101 | + updated but that's another story). |
| 102 | + |
| 103 | + Once Vagrant reports that you're booted up and ready to go then you'll be |
| 104 | + able to SSH into the local vm similiar to any other remote box. |
| 105 | + |
| 106 | + # still in ~/assemblymade/coderwall |
| 107 | + vagrant ssh |
| 108 | + # whoa! |
| 109 | + pwd |
| 110 | + hostname |
| 111 | + ls -al |
| 112 | + # We're not in localhost any longer... well, you get what I mean |
| 113 | + |
| 114 | + Now that you're SSH'ed into the Vagrant VM it's time to run the app. |
| 115 | + |
| 116 | + # we're still SSH'ed into Vbox |
| 117 | + cd ~/assemblymade |
| 118 | + rvm current # should be ruby-2.1.0@coderwall |
| 119 | + bundle check # should be a response that everything's good |
| 120 | + bundle exec rails server |
| 121 | + |
| 122 | + If all went well the Rails server should start up on PORT 3000. |
| 123 | + |
| 124 | + Now go open your favorite web browser on you host machine and |
| 125 | + navigate to `http://localhost:3000`. |
| 126 | + |
| 127 | + If all goes well (and if it doesn't then check if another app is |
| 128 | + running on port 3000 and if there's any logging output being displayed |
| 129 | + in the window you were running Vagrant in) then you're going to be |
| 130 | + looking at the Coderwall homepage. |
| 131 | + |
| 132 | + Congratulations! NOW GET TO WORK! Enough dilly-dallying with your devenv. |
| 133 | + |
| 134 | +5. **Hackety Hack!** |
| 135 | + |
| 136 | + Vagrant is powerful not just because it can abstract away the mess of |
| 137 | + managing a crazy, complicated development environment while ensuring everyone |
| 138 | + has a common platform to work on. It's also powerful because it will still |
| 139 | + let you have whatever crazy, complicated editors and tools to work on your |
| 140 | + code while abstracting away the nasty details of installing and configuring Postgres. |
| 141 | + |
| 142 | + If you're on your host computer and navigate to `~/assemblymade/coderwall` (we're all there, right?) |
| 143 | + and make changes to your code while Vagrant is running you'll be able to see the changes |
| 144 | + reflected in Vagrant immediately. Try this. |
| 145 | + |
| 146 | + cd ~/assemblymade/coderwall |
| 147 | + echo Hello, `whoami` from `hostname` >> HELLO.txt |
| 148 | + vagrant ssh |
| 149 | + cd ~/assemblymade |
| 150 | + cat HELLO.txt #whoa. |
| 151 | + echo Hello, `whoami` from `hostname` >> HELLO.txt |
| 152 | + exit |
| 153 | + cat HELLO.txt # wah-wah-wee-wa! |
| 154 | + rm -f HELLO.txt # yeah, it's deleted in the other spot too. |
| 155 | + |
| 156 | + Yeah, that's pretty awesome. Remember that NFS thing we glossed over earlier? That's |
| 157 | + the mechanism that Vagrant set up with VirtualBox to transparently synchronize your |
| 158 | + local folder with the folder on the VM. Now you can edit and manage your files from |
| 159 | + the comfort of your favorite OS without having to worry about copying them to the VM. |
| 160 | + |
| 161 | +6. **All done.** |
| 162 | + |
| 163 | + When you're ready to call it a day and want to turn the VM off you have two options. |
| 164 | + |
| 165 | + You can either "turn the VM off" using `vagrant halt` or you can suspend the VM using `vagrant suspend`. |
| 166 | + |
| 167 | + Either way when you're ready to resume working just `vagrant up` and you're good to go. |
| 168 | + |
| 169 | +7. **Thanks** |
| 170 | + |
| 171 | + I hope you enjoy working with Vagrant as much as we do and feel free to ask questions |
| 172 | + if you get stuck or have a problem. You're probably not alone and even if you're the |
| 173 | + first to encounter a rough patch you won't be the last. |
0 commit comments