1
1
= PostgreSQL Operator Build and Setup
2
2
v1.3.2, {docdate}
3
3
4
+ == Table of Contents
5
+
6
+ * <<Overview>>
7
+ * <<Requirements>>
8
+ * <<Kubernetes Environment>>
9
+ * <<Openshift Origin Environment>>
10
+ * <<Create Project and Clone>>
11
+ * <<Get Packaged Dependencies>>
12
+ * <<Build from Source>>
13
+ ** <<Compiling the PostgreSQL Operator>>
14
+ ** <<Build the Docker Images>>
15
+ ** <<Deploy the PostgreSQL Operator>>
16
+ ** <<Configuration>>
17
+ ** <<Viewing Operator Resources>>
18
+ * <<Performing a Smoke Test>>
19
+
20
+ [#Overview]
4
21
== Overview
5
22
6
23
This document describes how to build from source code the
@@ -10,13 +27,18 @@ from source, you can download them from the following:
10
27
* Dockerhub (crunchydata/lspvc and crunchydata/postgres-operator images)
11
28
* link:https://github.com/CrunchyData/postgres-operator/releases[Github Releases] (pgo client and client configuration files, extracted to your $HOME)
12
29
30
+ Further details can be found in the link:design.asciidoc[PostgreSQL Operator Design] document on
31
+ how the operator is built and how it operates.
32
+
33
+ [#Requirements]
13
34
== Requirements
14
35
15
36
* Kubernetes 1.5.3+
16
37
* Openshift Origin 1.5.1+ and Openshift Container Platform 3.5
17
38
* link:https://hub.docker.com/r/crunchydata/crunchy-postgres/[PostgreSQL 9.5+ Container]
18
39
* link:https://hub.docker.com/r/crunchydata/crunchy-backup/[PostgreSQL Backup Container]
19
40
41
+ [#Kubernetes Environment]
20
42
== Kubernetes Environment
21
43
22
44
To test the *postgres-operator* you will need a Kubernetes cluster
@@ -32,7 +54,7 @@ the permissions:
32
54
sudo chmod +r /etc/kubernetes/admin.conf
33
55
....
34
56
35
- Once you have your Kube VM created, install some of the
57
+ Once you have your Kube VM created, install some of the
36
58
required dependencies:
37
59
....
38
60
yum -y install git
@@ -58,12 +80,13 @@ details on how to enable RBAC roles.
58
80
59
81
To test the *postgres-operator* you will need a Kubernetes cluster
60
82
83
+ [#Openshift Origin Environment]
61
84
== Openshift Origin Environment
62
85
63
86
The postgres operator has been tested using Openshift Origin 1.5.1.
64
87
65
88
The operator works the same as in a Kubernetes environment except
66
- that you have to configure the Origin permissions to allow
89
+ that you have to configure the Origin permissions to allow
67
90
the operator to function.
68
91
69
92
The HostPath volume is by default restricted in Origin, so you
@@ -109,7 +132,8 @@ export CO_NAMESPACE=myproject
109
132
This will cause the *oc* command to be used within the operator
110
133
startup script and deploy the operator to the *myproject* namespace or project.
111
134
112
- == Create Project and Clone
135
+ [#Create Project and Clone]
136
+ == Create Project and Clone
113
137
In your .bashrc file, include the following:
114
138
....
115
139
export GOPATH=$HOME/odev
@@ -130,7 +154,9 @@ git clone https://github.com/CrunchyData/postgres-operator.git
130
154
cd postgres-operator
131
155
....
132
156
133
- == Get Pre-built Images
157
+ [#Get Packaged Dependencies]
158
+ == Get Packaged Dependencies
159
+
134
160
At this point if you want to avoid building the images and binary
135
161
from source, you can pull down the Docker images as follows:
136
162
....
@@ -148,8 +174,8 @@ tar xvzf ./postgres-operator.1.3.2.tar.gz
148
174
149
175
Lastly, add the *pgo* client into your PATH.
150
176
151
-
152
- == Source Dependencies
177
+ [#Build from Source]
178
+ == Build from Source
153
179
154
180
Install a golang compiler, this can be done with either
155
181
your package manager or by following directions
@@ -162,35 +188,37 @@ go get -u github.com/FiloSottile/gvt
162
188
gvt restore
163
189
....
164
190
165
- In a development environment you will likely want to create a
166
- *docker* group and add your user ID to that group, this allows
167
- you as your normal user ID to access the *docker* daemon and
191
+ In a development environment you will likely want to create a
192
+ *docker* group and add your user ID to that group, this allows
193
+ you as your normal user ID to access the *docker* daemon and
168
194
issue commands to it:
169
195
....
170
196
sudo groupadd docker
171
197
sudo usermod -a -G docker youruserID
172
198
sudo systemctl restart docker
173
- newgrp docker
199
+ newgrp docker
174
200
....
175
201
176
- == Compile *pgo*
202
+ [#Compiling the PostgreSQL Operator]
203
+ === Compiling the PostgreSQL Operator
177
204
....
178
205
cd $COROOT
179
206
make pgo
180
207
which pgo
181
208
....
182
209
183
- == Build the Docker Images
210
+ [#Build the Docker Images]
211
+ === Build the Docker Images
184
212
....
185
213
cd $COROOT
186
214
make operatorimage
187
215
make lsimage
188
216
docker images | grep crunchydata
189
217
....
190
218
191
-
192
- == Deploy the PostgreSQL Operator
193
- note that this will create and use */data* on your
219
+ [#Deploy the PostgreSQL Operator]
220
+ === Deploy the PostgreSQL Operator
221
+ NOTE: This will create and use */data* on your
194
222
local system as the persistent store for the operator to use
195
223
for its persistent volume:
196
224
....
@@ -207,7 +235,10 @@ desired PVC to use when databases and clusters are created.
207
235
When you first run the operator, it will create the required
208
236
ThirdPartyResources.
209
237
210
- == Setup *pgo* Configuration File
238
+ Strategies for deploying the operator can be found in the link:strategies.asciidoc[PostgreSQL Operator Deployment Strategies] document.
239
+
240
+ [#Configuration]
241
+ == Configuration
211
242
212
243
The *pgo* client requires two configuration files be copied
213
244
to your $HOME as follows:
@@ -229,7 +260,11 @@ located in */etc/kubernetes/admin.conf*. Update this kubeconfig
229
260
path to match your local Kube config file location. Also, update
230
261
the location of the LSPVC_TEMPLATE value to match your $HOME value.
231
262
232
- == Viewing Operator Resources
263
+ More in-depth explanations of postgres operator configurations are available
264
+ in the link:config.asciidoc[Configuration] document.
265
+
266
+ [#Viewing Operator Resources]
267
+ === Viewing Operator Resources
233
268
234
269
When you first run the operator, it will look for the presence
235
270
of its third party resources, and create them if not found. You can view the various resources created and used by the
@@ -243,11 +278,12 @@ kubectl get pgupgrades
243
278
244
279
At this point, you should be ready to start using the *pgo* client!
245
280
281
+ [#Performing a Smoke Test]
246
282
== Performing a Smoke Test
247
283
248
284
A simple *smoke test* of the postgres operator includes testing
249
285
the following:
250
-
286
+
251
287
* create a cluster (*pgo create cluster testcluster*)
252
288
* show a cluster (*pgo show cluster testcluster*)
253
289
* show all clusters (*pgo show cluster all*)
@@ -261,3 +297,4 @@ the following:
261
297
* clone a cluster (*pgo clone testcluster --name=cloneexample*)
262
298
* delete a cluster (*pgo delete cluster testcluster*)
263
299
300
+ More detailed explanations of the commands can be found in the link:user-guide.asciidoc[User Guide].
0 commit comments