Ability to add new virtual hosts?

16 views
Skip to first unread message

Matt R

unread,
Mar 14, 2012, 11:18:05 AM3/14/12
to railsmachin...@googlegroups.com
We are using Moonshine to manage our Rails app (obviously!). We have a requirement that we want to serve various static files from our Rails' public directory.

e.g.

foo.example.com -> $MYAPP/public/foo/index.html
bar.example2.com -> $MYAPP/public/bar/index.html

This can be done pretty easily, I think, with a simple name-based virtual host:

<VirtualHost *:80>
ServerName foo.example.comDocumentRoot /srv/myapp/shared/public/foo
</VirtualHost>

<VirtualHost *:80>
ServerName bar.example2.comDocumentRoot /srv/myapp/shared/public/bar
</VirtualHost>

However, I'm not sure where I'd drop this into our manifest to actually appear in our site config?

Looking through $MOONSHINE/lib/moonshine/manifest/rails/templates/passenger.vhost.erb the assumption is a single name-based virtual host and that any application_manifest.rb items will be applied to that one.

In theory, I'd want to tack on a bunch of additional name-based vhosts at the end of the passenger.vhost.erb declaration. I can hack that in there but I was hoping there's more of a 'blessed' way to make this happen. Any ideas?

Thanks,

--
Matt

jDeppen

unread,
Mar 14, 2012, 5:30:33 PM3/14/12
to railsmachin...@googlegroups.com
Piggybacking on that question... Is it possible to run multiple Rails apps on the same server with Moonshine? I haven't found documentation on it anywhere.

Jamie Orchard-Hays

unread,
Mar 15, 2012, 11:42:30 AM3/15/12
to railsmachin...@googlegroups.com
I have a server with a bunch of rails apps on them. No problems, but you have to be aware, as Moonshine was not designed for more than one app per server. Nevertheless, I've had this in operation for nearly two years now and it's working great for me. I recently upgraded to Ruby 1.9.3 and Rails 3.1.x and Bundler. It's a better world with Bundler in the mix.

One thing I should say is that all these apps are different instances of the same app. I don't think I've run different apps and have no idea how that would affect the situation.

Jamie

--
You received this message because you are subscribed to the Google Groups "Moonshine" group.
To view this discussion on the web visit https://groups.google.com/d/msg/railsmachine-moonshine/-/T_X3whGGdV4J.
To post to this group, send email to railsmachin...@googlegroups.com.
To unsubscribe from this group, send email to railsmachine-moon...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/railsmachine-moonshine?hl=en.

Will Farrington

unread,
Mar 15, 2012, 12:55:00 PM3/15/12
to railsmachin...@googlegroups.com
It's possible, but would require a good bit of code in your manifest. 

If you want to venture down that path, I'd strongly recommend using only one Ruby version and using Bundler for everything. 


Sent from my phone. Please excuse the brevity.

--
Will Farrington

Josh Nichols

unread,
Mar 27, 2012, 9:28:35 AM3/27/12
to railsmachin...@googlegroups.com
Hey Matt,

While Moonshine doesn't have configuration options for doing arbitrary virtual hosts, you can take a look at how moonshine uses the passenger.vhost.erb. Specifically:


You could make a new recipe for creating your own vhost file, then a2ensite it. Hope that helps!

- Josh


--
You received this message because you are subscribed to the Google Groups "Moonshine" group.

Josh Nichols

unread,
Mar 27, 2012, 9:33:38 AM3/27/12
to railsmachin...@googlegroups.com
Moonshine makes some a lot of assumptions about only managing one application. This is more problematic for some plugins than other, like moonshine_god specifically configures /etc/god/god.conf to loads /srv/<app>/current/config/god/*.god, so if you had multiple apps, the last one to deploy would win.

So the simple answer is, yes it is possible with enough hacking, but no, it's not supported.

- Josh

On Mar 14, 2012, at 5:30 PM, jDeppen wrote:

--
You received this message because you are subscribed to the Google Groups "Moonshine" group.

Matt R

unread,
Mar 27, 2012, 11:03:06 AM3/27/12
to railsmachin...@googlegroups.com
Josh,

Great, will do something like that. Thanks!!

--
Matt
To post to this group, send email to railsmachine-moonshine@googlegroups.com.
To unsubscribe from this group, send email to railsmachine-moonshine+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages