Discourse as Your First Rails App

I had this error recently. Turned out to be permissions related. The fix is available here Rails Multisite still breaking build

2 Likes

Awesome! Worked for me. Thanks so much!

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.

4 Likes

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

2 Likes

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.

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 that explains how to set it up without virtualization.

2 Likes

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.

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 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.

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.

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

5 Likes

Yep, that works. Thanks a lot @Mittineague :slight_smile:

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!

Awnser is 2 topics above you :wink:.

2 Likes

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

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?

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.

1 Like

Is there any way to use discourse without using VM? Does it can be used with local system as normal rails app?

Docker is not a VM, it does not suffer the same performance penalty as virtualization.

The official Docker-based install is the only supported installation method (for production use). In theory, you can also use different installation methods, but it will be entirely unsupported, is likely slower than a Docker-based install, and can break with any upgrade.

1 Like

I’ve been able to develop on Discourse just fine using my local machines (mac and linux), no VM required. (Windows will be a bit trickier, so Vagrant or something similar would be the way to go there)

3 Likes

Can you explain how to set this up or link to a howto?

Here’s a back-of-the-napkin approximation for mac (linux will be the similar with apt-get instead of brew):

(this assumes that you’re using the correct ruby version [2.3.0 at the time of this writing], probably installed with either rvm or rbenv)

brew install redis
brew install postgres
git clone https://github.com/discourse/discourse.git && cd ./discourse
bundle install
rake db:setup
redis-server &
bundle exec rails s
3 Likes