Discourse as Your First Rails App

Are the Docker images intended for dev though? I thought they were more for production / deployment.

2 Likes

Oh my. Youā€™re right, theyā€™re not really intended for devā€¦ @npruehs are you sure youā€™re running everything from inside the VM?

Iā€™m hoping to learn a bit more about some of the choices or options mentioned here, and why they might or might not be good ones.

(a) VM: the guide is pretty clear that one of the downsides of using a VM is the potential performance hit. Lots of ram and multiple drives are recommended to help alleviate this. I assume the upsides are mostly that you can build/install a known environment, and that if it goes kerblooey, it doesnā€™t take other stuff down with it.

Now, I already have an Ubuntu server with hardware RAID drives, Postgres 9.1 and Ruby 1.9.3. While I could partition the array to create two drives, deep down, itā€™ll still just be the one array, so thatā€™s not really an improvement. So why shouldnā€™t I just install it in the real machine, instead of a virtual one? Or, conversely, I have a spare server that isnā€™t even running. It would appear that doing so means instead of steps 1, 2, 3, 4, and 5, I have just step 3, and thatā€™s it. Iā€™m just not sure what hidden downsides of non-virtuality might be.

(b) One of the comments has a ā€œhow to do this on Ubuntu.ā€ Nice. Whether Iā€™m using a VM or not, if I were going to pull a server out of storage and fire it up, what would be a really good machine to do it with? If Iā€™m going to go the VM route, youā€™ve said ā€œone SSD, and then another drive, possibly also SSDā€, and ā€œ8 gig of system memory.ā€ Care to recommend an OS? (Ubuntu? Debian? Windows? Mac? I mean, I do have an XServe available.) Processor, or maybe a core count? Do I need just a few gigabytes on the drives, or would <128 Gig be awfully crowded?

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