blob: 39d309f1c969ddd948ca4716fe4764f16582d44b [file] [log] [blame]
Lusheng Jibd115742017-10-13 19:18:52 +00001PostgreSQL as a Service
2============
Tony Hansen30c453e2017-10-13 14:34:46 +00003
4PostgreSQL as a Service comes in two flavors: all-in-one blueprint, and
5separate disk/cluster/database blueprints to separate the management of
6the lifetime of those constituent parts. Both are provided for use.
7
Lusheng Jibd115742017-10-13 19:18:52 +00008Why Two Flavors?
9------------
Tony Hansen30c453e2017-10-13 14:34:46 +000010
11The reason there are two flavors of blueprints lays in the difference in
12lifetime management of the constituent parts.
13
14For example, a database usually needs to have persistent storage, which
15in these blueprints comes from Cinder storage volumes. The primitives
16used in these blueprints assume that the lifetime of the Cinder storage
17volumes matches the lifetime of the blueprint deployment. So when the
18blueprint goes away, any Cinder storage volume allocated in the
19blueprint also goes away.
20
Tony Hansen8c558972017-10-17 18:14:52 +000021Similarly, a database's lifetime may be the same time as an application's
22lifetime. When the application is undeployed, the associated database should
23be deployed too. OR, the database should have a lifetime beyond the scope
24of the applications that are writing to it or reading from it.
Tony Hansen30c453e2017-10-13 14:34:46 +000025
Tony Hansen8c558972017-10-17 18:14:52 +000026The Blueprints for PG Services and Cinder
27------------
Tony Hansen30c453e2017-10-13 14:34:46 +000028
Tony Hansen8c558972017-10-17 18:14:52 +000029The all-in-one blueprint PGaaS.yaml assumes that the PG servers and Cinder volumes can be allocated and
30deallocated together. This PGaaS.yaml blueprint creates a cluster named "pstg" by default.
31
32Alternatively, you can split them apart into separate steps, using PGaaS-disk.yaml to allocate the
33Cinder volume, and PGaaS-cluster.yaml to allocate a PG cluster. Create the Cinder volume first using
34PGaaS-disk.yaml, and then use PGaaS-cluster.yaml to create the cluster. The PG cluster can be
35redeployed without affecting the data on the Cinder volumes.
36
37The Blueprints for Databases
38------------
39
40The PGaaS-database.yaml blueprint shows how a database can be created separately from any application
41that uses it. That database will remain present until the PGaaS-database.yaml blueprint is
42undeployed. The PGaaS-getdbinfo.yaml file demonstrates how an application would access the credentials
43needed to access a given database on a given PostgreSQL cluster.
44
45If the lifetime of your database is tied to the lifetime of your application, use a block similar to what
46is in PGaaS-database.yaml to allocate the database, and use the attributes as shown in PGaaS-getdbinfo.yaml
47to access the credentials.