Thoughts on Environments

This has been discussed a few times, with various philosophies on handling environments for testing, staging, and production. I am at a point where all of the above are necessary, with an additional environment specifically for page-preparation (a clean way of generating optimal responsive images).

Simply put, my workflow looks like this:

  • Testing: Develop templates and styling (on a non-cached Grav installation), using mock pages and content.
  • Pages: Format and spellcheck actual pages, generate responsive images (non-destructively, through gulp).
  • Staging: Test site with actual pages on current templates and styles (cached Grav).
  • Production: Live, optimized site with actual pages etc.

Basic Workflow

I am wanting/trying to secure some level of consistency in the Staging and Production environments through version control, Git as it happens, but as ever that is a beast in itself and there are many a way to skin this cat. Thus, I am currently pushing template- and style-files from Testing, as well as Pages, to Staging, which when the y check out are pushed to BitBucket which automatically deploys to the Live server. Like so:

Git Workflow

However, managing .gitignore-files, gulp pipelines and avoiding conflicts in Git really can be a hassle in terms of avoiding superfluous files or having to resolve conflicts down the line.

How do people prefer to set up their deployments, and what experiences do you have with multiple environments? Ideally I would hope to reduce the need for many repositories, and potentially allow for some CI-build system wherein changes were not pushed if PHP/Twig returned a fatal error.

I wrote a note with an update on my progress in setting up my development environments and deployment-process. In essence:

Extended workflow

This is an interesting approach. It’s a bit more involved than I mostly want to bother with, but it definitely seems like a solid solution that gets you from flexible development setup to streamlined and optimized production environment efficiently.

WOW!, Gingah. Your article A Grav Development Workflow is really inspiring. Thanks for the time and effort to write such a well-reasoned thought-piece. Lots of morsels to chew on!