Site Automation Question

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
User avatar
volomike
Forum Regular
Posts: 633
Joined: Wed Jan 16, 2008 9:04 am
Location: Myrtle Beach, South Carolina, USA

Site Automation Question

Post by volomike »

Do you know of any web hosting providers that have an API for setting up domains and shared hosting plans for my customers?

Let's say I build a great web app called Alpha at alpha.com. Users can pay $90 to download and install on their own server, or they can pay for a hosted solution. On the hosted solution, it's really just a domain name purchase and a shared hosting plan purchase, but with the addition that the whole thing is automated and the Alpha database and web app is copied to that space, ready for them to use. Okay, fine and all, but how to automate?

I mean, I'd like people to pay $120 setup fee and $15/month for hosting. So, they go to alpha.com, start the signup process, keep looping through a domain name finder form until they get one that's available, pay a PayPal payment of $135, and some kind of magic script creates the domain, creates the shared hosting plan, creates the MySQL database for Alpha, copies the Alpha web app files to public_html, gives me $100 to my PayPal account, and deposits the rest with the hosting provider to pay for everything else. Then, on recurring billing, the hosting provider will automatically bill $15/month for hosting exclusively separate from me. I would be out of the loop on hosting support, but would be in the loop as far as software support. The end user would also get a fully working shared hosting plan completely under their control and would own full rights to that domain name. If that means full SSH, FTP, and/or cPanel access, then so be it.

And when they want to stop using Alpha, they fill out a form on my site and it stops the recurring billing from the hosting provider and removes the shared hosting plan. (Or I can have an alternate link to just stop the hosting plan direct from the hosting provider's website.)
User avatar
volomike
Forum Regular
Posts: 633
Joined: Wed Jan 16, 2008 9:04 am
Location: Myrtle Beach, South Carolina, USA

Re: Site Automation Question

Post by volomike »

The only options so far that look slightly inexpensive are:

(a) Cloud computing. Unfortunately it's not so cheap for me yet, has had a record of some outages that don't make me feel safe with it, has a set of rules where you have to rewrite your code, and locks you into a proprietary API on some things.

(b) VPS hosting with 3 servers. One server acts as the head server with Pound Reverse Proxy, acts as the central database server, and acts as the central file server for uploads and downloads of file attachments (if applicable). The other 2 VPS hosts act as PHP web nodes, and I add more as necessary later on. Unfortunately when I checked the price on this, it comes to $538.20 per year for the 3 VPS servers -- still out of my price range initially. I mean, I don't even know yet if the website project will be of interest to people yet. If I knew it would sell like hotcakes, then yeah, I'd go pay the $538.20 bill and get started on this.

(c) Purchase 2 shared hosting plans. Get the domain name pointing only to one hosting plan. Fill up users on that hosting plan as much as possible when they register. When that server gets full, edit the .htaccess file to use RewriteRule to point them to another server. Only trouble is -- I don't think Apache2 supports a RewriteRule that goes to another IP address or domain name.

(d) Purchase a series of domain names like alpha1.com, alpha2.com, alpha3.com, and so on. When they go to https://alpha.com/ricks-motorcycles/, redirect them to https://alpha3.com/ricks-motorcycles/, for instance.

(e) Some kind of creative DynDNS solution where users would go to like ricks-motorcycles.alpha.com and it would automatically route to a parked domain on some shared hosting plan. Only trouble is -- does it support it like I think it does, and does it have an API that can be automated?
User avatar
volomike
Forum Regular
Posts: 633
Joined: Wed Jan 16, 2008 9:04 am
Location: Myrtle Beach, South Carolina, USA

Re: Site Automation Question

Post by volomike »

Hey, I found a great, inexpensive fix that works with Apache2 if the web hosting provider has loaded mod_proxy in the config. It's called Proxy Throughput and is a relative one-liner in your .htaccess file. For instance, if you want Rick's Motorcycles to sign up on your alpha.com site and you want to give him space on x.com as if it was on alpha.com, your .htaccess file would look like:

Code: Select all

RewriteEngine On
RewriteRule ^ricks-motorcycles/(.*)$  http://x.com/ricks-motorcycles/$1 [P,L]
Rick's employees would then connect with a URL like:

http://ricks-motorcycles.alpha.com/blah/blah/blah/

And then it's just a matter of making a ricks-motorcycles subdirectory on x.com, along with copying out PHP files and creating the MySQL database.

This trick works not only with shared hosting plans, but also any kind of Linux-based hosting plan out there if they've enabled Apache2 and mod_proxy for that plan.

And note this is in addition to any load balancing you may want to do. All we're doing here is redirecting a portion of your traffic off an overloaded server permanently to another server. But if that server (such as x.com) has a load balancer arrangement on it, it can distribute load yet again randomly among a series of other web nodes such as a.com, b.com, or c.com, for instance. By the way, tonight I learned of an easy alternative to the Pound Reverse Proxy service. The technique uses Apache2, an .htaccess file, and a Perl script, and requires that the mod_proxy module be loaded in your Apache2. The technique is under the section "Load Balancing", here:

http://httpd.apache.org/docs/2.0/misc/rewriteguide.html

The only catches I saw were that you'll need to change this up slightly to handle https versus http, and you'll need to watch out for your web app starting URLs with "./<path>" or "/<path>" because they won't work in this config. Instead, use either relative pathing without the slash prefix, or use the absolute URL path.

So, with a solution like this, you can purchase like 2 shared hosting plans really cheaply to start with and grow this, or even grow it fairly smoothly into a VPS or dedicated hosting solution.

As for automation, you're looking at a PHP page with user/pass combo that you build to create databases, make subdirectories, and copy over files, and then a registration form that kicks this off, and PayPal integration. You can then take the cash to purchase more shared, VPS, dedicated, or other hosting plans as you see performance needs for it.
Post Reply