|
1 | | -# BOSH Release for postgres |
| 1 | +# PostgreSQL, BOSH-Style |
2 | 2 |
|
3 | | -## Usage |
| 3 | +This BOSH release packages up PostgreSQL so that you can deploy it |
| 4 | +on BOSH. It supports standalone, clustered, and HA |
| 5 | +configurations. |
4 | 6 |
|
5 | | -To use this bosh release, first upload it to your bosh: |
| 7 | +# Supported Topologies |
6 | 8 |
|
7 | | -``` |
8 | | -bosh target BOSH_HOST |
9 | | -git clone https://github.com/cloudfoundry-community/postgres-boshrelease.git |
10 | | -cd postgres-boshrelease |
11 | | -bosh upload release releases/postgres-1.yml |
12 | | -``` |
| 9 | +## Standalone Configuration |
13 | 10 |
|
14 | | -For [bosh-lite](https://github.com/cloudfoundry/bosh-lite), you can quickly create a deployment manifest & deploy a cluster: |
| 11 | +For a single, standalone PostgreSQL node, you only need the |
| 12 | +`postgres` job: |
15 | 13 |
|
16 | 14 | ``` |
17 | | -templates/make_manifest warden |
18 | | -bosh -n deploy |
| 15 | +instance_groups: |
| 16 | + - name: db |
| 17 | + jobs: |
| 18 | + - name: postgres |
| 19 | + release: postgres |
19 | 20 | ``` |
20 | 21 |
|
21 | | -For AWS EC2, create a single VM: |
| 22 | +## Clustered Configuration |
| 23 | + |
| 24 | +To enable replication, deploy multiple nodes and set the |
| 25 | +`postgres.replication.enabled` property to "yes": |
22 | 26 |
|
23 | 27 | ``` |
24 | | -templates/make_manifest aws-ec2 |
25 | | -bosh -n deploy |
| 28 | +instance_groups: |
| 29 | + - name: db |
| 30 | + instances: 4 |
| 31 | + jobs: |
| 32 | + - name: postgres |
| 33 | + release: postgres |
| 34 | + properties: |
| 35 | + replication: |
| 36 | + enabled: true |
26 | 37 | ``` |
27 | 38 |
|
28 | | -### Override security groups |
29 | | - |
30 | | -For AWS & Openstack, the default deployment assumes there is a `default` security group. If you wish to use a different security group(s) then you can pass in additional configuration when running `make_manifest` above. |
| 39 | +In replicated mode, the bootstrap VM will assume the role of |
| 40 | +master, and the remaining nodes will replicate from it, forming a |
| 41 | +star topology. No special query routing is done in this |
| 42 | +configuration; applications that wish to make use of read replicas |
| 43 | +must do so explicitly. |
31 | 44 |
|
32 | | -Create a file `my-networking.yml`: |
| 45 | +Promotion of a replica is left to the operator. |
33 | 46 |
|
34 | | -``` yaml |
35 | | ---- |
36 | | -networks: |
37 | | - - name: postgres1 |
38 | | - type: dynamic |
39 | | - cloud_properties: |
40 | | - security_groups: |
41 | | - - postgres |
42 | | -``` |
43 | | -
|
44 | | -Where `- postgres` means you wish to use an existing security group called `postgres`. |
| 47 | +## HA Configuration |
45 | 48 |
|
46 | | -You now suffix this file path to the `make_manifest` command: |
| 49 | +For a highly-available, single-IP pair of PostgreSQL nodes, the |
| 50 | +`vip` job can be added. Note that you *must* deploy exactly two |
| 51 | +instances, or HA won't work. Replication must also be enabled. |
47 | 52 |
|
48 | 53 | ``` |
49 | | -templates/make_manifest openstack-nova my-networking.yml |
50 | | -bosh -n deploy |
| 54 | +instance_groups: |
| 55 | + - name: db |
| 56 | + jobs: |
| 57 | + - name: postgres |
| 58 | + release: postgres |
| 59 | + properties: |
| 60 | + replication: |
| 61 | + enabled: true # don't forget this! |
| 62 | +
|
| 63 | + - name: vip |
| 64 | + release: postgres |
| 65 | + properties: |
| 66 | + vip: 10.3.4.5 |
51 | 67 | ``` |
52 | 68 |
|
53 | | -## High Availability |
54 | | - |
55 | 69 | HA is implemented with automatic failover, if you set |
56 | 70 | `postgres.replication.enabled` to true. |
57 | 71 |
|
@@ -133,6 +147,6 @@ The following parameters affect high availability: |
133 | 147 |
|
134 | 148 | - `vip.readonly_port` - Which port to access the read-only node |
135 | 149 | of the cluster. Defaults to `7542`. |
136 | | - |
| 150 | + |
137 | 151 | - `vip.vip` - Which IP to use as a VIP that is traded between the |
138 | | - two nodes. |
| 152 | + two nodes. |
0 commit comments