Skip to content

(as Code) SandBox, (reproducible) local development environment

License

Notifications You must be signed in to change notification settings

theodore86/vagrantenv

Repository files navigation

Current Tag CircleCI Sandbox License: MIT

SandBox for Testing and Developing as a code

Provisioning of the sandbox using the Hashicorp Vagrant automation tool (IaC).

Fully managed and configured through Ansible roles.

What is Vagrant

Vagrant is an tool for building and managing virtual machine environments in an sigle workflow.

Provides easy to configure, reproducible and portable work environments built on top of industry-standard technology and controlled by an single consistent workflow to help maximize the productivity and flexibility.

Vagrant has a concept of providers which map to the virtualisation engine and its API. The most popular and well-supported provider is Virtualbox; plugins exist for libvirt, kvm, lxc, vmware and more

Features

  • Declarative approach through YAML configuration format.
  • Extensible through Vagrant plugins (host) and Ansible roles (guest).
  • Flexible networking setup:
    • NAT/PAT
    • Multiple network adapters
    • DNS setup
    • Host/Guest Time sync
    • System or Application proxy
  • Resizing of virtual disk(s) size, addition or removal of it/them.
  • Support of Linux & Windows host OS.
    • Support of MacOS with Intel processors only.

Requirements

Intel VT-x virtualization

Many PC laptops (especially those from Lenovo, HP and Dell) have Intel's VT-x virtualization turned off by default, which can cause issues with many Vagrant boxes. Enable VT-x in your system BIOS/UEFI settings.

Git

Install the Git command line tool.

  • On Linux OS/Mac OS X use your distribution package manager.
  • On Windows OS download and install Git.
    • Don't forget to include the Git BASH during installation.

Linux OS/Mac OS X

Use your distribution package manager and install the following mandatory packages:

Windows OS

  • Install (as Administrator) the Package Manager Chocolatey:

The following mandatory packages must be installed through Chocolatey:

There is no need to install the above packages manually, use the automated steps as described below.

In case of Windows 7 install the Powershell patch:

Vagrant Box

Base Box

Based on Ubuntu jammy/22.04 box from: HashiCorp's Vagrant Cloud

Hashicorp

  • vagrant
  • vault
  • terraform

Containerization

  • docker
  • docker-compose
  • kubectl
  • helm
  • helm-dashboard
  • kind
  • k9s
  • kubectx
  • kubens
  • kubeshell
  • kubeps1
  • kubecolor
  • kubeshark
  • kubetail

Network Protocol Analyzers

  • tshark (from source code)

Git

  • git-core
  • git-lfs
  • git-crypt

JVM

  • openjdk
  • groovy
  • maven
  • allure

Ruby

  • Gem
  • Bundle

GO

  • go
    • github.com/nektos/act
    • golang.org/x/lint/golint
    • github.com/rhysd/actionlint
    • github.com/mkouhei/gosh
    • golang.org/x/tools/gopls
    • github.com/go-delve/delve/cmd/dlv
    • honnef.co/go/tools/cmd/staticcheck

Python3

  • Python 3.10

VIM Plugins

  • Robot Framework
  • Jinja2
  • Jenkins

Linters

  • hadolint
  • golint

User Workspace Settings

  • .vimrc
  • .gitconfig
  • .bash_profile
  • .bash_aliases

Others

  • lynx
  • socat
  • sshpass
  • jq
  • yq
  • bridge-utils
  • x11-apps
  • xdg-utils
  • lsyncd

Accessing the Project Source Code

In order to clone the project source code you need:

  1. Request membership to vagrantenv project.

Windows Host Provisioning

Open Git BASH as Administrator:

git clone git@github.com:theodore86/vagrantenv.git
cd vagrantenv/tools/windows
cmd "/C provision.bat"
shutdown /r (Reboot Windows PC)

Linux Host Provisioning

Open your terminal:

git clone git@github.com:theodore86/vagrantenv.git
cd vagrantenv/tools/linux
bash provision.sh
sudo shutdown -r (Reboot your Linux PC)

Bringing Up the Virtual Machine

cd vagrantenv
export HTTP(S)_PROXY=x.x.x.x:8080 (if behind proxy)
vagrant up
vagrant ssh

Updating the Virtual Machine

cd vagrantenv
git pull
vagrant box update
vagrant up or reload
vagrant ssh

Retrieve Virtual Machine SSH config

vagrant ssh-config

Project Structure

vagrantenv
├── AUTHORS.md
├── bin (d)
├── CHANGELOG.md
├── CONTRIBUTING.md
├── Dockerfile
├── docs (d)
├── Gemfile
├── Gemfile.lock
├── lib (d)
├── LICENSE
├── mkdocs.yml
├── provisioners (d)
├── README.md
├── requirements.d (d)
├── tools (d)
├── tox.ini
├── Vagrantfile
└── vagrant.yaml
  • bin: Project executables
  • Dockerfile: File to build project CI docker containers
  • docs: Project documentation
  • lib: Vagrant ruby helper modules
  • provisioners: Vagrant (shell, ansible) provisioners
  • requirements.d: Python project dependencies
  • tools: Generic project tools
  • tox.ini: Test automation command line tool
  • vagrant.yaml: Vagrant central configuration file
  • Vagrantfile: Vagrant main ruby file

Documentation

For more details, generate and serve locally the project documentation:

tox -e docs -- --dev-addr 0.0.0.0:8000

In a Nuschell

Vagrant Workflow