Skip to content
Gaetan Craig-Riou edited this page Nov 14, 2025 · 14 revisions

Vagrant can be used for testing the provisioning and deployment processes locally. You will need a recent version of Vagrant installed, as well as Ansible. Vagrant also requires a VM provider, and ours is set up to work with Virtualbox.

Tested versions

Ansible Ubuntu Vagrant Virtualbox Dev OS comment
2.10.17 20 2.3.4 7.0.12 Debian 12 Install Virtualbox
2.15.13 24 2.4.9 7.1.14 Mint 21.3 (Based on Ubuntu 22.04) Install Virtualbox
2.7 ? 2.1.1 5.2.10 ?

Vagrant will create a virtual Ubuntu server on your local machine that behaves like a real server. You can then use it to test Ansible playbooks and general sysadmin operations in a dev environment.

Starting the Vagrant server

To create and start up your VM (virtual machine), use this command from inside your local ofn-install directory:

vagrant up

You can then run a full setup, provision, and deploy of the virtual server with this command:

ansible-playbook site.yml --limit vagrant

This operation can take about 20 minutes! If everything was successful, you can then see the site at http://localhost:8080/. Be aware that the installation of a TLS certificate is skipped here, you can only test https connections on a live server.

With the server set up, it will then behave like an OFN production server, so you can test operations like deploying a specific release version to the server with the deploy playbook:

ansible-playbook playbooks/deploy.yml --limit vagrant -e "git_version=v1.30.0"

In the above example we are deploying v1.30.0. See releases here: https://github.com/openfoodfoundation/openfoodnetwork/releases

Vagrant general usage

The following commands are useful for managing your virtual server with Vagrant:

# Shut down the VM:
vagrant halt

# Restart the VM:
vagrant reload

# Delete the VM:
vagrant destroy

You can also connect to the VM via SSH using the command: vagrant ssh.

Continue with the Administration of your application server.

Clone this wiki locally