How can I have 2 or more Rails applications using AWS OpsWork?
When I'd deploy 2 apps with Opswork they get the same URL and redirect to the first app deployed.
How can I manage to have two separate apps, in one instance of OpsWork?
1 Answers
I've had a similar problem before - with two Node apps in the same stack.
One answer would be to create two separate OpsWorks stacks for the two Rails apps. This of course assumes they don't depend on the same resources (ie a shared database).
The second, harder, answer - and the one I took for my Node apps - is to create a custom layer and manually specify all the recipes that the built in Rails layer calls. If the built in Rails layer and your custom layer BOTH have ELBs AND the Rails sites are hosted on separate instances (port numbers may clash, dependig on which app server you're using) AND you make sure your application deploys in OpsWorks target only the correct boxes (don't want to install two Rails apps on the same server!)... well it should work out. (Or come close).
I don't think this is as easy as it sounds: I remember digging into a fair bit of Opsworks Chef cookbook code for some reason. I forget if that was because of this custom layer issue or because of another custom layer I wrote.