Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.
/ rockstor-dev-env Public archive

Community contribution: Vagrant & Ansible based dev env. See Website for official docs.

License

Notifications You must be signed in to change notification settings

rockstor/rockstor-dev-env

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rockstor Development Environment

Introduction

You can use this vagrant environment to build a vagrant box VM of a confirmed working specification with rockstor installed from source for testing.

It will use the ansible playbook and roles in this repository to perform the VM provisioning. However, Vagrant generates it's own host inventory since it operates using the vagrant user. eg.

ANSIBLE_GROUPS = {
  "all_groups" => ["rockstor"],
  "all_groups:vars" => {
        "rs_inst_set_root_pass" => "true"
    }
}

Prerequisites

It is assumped that you have the follow software packages install on you host machine:

All above packages are available on Linux, MacOS, and Windows.

You will also need one of the following virtualisation platforms:

  • Linux users: may prefer to use libvirt, qemu + kvm (see vagrant-libvirt)
  • Virtualbox is available on all platforms: Download

It is also assumed that you have a local copy of the core repository rockstor-core on your machine at the same level as this repo:

./rockstor-core
./rockstor-dev-env

You should also be currently within the vagrant_env directory in this repo, where the Vagrantfile is located.

Vagrant Boxes

This Vagrantfile uses a number of vagrant boxen:

Building an OpenSUSE Leap VM and installing Rockstor from source

On MacOS, Linux and Windows:

./build.sh

This will, by default, build and provision an OpenSUSE Leap 15.2 vagrant box in libvirt - including rsyncing the source to the VM in /root. It will then build and install Rockstor from source.

Should you prefer to use VirtualBox you can perform the following:

./build.sh leap virtualbox

The VM window should have popped up and show the usual Rockstor messages regarding how to reach the Web UI. e.g.

Rockstor is successfully installed.

web-ui is accessible with the following links:
https://127.0.0.1
https://10.0.2.15
https://172.28.128.101
https://172.28.128.100
rockstor login:

Note: your IPs may vary.

CAUTION: This command will ALWAYS do a clean build due to the nature of the vagrant rsync which uses the rsync option --delete.

To do subsequent builds see the Aliases section that follows on how to login as root and run further operations.

Accessing Rockstor on the VMs

Port forwarding is used to provide local access to the Rockstor Web UI. To allow you to have Rockstor built and running in each platform side by side port the ports are assigned as follows:

VM Name Host Port Guest Port Example URL
rockstor-leap 2443 443 https://172.28.128.101:2443
rockstor-tw 2444 443 https://172.28.128.101:2444
rockstor-pi 2445 443 https://172.28.128.101:2445

Aliases

Some aliases are defined in the file alias_rc to assist with some commands detailed in the developer contribution docs.

These are appended onto the file /root/.bashrc so that they are available when logged in as the root user.

Typically in the world of vagrant you login as the user vagrant and use sudo for privilege escalation. However, for ease in this case and in line with the instructions you can also log in as root in one of the following ways:

host> vagrant ssh
vm> su root
password: vagrant
vm> cd

or

host> ssh root@<vm IP>
password: vagrant

If you have set the ansible option rs_inst_set_root_pass: yes then the root password will be defined in ansible/roles/rockstor_installer/defaults/main.yml and defaults to password.

From here the aliases can be used. Here is a summary of them:

build_init
build_all
build_ui
make_mig_stadm
apply_migrations_stadm
make_mig_smtmgr
apply_migrations_smtmgr

See alias_rc for details

Deploy from Testing Channel

If you wish to deploy a VM from the Test Channel RPMs (rather than building from source) you need to update the ansible playbook ansible/Rockstor.yml to set the variable rs_inst_install_from_repo: yes as follows:

  roles:
    - role: rockstor_installer
      vars:
        rs_inst_install_from_repo: yes

Then simply bring up the VM using the command:

vagrant up

Do NOT run build.sh in this scenario.

Building for Tumbleweed and Aarch64

To build for Tumbleweed x86_64 in libvirt:

./build.sh tw

or for VirtualBox:

./build.sh tw virtualbox

To build for Tumbleweed Aarch64 in libvirt:

NOTE: Work in progress... only works on libvirt see vagrant libvirt plugin:

./build.sh pi

Managing the Virtual Machine

To manage the Vagrant box VM simply type the following from this directory...

  • Enable disk management to allow creation of data disks requires the enablement of the experimental disk feature. You can set these for the current shell, or enable them permanently by setting them in ~/.profile, ~/.bashrc, or likewise:

    export VAGRANT_EXPERIMENTAL="disks"
    export VAGRANT_DEFAULT_PROVIDER=kvm

    Note: This is enabled in build.sh but needs external enablement if you wish to use discrete vagrant calls below.

  • Bring up all vagrant box VMs in libvirt

    vagrant up --provider=libvirt

    or for VirtualBox

    vagrant up --provider=virtualbox

    Note: You can NOT manage boxes in both libvirt and VirtualBox at the same time.

  • Bring up a particular vagrant box VM

    vagrant up <box-name eg. rockstor-core> --provider=libvirt
  • Reconfigure the vagrant box VM following a change to the Vagrantfile:

    vagrant reload

    or

    vagrant reload <box-name eg. rockstor-core>
  • If you change the provisioner section of the Vagrantfile or update the ansible, you can rerun just that part as follows:

    vagrant provision

    or

    vagrant provision <box-name eg. rockstor-core>
  • Destroy the vagrant box VM:

    vagrant destroy

    or

    vagrant destroy <box-name eg. rockstor-core>
  • If you wish to ssh into the vagrant box VM to poke around, try this:

    vagrant ssh

    or

    vagrant ssh <box-name eg. rockstor-core>
  • If you wish to re-rsync your source files (warning this will have the effect of cleaning the build too due to using the --delete options):

    vagrant rsync

    or

    vagrant rsync <box-name eg. rockstor-core>

Debugging Ansible

If you need additional debug for the ansible configuration add additional v's to the ansible.verbose variable in the Vagrantfile. eg.

    config.vm.provision "rockstor", type: "ansible" do |ansible|
        ansible.config_file = "../ansible/ansible.cfg"
        ansible.playbook = "../ansible/Rockstor.yml"
        ansible.verbose = "vvvv"
        ansible.groups = ANSIBLE_GROUPS

About

Community contribution: Vagrant & Ansible based dev env. See Website for official docs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages