# Discourse as Your First Rails App

**URL:** https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751
**Category:** Blog
**Created:** [09.Апрель.2013 23:08:33 UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751 "2013-04-09T23:08:33Z")
**Posts on this page:** 20
**Page:** 5

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [10.Июнь.2014 23:02:57 UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/92 "2014-06-10T23:02:57Z")

</div>

Though it is quite a crime our “recommended” dev environment is on 2.0 p0 …

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [11.Июнь.2014 19:04:38 UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/93 "2014-06-11T19:04:38Z")

</div>

> [@NomNuggetNom](#):
>
> How can I feed it commands

Just open another `vagrant ssh` session and enter those commands. Glad you got things going!

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [11.Июнь.2014 19:06:45 UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/94 "2014-06-11T19:06:45Z")

</div>

And Postgres 9.1 as well.

Fix your kit!

---

<div class="post-metadata">

### Author: ![NomNuggetNom](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nomnuggetnom/32/122685_2.png) [@NomNuggetNom](https://meta.discourse.org/u/NomNuggetNom)
#### Post date: [11.Июнь.2014 19:09:37 UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/95 "2014-06-11T19:09:37Z")

</div>

I just used PuTTY as you suggested [here](https://github.com/discourse/discourse/blob/master/docs/VAGRANT.md) 🙂

---

<div class="post-metadata">

### Author: ![batjko](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/batjko/32/32286_2.png) [@batjko](https://meta.discourse.org/u/batjko)
#### Post date: [02.Июль.2014 19:47:40 UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/96 "2014-07-02T19:47:40Z")

</div>

So here’s a very stupid question…  
The article got me to the point where I have a running Rails server on a VM, serving me the Discourse site… which is great.  
But I was kind of surprised that an article that seems to suggest it gets you started writing a RoR app, stops at installing the environment and an example app…

So… What now?

How do I start working on the files? Especially since I had to follow the advise from one commenter above to run the site from an aliased local directory, rather than the shared folder.

So do I just load the repository files into any Ruby-capable editor, and then re-synch the changed files to the local folder on the VM?

And so what should I do now?  
As a newbie I still don’t know anything about ruby or rails, consequently I have no idea what to look at now or where to start…

Any advise?

---

<div class="post-metadata">

### Author: ![vulkanino](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vulkanino/32/119654_2.png) [@vulkanino](https://meta.discourse.org/u/vulkanino)
#### Post date: [28.Октябрь.2014 17:03:56 UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/97 "2014-10-28T17:03:56Z")

</div>

Installing GitHub behind a proxy gave me some errors. The solution is here:

> <https://stackoverflow.com/questions/13490229/github-for-windows-installation>

(Internet Explorer incredibly worked fine)

---

<div class="post-metadata">

### Author: ![dadachi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dadachi/32/114449_2.png) [@dadachi](https://meta.discourse.org/u/dadachi)
#### Post date: [05.Ноябрь.2014 13:13:27 UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/98 "2014-11-05T13:13:27Z")

</div>

1. Is there OAuth sign-in test howto in development mode?
2. Is there SSO overriding avatar test howto in development mode?

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [08.Ноябрь.2014 09:03:17 UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/99 "2014-11-08T09:03:17Z")

</div>

OAuth should work just fine like a production system. Google for certain allows for any localhost callback URL.

SSO testing will be harder, as you’ll need to set up another local web server to serve as the source of authority.

---

<div class="post-metadata">

### Author: ![ZeroFlux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zeroflux/32/42184_2.png) [@ZeroFlux](https://meta.discourse.org/u/ZeroFlux)
#### Post date: [13.Январь.2015 22:19:05 UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/100 "2015-01-13T22:19:05Z")

</div>

Are the instructions in the first post still up-to-date? How about the Vagrant image itself? I’ve installed VirtualBox, Vagrant, and the Discourse repository. After SSH’ing into Vagrant and CD’ing into the Vagrant directory, I can’t bundle install due to a missing gemfile. First time using a VM, so I may indeed be doing something rather silly.

Windows 7 x64  
VirtualBox 4.3.20  
Vagrant 1.7.2

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [27.Январь.2015 01:32:52 UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/101 "2015-01-27T01:32:52Z")

</div>

Vagrant was updated recently, are you still having issues?

---

<div class="post-metadata">

### Author: ![Kasper](https://avatars.discourse-cdn.com/v4/letter/k/eada6e/32.png) [@Kasper](https://meta.discourse.org/u/Kasper)
#### Post date: [08.Март.2015 16:35:33 UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/102 "2015-03-08T16:35:33Z")

</div>

I’ve done all the steps, and it is running. But how can I login as admin ? There is already an admin account, but I don’t know the password.

Edit: Nevermind, this guide worked for me on osx, and showed me how to create an admin account.

> [@Install Discourse on macOS for development](https://meta.discourse.org/t/beginners-guide-to-install-discourse-on-mac-os-x-for-development/15772/0):
>
> warning This guide covers installation instructions for a macOS development environment, for production guides see: [Install Discourse in production with the official supported instructions](https://meta.discourse.org/t/how-to-install-discourse-in-production/142537) So you want to set up Discourse on macOS to hack on and develop with? We’ll assume that you don’t have Ruby/Rails/Postgres/Redis installed on your Mac. Let’s begin rocket ! Install Discourse Dependencies You will need the following packages on your system: [Git](http://git-scm.com/)[rbenv](https://github.com/sstephenson/rbenv) or [asdf](https://asdf-vm.com/guide/getting-started.html)[ruby-build](https://github.com/sstephenson/ruby-build)[Ruby](https://www.ruby-lang.org/) (latest s…

---

<div class="post-metadata">

### Author: ![Rene](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rene/32/115724_2.png) [@Rene](https://meta.discourse.org/u/Rene)
#### Post date: [19.Март.2015 23:10:35 UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/103 "2015-03-19T23:10:35Z")

</div>

To get my vagrant box running on osx and avoid the nfs issue, I changed the vagrant file:

```
- config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", :nfs => nfs_setting
+ config.vm.synced_folder ".", "/vagrant"

```

But when I start the app in my vagrant box and try to access localhost:4000 my app hangs with the following output:

```
 (4,3,2,5,6,7,8,9,10,11,1,12,14)) AND (NOT ( pinned_globally AND pinned_at IS NOT NULL )) ORDER BY topics.bumped_at DESC LIMIT 30
D, [2015-03-19T18:51:20.066104 #5462] DEBUG -- : User Load (1.5ms) SELECT "users"."id", "users"."email", "users"."username", "users"."uploaded_avatar_id" FROM "users" WHERE "users"."id" IN (24, 7, 23, 19, 22, 2, 20, 22, 11, 14, 20, 9, 20, 12, 11)
I, [2015-03-19T18:51:20.142212 #5462] INFO -- : Rendered list/list.erb within layouts/application (18.7ms)
I, [2015-03-19T18:51:20.151204 #5462] INFO -- : Rendered layouts/_head.html.erb (0.6ms)
I, [2015-03-19T18:51:20.161305 #5462] INFO -- : Rendered common/_special_font_face.html.erb (7.6ms)
D, [2015-03-19T18:51:20.177408 #5462] DEBUG -- : ColorScheme Load (2.3ms) SELECT "color_schemes".* FROM "color_schemes" WHERE "color_schemes"."versioned_id" IS NULL AND "color_schemes"."enabled" = 't' LIMIT 1
D, [2015-03-19T18:51:20.181779 #5462] DEBUG -- : (1.5ms) SELECT "categories"."updated_at" FROM "categories" ORDER BY updated_at desc LIMIT 1
D, [2015-03-19T18:51:20.188617 #5462] DEBUG -- : (1.4ms) SELECT "site_customizations"."stylesheet_baked" FROM "site_customizations" WHERE "site_customizations"."enabled" = 't' ORDER BY "site_customizations"."name" ASC
I, [2015-03-19T18:51:20.192962 #5462] INFO -- : Rendered common/_discourse_stylesheet.html.erb (28.3ms)
D, [2015-03-19T18:51:22.644547 #5462] DEBUG -- : CACHE (0.1ms) SELECT "site_customizations".* FROM "site_customizations" WHERE "site_customizations"."enabled" = 't' ORDER BY "site_customizations"."name" ASC
I, [2015-03-19T18:51:22.653375 #5462] INFO -- : Rendered application/_header.html.erb (1.1ms)
D, [2015-03-19T18:51:22.656411 #5462] DEBUG -- : CACHE (0.0ms) SELECT "site_customizations".* FROM "site_customizations" WHERE "site_customizations"."enabled" = 't' ORDER BY "site_customizations"."name" ASC
I, [2015-03-19T18:51:22.668399 #5462] INFO -- : Rendered common/_discourse_javascript.html.erb (7.0ms)
D, [2015-03-19T18:51:22.671681 #5462] DEBUG -- : CACHE (0.0ms) SELECT "site_customizations".* FROM "site_customizations" WHERE "site_customizations"."enabled" = 't' ORDER BY "site_customizations"."name" ASC
I, [2015-03-19T18:51:22.676435 #5462] INFO -- : Completed 200 OK in 2944ms (Views: 2549.3ms | ActiveRecord: 65.9ms)

```

Any idea whats wrong here?

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [20.Март.2015 03:24:01 UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/104 "2015-03-20T03:24:01Z")

</div>

That looks all normal. Try opening your browser’s Network debugger, likely it’s taking a while to download all of the various .js files. (They’re unbundled in development.)

---

<div class="post-metadata">

### Author: ![wlads](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wlads/32/116096_2.png) [@wlads](https://meta.discourse.org/u/wlads)
#### Post date: [10.Май.2015 19:59:39 UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/105 "2015-05-10T19:59:39Z")

</div>

Hi guys, I’ve been looking through the install docs and catch a divergence in the first one about vagrant’s default memory:

The [discourse-as-your-first-rails-app](http://blog.discourse.org/2013/04/discourse-as-your-first-rails-app/) states in step 1 - 3: _The VM image we set up defaults to **1 GB** of memory…_

```
Increase the VM memory. The VM image we set up defaults to 1 GB of memory, which makes it friendly to run on 4 GB machines. But this is the practical minimum — performance will be a lot better if you can ramp the VM memory up to 2 GB or even 4 GB. To do so, change your system’s DISCOURSE_VM_MEM environment variable to the desired amount of memory.

```

But the updated Vagrantfile has:

```
# This setting gives the VM 1024MB of RAM instead of the default 384.
v.customize ["modifyvm", :id, "--memory", [ENV['DISCOURSE_VM_MEM'].to_i, 2048].max]

```

Looks like the default now is 2Gb! Just a typo, but is good to keep the docs up to date. 😄  
Regards

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [11.Май.2015 00:29:22 UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/106 "2015-05-11T00:29:22Z")

</div>

Actually I commit that to the repo by mistake!

[https://github.com/discourse/discourse/pull/3377](https://github.com/discourse/discourse/pull/3377)

Either it needs to be changed back or the documentation needs to be changed. Sorry 😳

---

<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: [11.Май.2015 01:11:01 UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/107 "2015-05-11T01:11:01Z")

</div>

Maybe you can submit a PR to fix it?

---

<div class="post-metadata">

### Author: ![wlads](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wlads/32/116096_2.png) [@wlads](https://meta.discourse.org/u/wlads)
#### Post date: [11.Май.2015 04:39:19 UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/108 "2015-05-11T04:39:19Z")

</div>

Did it [PR-3446](https://github.com/discourse/discourse/pull/3446) after testing the VM still boot with 1024MB 👌

---

<div class="post-metadata">

### Author: ![zigomir](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zigomir/32/103166_2.png) [@zigomir](https://meta.discourse.org/u/zigomir)
#### Post date: [03.Октябрь.2015 00:12:23 UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/109 "2015-10-03T00:12:23Z")

</div>

I just set up Discourse with Vagrant like the post says. I was getting empty responses

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

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

I fix it with running a server like so

```
bundle exec rails s -b 0.0.0.0

```

---

<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 01:02:40 UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/110 "2015-10-15T01:02:40Z")

</div>

I hope my question isn’t silly in some way but I’m having trouble following this how-to. When I attempt `bundle exec rake db:migrate`, I get this error:

```plaintext
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'
/vagrant/lib/site_setting_extension.rb:96:in `block in setting'
/vagrant/lib/site_setting_extension.rb:93:in `synchronize'
/vagrant/lib/site_setting_extension.rb:93:in `setting'
/vagrant/lib/site_setting_extension.rb:151:in `client_setting'
/vagrant/app/models/site_setting.rb:18:in `block in load_settings'
/vagrant/lib/site_settings/yaml_loader.rb:29:in `block (2 levels) in load'
/vagrant/lib/site_settings/yaml_loader.rb:20:in `each'
/vagrant/lib/site_settings/yaml_loader.rb:20:in `block in load'
/vagrant/lib/site_settings/yaml_loader.rb:19:in `each_key'
/vagrant/lib/site_settings/yaml_loader.rb:19:in `load'
/vagrant/app/models/site_setting.rb:16:in `load_settings'
/vagrant/app/models/site_setting.rb:25:in `<class:SiteSetting>'
/vagrant/app/models/site_setting.rb:4:in `<top (required)>'
/vagrant/config/initializers/04-message_bus.rb:39:in `<top (required)>'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:652:in `block in load_config_initializer'
/var/lib/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/notifications.rb:166:in `instrument'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:651:in `load_config_initializer'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:615:in `each'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:615:in `block in <class:Engine>'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `instance_exec'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `run'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:55:in `block in run_initializers'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:44:in `each'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:44:in `tsort_each_child'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:54:in `run_initializers'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/application.rb:352:in `initialize!'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/railtie.rb:194:in `public_send'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/railtie.rb:194:in `method_missing'
/vagrant/config/environment.rb:5:in `<top (required)>'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/application.rb:328:in `require_environment!'
/var/lib/gems/2.2.0/gems/railties-4.2.4/lib/rails/application.rb:457:in `block in run_tasks_blocks'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)

```

Can anyone help me?

---

<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 03:24:27 UTC](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751/111 "2015-10-15T03:24:27Z")

</div>

> [@Thrillberg](#):
>
> I hope my question isn’t silly in some way

Let me guess, Windows 10 ?

I installed my localhost Discourse around a year and a half ago. At that time I had Windows 7 Home Premium

I followed “Discourse as Your First Rails App” as best as I could.  
Installed VirtualBox  
Installed Vagrant  
Installed GitHub  
Downloaded Discourse

I can’t say everything has gone swimmingly since, but it worked well enough for getting familiar with Discourse and testing plugins

- UNTIL - I upgraded to Windows 10 this last weekend. Now I get

```plaintext
Windows PowerShell
Copyright (C) 2015 Microsoft Corporation. All rights reserved.

C:\VirtualBox\discourse [master +0 ~1 -0]> vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set network interfaces...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["hostonlyif", "create"]

Stderr: 0%...
Progress state: E_FAIL
VBoxManage.exe: error: Failed to create the host-only adapter
VBoxManage.exe: error: Code E_FAIL (0x80004005) - Unspecified error (extended info not available)
VBoxManage.exe: error: Context: "int __cdecl handleCreate(struct HandlerArg *,int,int *)" at line 66 of file VBoxManageHostonly.cpp

C:\VirtualBox\discourse [master +0 ~1 -0]>

```

Not the exact same problem you’re having, but I am wondering if the ~2 1/2 year old instructions are still applicable or if I might need t upgrade

GitHub The Last Free Monad (3.0.6.4) 2bb6864  
VirtualBox 4.3.30 r 10 16 10  
vagrant 1.7.4

[Предыдущая страница](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751.md?page=4)

[Следующая страница](https://meta.discourse.org/t/discourse-as-your-first-rails-app/5751.md?page=6)
