Skip to content

Commit 520c2d2

Browse files
authored
Merge pull request alphagov#235 from alphagov/update-setup-documentation
Update setup and virtual environment documentation
2 parents e25894e + f607296 commit 520c2d2

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

README.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,21 @@
44
and systems administration tasks. It allows the user to run commands across a
55
server farm.
66

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
821

9-
This is intended to be setup and run on your local workstation/laptop.
1022

1123
### Setup
1224

@@ -42,22 +54,22 @@ And execute against an environment and set of hosts like so:
4254

4355
Fabric tasks can be run on groups of machines in a variety of different ways.
4456

45-
by puppet class
57+
By puppet class:
4658

4759
# target all machines that have the 'govuk::safe_to_reboot::yes' class
4860
$ fab integration puppet_class:govuk::safe_to_reboot::yes do:'uname -a'
4961

50-
by numeric machine suffix
62+
By numeric machine suffix:
5163

5264
# target all machines that end in '2'
5365
$ fab integration numbered:2 do:'uname -a'
5466

55-
by node type (as defined in puppet)
67+
By node type (as defined in puppet):
5668

5769
# target all 'frontend' machines
5870
$ fab integration node_type:frontend do:'uname -a'
5971

60-
by the node name
72+
By the node name:
6173

6274
# target just one node
6375
$ 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
7789

7890
## Syncing postgres machines
7991

80-
An example
92+
An example:
8193

8294
`fab <env> -H '<src_db>' postgresql.sync:<db_name>,<dst_db> -A`
8395

8496
the -A must be specified to forward the agent
8597

8698
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

Comments
 (0)