# Discourse as Your First Rails App

**URL:** https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751
**Category:** Blog
**Created:** [April 9, 2013, 11:08pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751 "2013-04-09T23:08:33Z")
**Posts on this page:** 20
**Page:** 2

<div class="post-metadata">

### Author: ![tomeoftom](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tomeoftom/32/103480_2.png) [@tomeoftom](https://meta.discourse.org/u/tomeoftom)
#### Post date: [April 11, 2013, 2:53pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/21 "2013-04-11T14:53:58Z")

</div>

I just want to emphasise how much I appreciated this post. I’ve tried getting Vagrant up on Windows before (“Unixism” is a great word for it) and the process failed for me in myriad ways.

Aside: since then, I’ve discovered [gow (Gnu On Windows)](https://github.com/bmatzelle/gow), which is a really lightweight and portable library of binaries like `ssh`, `curl`, and the basics like `ls` - it’s a lot more convenient than Cygwin. Cygwin can be agonising when you have to deal with Ruby gems. It’s also a smidgeon more convenient than Git Bash in quite a lot of places.

Anyway, thanks so much for making this process a bit clearer. I can’t wait to have a look around Discourse - this is my first post, and I’m astounded by how perfectly considered the UI design is.

---

<div class="post-metadata">

### Author: ![jorge\_castro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jorge_castro/32/102508_2.png) [@jorge\_castro](https://meta.discourse.org/u/jorge_castro)
#### Post date: [April 11, 2013, 10:00pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/22 "2013-04-11T22:00:41Z")

</div>

Here is a quick and dirty translation of Getting Started for Debian/Ubuntu users if you want to toss it in a script or something:

1. `sudo apt-get install git virtualbox nfs-common nfs-kernel-server`
2. `wget http://files.vagrantup.com/packages/64e360814c3ad960d810456add977fd4c7d47ce6/vagrant_x86_64.deb`
3. `sudo dpkg -i vagrant_x86_64.deb`
4. Open a terminal
5. Clone the project: `git clone git@github.com:discourse/discourse.git`
6. Enter the project directory: `cd discourse`

Then continue on with the rest of the instructions … (I’m getting an error with the NFS client thing, but that should work, I’m investigating that and will update this when I find the cause.)

---

<div class="post-metadata">

### Author: ![jrduncans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jrduncans/32/102912_2.png) [@jrduncans](https://meta.discourse.org/u/jrduncans)
#### Post date: [April 21, 2013, 12:22am UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/23 "2013-04-21T00:22:17Z")

</div>

I found you also need to add `nfs-kernel-server` to the list of packages to `apt-get install`. That got past all my NFS related errors.

---

<div class="post-metadata">

### Author: ![sinak](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sinak/32/105140_2.png) [@sinak](https://meta.discourse.org/u/sinak)
#### Post date: [April 21, 2013, 9:27pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/24 "2013-04-21T21:27:41Z")

</div>

A quick note to say that I was getting this error following the instructions on OS X:

> [default] Mounting NFS shared folders…

> The following SSH command  
> responded with a non-zero exit status. Vagrant assumes that this means  
> the command failed!
> 
> mount -o vers=3 192.168.10.1:‘/path\_to/folder’  
> /vagrant

Fix was very simple, simply make a directory called “vagrant” in the root of the drive you’re running the VM.

> Macbook-Air:/ Sina$ sudo mkdir vagrant

Hope that helps someone getting started …

---

<div class="post-metadata">

### Author: ![ultimape](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ultimape/32/115327_2.png) [@ultimape](https://meta.discourse.org/u/ultimape)
#### Post date: [April 22, 2013, 4:26pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/25 "2013-04-22T16:26:54Z")

</div>

To add to your reply to @ndc, they just recently released a way to add a new provider, so it is possible to get it going on hyper-v if someone was willing to do the leg-work for vagarent. [Vagrant | HashiCorp Developer](http://docs.vagrantup.com/v2/plugins/providers.html)

I’m not familiar enough with vagrant to know if its something i’m going to be looking into or not, but I am interested in automating deployments to various VMs. Thanks for pointing it out.

With windows 8 coming with hyper-v as an install option out of box, it sounds like a no-brainer. Also, the free version of hyper-v 2012 is excellent. I just set up a cluster of 3 machines in my basement and have been using no shared state live-migration to offload working servers that I set up on my windows-8 box onto the cluster. its fantastic.

---

<div class="post-metadata">

### Author: ![filtercake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/filtercake/32/105415_2.png) [@filtercake](https://meta.discourse.org/u/filtercake)
#### Post date: [May 24, 2013, 7:28pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/26 "2013-05-24T19:28:36Z")

</div>

thx, had the same problem! maybe @Hanzo could add that to the blog post?

---

<div class="post-metadata">

### Author: ![filtercake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/filtercake/32/105415_2.png) [@filtercake](https://meta.discourse.org/u/filtercake)
#### Post date: [May 24, 2013, 8:02pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/27 "2013-05-24T20:02:16Z")

</div>

Thx, awesome writeup, had it running locally in about an hour.

I searched for hints on Heroku deployment but didn’t find anything definite. Do I simply follow [https://devcenter.heroku.com/articles/rails3](https://devcenter.heroku.com/articles/rails3)?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [May 24, 2013, 8:17pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/28 "2013-05-24T20:17:20Z")

</div>

You didn’t look at [discourse/docs at main · discourse/discourse · GitHub](https://github.com/discourse/discourse/tree/master/docs) ?

I got many hits by searching here for “heroku”

---

<div class="post-metadata">

### Author: ![filtercake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/filtercake/32/105415_2.png) [@filtercake](https://meta.discourse.org/u/filtercake)
#### Post date: [May 24, 2013, 9:04pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/29 "2013-05-24T21:04:24Z")

</div>

Sorry, my bad, searched here on meta only. Yes, many hits, but not what I was hoping for.

For anybody else looking for this: the Heroku step-by-step guide is of course in the docs at [https://github.com/discourse/discourse/blob/master/docs/HEROKU.md](https://github.com/discourse/discourse/blob/master/docs/HEROKU.md)

A reminder/pointer to the docs would maybe helpful as an ending to the post?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [May 24, 2013, 9:07pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/30 "2013-05-24T21:07:33Z")

</div>

That blog post isn’t about deployment. It’s about getting the site running on your local box for _development_.

---

<div class="post-metadata">

### Author: ![rumpelcita](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rumpelcita/32/105442_2.png) [@rumpelcita](https://meta.discourse.org/u/rumpelcita)
#### Post date: [May 27, 2013, 3:45pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/31 "2013-05-27T15:45:13Z")

</div>

Okay, I want to help with Discourse, but I’ve never did anything in ruby at all and I’m a chicken, so I will go to this cool ruby workshop I found in my city where we all hang out to learn ruby together. Once I’m done and feel ready, I’ll start doing things for the project and I believe this to be the best place to let you all know. Also, what about native linux users? You feel we are strong and independent and will figure things out on our own? Or have we been forgotten?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [May 27, 2013, 4:37pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/32 "2013-05-27T16:37:52Z")

</div>

Vagrant works in Linux, instructions for Ubuntu were [posted above](http://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/22).

---

<div class="post-metadata">

### Author: ![rumpelcita](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rumpelcita/32/105442_2.png) [@rumpelcita](https://meta.discourse.org/u/rumpelcita)
#### Post date: [May 27, 2013, 5:43pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/33 "2013-05-27T17:43:10Z")

</div>

Awesome, thanks. I didn’t see that post 🙂

---

<div class="post-metadata">

### Author: ![siancu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/siancu/32/105479_2.png) [@siancu](https://meta.discourse.org/u/siancu)
#### Post date: [May 30, 2013, 3:26pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/34 "2013-05-30T15:26:01Z")

</div>

@Hanzo That would describe me 100%. That is why I am very interested in looking at Discourse and the article is very helpful in setting up a dev environment.

So thanks for writing it!

---

<div class="post-metadata">

### Author: ![siancu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/siancu/32/105479_2.png) [@siancu](https://meta.discourse.org/u/siancu)
#### Post date: [May 30, 2013, 9:40pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/35 "2013-05-30T21:40:20Z")

</div>

And what do I then do once I create the /vagrant folder? I can now ssh into the VM but, inside the VM, the vagrant folder is empty.

How can I then mount the NFS share?

Thanks!

---

<div class="post-metadata">

### Author: ![happycollision](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/happycollision/32/105486_2.png) [@happycollision](https://meta.discourse.org/u/happycollision)
#### Post date: [June 1, 2013, 4:50pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/36 "2013-06-01T16:50:34Z")

</div>

I finally got discourse running locally. I am running OSX Mtn Lion. I kept running into vagrant errors and db errors. So I just uninstalled everything (via the included uninstall tools for Vagrant and VirtualBox). Then I installed the exact versions of each that are mentioned in the instructions from the blog post. I didn’t get the newer versions of either Vagrant or VirtualBox.

VirtualBox: “As of this writing, **4.2.10** is the latest and works for us.”  
Vagrant: “you’ll need Vagrant **1.1.2** or higher” (don’t go higher)

Finally, everything worked.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [June 7, 2013, 10:13pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/37 "2013-06-07T22:13:41Z")

</div>

Using the shared folder `/vagrant` will provide really low performance.

If you want decent performance, you will need to do the following:

```shell
# create an alias to synchronize the code from the shared folder to a local folder
alias sin="rsync -a --delete /vagrant ~"
# actually synchronize (can take a minute for the first run)
sin
# switch to the local folder
cd ~/vagrant
# standard procedure to update, migrate and launch the application
bundle install
bundle exec rake db:migrate
bundle exec rails s

```

Enjoy 😉

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [June 7, 2013, 11:13pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/38 "2013-06-07T23:13:10Z")

</div>

And for anyone who wants to run the unit / spec tests on the vagrant image:

```
bundle exec rake db:migrate
bundle exec rake db:test:prepare
redis-cli flushall
bundle exec rspec

```

---

<div class="post-metadata">

### Author: ![pixelBender67](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pixelbender67/32/105552_2.png) [@pixelBender67](https://meta.discourse.org/u/pixelBender67)
#### Post date: [June 9, 2013, 8:22pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/41 "2013-06-09T20:22:29Z")

</div>

This was pretty painless on the mac, I see why you would want to use vagrant on windows and I guess it removes any env issues on the mac as well? I ask because I the only time I set up a VM is to test IE on my MBP  
Anyways set up was cooll, thanks for the fun

---

<div class="post-metadata">

### Author: ![pixelBender67](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pixelbender67/32/105552_2.png) [@pixelBender67](https://meta.discourse.org/u/pixelBender67)
#### Post date: [June 9, 2013, 8:37pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/42 "2013-06-09T20:37:41Z")

</div>

hmm, nothing is showing up at 0.0.0.0:3000  
getting no errors, am I missing something here?

[Previous page](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751.md?page=1)

[Next page](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751.md?page=3)
