Recreating the DigitalOcean App Platform
Tags: dohackathon, showdev
Published: 2021-01-04 14:11:57

--- 
series: 2020 DigitalOcean Hackathon
---

When I first saw the [DO Hackathon](https://dev.to/devteam/announcing-the-digitalocean-app-platform-hackathon-on-dev-2i1k) show up on Dev, I wasn't really all that interested because App Platform isn't particularly useful to me and Hackathons generally aren't my cup o' tea.  But then I remembered that I had a project stuck on the ol' backburner and decided to make the ultimate tongue-in-cheek project for this Hackathon:  Recreate DigitalOcean App Platform so that businesses don't waste their money on DigitalOcean App Platform.

By the very nature of this project, I don't expect to win this Hackathon, but I will have a whole lot of fun in getting my submission rejected in style!

Before I begin, it may help to know in advance that just one of several systems I maintain moves a mere 3.5TB of outbound data transfer each month.  And that's an average amount of transfer for any given system I work with.  I don't like surprise monthly bills.  Paying through the nose per-GB of storage and/or transfer is a bad place to be (e.g. $0.01/GB of overage can add up fast).  As a result, I end up doing a lot of comparison shopping that no one should have to do.

Outside of the relatively pointless free Starter tier, here's the fundamental problem with DO App Platform in a nutshell:

| Tier | Cost | Transfer | Storage | Est. Cost vs. Closest Droplet |
|------|------|----------|---------|------------------|
| Basic | $5/mo | 40GB/mo | ~1GB | ~13x (Ouch!) |
| Pro | $12/mo | 100GB/mo | ~1GB | ~40x (Wow!) |
| Database | $7/mo | N/A? | 256MB | ~120x (Boinnnnnng!) |

The critical limitations of just the entry level pay-actual-money-for DO App Platform Basic tier are pretty wild:  40GB/mo of transfer when compared to the DO baseline VPS of 1TB/mo.  Also, because GitHub generally has a 1GB repo size limit and App Platform is ephemeral (no permanent storage), DO clearly isn't particularly concerned about disk usage.  Those two items combined results in something around 13 times the cost compared to a baseline Droplet!  Ouch.

Users can get 256MB of storage for a database for $7/mo!  That's _crazy_ expensive at $28/GB/mo.  I can't even begin to wrap my head around how insane the cost metrics are for that one.  The math works out to maybe something around 120 times the cost of a baseline Droplet.  Boinnnnnng!

I could probably go on but I'll stop there.  Wow.

{% youtube X-vaNmtG-x0 %}

The estimates are just that:  Estimates.  I threw some ballpark numbers at the wall to see what the cost differential against a Droplet of roughly equivalent size might be.  Given the number of variables involved, attempting to be accurate is not really the point.  Anything over 2x the cost for network transfer and storage is pretty bad.  From my perspective, DO App Platform is simply not price competitive with Droplets.

Besides cost, App Platform has two major functional limitations:  No root/SSH access and local storage isn't permanent.  I consider those to be vital features of any system I use.  The whole point of a VPS is to get bandwidth, transfer, OS, CPU, RAM, storage, and electricity and have near-total control of the setup and management of the system.

Okay, so App Platform might work fine for some things (e.g. pure static sites that could be hosted anywhere) but it is pretty expensive for most things.  My project for this Hackathon is to recreate the relevant portions of App Platform at a fraction of the cost and without the limitations.

Behold, Server Instant Start:

{% github cubiclesoft/server-instant-start %}

I've been working on this off and on for the past few weeks.  Christmas slowed progress down quite a bit since I took some time to write a web application to allow multiple people to remotely control 6 different webcams for Christmas during this year's Zoom session.  That's a story possibly for a different time and I digress.

Anyway, most of the code and data for Server Instant Start was already built thanks to [Barebones CMS Instant Start](https://github.com/cubiclesoft/barebones-cms-instant-start).  It just required some refactoring to remove all of the Barebones CMS specific stuff and make components optional, adding scripts to install and configure MariaDB/MySQL and PostgreSQL, and creating a few post-install scripts.

Server Instant Start is essentially the Basic tier of DO App Platform but uses a Droplet via the underutilized "User data" feature of Droplets.  Oh, and it is much more cost effective too.

If you are thinking, "This Instant Start thing looks a bit like Chef, Puppet, Ansible, etc."  Sure, Instant Start is a bit like those tools but it is specifically geared for spinning up a ready-made, Internet-facing, pre-configured web server from scratch, which allows it to come with complex cross-package integration and configuration (e.g. connecting Nginx to PHP FPM), has a spot in the cloud-init script to pull down and deploy your project as you see fit (e.g. from GitHub), and also dramatically simplifies complex post-install tasks such as setting up HTTPS and DKIM.  Those other configuration management tools take effort to learn and I'd rather write my own stuff anyway.

Here is the feature set from DO which shows how Instant Start stacks up to the Basic tier of App Platform:

| Feature | DO App Platform (Basic tier) | Instant Start |
|---------|------------------------------|---------------|
| Build static sites | Yes | Yes |
| Build and deploy dynamic apps | Yes | Yes (PHP is specifically configured) |
| Deployment from GitHub | Yes | Yes |
| Automatic HTTPS | Yes (see Side Note) | Not automatic but very easy to do - or use Cloudflare |
| Bring your custom domain | Yes | Yes |
| Global CDN via Cloudflare | Yes | Just go set up Cloudflare |
| DDoS mitigation | Yes (see Side Note) | Just go set up Cloudflare |
| Unlimited team members (this is an [account-level feature](https://www.digitalocean.com/docs/accounts/teams/), so I'm not sure why this is even mentioned) | Yes | Yes |
| Application metrics | Yes | No?  But how useful is this if your app is written efficiently in the first place? |
| CPU – Shared | Yes | Yes |
| Auto OS patching | Yes | Yes |
| Vertical scaling | Yes | [Yes](https://www.digitalocean.com/docs/droplets/how-to/resize/) |
| Outbound transfer | 40GB/mo | 1TB/mo minimum |
| Build minutes | 400/mo | Unlimited |
| SSH root access | No | Yes |
| Permanent local disk storage | None (ephemeral) | 25GB minimum |

Side Note:  If the [Anti-DDoS and Automatic HTTPS](https://www.digitalocean.com/products/app-platform/) features of App Platform actually come from Cloudflare, then DigitalOcean is actively misrepresenting several Cloudflare services as their own, which is a direct violation of the [Cloudflare Terms and Conditions](https://api.cloudflare.com/#getting-started-endpoints) and could get DigitalOcean kicked off of the Cloudflare platform.  If anyone at DO sees this note, please double-check your marketing materials.

As can be seen in the feature comparison list, Instant Start checks most of the boxes and is therefore fairly close in terms of features/options of the DO App Platform.  It's also a fraction of the cost in terms of network data transfer allowance and storage, has SSH root access, and has permanent local disk storage, which are things that matter to me.

Time permitting, I plan on adding [Data Relay Center](https://github.com/cubiclesoft/php-drc) to the servers and producing a project video.

I'm not entirely sure which Hackathon category this fits under.  Probably the business and/or silly/wacky/fun categories.