Discourse as Rails engine

(coder2000) #1

Is it possible to use discourse as a rails engine? I would like to include it in my normal routes but will sacrifice if I have to.

How to implement Discourse with an already built Rails project
(alain) #2

I am interested in this too.

(Robin Ward) #3

Not right now. I suspect it would actually be possible after a fair amount of clean up, but not in the short term, sorry guys :cry:

(Kiran Patil) #4

:100: :+1: for rails engine

(Jeff Atwood) #5

Rather than just mindlessly saying “upvote 100 times” can you please explain why this would be useful to you, and how?

(Kiran Patil) #6

With Rails engine it would allow to integrate with the existing rails app in a much better way rather using it as gem.

(Jeff Atwood) #7

Can you explain what “in a much better way” means? What problem would it solve for you? Can you provide an example, or two examples?

(Kiran Patil) #8

I do want to have discourse to work with my base app in conjunction and I felt rails engine would be the better way as shown in below talk

Rails engine patterns

(Kiran Patil) #9

I might be wrong here, please correct me.

I would like Discourse to work as a plugin for base app without any changes to it as well base app.

That would save me the integration work and engines makes easy to use Discourse with existing app.

(Jeff Atwood) #10

OK, thanks for the clarification, I think I understand what you mean now.

I’m not convinced that is a healthy case for Discourse, since this is a large and complex app – and will be larger and more complex every month that goes by. I think it is safer for everyone involved to have Discourse be a standalone app rather than some weird “pretend this app is a plugin to this other random app” case.

(Chris Benson) #11

In my opinion as a big fan of Discourse, its biggest weakness is its failure to integrate discussion into larger apps, because of a license that doesn’t play well with others, and lack of availability as a Rails engine.

I would love to have Discourse as a Rails engine. I have multiple use cases where having a robust modern discussion forum is highly desirable - but in combination with other non-related features in my existing Rails/Ember apps. Users are already authenticated in the primary app, so having them re-authenticate just to participate in a discussion has a non-integrated user experience (because it wouldn’t be integrated, just a bolted-on adjacent app).

Also, choosing a license that plays well with other licenses would be helpful. Like many in the Ruby community, I have a preference for MIT (or Apache) because it isn’t invasive. If Discourse must use a GPL flavor (???), then something like LGPL for a Rails engine, so that it can be integrated with other licenses, while maintaining the “copyleft” only on the Discourse code.

Discourse is a great solution in most respects, but in its current incarnation, it doesn’t play well with others.

Thank you.

(Jeff Atwood) #12

Then you should work on shared cookie auth. :smile: We do want to get there soon-ish!

(Kiran Patil) #13

I have come across some links which points how to share authentication among multiple apps.

Please let us know, which solution Discourse is going to follow.


(Kiran Patil) #14

:cool: When can we expect it ?

(Andreashaller) #15

Discourse supports single sign on via CAS. You could use this instead of shared cookie auth. The UX would be almost the same, right?

(Kiran Patil) #16

I have come across this link,

(Kurtis Rainbolt-Greene) #17

The problem this solves is website owners being limited, for whatever reason, to one application for their entire service.

Example: An indie gaming company can’t afford heroku instances: A Spree shopping cart for their game and a discourse forum for their customers.

Having this be an engine capable rails application allows you to have 1 rails process and essentially 2 applications. In the above example spree would be mounted on “/shop” and discourse mounted on “/forum”, and maybe a further ActiveAdmin on “/admin”.

They share databases, resources, etc.

(ksec) #18

I thought license wouldn’t be much of a problem due it being used in the Web Backend and not front End?

(Andy) #19

I agree that having Discourse available as a Rails engine would be awesome. The ability to deeply integrate into an existing site strikes me as invaluable. For instance, having a common user model allows one to associate activity and reputation in the forum with permissions in the rest of the site.

(akshatpradhan) #20

I agree! I’d like to use Discourse as an engine for my open source app. A community for people to talk about PCI Compliance issues.


Having to re-authenticate is a really big pain and makes the UX suffer greatly.