two different domain names accessing the same server / application - ruby-on-rails

we have a Ruby on Rails application deployed to AWS using EKS. We are planning to update the application URL from
https://old_subdomain.old_domain.com
to
https://new_subdomain.new_domain.com
for a while (3 weeks or so), we plan to have both the URLS active and after that set a redirect in the ingress.yml from old to new URL.
Could there be any issues resulting out of this by having two different urls serving the same application for a while?
Thanks.

Related

Multiple Heroku apps on the same domain

I have a Ruby on Rails app hosted on Heroku and one of its paths must be connected to another Heroku app dedicated to a blog.
The objective is to use a path of the main website to reach the blog, keeping the original domain and avoiding the usage of different subdomains, this is a must due to SEO requirements.
Here the idea:
www.site.com -> app1
www.site.com/blog -> app2 (blog)
www.site.com/blog/articles/xxx -> article in app2 (blog)
Both the websites are developed in Ruby on Rails and hosted on Heroku. The path structure should be complete to be Google-friendly.
I've found some possible duplicates of this, but they are very old and related to deprecated plugins and gems not working at the moment:
How to run two different apps on the same domain using heroku
The first comment links to this article based on Docker Toolbox that is obsolete at the moment and also to routepath.app (broken link)
Multiple Heroku apps on a single domain
This suggests the usage of the gem "rack-reverse-proxy". The docs clearly says that is not for production systems, and it seems no longer maintained. This duplicate also links to this article, but it is a broken link.
Possible solutions:
Convert the 2nd application to a rails engine
Reverse proxy to the 2nd application
Configure the 1st application to have a 2nd database, using the database from the 2nd application as a read-only Rails Multiple Databases (I would choose this option)
The last option allows you to keep your 2nd application as-is for editing and whatever it already does. You can redirect production viewing to the 1st application.

How to run multiple Rails versions for a single website / project?

I've inherited a Rails 3.2 production environment which is 'humming' away nicely.
The client now wants another major piece of work doing but I want to do it in Rails 5. The web address would be the same for both the old site and the new project. The new project would be additional functionality which would be accessed via the old site.
Any one know of a way of keeping the old site running whilst I develop and deliver the new work via Rails 5? Eventually if this all works then I get the opportunity to migrate the old site to Rails 5. However for the moment I need to serve up both Rails 3.2 and Rails 5 from the same site.
It's possible to do what you describe with a reverse proxy, e.g. nginx, configured to serve from different web servers based on different paths on the same host. This answer has some details on how to do that. We would need to know how your website is hosted in order to give more details on exactly how to do that.
However, there are other concerns that come up when you start separating your apps which you may not have considered. For example, if your website allows users to log in, do you want them to still be logged in when they visit the new site? To do so transparently will require sharing the session cookie, which this post describes a bit (you'll need to use the same secret key for both apps, or use a remote session store like Memcached). I'm not sure if it'll work properly when shared between Rails 3.2 and 5, though.
As a final note, breaking up your monolithic app into a distributed system is never a decision to take lightly. It would likely end up being less work, and less overall architectural overhead, to simply invest the time in upgrading from 3.2 -> 4.0 -> 4.2 -> 5.0.
Personally I wouldn't touch that old app and its server, especially if the client is happy. Deploying the new app to a new server or a container service like heroku is something you should consider.

Domains and Multiple Platforms Uploaded to Same Server

I have both an Ionic and a Rails application. I'm currently wanting to push both apps onto the same EC2 instance. Ionic will act as a login section and several other pages. The rails application is intended to be a shopping cart and is only accessible when a user is logged in. I'm confused on a couple of points.
Am I right to believe both apps should be under different subdomains? Can I instead push both apps to two separate servers while still maintaining two separate subdomains? If two separate servers are used, can I expect sessions and localStorage to work across both applications? Thanks!
I assume that you are mixing up many things.
Domains & Subdomains
Let me explain that point with an example :
sub.example.com : first subdomain
other.example.com : second subdomain
Domains and subdomain are pointer to a server ip. Therefore, both example can point to the same EC2 instance.
The domain and subdomain shall therefore not enter into consideration into your analysis.
Webserver & Session Management
I'm not an expert and that point at all, but the magic is performed generaly here to share information & Sessions.
Common Webservers are Apache / Tomcat or even Jetty.
Some person use for session management REDIS too
LocalStorage
Correct me if I'm wrong, but localStorage can't be shared from one site to another.
Your problem resides more into this question :
What webserver am I using ?
Or : How Tomcat7 manage sessions ?
Or : Can I share session from different Webservers ?

How to run two different apps on the same domain using heroku

I have a Rails app at example.com, which is a Heroku app running under that domain. However, the marketing team would like something more dynamic to use to change the material on the main landing page.
My questions therefore are:
Can I run a different system than Rails under the same domain (example.com is one system, example.com/* is the old Rails app)
Can those 2 systems be in the same Ruby app?
Can those 2 systems be in different languages (different Heroku apps)
I've done these kinds of setups on custom servers. Just wandering whether it's possible to do this on Heroku.
No you can't. Heroku allows to associate zero or more custom domains to the same app, but it's not possible to associate two apps with the same domain and somehow split the routing.
It's also very hard to have two different applications co-existing under the same umbrella. You can create more rack-based applications inside the same project and mount them under the same Rails router (for instance you can mount a Sinatra or Lotus application at a specific path in a Rails project).
You cannot write the apps in two different languages, because it's not possible to build a single Heroku app with two different buildpacks. Well, in theory, you can write your own buildpack... but it's not trivial.
The only viable solution is to have more Rack-based applications mounted under the same Rails or Rack router (you can have N Rack applications, 1 Rails and N Rack, but it's hardly possible to have N Rails).

rails in heroku: one domain, several applications

How can I do to run an application in www.domain.com/folder1 and other in www.domain/folder2, using heroku?
You can't really do that with Heroku - the system assumes a single app per domain. You do have a couple of options - merge your apps into a single application, setting routing accordingly, or host the applications using subdomains: app1.domain.com, app2.domain.com.

Resources