This document describes the recommended setup for Crowbar front-end development (eg. CSS, SASS, HAML, HTML, Rails).
For designers and (especially front-end) developers to have a productive workflow, it is critical to be able to work directly from a Git checkout and have, as much as possible, the exact same UI/UX as the actual product (and upstream).
The challenge is that Crowbar is a complex product with many moving parts and dependencies. The code is not structured or designed to run out of a Git checkout. Many improvements have been made to simplify the running of the Crowbar web UI from a Git checkout, but for a fully functional system (which one needs to see and test all the UI and interactions), there is still a quite some work.
In the following section we will describe in detail, the requirements of this development setup and how it is configured.
We have the following two flavors of the Crowbar Web UI running so we can easily compare the differences:
- Regular SUSE OpenStack Cloud install. Runs on standard http port
(http://HOSTNAME) and from the
/opt/delldirectory. - From Git upstream branding. Runs on [port 5000]
(http://HOSTNAME:5000) and from the
/opt/crowbardirectory.
All are using the same default username and password, both crowbar. The
following sections will describe in detail how each of these are setup and
configured.
Before we can start you need to match some prerequirements on your host machine.
-
Please create this script somewhere in your path, it's just a wrapper around our mkcloud script that will be mentioned later on again. We place it in general at /usr/local/bin/mkcloud7
#!/usr/bin/env bash export cloudsource=develcloud7 export nodenumber=2 export user_keyfile=~${SUDO_USER}/.ssh/id_rsa.pub /usr/local/bin/mkcloud $@
-
At first you need a running mkcloud setup. For more information about this read the mkcloud documentation. Please use the wrapper script created above to install Crowbar, e.g.
sudo mkcloud7 plain devsetup. thedevsetupstep formkcloudis necessary to install the dependencies -
You need some ruby environment on your workstation in order to execute some rake tasks, so please install
rubyandbundlerfirst. -
You need to clone all repositories from GitHub. There are rake tasks for cloning, forking and updating all required repositories. Make sure to get all the dependencies with
bundle installand userake -Tto get an overview about the rake tasks. For theraketasks talk to the GitHub API you need to have a~/.netrcfile which looks like:machine api.github.com login <GITHUB USERNAME> password <API TOKEN>The GitHub API Token can be obtained from your GitHub settings in the Browser.
rake crowbar:initwill fork, clone and add the required remotes to the required repositories defined within our configuration within barclamps/rake crowbar:updatewill update the clones, this should be performed from time to time to get the latest changes into your cloned repositories.
-
Now run Guard to sync your local git repos with the server, please place this script in
/usr/local/bin/crowbar_guard#!/bin/bash cloud=$1 target_folder=$2 guard_sync_port=$3 if [[ -z $1 ]] || [[ -z $2 ]] || [[ -z $3 ]] then echo "usage ./crowbar_guard cloudname targetfolder sshport" echo " example: ./crowbar_guard crowbarc1 /opt/crowbar 22" exit 1 fi export GUARD_SYNC_PORT=$guard_sync_port export GUARD_SYNC_HOST=$cloud export GUARD_TREE_TARGET=$target_folder export GUARD_SCRIPT_TARGET=$target_folder/bin bundle exec guard --no-notify
and run it in a seperate terminal window as this process will stay in the foreground.
NOTE: you have to run the script from the
crowbar/crowbargit clone where theGuardfileis located -
Now place the following script in
/usr/local/bin/crowbar_rails
```bash
#!/bin/bash
cloud=$1
port=$2
targetdir=$3
if [[ -z $1 ]] || [[ -z $2 ]] || [[ -z $3 ]]
then
echo "usage ./crowbar_rails cloudname targetdir"
echo " example: ./crowbar_rails crowbarc1 5000 /opt/crowbar"
exit 1
fi
ssh -t root@${cloud} "$targetdir/crowbar_framework/bin/rails s -b 0.0.0.0 -p $port"
```
and run it in a seperate terminal window as this process will stay in the foreground.
- Now you can access you crowbar development setup via
http://your.crowbar.instance:5000
If you want to debug some specific piece of code you can use byebug which is
also mentioned in the Gemfile
To set it up you have to make sure byebug is installed
which byebugif it is not installed yet you can find the package in the sdk repository:
zypper ar -f http://dist.suse.de/install/SLP/SLE-12-SP2-SDK-LATEST/x86_64/DVD1/ sle12-sp2-sdk
zypper -n install ruby2.1-rubygem-byebugThen you just have to add a byebug at the line of code that you want the
debugger to stop, and run the action that leads you to this codepath.
byebug works similar to gdb, for a reference of available commands see
https://github.com/deivid-rodriguez/byebug#byebugs-commands
43: def index
44: byebug
=> 45: @sum = 0
46: @groups = {}
47: session[:node] = params[:name]
48: if params.key?(:role)
49: result = NodeObject.all
(byebug)