Skip to content

Modern WordPress development and deployment workflow with Platform.sh and Upsun

Notifications You must be signed in to change notification settings

platformista/modern-wp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Modern WordPress development and deployment workflow

This repository hosts the codebase for two sites, both

In addition to the above:

WordPress

WordPress remains by far the CMS that is easiest to adopt, and that provides a fast time to market in the majority of use cases. There is so much high quality stuff out there for WordPress, be it OSS or Premium, that one can have beautiful sites powered by an easy-to-use CMS up and running in no time.

Platform.sh

Platform.sh provide an incredibly flexible and powerful PaaS. As they like to call it, it is the Idea-to-Cloud PaaS. With a GitHub integration, you can have a child environment cloned from your a parent environment (the root of the tree is usually the production environment) for each pull request, and a Status Check that runs a build on Platform.sh out of the new branch, so to verify that the changes do not break anything. Upon merging a PR, the code is deployed straight to the parent environment.

Upsun

As of April 2024, this template also supports Upsun, the new offering by Platform.sh

Feel free to poke around the Upsun configuration, too.

Bear in mind, however, that the "deploy button" you find at the top of this file only works with Platform.sh. If you want to deploy this repository to your Upsun account, make sure to fork this repo and then connect your GitHub account to your Upsun one.

Dependabot

Now part of the GitHub family, it provides a free plan for public repositories, and it supports PHP+Composer. You can configure it to decide what kind of upgrades you want to perform on your dependencies, and the bot will issue pull requests periodically, avoiding stale dependencies.

Mergify

This service, too, provides a free plan for public repositories. You can configure it with a number of conditions that, when met, will trigger an automatic merge of your pull requests.

Redis

Redis is an open source, in-memory data structure store, that here I use as a back-end cache system via the Redis Object Cache plugin. It is easy to adopt with Platform.sh, as it is one of the many containeresed services that you can add to your project.

Cloudflare

Cloudflare is one of the CDNs best supported by Platform.sh; it is also one that provides a good free plan. When you combine that with the awesome plugin WP Cloudflare Super Page Cache, choosing Cloudflare for your personal sites becomes really a no-brainer.

WordPress translation files and Composer

One of the sites is not in English and uses translation files for WordPress core, themes, and plugins for an optimal setup. WordPress Packagist does not currently provide such files, but—–thankfully–—the OSS community never rests, and inpsyde/wp-translation-downloader is a great Composer plugin to manage WordPress translations.

GitHub Actions

It seemed like the obvious choice. Currently no particular CI/CD task is implemented, as Platform.sh provide their own built-in CI/CD for builds and deployments. Moreover, I do not require particular testing at present, so I am not using Actions for that either. However, I am using it as Cron Scheduler, to perform regular tasks on my Platform.sh project.

Although Platform.sh allow you to do that by defining Cron Jobs on their own platform, I chose to have this functionality decoupled from Platform.sh.

Elasticsearch

Elasticsearch is a distributed, RESTful search and analytics engine that centrally stores your data for lightning fast search, fine‑tuned relevancy, and powerful analytics that scale with ease. Platform.sh allows a very easy adoption of the service. ElasticPress provides a seamless integration with WordPress.

Algolia

Algolia is a commercial service similar to ElasticSearch or Solr, but that claims to be up to 200x faster than Elasticsearch. There is a free plan that is definitely suitable for small sites. Algolia no longer maintains an official WordPress plugin but their former official plugin was forked and it is now known as WP Search with Algolia. It is actively maintained and works well as far as we have been able to ascertain.

Rudimentary "distro" support for WordPress

"Distros" or "install profiles" are essentially a way to have your own default installation configuration. Whilst some softwares have built-in support for that, WordPress does not. Our rudimentary support for this in WordPress relies on two things: a bespoke section in the composer.json file and a script that uses the information in that section to perform some initial setup. The script is then executed as part of the deploy hook in Platform.sh. If you are wondering why we didn't simply use the scripts.postbuild section in composer.json to run such a script, the reason is that during the build phase in Platform.sh (when composer is run) the database service is not yet available.

Jetpack's identity crisis averted

You may know that Jetpack can suffer from identity crisis. This template is configured so that non-production environments on Platform.sh automatically adopt Offline Mode, thus averting the identity crisis. It would've been preferable to use Staging Mode instead of Offline Mode, but it turns out—after a long chat with WordPress support—that just adding define( 'JETPACK_STAGING_MODE', true ); to wp-config.php for a site that already has an active production connection to Jetpack doesn't actually put that site in Safe Mode automatically as described, but still causes the identity crisis.

About

Modern WordPress development and deployment workflow with Platform.sh and Upsun

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •