Skip to content

Commit f6338a4

Browse files
committed
README.md: Reformatted to aid copy to clipboard
Modified command blocks to make it easier to use the copy to clipboard button in GitHub. E.g., by removing dollar sign prefixes and dividing them into smaller blocks. Also fixed some redundant whitespace and typos. Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
1 parent c29bfda commit f6338a4

1 file changed

Lines changed: 172 additions & 75 deletions

File tree

README.md

Lines changed: 172 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ https://www.vagrantup.com/docs/installation/
1717
Install guest additions plugin:
1818

1919
```
20-
$ vagrant plugin install vagrant-vbguest
20+
vagrant plugin install vagrant-vbguest
2121
```
2222

2323
It is also possible to use libvirt (KVM) instead of VirtualBox. Apart from the
@@ -26,7 +26,7 @@ installed too. It may either be provided as a package in your distribution or it
2626
can be installed by vagrant itself:
2727

2828
```
29-
$ vagrant plugin install vagrant-libvirt
29+
vagrant plugin install vagrant-libvirt
3030
```
3131

3232
Please see the [libvirt notes](#libvirt-notes) section for some more details and
@@ -54,15 +54,24 @@ If you use another path, you will have to update Vagrantfile and bash scripts.
5454
Something like this does the job:
5555

5656
```
57-
$ sudo mkdir -p /northern.tech/cfengine
58-
$ export NTECH_ROOT=/northern.tech
59-
$ cd $NTECH_ROOT/cfengine
60-
$ git clone git@github.com:cfengine/starter_pack.git
61-
# if your local username doesn't match your github username then provide it to clone.sh
62-
$ bash ./starter_pack/repos/clone.sh my_github_username
63-
# if they match, just use:
64-
$ bash ./starter_pack/repos/clone.sh
65-
$ cd starter_pack
57+
sudo mkdir -p /northern.tech/cfengine
58+
export NTECH_ROOT=/northern.tech
59+
cd $NTECH_ROOT/cfengine
60+
git clone git@github.com:cfengine/starter_pack.git
61+
```
62+
63+
If your local username doesn't match your github username then provide it to clone.sh
64+
65+
```
66+
bash ./starter_pack/repos/clone.sh my_github_username
67+
cd starter_pack
68+
```
69+
70+
If they match, just use:
71+
72+
```
73+
bash ./starter_pack/repos/clone.sh
74+
cd starter_pack
6675
```
6776

6877
**Note:** The `clone.sh` script clones all CFEngine repos into the current directory
@@ -103,7 +112,7 @@ The vagrant VMs use a custom base box where some dependencies are installed.
103112
To create this box locally, run:
104113

105114
```
106-
$ bash ./basebox/create.sh
115+
bash ./basebox/create.sh
107116
```
108117

109118
(vagrant required).
@@ -113,56 +122,102 @@ If you're not using vagrant, you can run/adapt that script on a build/developmen
113122
### Starting the development machine
114123

115124
```
116-
$ vagrant up dev
125+
vagrant up dev
117126
```
118127

119128
If you ever need a clean dev machine, log out and:
120129

121130
```
122-
$ vagrant destroy dev
123-
$ vagrant up dev
131+
vagrant destroy dev
132+
```
133+
134+
followed by:
135+
136+
```
137+
vagrant up dev
124138
```
125139

126140
This is great, because you don't have to be careful not to mess up your dev machine.
127141
You can always get a new one within a minute.
128142

129143
### Compiling CFEngine Community in the development machine
130144

145+
Login to dev machine:
146+
147+
```
148+
vagrant ssh dev
149+
```
150+
151+
Configure and compile CFEngine Core:
152+
153+
```
154+
cd /northern.tech/cfengine/core
155+
./autogen.sh --enable-debug
156+
make -j2
157+
```
158+
159+
Configure the Masterfiles Policy Framework:
160+
131161
```
132-
$ vagrant ssh dev
133-
$ cd /northern.tech/cfengine/core
134-
$ ./autogen.sh --enable-debug
135-
$ make -j2
136-
$ cd ../masterfiles
137-
$ ./autogen.sh --enable-debug
162+
cd ../masterfiles
163+
./autogen.sh --enable-debug
138164
```
139165

140166
### Installing CFEngine Community on a test machine
141167

142168
#### Hub
143169

170+
Bring up and login to the hub machine:
171+
172+
```
173+
vagrant up hub
174+
vagrant ssh hub
175+
```
176+
177+
Configure, compile and install CFEngine Core:
178+
144179
```
145-
$ vagrant up hub
146-
$ vagrant ssh hub
147-
$ cd /northern.tech/cfengine/core
148-
$ ./configure && make && sudo make -j2 install
149-
$ cd ../masterfiles
150-
$ ./configure && make && sudo make -j2 install
151-
$ sudo su -
152-
# /var/cfengine/bin/cf-key
153-
# /var/cfengine/bin/cf-agent --bootstrap 192.168.56.90
180+
cd /northern.tech/cfengine/core
181+
./configure && make && sudo make -j2 install
154182
```
155183

184+
Configure and install the Masterfiles Policy Framework:
185+
186+
```
187+
cd ../masterfiles
188+
./configure && make && sudo make -j2 install
189+
```
190+
191+
Generate keys and bootstrap to self (as root):
192+
193+
```
194+
sudo /var/cfengine/bin/cf-key
195+
sudo /var/cfengine/bin/cf-agent --bootstrap 192.168.56.90
196+
```
197+
198+
**Note:** You could use `localhost` as the IP, but this would prevent other hosts from bootstrapping to the hub.
199+
156200
#### Client
157201

202+
Bring up and login to the hub machine:
203+
158204
```
159-
$ vagrant up client
160-
$ vagrant ssh client
161-
$ cd /northern.tech/cfengine/core
162-
$ ./configure && make && sudo make -j2 install
163-
$ sudo su -
164-
# /var/cfengine/bin/cf-key
165-
# /var/cfengine/bin/cf-agent --bootstrap 192.168.56.90
205+
vagrant up client
206+
vagrant ssh client
207+
```
208+
209+
Configure, compile and install CFEngine Core:
210+
211+
```
212+
cd /northern.tech/cfengine/core
213+
./configure && make && sudo make -j2 install
214+
```
215+
216+
Generate keys and bootstrap to hub:
217+
218+
```
219+
sudo /var/cfengine/bin/cf-key
220+
sudo /var/cfengine/bin/cf-agent --bootstrap 192.168.56.90
166221
```
167222

168223
## build-remote on buildslave
@@ -176,27 +231,50 @@ Running `build-remote` from `dev` VM to `buildslave` VM is the easiest.
176231
If you haven't already, create the buildslave base box:
177232

178233
```
179-
$ bash ./buildslave/create.sh
234+
bash ./buildslave/create.sh
180235
```
181236

182237
This VM has some extra dependencies for performing buildslave tasks.
183-
You can now use build-remote from dev machine to build on buildslave:
238+
You can now use build-remote from dev machine to build on buildslave.
239+
240+
Bring up the build machine:
241+
242+
```
243+
vagrant up buildslave
244+
```
245+
246+
Bring up and login to the dev machine:
247+
248+
```
249+
vagrant up dev
250+
vagrant ssh dev
251+
```
252+
253+
Login to buildmachine from dev machine:
254+
255+
```
256+
ssh build@buildslave
257+
```
258+
259+
Answer yes to verify the authenticity of the host:
184260

185261
```
186-
$ vagrant up buildslave
187-
Bringing machine 'buildslave' up with 'virtualbox' provider...
188-
$ vagrant up dev
189-
Bringing machine 'dev' up with 'virtualbox' provider...
190-
$ vagrant ssh dev
191-
vagrant@dev ~ $ ssh build@buildslave
192262
The authenticity of host 'buildslave (192.168.56.100)' can't be established.
193263
ECDSA key fingerprint is SHA256:VoU/qb7Y7Pt1HYBw7ze1DXHF3E99hQvhBjoUjme9+3c.
194264
Are you sure you want to continue connecting (yes/no)? yes
195265
Warning: Permanently added 'buildslave,192.168.56.100' (ECDSA) to the list of known hosts.
196-
build@buildslave:~$ logout
197-
Connection to buildslave closed.
198-
vagrant@dev ~ $ bash /northern.tech/cfengine/buildscripts/build-remote -c x64-mingw --source /northern.tech/cfengine --verbose build@buildslave
199-
[...]
266+
```
267+
268+
Type logout or simply press `CTRL + D` to return to the dev machine:
269+
270+
```
271+
logout
272+
```
273+
274+
From the dev machine, execute the build-remote script:
275+
276+
```
277+
bash /northern.tech/cfengine/buildscripts/build-remote -c x64-mingw --source /northern.tech/cfengine --verbose build@buildslave
200278
```
201279

202280
This currently works for building dependencies as well as our binaries, but not packaging.
@@ -209,20 +287,29 @@ You can then install the package once, and as you make changes, upload the local
209287

210288
### Compiling core, enterprise and nova on the dev machine
211289

290+
Bring up and login to the dev machine:
291+
292+
```
293+
vagrant up dev
294+
vagrant ssh dev
295+
```
296+
212297
Using `cf-builder.py`:
213298

214299
```
215-
$ vagrant up dev
216-
$ vagrant ssh dev
217-
$ cd /northern.tech/cfengine/starter_pack
218-
$ python3 cf-builder.py --autogen --make --core --masterfiles --enterprise --nova
300+
cd /northern.tech/cfengine/starter_pack
301+
python3 cf-builder.py --autogen --make --core --masterfiles --enterprise --nova
219302
```
220303

221-
The individual steps:
304+
By running:
222305

223306
```
224-
$ python3 cf-builder.py --build-all --dry-run
307+
python3 cf-builder.py --build-all --dry-run
308+
```
225309

310+
the individual steps will be outputted:
311+
312+
```
226313
These commands would run if you didn't specify --dry-run:
227314
cd /northern.tech/cfengine && cd core && ./autogen.sh --enable-debug
228315
cd /northern.tech/cfengine && cd core && make -j2
@@ -234,23 +321,34 @@ cd /northern.tech/cfengine && cd nova && make -j2
234321

235322
(You can run the steps without using `cf-builder.py`, simplify the `cd` commands if you'd like)
236323

237-
### WIP! Installing CFEngine on hub machine
324+
### WIP! Installing CFEngine Enterprise on hub machine
238325

239326
In general, don't install on your dev machine, and don't run sudo commands on the dev machine.
240327
Everything you're doing there should work without sudo.
241328
Use the `hub` and `client` machines to install and bootstrap.
242329

243-
After compiling on `dev` machine, use `cf-builder.py` to install on `hub`:
330+
After compiling on `dev` machine, use `cf-builder.py` to install on `hub`.
331+
332+
Bring up and login to the hub machine:
333+
334+
```
335+
vagrant up hub
336+
vagrant ssh hub
337+
```
338+
339+
Install CFEngine Enterprise (as root):
244340

245341
```
246-
$ vagrant up hub
247-
$ vagrant ssh hub
248-
$ sudo su
249-
$ cd /northern.tech/cfengine/starter_pack
250-
$ python3 cf-builder.py --install --all-repos
251-
$ /var/cfengine/bin/cf-key
252-
$ bash scripts/initdb.sh
253-
$ /var/cfengine/bin/cf-agent --bootstrap 192.168.56.90
342+
cd /northern.tech/cfengine/starter_pack
343+
sudo python3 cf-builder.py --install --all-repos
344+
```
345+
346+
Generate keys, initialize the database and bootstrap to self (as root):
347+
348+
```
349+
sudo /var/cfengine/bin/cf-key
350+
sudo bash scripts/initdb.sh
351+
sudo /var/cfengine/bin/cf-agent --bootstrap 192.168.56.90
254352
```
255353

256354
### WIP! Running no-install reporting test
@@ -293,28 +391,27 @@ rsync -avz ~/CFEngine/documentation-generator /northern.tech/cfengine/
293391
294392
cd /northern.tech/cfengine/core
295393
git checkout master
296-
git pull --rebase upstream master
394+
git pull --rebase upstream master
297395
298396
cd /northern.tech/cfengine/mission-portal
299397
git checkout master
300-
git pull --rebase upstream master
398+
git pull --rebase upstream master
301399
302400
cd /northern.tech/cfengine/nova
303401
git checkout master
304-
git pull --rebase upstream master
402+
git pull --rebase upstream master
305403
306404
cd /northern.tech/cfengine/masterfiles
307405
git checkout master
308-
git pull --rebase upstream master
406+
git pull --rebase upstream master
309407
310408
cd /northern.tech/cfengine/enterprise
311409
git checkout master
312-
git pull --rebase upstream master
410+
git pull --rebase upstream master
313411
314412
cd /northern.tech/cfengine/nova
315413
git checkout master
316-
git pull --rebase upstream master
317-
414+
git pull --rebase upstream master
318415
319416
cd ~/CFEngine/starter_pack
320417
vagrant rsync docbuildslave
@@ -371,10 +468,10 @@ vagrant-libvirt doesn't support the mechanisms for sharing folders between VMs
371468
and the host system. So it either uses _rsync_ to sync the folders (that's why
372469
we have some extra rsync options in the `Vagrantfile`) or sets up NFS to share
373470
the folders. However, it quite often fails to set NFS up properly, so it may be
374-
necesary to enforce rsync syncing. This can be done by adding `type: "rsync"` to
471+
necessary to enforce rsync syncing. This can be done by adding `type: "rsync"` to
375472
the `synced_folder` lines. So something like this:
376473

377474
```
378-
- config.vm.synced_folder ".", "/vagrant",
379-
+ config.vm.synced_folder ".", "/vagrant", type: "rsync",
475+
- config.vm.synced_folder ".", "/vagrant",
476+
+ config.vm.synced_folder ".", "/vagrant", type: "rsync",
380477
```

0 commit comments

Comments
 (0)