CMS

Docksal as local CMS development environment

The purpose of this blog is to demonstrate using Docksal for local development of major Content management systems like Drupal, WordPress, Magento, Laravel and many more. We will see how replacing our lamp/Xampp/Wamp desktop environments with modern development platforms like Docksal can save us time and energy, and help avoid hassles in getting up to speed on projects.

Problem/motivation –

Debugging issues on a development environment can be tedious when we use conventional stacks like Wamp/LAMP/Xampp. As there are many components(PHP, Mysql, Apache, drush, composer, etc) debugging issues with the stack can kill the time which could be used in development instead. As a local environment that is based on such stacks is not a perfect simulation of a live environment, there is a risk of encountering issues when we deploy our application.

Also, since each developer’s environment may be configured differently, a fix that works on one environment may not work in another.

Solution –

Docksal resolves the above problem by providing a local development setup which is identical for each user, simulates live environments to a great extent and is easy to debug.

Docksal.io is the place to start learning about what Docksal is and how does it serve our purpose. The page Docksal Documentation provides a great write up on the key features and why we should consider using Docksal. Some noteworthy points are –

  1. Docksal is a tool for defining and managing development environments. It uses Docker to create fully containerized environments, along with Virtual Box to support macOS and Windows. Its main feature is the inclusion of a command-line tool called fin that simplifies the management of all components.
  2. Docksal comes preloaded with common development tools, e.g., Composer, PHP Code Sniffer, php-cli, node, Node Package Manager, Ruby, Bundler, and Python. For Drupal and WordPress development, it comes with drush, Drupal Console, and WP-CLI.
  3. There is built-in support for Apache Solr, Varnish, Memcache, Selenium, and Behat. And since services are containerized with Docker, any other service needed for a project can be added.

 

Docksal is based on Docker –

Docker provides a container based platform for developers who are looking to launch container based applications. The Docker webpage https://www.docker.com/resources/what-container provides a good read on what is the concept of containers and how it helps package Software into Standardized Units for Development, Shipment and Deployment.

Fin, the command line tool –

Fin is a command line tool for controlling and running a Docksal environment. Run “fin” or “fin help” command to get a complete list of fin commands for Docksal. Read more at https://docksal.readthedocs.io/en/master/fin/fin/#using-fin.

System Requirements –

  1. RAM – 8 GB or More is recommended.
  2. Mac – 2010 or newer model, macOS 10.11 or later.
  3. Linux – CPU should support hardware VT-x/AMD-V virtualization and it should be enabled in BIOS, Supported distributions: Debian with derivatives (Ubuntu, Mint, etc.), Fedora with derivatives (CentOS etc.)
  4. Windows – CPU should support hardware VT-x/AMD-V virtualization and it should be enabled in BIOS, Windows 7 or newer.

 

Installation –

The page Getting started describes in detail Docksal setup on all Operating systems.

Here we will elaborate on installing Docksal on windows environment –

  1. Windows needs Linux type shell to install Docksal. You have option of choosing between Babun(A windows shell) and Ubuntu App (Windows subsystem for Linux). We recommend using Ubuntu App as it provides a real Unix shell. We will use Unix shell to proceed with our installation.
  2. Install Ubuntu app. Watch the videos – Installing Ubuntu app on Windows 10 and Installing Ubuntu app on Windows 10 [Part 2/2]
  3. Install and configure Docker for Windows – Installing Docker for Windows and configuring it to use with Ubuntu app (WSL)

  4. Install Docksal – (Beta) Installing Docksal in Ubuntu app on Windows 10

 

Creating a Content Management System boilerplate with Docksal from scratch –

At this point, we assume you have completed the Docksal installation and configured it. The Boiler plates page  has links to Docksal supported Github repositories for all major Content Management Systems. For example, clicking on Drupal 8 icon takes us to Docskal for Drupal 8 repository which has detailed setup instructions in the README.md file.

Porting an existing project to Docksal –

The page Project setup provides instructions on how to configure an existing project to work with Docksal. All the configuration for Docksal lives in .docksal folder inside the project docroot. If .Docksal folder exists in docroot, it is an indication that the project is using Docksal.

Advantages –

This implementation will enable us to –

  1. quickly setup our development environments which will come preinstalled with all basic tools for local CMS development.
  2. Configure entire environments with a single configuration file, which are easy to manage and work with. This allows for keeping all developer environments identical.
  3. Debug issues on developer environments with ease, and create environments which are lesser prone to such issues.
  4. Easy to share your site over the internet using ngrok. This lets us show our project to others without having to move your project to a web host.

 

References –

You can read more about Docksal on its official blog – Docksal blog and its brief documentation lives at Docksal documentation.

 

– Devender Reddy

 – Deepak Kumar

About The Author

Leave a Reply

*