Today we deliver a feature that has been requested many times in the past couple of years: a hypernode-docker for local Magento development and deployment automation. Lately with the proliferation of continuous integration and automated deployments in the Magento space, partly because of improvements in the deployment lifecycle in Magento 2.2, but also because of an increasing demand for tools to streamline feature development and testing, we have heard the need for a production-like containerized environment.

An official Docker image for Hypernode

Like the previously existing hypernode-vagrant, the new hypernode-docker is an environment that you can use on your computer to simulate a real Hypernode. You’ll get the same exact software, tools and configurations as on your production server but in a fast and disposable environment that you can run locally or integrate as part of your deployment pipeline. While the Vagrant also has a performant container based configuration (LXC), using Docker offers some additional advantages in terms of user-friendliness, tooling and off-the-shelf integration with peripheral services like BitBucket Pipelines and GitLab Runner.

For an example Dockerfile take a look at ByteInternet/hypernode-docker on GitHub. Or run the following two commands to pull the image and start a new instance on your local machine.

$ docker pull docker.hypernode.com/byteinternet/hypernode-docker:latest
$ docker run docker.hypernode.com/byteinternet/hypernode-docker:latest
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
*** Running /etc/my_init.d/10_login_instructions.sh...
                                              _
  /  /_   _ _ __   ___ _ __ _ __   ___   __| | ___
 / /_/ / | | | '_  / _  '__| '_  / _  / _` |/ _ 
/ __  /| |_| | |_) |  __/ |  | | | | (_) | (_| |  __/
/ /_/  __, | .__/ ___|_|  |_| |_|___/ __,_|___|
        |___/|_|

Host/IP:    xxxxx-dummytag-docker.nodes.hypernode.io (172.17.0.3)
Account_id: 666
Release:    release-5278-28-ga9d3844 @ 2018-06-05 12:56:34 UTC

Handy commands (more at https://www.hypernode.com):

 livefpm (see live PHP status)
 tal | pnl (follow live requests)

 hypernode-importer (import a Magento shop)
 hypernode-image-optimizer (reduce image size)
 hypernode-ftp (manage FTP accounts)

 magerun list (many useful extensions)

------------------------------------------------------------------------------
The SSH daemon will be up in a couple of seconds, you can login with: ssh -A app@172.17.0.3
*** Running /etc/my_init.d/50_copy_key.sh...
*** Running /etc/my_init.d/50_fix_mailname.sh...
*** Running /etc/my_init.d/51_postfix.sh...
 * Starting Postfix Mail Transport Agent postfix
   ...done.
*** Running /etc/my_init.d/60_restart_services.sh...
Killing old Hypernode services
Killing any old NGINX service
Killing any old Redis service
Killing any old PHP-FPM service
Killing any old MySQL service
Killing any old Mailhog service
Killing any old Varnish service
Giving any old services 5 seconds to stop..
No Sockets found in /var/run/screen/S-root.

Starting new detached hypernode services. See screen -x
Starting NGINX
Starting Redis
Starting PHP
Starting MySQL
Starting Mailhog
Starting Varnish
Giving the new services a couple of seconds to start..
hypernode-docker status: everything ok
*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 312

A new Docker image will be automatically built every time we do a platform release, which generally happens multiple times a day because of our continuous deployment development process. That way you can test your application against an image that is as close as possible to the production environment. Because the Docker is updated this frequently, in some cases you could even be running a newer version of Hypernode locally than what has actually been propagated to your production nodes yet.

However, keep in mind that because Dockers are not VMs there will be some fundamental differences between the container and a real Hypernode (or a Vagrant). There is not a conventional init system, so services can’t be managed by tools like systemctl. It is possible to run systemd inside the container but we have chosen not to do so to achieve greater compatibility with hosts that do not run systemd themselves (like macOS).

A website for community docs: community.hypernode.io

For more information about this Docker based Magento development environment, check out the hypernode-docker section on our new website for Hypernode community docs. To make the documentation for this new feature optimally accessible, we have set up a website based on docsify that will gather the open source documentation for various of our open source projects and display them neatly on https://community.hypernode.io.

This will hopefully make it easier to discover documentation that would otherwise be buried somewhere on GitHub. If there is some documentation that you would like to add or alter, you can click ‘Edit Document’ and you’ll be redirected to the correct file on GitHub.