Get started with Winter in 5 minutes using Dev Containers

Ben Thomson
Posted on Dec 09, 2024.

Open in GitHub Codespaces

In our quest to ensure that everyone has easy access to Winter, we have worked on various ways and with various providers to make it easy to get started with a new installation with Winter. Our current installation methods - from using Composer or the Web-based installer, to using Softaculous on supported website hosts - all make it easy to install Winter on your own hosting. However, we have long wanted to make it even easier for people without access to hosting to be able to enjoy development on Winter, and even contribute to core Winter development without going through all the hassle of setting up a development environment.

Previously, we implemented support for Gitpod.io directly within the Winter CMS repository to allow a user to quickly start up an online code editor to submit code directly to the Winter CMS codebase. While the service itself was really good, it was unfortunately very proprietary to Gitpod.io and didn't have all the necessary components to really use Winter to its full potential (in fairness, Gitpod.io has gotten much more capable recently). It also required users to sign up for a new account with Gitpod and, at the time, required billing information and had a restrictive free tier, making it cost-prohibitive for people who just want to give Winter a try. So we kept looking.

That's when we then found Dev Containers.

What are Dev Containers?

Dev Containers are an open-sourced specification, spearheaded by Microsoft, to create a simple configuration for starting a fully-functional development environment in a supported code editor using containers, such as those provided by Docker. When a project, such as Winter, publishes a dev container configuration in its repository, these code editors will be able to automatically download all requirements and dependencies, and run any bootstrapping scripts necessary to make this development environment available with the intention of allowing you to simply start coding.

Supported editors for Dev Containers include Visual Studio Code and the Jetbrains suite of tools such as PHPStorm. In the case of Visual Studio Code, when it detects a Dev Container configuration in the current project, it offers to start the process immediately and walks you through every step needed to use the configuration including installing Docker. (This is, of course, assuming you have the Dev Containers extension installed).

Container prompt

This still sounds super complicated!

You'd be right on that regard. A lot of people avoid Docker due to its complexity, and that's totally fair. Thankfully, there's a number of services out there that take away the need to deal with Docker and allow you to just spin up an instance of the application through their user interface. Along with the previously mentioned Gitpod.io, there is also GitHub Codespaces.

The beauty of these services is that they provide the hosting environment, generally on isolated servers, fully capable of starting up a development environment using the Dev Containers configuration usually at the press of a button. Most of these providers provide free development time up to a certain amount of hours, with the option to pay for more time or more resources if necessary.

A lot of these services provide a code editor in-built into the browser, generally the web version of Visual Studio Code, allowing you to get started with development directly within your browser - perfect if you're using a slower computer or are away from your main development computer and quickly need to make some edits to your code. With all the software running remotely on the hosting service's infrastructure, you could literally code from your phone or tablet if you wanted to (screen space restrictions not withstanding).

Since Winter and its first-party plugins and themes are hosted on GitHub, we will describe the process of getting your 5-minute install of Winter running using GitHub Codespaces.

Running Winter on GitHub Codespaces in 5 minutes

Before we start, we should clarify - those 5 minutes will be mainly the development environment getting started. Your actual efforts can be measured in seconds!

Firstly, you can fork the Winter CMS repository into your own repository, or run a codespace directly from the Winter repo if you want to contribute to Winter.

Click on the Code button at the top of the repository, then click the Codespaces tab. Finally, pressing the + button next to Codespaces creates a new codespace.

Opening codespaces

This is literally all it takes! GitHub will create a Codespace instance with a generated URL, and redirect you immediately to the code editor view. The first time this happens, the development environment will need to be created. This takes up to 5 minutes to:

  • Install PHP 8.3 and the necessary PHP extensions to run Winter.
  • Download and install all Composer dependencies required to run Winter.
  • Set up an SQLite database and run the necessary database migrations.
  • Install some demonstration plugins and themes, including the Workshop theme, Blog plugin and Test plugin
  • Set up an administrator account
  • Configure the development environment to be publicly accessible on the generated URL.

Once completed, your Winter CMS install will be web-accessible, fully operational and ready for you to begin! The Workshop theme provides a useful base to test out core features of the CMS on the frontend, and the Test plugin provides ample testing of features in the Backend. You can quickly sign in to the Backend with admin / admin as the credentials, change the password of the admin user, and get cracking!

Environment

More information

If you want to explore more about Dev Cotnainers, check out the Dev Containers documentation website. You can have a browse of our Dev Container configuration to see what steps are taken to set up the development environment, and read more about using dev containers for your own projects.

More

Keep informed

Sign up to our newsletter and receive updates on Winter releases, new features in the works, plugin and theme promotions and much more!