LocalDev

Introduction

Why use LocalDev?

A local development environment is ideal for several use cases: 

  1. Starting a new application from scratch will allow you to develop in an environment that will be setup in the exact same way as your final production target for you and all other developers on the project. 

  2. Debugging legacy applications which you haven’t touched for quite a while can be quite a hassle. By cloning a production environment into a local development environment using a snapshot based clone, you have a true zero config exact replica from the production environment allowing you to reproduce any issue without the classical “it works on my machine” wall you’ll be bound to hit depending on the issue at hand. 

What functionality does LocalDev provide?

  • It runs all your applications inside containers within a local virtual machine that replicates the way DeltaBlue.cloud hosts run your applications. 

  • It exposes these applications on your machine with local hostnames. 

  • It allows you to control this environment in exactly the same way as your environments in the cloud. 

  • It supports all necessary platform features, such as running scenarios, cloning and snapshots

Installing requirements on your machine

The DeltaBlue local dev environments require Vagrant with the VirtualBox provider to set up a local dev environment on your machine. If you already have these installed, there is a high probability you can use your existing setup.

To provide easy access to your development environment, DeltaBlue has built an additional service that manages readable hostnames for your applications in the local hosts file on your machine.

The DeltaBlue hosts-updater is currently supported on Debian/Redhat/Arch-based systems, as well as macOS and Windows. 

You can follow the brief walkthrough below for installing a compatible combination of Vagrant and VirtualBox. Beware that at the time of writing, Vagrant version 2.2.6 is not compatible with VirtualBox 6.1.x! So be sure to install VirtualBox 6.0.x when you are running Vagrant 2.2.6 or your Vagrant will not be able to launch the VirtualBox instance. 

Installing Vagrant

If you already have Vagrant installed on your machine, you can skip this step, but as mentioned above, be sure to use a VirtualBox version that is compatible with the Vagrant version you have installed! 

Linux - Debian-based (Debian, Ubuntu …)

  1. Make sure your package list is up-to-date by running: sudo apt update

  2. Run: sudo apt install vagrant 

Linux - Redhat-based (Redhat, Fedora …)

  1. Make sure your package list is up-to-date by running: sudo dnf update.

  2. Run: sudo dnf install vagrant

Linux - Arch-based (Arch, Manjaro …)

  1. Run: sudo pacman -S vagrant

macOS or Windows

  1. Download the macOS or Windows version 

  2. Install it 

Installing VirtualBox

If you already have VirtualBox installed on your machine, you can skip this step. Beware of existing compatibility issues between Vagrant and VirtualBox. Vagrant 2.2.6 will not work with VirtualBox 6.1.x or higher! 

Linux - Debian-based (Debian, Ubuntu …)

  1. Make sure your package list is up-to-date by running: sudo apt update.

  2. Run: sudo apt install virtualbox-6.0

Linux - Redhat-based (Redhat, Fedora …)

  1. Make sure your package list is up-to-date by running: sudo dnf update

  2. Run: sudo dnf install virtualbox-6.0

Linux - Arch-based (Arch, Manjaro …)

  1. Run: sudo pacman -U https://archive.archlinux.org/packages/v/virtualbox/virtualbox-6.0.8-2-x86_64.pkg.tar.xz

macOS or Windows

  1. Download the macOS or Windows version

  2. Install it 

Installing the DeltaBlue hosts updater

This is an additional application that runs as a service on your machine. It listens for http requests from your vagrant box, and registers the application urls within it as locally accessible hosts by managing your /etc/hosts file. 

Linux - Debian-based (Debian, Ubuntu …)

  1. Execute wget https://deltablue-localdev-public.s3-eu-west-1.amazonaws.com/linux/linux-hosts-updater_0.1.3-15-g8f6d1be_amd64.deb 

  2. Run: sudo dpkg -i linux-hosts-updater_0.1.3-15-g8f6d1be_amd64.deb

  3. Enable it to auto start on boot: sudo systemctl enable hosts-updater.service

  4. Start it for immediate use now: sudo systemctl start hosts-updater.service

Linux - Redhat-based (Redhat, Fedora …)

  1. Execute wget https://deltablue-localdev-public.s3-eu-west-1.amazonaws.com/linux/linux-hosts-updater_0.1.3-15-g8f6d1be_amd64.rpm

  2. Run: sudo dnf linux-hosts-updater_0.1.3-15-g8f6d1be_amd64.rpm

  3. Enable it to auto start on boot: sudo systemctl enable hosts-updater.service

  4. Start it for immediate use now: sudo systemctl start/enable hosts-updater.service

Linux - Arch-based (Arch, Manjaro …)

  1. Execute wget https://deltablue-localdev-public.s3-eu-west-1.amazonaws.com/linu x/linux-hosts-updater_0.1.3-15-g8f6d1be_amd64.tar.xz

  2. Run: sudo pacman -U linux-hosts-updater_0.1.3-15-g8f6d1be_amd64.tar.xz

  3. Enable it to auto start on boot: sudo systemctl enable hosts-updater.service

  4. Start it for immediate use now: sudo systemctl start/enable hosts-updater.service

macOS

  1. Download the macOS installer

  2. Install it 

Windows

  1. Download the Windows installer

  2. Install it

Setting up a local environment for your project

Create your local environment

  1. Create a new environment in your project by clicking “Add a new environment”:

  2. Mark the environment as “local”:

  3. Now click the save button in the modal to create the environment. The LocalDev environment will be distinguishable by the PC icon: Note: a LocalDev environment will only be visible to the user who created it! 

Starting your local environment

  1. Download the vagrant file by clicking the PC icon and selecting the appropriate link from the dropdown menu:

  2. Move the downloaded Vagrantfile to a location of your choosing. We recommend placing it in a new empty folder to prevent clutter. 

  3. Inside the directory of your Vagrantfile, run: vagrant up 

Registering your Vagrant box

  1. After the first time you have executed vagrant up, you will see a message that looks like this:

  2. Navigate to the link as shown in the message which will bring up a login page.

  3. Enter your DeltaBlue.cloud username and password and make sure you see a confirmation about your box being authenticated successfully.

Setting up your applications inside the local environment

  1. You can drag and drop any application from another environment to your local dev environment, or you can click “Add application”:

  2. When all the applications are present in your local dev environment, you can launch them to start working on your laptop! Be sure you have registered the box first!

Also take care not to lose your internet connection during the launch! When all applications are launched, you can safely disconnect from the internet should you want to. You will only need an internet connection if you want to execute actions using the web UI, otherwise you can develop offline.