tl;dr PaaS are great for rapid PHP app development, but not all are good fit for microservices.
In the recent years I did more and more DevOps work tasks instead of purely PHP app development. I like to solve technical architectural challenges, and I like to automate things. That's why I don't mind when I have to set up a LAMP stack for my side projects. However, as I wrote before when I showed how to deploy a PHP app to Heroku, this takes time. Valuable time I am not willing to spend when I want to do rapid application development.
The smaller the app, the larger the angst of infrastructure hassle.
Platform as a service (PaaS) providers help to reduce this hassle dramatically. They manage everything from runtime, middleware, operating system, virtualization, servers, to storage and networking.
PaaS helped me a lot to embrace a whole new strategy how to deal with my side projects and break the not-finished-yet-mindset.
But PaaS providers have their limitations. You will quickly realize this, when you develop and orchestrate many micro apps.
PaaS locks you out of open source
One important idea in rapid app development is “do what you can to make that core functionality happen with the simplest technologies“. PaaS providers limit the set of available technologies.
If you decided to use a NoSQL database in your application you have many options: MongoDB, CouchDB, Cassandra and many more. You can install and maintain them yourself or buy them as a service from a variety of providers. You have the second option with a PaaS provider. For example you can use MongoHQ as on Heroku. But for any other open source tool, you will have to wait long enough for it to become a mainstream product and profitable to run as a service.
You're losing out on innovation.
PaaS can be too expensive
The price for most PaaS is appropriate for the amount of functionality they provide. Heroku for example charges a minimum of $7 for each “hobby” project. Fair price. But seven bucks for each microservice… that adds up to an expensive hobby rather quickly.
That's why I evaluated some alternatives.
Heroku made the PaaS concept popular. I used it for several years but migrated all of my projects recently.
- ➕ Deployment via
git push, everything else is managed by Heroku, this is an exceptional user experience
- ➕ Large featureset, mature services
- ➕ Native PHP support, a lot of documentation
- ➕/➖ Free tier - Only for proof-of-concepts imho
- Free projects will “sleep“ when not used for a certain time and waking up will take up to 30 seconds, which means that there is a good chance your microservice side project won't be used by a real person
- ➖ Too expensive to set up many microservices
- ➖ Not flexible enough when you mant to manage many projects
- ➖ GDPR compliance is difficult - Heroku is a US service and writes IP logs by default, without a way to disable this behaviour
Dokku is like a “Docker powered mini-Heroku”. The original intent was to let a collection of shell scripts build yourself a DIY Heroku-like PaaS. Rent a server, install Dokku and then manage your apps just as you used to do with Heroku.
- ➕ Self-Hosted, self-owned, extensible, open-source
- ➕ Deployment via
git push- Apps compatible to Heroku will run on Dokku as well, in the best case it is sufficient to switch the remote URL
- ➕ Native PHP support, extensible with various Docker images
- ➕ Self-Hosted allows you to be fully GDPR compliant
- I asked for an option to disable webserver logs, this was implemented straightway
- ➕ Dokku is free, a single server is required to run Dokku with an almost unlimited number of projects in parallel
- ➖ Requires additional maintenance for the Dokku server, which is a
hidden cost jokingly addressed in this wonderful feature point:
You'll save tens of dollars a year on your dog photo sharing website
- ➖ Limited to a single server - no horizontal scaling
- ➖ Work in progress, some essentical features are open for a long time
AWS is a cloud platform with multiple solutions for cloud infrastructure and technology demands from IaaS to PaaS and SaaS. As a result AWS could act as PaaS itself or support PaaS development.
Elastic Beanstalk is the PaaS of AWS and is a wrapper for multiple other AWS services.
- ➕ Fast & robust, large featureset
- ➕ Cheap, the smallest instance variant is available for $3
- Due to the flexbility of the service to add resources at will there are no “plans” with a clear price model
- ➕/➖ GDPR - It's still a US service, but has appropriate data processing contracts and hosting is possible in many EU regions and datacenters
- ➖ UI & UX of AWS is poor - I use it on my day job and know many (not all) abbreviations and oddities, but would not recommend it for side projects
- ➖ Deployment either via drag & drop of crafted ZIP archives or a special CLI tools - booth don't feel very smooth
Among other services EC2 is the one to rent a server and install your own PaaS like Dokku. The pros and cons of Beanstalk apply here as well.
In a talk about microservices Dr. Gernot Starke once explained that microservices don't suddenly remove complexity, they just shift this issue to DevOps. Same applies to PaaS more or less.
PaaS does not solve infrastructure hassle, it postpones it.
To me this is absolutely fine. As said above, it is the actual reason to use PaaS in rapid app development in the first place. In a later step, when the app reaches a level where the selected PaaS is an issue at all, I am able to take countermeasures.
When you have SSH access to a server you may build a DIY PaaS infrastructure, also known as Private PaaS.
- ➕ Cheap, one server or webpackage with SSH access is enough for many apps
- ➕/➖ Self-controll, with all benefits and drawbacks regardings hidden costs, GDPR, maintenance, security
- ➖ Requires additional know-how which slows down development quite clearly
Some managed servers or webpackage hosters provide CLI commands to set up parts of the infrastructure. This might be faster and more flexible than you expect. On Uberspace for example a bash script with no more than 10 lines of code is enough to create a new project, virtualhost, subdomain and database, and set the desired PHP version.
Ansible is a mature and popular tool to automate infrastructure provisioning. It also works with many servers at once.
With Git you are even able to build a Heroku like deployment experience.
Install Git on the server, create a bare repository in a working directory,
and add the SSH-address of the repository to your local Git repository.
With the help of a so-called
hook, it is possible to trigger a build script and sync the files to a
document root after each
Other noteworthy solutions
Paasfinder is a great site to find services which may suit your use case. I evaluated these noteworthy services as well:
- Flynn - Alternative to Dokku, straightforward docs,
supports horizontal scaling, has a dashboard for all projects
- Is dead unfortunately
- Netlify - Cool service, clean interface, fast,
with ambigous terms though
- “PHP Runtime” = A build script to generate the site may be written in a server side language like PHP, but the result stays static
- “Deploy & Build“ - It is possible to build the site on your own and then use Drag & Drop to deploy the result, or “deploy“ via Git and then let a build runtime generate the site and deploy to the target server
- Back4App - Popular serverless database platform, very large featureset, many helpful guides, evident vendor lock-in