# Discourse as Your First Rails App

**URL:** https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751
**Category:** Blog
**Created:** [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:** 6

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [15 באוקטובר,‏ 2015,‏ 5:05am UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/112 "2015-10-15T05:05:43Z")

</div>

Well, I’ve made some progress

I went back to

> **[\#14040 (Windows host-only adapter creation fails due to slow background...](https://www.virtualbox.org/ticket/14040)**

I hadn’t read far before, and saw that VirtualBox 5 was supposedly free of this problem - BUT - when I tried it learned that version 5 is not supported by the latestest version of GitHub

Just now I read more and found  
`https://www.virtualbox.org/attachment/ticket/14040/VBox-Win10-fix-14040.exe`

It now gets past the error but times out trying to connect.  
Aaarrrgggh! #@\*$!#@

---

<div class="post-metadata">

### Author: ![ptgamr](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ptgamr/32/116844_2.png) [@ptgamr](https://meta.discourse.org/u/ptgamr)
#### Post date: [15 באוקטובר,‏ 2015,‏ 7:25am UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/113 "2015-10-15T07:25:16Z")

</div>

@Thrillberg I got the same error as you. Did you got a way to fix yet?

---

<div class="post-metadata">

### Author: ![Thrillberg](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thrillberg/32/116889_2.png) [@Thrillberg](https://meta.discourse.org/u/Thrillberg)
#### Post date: [15 באוקטובר,‏ 2015,‏ 9:54am UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/114 "2015-10-15T09:54:09Z")

</div>

Hmm, nope I’m on Mac OSX 10.10. ☹

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [15 באוקטובר,‏ 2015,‏ 7:05pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/115 "2015-10-15T19:05:07Z")

</div>

@Thrillberg @ptgamr

Maybe these will help

> [@Vagrant based server failing on db:migrate](https://meta.discourse.org/t/vagrant-based-server-failing-on-db-migrate/34566):
>
> I just ran through the instructions in the developer guide to install an environment using a virtual machine with vagrant I found [here](https://github.com/discourse/discourse/blob/master/docs/VAGRANT.md). In my newly created instance, after a bundle update, updating the database with rake like so bundle exec rake db:migrate generates the following error: rake aborted! NameError: uninitialized constant SiteSettings::DbProvider::RailsMultisite /vagrant/lib/site\_settings/db\_provider.rb:52:in `current_site' /vagrant/lib/site_setting_extension.rb:44:in `current' /…

[https://meta.discourse.org/t/upgrade-failed-after-the-recent-todays-commits-cannot-load-such-file-rails-multisite/34396?u=mittineague](https://meta.discourse.org/t/upgrade-failed-after-the-recent-todays-commits-cannot-load-such-file-rails-multisite/34396)

---

<div class="post-metadata">

### Author: ![Thrillberg](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thrillberg/32/116889_2.png) [@Thrillberg](https://meta.discourse.org/u/Thrillberg)
#### Post date: [15 באוקטובר,‏ 2015,‏ 7:47pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/116 "2015-10-15T19:47:59Z")

</div>

Thanks for these links! Unfortunately, it doesn’t work for me. `gem rails_multisite` was already in my Gemfile and when I tried the `sudo chmod a+r generators.rake` command, it gave me this error:  
`chmod: cannot access `generators.rake’: No such file or directory`

---

<div class="post-metadata">

### Author: ![Matthew\_Asbury](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/matthew_asbury/32/116900_2.png) [@Matthew\_Asbury](https://meta.discourse.org/u/Matthew_Asbury)
#### Post date: [26 באוקטובר,‏ 2015,‏ 2:27pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/117 "2015-10-26T14:27:49Z")

</div>

I had this error recently. Turned out to be permissions related. The fix is available here [https://meta.discourse.org/t/rails-multisite-still-breaking-build/34575/14?u=matthew\_asbury](https://meta.discourse.org/t/rails-multisite-still-breaking-build/34575/14)

---

<div class="post-metadata">

### Author: ![Thrillberg](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thrillberg/32/116889_2.png) [@Thrillberg](https://meta.discourse.org/u/Thrillberg)
#### Post date: [26 באוקטובר,‏ 2015,‏ 3:22pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/118 "2015-10-26T15:22:16Z")

</div>

Awesome! Worked for me. Thanks so much!

---

<div class="post-metadata">

### Author: ![AbbasFaisal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/abbasfaisal/32/158588_2.png) [@AbbasFaisal](https://meta.discourse.org/u/AbbasFaisal)
#### Post date: [7 בנובמבר,‏ 2015,‏ 6:36pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/119 "2015-11-07T18:36:03Z")

</div>

Don’t know if this has been posted yet. But I had trouble accessing from the browser in my Windows. I used `rails s -b 0.0.0.0` to access the site.

---

<div class="post-metadata">

### Author: ![Joe\_Flowers](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joe_flowers/32/122054_2.png) [@Joe\_Flowers](https://meta.discourse.org/u/Joe_Flowers)
#### Post date: [28 בדצמבר,‏ 2015,‏ 8:52pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/120 "2015-12-28T20:52:11Z")

</div>

this should truly be part of the tutorial now since rails doesn’t bind to 0.0.0.0 by default as of 4.2

I’m unable to post the SO link here because I am new but if you google search ‘What does binding a Rails Server to 0.0.0.0 buy you?’ there’s some chatter on it

---

<div class="post-metadata">

### Author: ![frankpiva](https://avatars.discourse-cdn.com/v4/letter/f/71e660/32.png) [@frankpiva](https://meta.discourse.org/u/frankpiva)
#### Post date: [19 בינואר,‏ 2016,‏ 8:42pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/121 "2016-01-19T20:42:35Z")

</div>

I’m slightly confused by the setup guide for a development environment. I have already installed a production instance of Discourse and had very little issues understanding/executing the instructions.

On your development instructions it seems like you keep switching back in forth between Linux and Windows/Mac. I am trying to install a development environment on a dedicated, remote Linux server. Is this where I’m making a mistake? Are these instructions intended for a local install?

Thanks.

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [20 בינואר,‏ 2016,‏ 4:02pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/122 "2016-01-20T16:02:56Z")

</div>

If you are installing on a Linux server you can still use vagrant to get set up easily. However, you might prefer to follow [this guide](https://meta.discourse.org/t/beginners-guide-to-install-discourse-on-ubuntu-for-development/14727) that explains how to set it up without virtualization.

---

<div class="post-metadata">

### Author: ![frankpiva](https://avatars.discourse-cdn.com/v4/letter/f/71e660/32.png) [@frankpiva](https://meta.discourse.org/u/frankpiva)
#### Post date: [20 בינואר,‏ 2016,‏ 7:55pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/123 "2016-01-20T19:55:02Z")

</div>

Thanks for providing the link to the guide, but unfortunately I also tried that to no avail. It seems the initial script he provides fails to install Ruby correctly. I’ll try to give it another shot though. It seems my issue is getting narrower.

---

<div class="post-metadata">

### Author: ![frankpiva](https://avatars.discourse-cdn.com/v4/letter/f/71e660/32.png) [@frankpiva](https://meta.discourse.org/u/frankpiva)
#### Post date: [22 בינואר,‏ 2016,‏ 6:05pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/125 "2016-01-22T18:05:49Z")

</div>

So I think I figured out my issue. I was trying to install Discourse on a dedicated AWS instance, that I was accessing through a Linux VM. I’m not sure where exactly the problem was, but when I tried installing directly to the VM itself and not the AWS instance it worked like a charm.

This is the [guide](https://github.com/discourse/discourse/blob/master/docs/VAGRANT.md) I was using.

I followed these steps exactly on the AWS cloud instance (making sure I had the latest version of each dependency) and it failed. I did the exact same thing on my local VM and it succeeded. Like I said, I don’t know what the exact issue is, but I hope this helps someone else, and I look forward to hacking on Discourse.

---

<div class="post-metadata">

### Author: ![Osama](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/osama/32/98013_2.png) [@Osama](https://meta.discourse.org/u/Osama)
#### Post date: [19 במרץ,‏ 2016,‏ 8:49pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/126 "2016-03-19T20:49:27Z")

</div>

Okay, so I’ve successfully installed Discourse locally on my computer, but there is one simple problem, seriously, **how can I login?** I solved a ton of problems and errors by myself while installing the application, but this one, I couldn’t!

My OS is Windows 10, if that helps.

And Ah, Sorry for bumping this thread, I didn’t want to create a new thread for just this little problem.

 ![](https://global.discourse-cdn.com/meta/original/3X/c/f/cf6b790a18d08c75ed400d2f3156a28444f35927.png)

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [19 במרץ,‏ 2016,‏ 9:13pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/127 "2016-03-19T21:13:56Z")

</div>

Have you tried going to this URL  
`http://localhost:4000/session/eviltrout/become`

Though IMHO it’s better to create a new Admin account using the CLI

[https://meta.discourse.org/t/how-to-create-an-administrator-account-after-install/14046?u=mittineague](https://meta.discourse.org/t/how-to-create-an-administrator-account-after-install/14046)

> [@Create an admin account from the console](https://meta.discourse.org/t/create-admin-account-from-console/17274):
>
> bookmark This guide provides instructions for creating an admin account or granting admin privileges using the console in a self-hosted Discourse installation. person_raising_hand Required user level: System Administrator warning Console access required So you want to create/grant Admin privileges or reset user password from console? Great, let’s get started! This guide will cover the following: Accessing the console Creating a new account with admin privileges Resetting an existin…

---

<div class="post-metadata">

### Author: ![Osama](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/osama/32/98013_2.png) [@Osama](https://meta.discourse.org/u/Osama)
#### Post date: [19 במרץ,‏ 2016,‏ 9:23pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/128 "2016-03-19T21:23:11Z")

</div>

Yep, that works. Thanks a lot @Mittineague 🙂

---

<div class="post-metadata">

### Author: ![strider72](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@strider72](https://meta.discourse.org/u/strider72)
#### Post date: [27 באפריל,‏ 2016,‏ 8:34pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/130 "2016-04-27T20:34:49Z")

</div>

It’s not too hard to figure out, but you might want to specify what the user needs to do the NEXT time they start this up. Obviously they don’t need to run all the install stuff again, but it seems they do need to re-run the server bit at the end?

Also: When I try to vagrant up the second time, I get an error when it tries to mount the NFS volume. The protocol is not loaded. (This is Mac OS 10.11.4)

Finally, what is the login for Discourse in the VM? I can’t get to the admin area because I don’t know this!

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [27 באפריל,‏ 2016,‏ 8:39pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/133 "2016-04-27T20:39:57Z")

</div>

Awnser is 2 topics above you 😉.

> [@Discourse as Your First Rails App](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/127):
>
> Have you tried going to this URL http://localhost:4000/session/eviltrout/become Though IMHO it’s better to create a new Admin account using the CLI [https://meta.discourse.org/t/how-to-create-an-administrator-account-after-install/14046?u=mittineague](https://meta.discourse.org/t/how-to-create-an-administrator-account-after-install/14046)

---

<div class="post-metadata">

### Author: ![Andrew\_Byrne](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/andrew_byrne/32/116413_2.png) [@Andrew\_Byrne](https://meta.discourse.org/u/Andrew_Byrne)
#### Post date: [2 במאי,‏ 2016,‏ 7:45am UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/134 "2016-05-02T07:45:51Z")

</div>

Hi I’m a developer that has been touched by Ruby on Rails… 😑

I really like the development version of the system BUT am struggling to see where I can enable the CORS for the development instance?

Anyone?

---

<div class="post-metadata">

### Author: ![Andrew\_Byrne](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/andrew_byrne/32/116413_2.png) [@Andrew\_Byrne](https://meta.discourse.org/u/Andrew_Byrne)
#### Post date: [2 במאי,‏ 2016,‏ 12:42pm UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/135 "2016-05-02T12:42:35Z")

</div>

OK totally got ^^^^ that…

seems that editing **discourse\_defaults.conf**

```
# enable Cross-origin Resource Sharing (CORS) directly at the application level
enable_cors = true
cors_origin = '*'

```

then restart

```
bundle exec rails s -b 0.0.0.0

```

does the trick, just not for prod please.

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

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