Using DigitalOcean for a hosting company or SaaS business

August 10, 2019 596 views
API Docker Ubuntu 18.04 DigitalOcean LAMP Stack PHP PHP Frameworks Applications Deployment Monitoring

I was wondering if it is possible to start a web hosting company or SaaS business with Digital Ocean. I have been building a PHP web application (using the Laravel Framework) for a while now, and it is already done and finished. I had a few clients purchase a copy of this app, but they had to manually set up the app on their own web hosting. This created lots of problems because not all web hosts are created the same. So I then thought that this would be a good opportunity to get into the SaaS business using this web application. I already have a website that handles basic SaaS principles (subscriptions, billing, user accounts, etc). But this is where I hit a roadblock because I didn’t know where to progress from there. This is how I envision the process.

Option 1:
A user purchases a subscription on my website. After the payment has been confirmed a Ubuntu 18.04 droplet will automatically be created on my account and install LAMP, phpMyAdmin, cPanel, as well as the web application that I created.

Option 2:
After the user purchases a subscription, and the payment has been confirmed. A VM will automatically be created for that customer with the web application I created automatically installed, which will be on a droplet that already has the requirements needed. I heard this can cut down on server costs significantly because having several droplets is not very cost-efficient.

Option 3:
Use Docker, which I don’t really understand as much as I do the other options (open to feedback).

Out of all of these options I am leaning towards Options 1 & 2 because I can understand them a little better.

A couple of questions:

Can I use the DigitalOcean API to fulfill these requests? If so, can you point me in the right direction?
Or as a last resort, should I hire a SysAdmin (related) developer to help me with this?

I was reading other posts covering the same topic, but they did not help me very much. Here they are anyway.
https://www.digitalocean.com/community/questions/advice-needed-on-how-to-setup-a-saas-service-for-a-php-based-application
https://www.digitalocean.com/community/questions/how-do-i-set-up-a-saas-product

If have any questions please don’t hesitate to ask. I will try to provide as much information needed

Thank you in advance for your help!

2 Answers

Hello,

You can certainly do that!

I believe that Option 1 would be most suitable for you if you don’t have any experience with Docker.

With Option 1 you could just use DigitalOcean’s API to automatically provision a droplet whenever someone pays for a subscription. This comes with a few benefits:

  • You could charge people for extra resources, and then easily add the extra resources to the server again with the DO’s API
  • Each application would be on separate droplet which is good for a few things like - dedicated IP, dedicated resources like RAM, CPU, Disk space and etc, security (as each application would be isolated)
  • This would be easily achievable as you could have 1 master snapshot and use it to deploy all of the new droplets so that way they would be identical, you could take a look at this guide here: https://www.digitalocean.com/community/tutorials/how-to-use-the-api-to-deploy-droplets-from-a-master-snapshot

Regarding Option 2, I think that you mean Vhosts rather than VM? If so it is not a bad idea in terms of costs, but essentially you would have 1 server, 1 IP address and all resources would be shared between all of the applications. So if one site has a huge spike in the traffic it could affect the rest of the applications hosted on the server. Also you would need to write some Ansible or bash scripts in order to automate the deployment process.

In my opinion Option 3 is also great, but if you don’t have experience with Docker, it might be a really steep learning curve.

Hope that this helps, let me know if you have any additional questions.
Regards,
Bobby

by Ryan Quinn
Learn how to use the DigitalOcean API to spin up droplets based on a master snapshot image.
  • Thank you for your reply & help! I have decided to go with Option 1 as it seems like the best option for me.

Hey there @Rainn,

Whilst I can’t really provide much advice on which of the three options is best (option 2 makes the most sense to me, but I too am not very familiar with Docker), I can help you out with the API…

For creating Droplets with the API, the documentation can be found here:

https://developers.digitalocean.com/documentation/v2/#create-a-new-droplet

To specifically create a LAMP droplet, you can take a look at our Marketplace LAMP page, which includes an API call example at the bottom to automate the creation of a LAMP droplet:

https://marketplace.digitalocean.com/apps/lamp

Hope that helps!
- Matt.

  • Thank you for your advice! I’ll definitely be needing this in the future.

Have another answer? Share your knowledge.