4
4
and systems administration tasks. It allows the user to run commands across a
5
5
server farm.
6
6
7
- ## Local usage
7
+ ## Local usage and environment setup
8
+
9
+ The tool is intended to be configured and run on your local workstation/laptop. You should use ` virtualenv ` to create an isolated Python environment.
10
+
11
+ To install ` pip ` , ` virualenv ` and set up the environment:
12
+
13
+ $ sudo easy_install pip
14
+ $ sudo pip install virtualenv
15
+ $ mkdir ~/venv
16
+ $ virtualenv ~/venv/fabric-scripts
17
+
18
+ To enable the virtual environment for this session (you will need to do this for each new terminal window):
19
+
20
+ $ . ~/venv/fabric-scripts/bin/activate
8
21
9
- This is intended to be setup and run on your local workstation/laptop.
10
22
11
23
### Setup
12
24
@@ -42,22 +54,22 @@ And execute against an environment and set of hosts like so:
42
54
43
55
Fabric tasks can be run on groups of machines in a variety of different ways.
44
56
45
- by puppet class
57
+ By puppet class:
46
58
47
59
# target all machines that have the 'govuk::safe_to_reboot::yes' class
48
60
$ fab integration puppet_class:govuk::safe_to_reboot::yes do:'uname -a'
49
61
50
- by numeric machine suffix
62
+ By numeric machine suffix:
51
63
52
64
# target all machines that end in '2'
53
65
$ fab integration numbered:2 do:'uname -a'
54
66
55
- by node type (as defined in puppet)
67
+ By node type (as defined in puppet):
56
68
57
69
# target all 'frontend' machines
58
70
$ fab integration node_type:frontend do:'uname -a'
59
71
60
- by the node name
72
+ By the node name:
61
73
62
74
# target just one node
63
75
$ fab production -H backend-3.backend do:'uname -a'
@@ -77,12 +89,11 @@ and ensure that you do not have the following option anywhere in your
77
89
78
90
## Syncing postgres machines
79
91
80
- An example
92
+ An example:
81
93
82
94
` fab <env> -H '<src_db>' postgresql.sync:<db_name>,<dst_db> -A `
83
95
84
96
the -A must be specified to forward the agent
85
97
86
98
This will sync the specified database ` <db_name> ` from the machine with the
87
- hostname of ` <src_db> ` to the machine with hostaname ` <dst_db> ` . It will destroy
88
- data on the destination db
99
+ hostname of ` <src_db> ` to the machine with hostaname ` <dst_db> ` . It will destroy data on the destination db.
0 commit comments