A push towards serverless data

Update: Two days after I wrote this post, Cloudflare announced that their Workers product would officially support Prisma Data Proxy to access relational data. Spooky!

Yesterday I logged into an old server that I use for hosting some small applications, a WordPress installation, and other little bits and bobs and I noticed that sudo apt-get update wasn't working correctly. One of the URLs that the operating system (Ubuntu 16.04 LTS) needed to perform updates was suddenly down. Oh, boy.

I knew in my gut that I couldn't leave this server without an update because I didn't check it often, so it could fall prey to hacks and vulnerabilities when I wasn't looking. I also knew that trying to figure this out would take at least an hour, if not more. Ever since leaving my old systems administrator job in April I haven't touched Linux servers on a daily basis, so I was rusty and that made me even more nervous.

I did eventually fix the update problem and I upgraded my OS to a more recent LTS version, but that and getting all my apps running again took 2 hours of my Friday evening. Plus, I know this is going to happen again in a few months or a year and I'm going to be even more rusty than I am now. I've been trying to focus more on software development and I just don't have the mental bandwidth to also be a server administrator (a whole career in its own right).

If I don't want to be a server administrator anymore, I need to get rid of this server.

Most of my new development projects have leveraged serverless computing to solve this "I don't want to be a server administrator" problem. Essentially you leave the server administration to a professional and get access to that server via an API. (Technically there is still a server involved in "serverless computing" but I only touch it at arm's length, which is what is important here.)

This website is itself a serverless application, but the only reason it works is that the data for it lives in the repository alongside the code. The site takes advantage of the fact that most source code hosting providers have a generous free hosting tier as long as the data is static and public. If you need to host dynamic or private data though, you have fewer options. Solutions like Cloudflare Workers KV get you most of the way there, but you will run into issues if you need relational data.

Relational serverless databases that can work on serverless computing platforms are basically the edge of the serverless frontier right now. Products like CockroachDB Serverless and PlanetScale allow you to have a serverless database, but the rely on needing a server to run the application that actually uses that data. That is, you can't have both serverless data and serverless computing. Both products say they are working on this issue, but there isn't an ETA on when this capability will be available. Dammit.

I thought I was out of luck and would have to administer this server for another few months or longer, but after a bit more digging I discovered that Prisma is rolling out an "Early Access" version of its Data Platform product, which allows you to administer a remote database as long as you had the database connection string. Prisma is basically running a server for you that can serve as the "glue" between serverless databases and serverless computing platforms. Sign 👏 me 👏 up 👏.

Of course, the biggest downside to this scheme is that you need accounts for 3 different things: the serverless database, the serverless application, and Prisma. But, for me, this is a small price to pay compared to remembering Linux commands, keeping up with server updates, and being responsible for server outages. Another thing to note is that most of this serverless stuff is "early access" or "beta", so you need to be willing to put up with some rough edges. I'm extremely patient with troubleshooting new technologies, but I realize that isn't for everyone.

Over the coming weeks I'm going to try setting up a project with a Prisma schema, spinning up a PlanetScale database (which Prisma seems to support), and getting it all running on Cloudflare Workers. It's possible that by the time I'm done PlanetScale will have a solution that won't require the Prisma Data Platform anymore, but at least I'll have a good story to tell about pushing the boundaries of the serverless data frontier.