After doing a lot of research about how to get a good and light local environment for Magento projects, either Magento 1 or 2, I got to this conclusion that I am sharing with you.

Of course, nothing is faster than a local lamp/lemp server if you are using a Linux distribution, but if you want to virtualize, which is the optimal, you need to decide between Vagrant, Docker, and any other similar.

I made and tried a huge number for Docker’s and Vagrant boxes, but everything was very slow and it makes you lose a ton of time, until I got to Docksal.

Docksal

Docksal is a tool for defining and managing development environments. It brings together common tools, minimizes configuration, and ensures environment consistency throughout your continuous integration workflow.

This is how they define Docksal, but let me tell you that is real fast! I mean, even for Magento 2 projects in developer mode and it doesn’t consumes much resources, that is the best part!

Docksal offers a sample Magento 2 project built with it, which is very simple to install. Take a look at the Docksal requirements in order to get it installed and working properly on your environment.

If you want to automate the installation of certain Magento projects, you can use a bash script that I made for Linux and OSX which creates a docksal based on an existing Magento project code.

This script gives you the ability to set up a local environment within minutes.

 

DSAL bash script

This is a simple bash script which uses the Docksal Magento container and creates a light environment.

Features

  • Setup a Magento 1/2 project within minutes
  • Import an existing Magento 1.x project by importing a .sql file
  • Import an existing Magento 2.x project by importing a .sql file

Requirements

  • Docker installed
  • Docksal installed

Installation

Global

Execute the following command in your terminal in order to execute the installer. You need to have “git” and “curl” installed within your terminal.

 

This will install the dsal command in ~/.dsal/bin and create a symlink on the /usr/local/bin directory.

Usage

Actions:

Command Description
init Initialize Magento project
bash Connect to your docker container
php Executes php cli within your project root
composer Executes composer within your project root
npm Executes npm within your project root
n98 Executes n98-magerun within your project root
magento Executes Magento 2 command line tool (e.g: dsal magento setup:upgrade)
setup Installs dsal command locally on your computer
self-update Updates dsal locally on your computer
permissions Resote magento file system permissions

 

NOTE: All of this commands will work only for your project root directory. That means that if you want to use, for example, gulp on a specify directory within project project (e.g.: skin/frontend/myvendor/mytheme/) it won’t work. In that case, you will need to use the “fin bash” command and navigate to that directory and use the gulp command from that place.

Leave a comment