Skip to content

A Ruby on Rails application for managing virtual machines via VMware vSphere

License

Notifications You must be signed in to change notification settings

hpi-swt2/vm-portal

Repository files navigation

VM-Portal

This Ruby on Rails application enables managing of virtual machines via VMware vSphere. License

Branch Travis CI Coverage CodeClimate Codefactor Codebeat
master Build Status Coverage Status --- CodeFactor codebeat badge
dev Build Status Coverage Status Maintainability CodeFactor codebeat badge

Deployment

The application requires access to internal resources, which are not directly available from the general internet. Therefore, the application is deployed on university servers.

An overview of the status of all involved systems is available here: https://stats.uptimerobot.com/j8DADFQnv

Deployment Error Collection

Errors that occur in the deployed systems are reported to a central Errbit error collection application. It can be found here:

You can login using your GitHub credentials.

Deployment Details

Automatic deployments are handled by a dedicated application:

The application shows an overview of the latest deployment attempts and handles deployment (via mina) to the university internal systems when it receives a POST request. These requests are send by Travis CI after a successful build, see the .travis.yml.

Development Setup

Note: Please be aware that the application is designed to manage internal university resources. These are only available from the internal network. Therefore, currently a VPN connection to the university network is required for those parts of the application that interact with internal resources.

Local

  • bundle install --without production Install the required Ruby gem dependencies defined in the Gemfile, skipping gems used for production (like pg)
  • Check config/database.yml for the correct database config (for development we recommend SQLite)
  • rails db:migrate db:seed Setup database, run migrations, seed the database with defaults
  • rails s Start the Rails development server (By default runs on localhost:3000)
  • bundle exec rspec Run all the tests (using the RSpec test framework)

Using Vagrant (Virtual Machine)

If you want to use a VM to setup the project (e.g. when on Windows), we recommend Vagrant in combination with Virtualbox. The Vagrantfile in the project root contains the needed configuration. If you have trouble starting the VM, try changing the parameters to adapt to your hardware. Please keep in mind that this method may lead to a loss in performance, due to the added abstraction layer.

Start VM

  • vagrant up Download and start the VM
  • vagrant ssh Login using SSH

Inside the VM

  • cd hpi-swt2
  • bundle install --without production Update dependencies
  • rails db:migrate db:seed Run migrations, update database
  • rails s -b 0 Start the rails server, the -b part is necessary since the app is running in a VM and would otherwise drop the requests coming from the host OS
  • exit Exit SSH session

Stop VM

  • vagrant halt Shuts down the VM
  • vagrant global-status Shows status of all Vagrant VMs

Developer Guide

Setup

  • bundle exec rails db:migrate RAILS_ENV=development && bundle exec rails db:migrate RAILS_ENV=test Migrate both test and development databases
  • bundle exec rails assets:clobber && bundle exec rails assets:precompile Redo asset generation

Testing

  • To run the full test suite: bundle exec rspec.
  • For fancier test running use option -f doc
  • bundle exec rspec spec/<rest_of_file_path>.rb Specify a folder or test file to run
  • specify what tests to run dynamically by -e 'search keyword in test name'
  • bundle exec rspec --profile examine how much time individual tests take

Linting

  • RuboCop is a Ruby static code analyzer and formatter, based on the community Ruby style guide
  • It is installed in the project. Run bundle exec rubocop to find possible issues.
  • Use --auto-correct to fix what can be fixed automatically.
  • The behavior of RuboCop can be controlled via a .rubocop.yml configuration file

Debugging

  • rails c --sandbox Test out some code in the Rails console without changing any data rails dbconsole Starts the CLI of the database you're using
  • bundle exec rails routes Show all the routes (and their names) of the application
  • bundle exec rails about Show stats on current Rails installation, including version numbers

Generating

  • rails g migration DoSomething Create migration _db/migrate/*DoSomething.rb.

About

A Ruby on Rails application for managing virtual machines via VMware vSphere

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published