How to use Hypernode Vagrant as a local staging environment

in Tools Tags: SSHstaging

Byte offers Hypernode customers a Vagrant image for local development. Vagrant is a tool that gives you the opportunity to set up a virtual staging environment. In case you would like to share an acceptance environment with customers, please consider our development packages instead.

What is Vagrant?

Vagrant is a technique that enables you to set up virtual staging servers locally. Vagrant downloads an image file and uses this “box” file to set up a virtual machine according to the instructions given by the Vagrant file. It offers you a quick way to boot a staging environment that is configured exactly the same as your live Hypernode.

Setting up Vagrant

The following steps describe how to set up a Hypernode staging environment with Vagrant using the commandline.

Step 1 – Create a local checkout

New checkout
If you don’t already have a checkout of the Vagrant box or want to start fresh you need to clone the repository from GitHub.

To create a checkout of the hypernode-vagrant repository on your local machine, open your terminal and run the following commands:

git clone
cd hypernode-vagrant

Existing checkout
If you already have a checkout, make sure you update to the latest version with the following command:

git pull origin master

Step 2 – Install the dependencies

To get the Vagrant box up and running you need to have some things installed first. You can find these in the of the hypernode-vagrant repository you just cloned, or follow the steps below:

  1. Install Virtualbox 4.3.18 or later.
  2. Install Vagrant 1.6.4 or later.
  3. Install the vagrant-vbguest and vagrant-hostmanager plugins with the following commands:
vagrant plugin install vagrant-vbguest vagrant-hostmanager

The vagrant-vbguest plugin is needed to manage the Guest additions of the boxfile and the vagrant-hostmanager plugin is used to provide you with convenient local domain names like hypernode.local.

Want to use PHP 7 in Vagrant?

If you want to boot a Hypernode Vagrant box running PHP 7 follow the steps below:

Copy the example local.yml if you don’t have one already:

cp local.example.yml local.yml

Open the file in your favorite editor and make sure the PHP version is set to 7.0:

  version: 7.0

Start the Vagrant with the following command:

vagrant up

Already have a Vagrant set-up in PHP 5.x?

If you’ve previously booted a PHP 5 version of the hypernode-vagrant box, you need to destroy it first. Note: this deletes all the data in the box.

vagrant destroy -f

When the PHP 5 version Vagrant is destroyed, set up a new one after editing the local.yml (as explained above).

Import your shop in Vagrant

Step 1 – First make sure your SSH-agent is running

To log on to your live Hypernode from the Vagrant Hypernode you’ll need a key. If you don’t already have a keypair, please create one by following the instructions in: Use SSH Keys on Hypernode. Your keypair needs to be stored in an ssh-agent. If you haven’t added your keypair(s) to your agent yet, follow the instructions on how to do so here: Use an SSH-agent.

Step 2 – Start the Vagrant box and log in

Start the Vagrant box with the following command:

vagrant up

Log in with ssh

ssh app@hypernode.local -oStrictHostKeyChecking=no -A

Check if your key is forwarded to your agent with the following command. This command should display the fingerprint of the key you have authorized for your live Hypernode

ssh-add -l

Step 3 – Copy your shop

Use the hypernode-importer to copy your live shop to your local environment, using the following commands:

hypernode-importer --host --port 22 --user app --path /data/web/public --set-default-url

Depending on the size of your shop, this can take a while.

All done

If all went well, you can now access your shop locally. In your browser go to: https://hypernode.local