different domains pointing to the same rails app - ruby-on-rails

I'm creating a rails app where users will be able to create and manage multiple blogs from their accounts. The app will be hosted on www.mydomain.com but i want users to specify a domain they own and be able to point it to any of the blogs they've created so that they can have www.usersite.com point to www.mydomain.com/user/:user_id/blog/:blog_id
that way it looks like is being hosted on their site even though is not
i've been reading some post and maybe CNAME is the way to go for this, but i'm pretty new to creating rails apps and if anyone can help me or point me in the right direction i would appriciate it.
If you need me to clarify anything please let me know
Thanks in advace
danny

As far as I understood your question is more about DNS rather than Rails.
I could suggest you Bandcamp as a live example.
There's some tips:
Using CNAME (and I pretty much sure there's no other options) You should provide every user with his own unique subdomain i.e. user.mydomain.com in your case. Quick googling and we find out that there's a solution for Rails 3 — http://bcardarella.com/post/716951242/custom-subdomains-in-rails-3
You should provide them with step-by-step manual how exactly they can modify their domain DNS entries and add CNAME record. It's up to them. You or Your app can't do it. Again, Bandcamp is a great example — http://bandcamp.com/faq_custom_domains
And then you win.

Related

How can I let my clients subdomain my Ruby On Rails / Heroku app?

I have an app that I want my clients to be able to subdomain. Right now it works like this
www.mydomain.com/clientname/
www.mydomain.com/clientname/page1
www.mydomain.com/clientname/page2
How can I structure the app so that my clients can subdomain it like:
dashboard.client1.com -> www.mydomain.com/clientname/
dashboard.client1.com/page1 -> www.mydomain.com/clientname/page1
etc
Can I use wildcard subdomains?
I can't figure out the terminology for what I want to do, but any references you can provide would be helpful!
there
I'm undergoing the same thing right now with an app in development. I came across a post and an older RailsCast by Ryan Bates:
Subdomains RailsCast: Albeit a little older there's a lot here and I think it's worth looking through.
"Rails, Heroku and Subdomains. Is my special case scenario feasible?" on StackOverflow. I'm using Heroku in particular so I'm going to see how this pans out.
And if you've found anything of note PLEASE let me know.
Thanks.

Share session between phpBB and a rails app

This might be a nonsensical question, but I have this task to create a rails app that shares session information, specifically login/authorization info, with an installation of a phpBB that some other person has customized to be more than just a BB.
Basically I need to rely on the user's phpBB login to authorize access to the rails app. I really don't want to have the user maintain two logins to use this conceptual single app.
I read a lot of documentation on phpBB and didn't find anything like exposed services or an API, but I'm hoping I just missed something obvious.
I've been considering adding a method to expose some hash or something to link the two applications rather than try to squeeze possibly different implementations of session.
Quick context, this work needs to be done fast and cleanly and I've never developed in php and rails is super fast so I am investigating the idea of integrating the two sides.
I might be off in the weeds, so don't be afraid to say so :)
thanks!
Have you checked phpbb-auth?
https://github.com/mattfawcett/phpbb-auth

(RoR) How to: link multiple apps, multiple URLs, one database

I am currently developing a site using Ruby on Rails. I am still a beginner who just started around a month ago. I use InstantRails on Windows 7. Here's my question.
Let's say app A is functional using MYSQL database A_development. The files such as views and controller are under folder 'A'. I now know how to, say for example, link www.app.com to this app by opening port 80 and changing some lines in the mySQL config.
In this app, you can register your username, login, and post some messages.
I now want to create some pretty identical apps say B and C. The only thing different will be the posts that shows, and the views. You can still log in with the same username, and everything is saved in the same database.
I now want the URLs to look something like A.app.com leading to app A, B.app.com leading to app B, etc. Can that be achieved? How?
I've been googling for a few days already and I'm still lost.
As I'm new to this forum, I'm not quite sure what info do you guys need. Please list and I'll provide them asap.
Any help will be appreciated! Thanks.
Seems like you have 2 (or more) issues...
On the URL front, it probably depends on what your webserver is - is it apache or something else?
In apache you could have multiple URLs point to the same web application or to different ones.
If you there are only going to be 3 or so and not much more, perhaps separate Rails apps for each one will do.
On the database front, if you point each web application at the same database, then that should achieve what you need. You probably want to a choose a transactional db to ensure updates from one app do not clash with updates from the other - eg if user has their profile window open in both apps and then saves a change to their name - which change is saved...
Given the DB is shared, you probably want to do something to ensure the related views are shared too. This goes beyond my ruby-fu - perhaps an inhouse plugin/gem would be the best route to go for that...
HTH, chris

Blog for existing Ruby on Rails application

I have an existing rails application/website that I want to add a blog to. I would like to access it by www.existingapplication.com/blog so I was thinking it would need to be some kind of plugin or engine or something. Does something like this exist? The main thing is that it can't be a standalone rails application, it has to be an addon to an existing app.
I was looking for something similar as well and stumbled upon Rails Engine.
It is a great way to create one.
As for you, just use this:
https://github.com/jipiboily/monologue
Someone already created an app to help add a blog to your site.
Good luck!
Why not just use Tumblr or similar, and redirect (or proxy) requests to /blog to it? If you're willing to use blog.application.com, you can even just set up a cname and be done with it. Blogging is a very solved problem at this point, and it makes little sense to staple one onto your application at the code level.
If you run it on a subdomain (blog.existingapplication.com/) it is even easier to setup and will definitely be doable through Heroku.

Advice for Setting Up Rails Sites for Prototyping

I'm learning Ruby on Rails and have just signed up with LunarPages as my webhosting company. To start, I want to write some test applications and get them uploaded and running on my website just to understand how things work. However, I don't want anyone looking at what I'm working on as I learn. Does anyone have any advice as to how I should structure my pages and sites in such a way that I can keep them hidden until I'm ready to go live? Can I easily do something like this?
www.mysite.com <- everyone can see
www.mysite.com/testapplication1 <- no one can see for now
www.mysite.com/testapplication2 <- no one can see for now
Sorry if this sounds like a stupid question. I'm just starting out. By the way, I have heard of Heroku but I've already paid for this webhosting service so I'd like to get my money's worth, at least until my subscription is up.
Thanks!
I'm not sure if LunarPages offers the level of configurability that is required to run rails apps from sub-directories. I'd use subdomains (testapp1.mysite.com, testapp2.mysite.com) and then use appropriate access control (could be htaccess, HTTP BASIC AUTH in your app, or something more complex like authlogic)

Resources