Skip to content

Commit 5fa8e7b

Browse files
Merge pull request crowbar#2278 from MaximilianMeister/docs
update development environment documentation
2 parents 6e8e02b + f69e82b commit 5fa8e7b

File tree

1 file changed

+54
-48
lines changed

1 file changed

+54
-48
lines changed

doc/development.md

+54-48
Original file line numberDiff line numberDiff line change
@@ -40,43 +40,22 @@ Before we can start you need to match some prerequirements on your host machine.
4040

4141
1. Please create this script somewhere in your path, it's just a wrapper
4242
around our mkcloud script that will be mentioned later on again. We place
43-
it in general at /usr/local/bin/mkcloud6
43+
it in general at /usr/local/bin/mkcloud7
4444

4545
```bash
4646
#!/usr/bin/env bash
4747

48-
export pre_do_installcrowbar=$(base64 --wrap=0 <<'EOS'
49-
zypper ar -f http://dist.suse.de/install/SLP/SLE-12-SP1-SDK-LATEST/x86_64/DVD1/ sle12-sp1-sdk
50-
zypper -n in -l gcc ruby2.1-devel sqlite3-devel libxml2-devel;
51-
52-
mkdir -p /opt/crowbar/crowbar_framework/db /opt/crowbar/barclamps;
53-
54-
ln -sf /opt/dell/crowbar_framework/db/production.sqlite3 /opt/crowbar/crowbar_framework/db/development.sqlite3;
55-
EOS
56-
)
57-
58-
export SHAREDVG=1
59-
export TESTHEAD=1
60-
export cloudsource=develcloud6
61-
export virtualcloud=l6
62-
export cloud=cloud6
63-
export net_fixed=192.168.116
64-
export net_public=192.168.96
65-
export net_admin=192.168.106
66-
export cephvolumenumber=0
48+
export cloudsource=develcloud7
6749
export nodenumber=2
68-
export vcpus=4
69-
export cloudvg=system
7050
export user_keyfile=~${SUDO_USER}/.ssh/id_rsa.pub
71-
export adminvcpus=2
72-
export want_sles12=1
7351

7452
/usr/local/bin/mkcloud $@
7553
```
7654

7755
2. At first you need a running mkcloud setup. For more information about this
7856
read the [mkcloud](https://git.io/vYO2E) documentation. Please use the
79-
wrapper script created above to install Crowbar, e.g. `sudo mkcloud6 plain`.
57+
wrapper script created above to install Crowbar, e.g. `sudo mkcloud7 plain devsetup`.
58+
the ```devsetup``` step for ```mkcloud``` is necessary to install the dependencies
8059

8160
3. You need some ruby environment on you workstation in order to execute some
8261
rake tasks, so please install ```ruby``` and ```bundler``` first.
@@ -85,44 +64,71 @@ Before we can start you need to match some prerequirements on your host machine.
8564
cloning, forking and updating all required repositories. Make sure to get
8665
all the dependencies with ```bundle install``` and use ```rake -T``` to get
8766
an overview about the rake tasks.
67+
For the ```rake``` tasks talk to the GitHub API you need to have a ```~/.netrc``` file
68+
which looks like:
69+
70+
```
71+
machine api.github.com
72+
login <GITHUB USERNAME>
73+
password <API TOKEN>
74+
```
75+
76+
The GitHub API Token can be obtained from your GitHub settings in the Browser.
8877

8978
1. ```rake crowbar:init``` will fork, clone and add the required remotes to the
9079
required repositories defined within our [configuration](../config/barclamps.yml)
9180
within [barclamps/](../barclamps/)
9281
2. ```rake crowbar:update``` will update the clones, this should be performed from time
9382
to time to get the latest changes into your cloned repositories.
9483

95-
5. Now run Guard to sync your local git repos with the server, please execute
96-
```GUARD_SYNC_HOST=192.168.106.10 bundle exec guard``` in a seperate
97-
terminal window as this process will stay in the foreground.
84+
5. Now run Guard to sync your local git repos with the server, please place this script in
85+
`/usr/local/bin/crowbar_guard`
9886

99-
6. Now ssh to the admin node and follow the steps below:
87+
```bash
88+
#!/bin/bash
10089
101-
1. Change to ```/opt/crowbar/crowbar_framework```.
90+
cloud=$1
91+
target_folder=$2
92+
guard_sync_port=$3
93+
94+
if [[ -z $1 ]] || [[ -z $2 ]] || [[ -z $3 ]]
95+
then
96+
echo "usage ./crowbar_guard cloudname targetfolder sshport"
97+
echo " example: ./crowbar_guard crowbarc1 /opt/crowbar 22"
98+
exit 1
99+
fi
100+
101+
export GUARD_SYNC_PORT=$guard_sync_port
102+
export GUARD_SYNC_HOST=$cloud
103+
export GUARD_TREE_TARGET=$target_folder
104+
export GUARD_SCRIPT_TARGET=$target_folder/bin
105+
106+
bundle exec guard --no-notify
107+
```
102108

103-
2. Set a dedicated GEM_HOME for the dev environment to avoid clobbering the
104-
admin node's system gems:
109+
and run it in a seperate terminal window as this process will stay in the foreground.
105110

106-
```
107-
export GEM_HOME=/tmp/crowbar-dev-gems
108-
```
111+
**NOTE**: you have to run the script **from the `crowbar/crowbar` git clone** where the `Guardfile` is located
109112

110-
You will need to ensure this environment variable is set each time
111-
you run the Rails server (step 5). You can also omit this step entirely,
112-
but without it the development environment is likely to break the admin
113-
node's regular crowbar setup. Likewise, you need to make sure that
114-
`GEM_HOME` is unset if you wish to use your system's regular gems again.
113+
6. Now place the following script in `/usr/local/bin/crowbar_rails`
115114

116-
3. Run ```bundle install```
115+
```bash
116+
#!/bin/bash
117117
118-
4. Install all barclamps with this snippet
118+
cloud=$1
119+
port=$2
120+
targetdir=$3
119121
120-
```bash
121-
COMPONENTS=$(find /opt/crowbar/barclamps -mindepth 1 -maxdepth 1 -type d)
122-
CROWBAR_DIR=/opt/crowbar RAILS_ENV=development bundle exec /opt/crowbar/bin/barclamp_install.rb $COMPONENTS
123-
```
122+
if [[ -z $1 ]] || [[ -z $2 ]] || [[ -z $3 ]]
123+
then
124+
echo "usage ./crowbar_rails cloudname targetdir"
125+
echo " example: ./crowbar_rails crowbarc1 5000 /opt/crowbar"
126+
exit 1
127+
fi
124128
125-
5. Run the Rails server ```bundle exec bin/rails s -b 0.0.0.0 -p 5000```
129+
ssh -t root@${cloud} "$targetdir/crowbar_framework/bin/rails s -b 0.0.0.0 -p $port"
130+
```
126131

132+
and run it in a seperate terminal window as this process will stay in the foreground.
127133

128-
7. Now you can access you crowbar development setup via ```http://192.168.106.10:5000```
134+
7. Now you can access you crowbar development setup via ```http://your.crowbar.instance:5000```

0 commit comments

Comments
 (0)