Topic: Rails on server side tasks?

Hello,

short question,
I would like to know if rails 3 can edit some apache setting? like a cpanel? I would like to manage hosts file and apache virtualhosts.

if yes, any idea where i must look to get information to do that?

thanks

Re: Rails on server side tasks?

Rails is just a development framework. Ruby is the programming language.

To answer your question, yes, Ruby can edit files, as long as the user your web server runs as (usually something like www-data) has read/write permissions for that file.

For more info, a Google search for 'Ruby write to file' or 'Ruby IO' should provide you with enough information to get started.

Re: Rails on server side tasks?

It would be tricky to configure Apache to allow you to directly access it's configuration files from your Rails site.  You'd probably have to develop scripts on the Apache side that reads stuff from the public web directories,  and make changes accordingly.   It could be done,  but most of the work would be scripts on the Apache server,  the rails part would be pretty straight forward.  The real trick is how do you KICK off the scripts,  from what I observe from the various sites I use that do this,  they run cron jobs that routinely scan public web directories, looking for 'instructions' deposited there by the user.   GoDaddy does this a lot,  you'll see 'change pending', meaning you've put in your instructions,  but the cron job has yet to run and pick it up and do it.

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.

Re: Rails on server side tasks?

Thanks, but the site are hosted on a cloud service. I'm not sure if this kind of server use cron job.

I need that because my app create subdomain, and the cloud site use cpanel to manage subdomain, i want to do a script that will create automatically the subdomain without going to cpanel to edit it!

in my dev system i use lvh.me, and i have no problem with subdomain, but i'm sure i will get some hard work to do to manage that on the cloud system.

Last edited by neimad (2011-08-17 21:12:28)

Re: Rails on server side tasks?

depends on your cloud provider.  I deploy on Joyent,  and I can create a cron job if I desire.

I have complete control of my Apache environment.  Joyent provides you a Solaris Zone,  it's a complete virtual Solaris operating system,  I can deploy Apache any way I want,  I can restart Apache,  *****, I can even reboot the machine if I want!!!!

You can do it if you deploy on a Joyent Smart machine,  a 1/4 Smart machine is $25/month.

That's guaranteed 1/4 of a DELL quad dual core machine,  if the other three users are not doing anything,  I can consume upto 95% of the machine.

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.

Re: Rails on server side tasks?

wow, thanks for the hint. for now, i'm with site5. I think i have some apache control. But i dont know anymore for yet.
But i will take a look on joyent.