Need some guidance on running shell commands from my app

During execution in my Rails web app, I need to create a virtual host
config on my Linux server, but I don’t know what would be the best way
to do it , here are the steps ( my_domain.com is fixed, only
my_subdomain is changing dynamically

1- create: /var/www/vhosts/my_domain.com/subdomains/my_subdomain/conf/
vhost.conf

ServerName mysubdomain.mydomain.com
… content is always the same…

2 - run : sudo /usr/local/psa/admin/sbin/httpdmng --reconfigure-domain
my_domain.com
… always the same command

3 - run : sudo /etc/init.d/apache2 reload

What could be the best option to set/execute such script from my Rails
web app ? any links ?
thanks for your feedback and guidances

[Running Rails 3.1.1/Ruby 1.9.3/ Debian 6 Squeeze]

On Nov 15, 7:37am, Erwin [email protected] wrote:

During execution in my Rails web app, I need to create a virtual host
config on my Linux server, but I don’t know what would be the best way
to do it , here are the steps ( my_domain.com is fixed, only
my_subdomain is changing dynamically

Not answering your question, but have you considered having a single
wildcard virtual host (i.e. ServerName *.mydomain.com) rather than
reconfiguring apache on the fly all the time?

Fred

thanks Fred , will give a try, I am using Apache behind Plesk ( to
manage many subscription) , need to check if I can bypass it …

On Nov 15, 2:20pm, Frederick C. [email protected]

2011/11/15 Erwin [email protected]:

During execution in my Rails web app, I need to create a virtual host
config on my Linux server, but I don’t know what would be the best way
to do it , here are the steps ( my_domain.com is fixed, only
my_subdomain is changing dynamically

I tried something similar in my PHP-days.

You really should not do that!

1.) Plesk would not be aware of that subdomain
2.) Plesk could overwrite or delete the manually added configs when
trying to add the subdomain in Plesk

That are the main problems I stumbled upon that time.

The way with wild card domains all going to your rails app are much
better. But I cant remember how to set them up in Plesk.

But with the Railspart http://railscasts.com/episodes/123-subdomains
could help.

HTH
Norbert

Thanks Norbert

I intended to use the Plesk API to add the new subdomain and the new
subdomain ghost.conf, then exec reconfig domain and reload Apache…
( the way we use to do manually in Plesk console) but it’s quite
heavy work…
I found how to setup wild card w Plesk … :
http://kb.parallels.com/2239
(quite weird…)
and it’s running fine … can access any sub-domain…

Thanks a lot for your feedback !

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs