Discourse as Your First Rails App

Answering something other than your question but you will need a newer version of ruby. 2.x at least.

Mmph. And presto-texto, the answer to (b) is right smack dab at the top of the “Official Discourse Install Guide.” 2gig, 2cores, 2gig swap, Ubuntu 12.04LTS.

(I would have just edited my previous entry to reflect this, but it didn’t work. “Edit” got me a spinner for well over four minutes before I gave up. )

It appears that my WiFi router went catatonic at just the wrong time. {roll eyes} Editing posts now seems to work just fine.

Hmm. www.discourse.org/faq told me 1.9.3. Perhaps it needs to be updated . . .

You are correct. I would really suggest something from the 2.x series. There are a lot of memory and performance improvements.

I moved 4 posts to a new topic: Schema.rb vs migrations

In case you want to install Discourse on real machine for Development Purpose, you may want to refer below guide:

As it happens, the production Discourse that I’m currently running ended up being installed using those instructions. They are deprecated, but the story of why I didn’t do it the currently supported way can be found in the thread titled “What’s the secret for getting ssh to work into a container?

As somebody in that thread points out, the current recommended installation procedure, using Docker, does not, in and of itself, virtualize the installation, although it does containerize it. If I understand correctly, this gets you the isolation benefits of a VM machine without the overhead of full emulation.

That’s odd! I posted this guide yesterday, to install Discourse on Ubuntu for Development purpose.

Oh, you did? My apologies! I’m afraid I just assumed it was the same “how to install discourse on ubuntu” guide that I’d used. Now I’m curious, and must go check it out. :smile:

1 Like

Sure! Please do. :smile:

The url for vagrant in the blogpost is outdated, it should now be:

2 Likes

I’m getting this error, any ideas?

/vagrant (master)]$ bundle exec rake db:migrate
ln: failed to create symbolic link `/vagrant/public/plugins/emoji': Protocol error
/vagrant/lib/validators/email_validator.rb:25: warning: regular expression has ']' without escape
rake aborted!
SyntaxError: /vagrant/lib/validators/email_validator.rb:25: syntax error, unexpected $undefined
    /^[a-zA-Z0-9!#$%&'*+\/=?\^_`{|}~\-]+(?:\.[a-...
                   ^
/vagrant/lib/validators/email_validator.rb:25: syntax error, unexpected $undefined, expecting keyword_end
...`{|}~\-]+(?:\.[a-zA-Z0-9!#$%&'\*+\/=?\^_`{|}~\-]+)*@(?:[a-zA...
...                               ^
unmatched close parenthesis: /=?\^_`{|}~\-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\
-]*[a-zA-Z0-9])?$/

are you on latest, I wonder if this is a regression in new code by @neil (those validations are new afaik)

What ruby version is vagrant running?

Looks like you’re using an old version of ruby. I tried in the vagrant image and didn’t get that error, but I had upgraded ruby a while ago.

Do this and then try again:

rvm get stable
rvm install 2.0.0-p451
rvm use --default 2.0.0-p451

If it’s using ruby 2.0.0-p0, then it definitely needs to be upgraded.

3 Likes

Can @techAPJ help us get this Vagrant image up to date?

1 Like

I changed the regexp to avoid the ruby bug that causes that error in ruby 2.0.0-p0 and earlier.

I’ll give it a try, thanks.


Edit:

I think that did the trick! It hasn’t loaded yet, but I can see the internals working and everything. The tab has also been renamed “Vagrant Discourse”

I did get one minor error though:

[vagrant@precise32:/vagrant (master)]$ bundle exec rake db:migrate
ln: failed to create symbolic link `/vagrant/public/plugins/emoji': Protocol error

Edit:
It’s been trying to load for almost ten minutes. Is that normal? :frowning: Comp specs. These were the last messages:

I, [2014-06-10T15:53:24.720091 #6554]  INFO -- :   Rendered common/_discourse_javascript.html.erb (56.0ms)
I, [2014-06-10T15:53:24.737944 #6554]  INFO -- : Completed 200 OK in 17633ms (Views: 15750.6ms | ActiveRecord: 188.4ms)

Edit:
Finally loaded!


How can I feed it commands, like

RAILS_ENV=development bundle exec rails c
u = User.last
u.admin = true
u.save

while it is running?

1 Like

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

1 Like

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

2 Likes

And Postgres 9.1 as well.

Fix your kit!

1 Like