Welcome Guest | Login

cPanel API???

Hi,

I am using shared hosting.

I am looking for a way to create new databases and subdomains programmatically from within my rails app. Normally I would do these things in cPanel; is there an API available?

Thanks!

2008-04-06 12:40 AM

I hope the link below would make more sense in going about this.

http://wiki.rubyonrails.org/rails/pages/HowToUseSubdomainsAsAccountKeys

2008-04-06 01:42 AM

Thanks for the link! I might use some of those techniques, but I am not actually looking to create a subdomain for every user. I am looking to create a whole new (running) rails app programmatically.

Each app will be very low traffic. Most will only be around for a few weeks. A few will stay and become higher traffic. These ones will likely be moved to mongrels.

Creating the app will be easy, but configuring it to run seems to be the difficult part. Certain things can only be done in cPanel.

I don't have a lot of experiance with cPanel. Can I use cPanel Scripts http://www.cpanel.net/docs/whm/Scripts.htm)? Or are those only for admins? What about the .cpanel directory in my home folder? Can that be safely modified to make the necessary changes?

Thanks

2008-04-06 02:08 AM

The scripts are only for admins -- if there was a way that you could serve all the apps off the same database then you could probably pull this off in a shared environment.  Otherwise doing this in a VPS would be the way to go.  

2008-04-06 02:47 AM

How about this:

I manually create X many databases ahead of time. Then I can programatically detect an empty database. When an app is no longer needed, I can empty the database and it will be ready for reuse.

Would that solve the database problem? If so, what about the subdomains. It would be nice to use subdomains instead of subdirectories.

Thanks!

2008-04-11 07:52 PM


Regarding the database, the method you have mentioned might work. However, it may not be a permanent solution. What I would suggest is to consider a VPS solution, where you have more control over the MySQL server.

Regarding the subdomins, you may not be able to create real subdomain using  rails on this shared environment. We can setup a wild card DNS entry for your domain so that http://anything.your_domain. com will redirect to your main domain. You might need to code your app to redirect this request to a particular sub directory.

 

2008-04-11 11:18 PM


Hello Guest! In order to post you must be an active client with us, please log in or sign up today!