Add recipe to set up PostgreSQL replication, rewrite kosmos-postgresql cookbook #163

Manually merged
raucao merged 17 commits from feature/160-postgres_replication into master 2020-05-14 13:10:37 +00:00
Owner

See the README in the kosmos-postgresql cookbook (site-cookbooks/kosmos-postgresql/README.md) for docs about the custom resource. For replication, Chef needs to run once on the replica, then once on the primary to set up the access rules, and then a second time on the replica

Also upgrade PostgreSQL from 10 to 12 (10 is the version running on andromeda right now)

Refs #160

See the README in the kosmos-postgresql cookbook (`site-cookbooks/kosmos-postgresql/README.md`) for docs about the custom resource. For replication, Chef needs to run once on the replica, then once on the primary to set up the access rules, and then a second time on the replica Also upgrade PostgreSQL from 10 to 12 (10 is the version running on andromeda right now) Refs #160
raucao reviewed 2020-05-12 09:12:41 +00:00
raucao left a comment
Owner

I glanced over everything and added a few comments to the mentioned README.

I glanced over everything and added a few comments to the mentioned README.
@ -3,2 +3,3 @@
TODO: Enter the cookbook description here.
## Custom resources
### `postgresql_custom_server`
Owner

What's "custom" about these servers? If "custom" merely means that it's going to be configured for our use case, then isn't that the case for literally every other server, too?

What's "custom" about these servers? If "custom" merely means that it's going to be configured for our use case, then isn't that the case for literally every other server, too?
Author
Owner

They're Chef custom resources (https://docs.chef.io/custom_resources/), the concept that replaces LWRP (https://chef.readthedocs.io/en/latest/lwrps_custom.html)

They're Chef custom resources (https://docs.chef.io/custom_resources/), the concept that replaces LWRP (https://chef.readthedocs.io/en/latest/lwrps_custom.html)
@ -5,0 +24,4 @@
```ruby
postgresql_custom_server "12" do
role "primary"
Owner

The replica also needs to have "primary" as role?

The replica also needs to have "primary" as role?
Author
Owner

Thanks, I've pushed a fix for the typo

Thanks, I've pushed a fix for the typo
@ -5,0 +38,4 @@
[`firewall_rules`](https://github.com/chef-cookbooks/firewall/issues/134) and
[`postgresql_access`](https://github.com/sous-chefs/postgresql/issues/648) need
to be declared in recipes, not resources because of the way custom resources
work currently in Chef
Owner

Which rules are needed? How are they declared? I believe this README would not answer these questions for someone trying to use it.

Which rules are needed? How are they declared? I believe this README would not answer these questions for someone trying to use it.
greg changed title from Add recipe to set up PostgreSQL replication, rewrite kosmos-postgresql cookbook to WIP: Add recipe to set up PostgreSQL replication, rewrite kosmos-postgresql cookbook 2020-05-12 09:52:30 +00:00
greg changed title from WIP: Add recipe to set up PostgreSQL replication, rewrite kosmos-postgresql cookbook to Add recipe to set up PostgreSQL replication, rewrite kosmos-postgresql cookbook 2020-05-14 07:03:02 +00:00
raucao reviewed 2020-05-14 11:02:27 +00:00
raucao left a comment
Owner

Left a couple of comments/questions.

Left a couple of comments/questions.
@ -5,0 +57,4 @@
the PostgreSQL server.
The root certificate needs to be deployed to clients so they verify the cert
can be trusted.
Owner

I don't see where that's done in this PR?

I don't see where that's done in this PR?
Author
Owner

I forgot to remove that part from the README, as we said in #160 that we don't care about verifying the root cert. It would be done in the cookbooks for software that connects to PostgreSQL (together with creating databases) and not in this cookbook

I forgot to remove that part from the README, as we said in #160 that we don't care about verifying the root cert. It would be done in the cookbooks for software that connects to PostgreSQL (together with creating databases) and not in this cookbook
@ -51,1 +73,4 @@
end
# TODO: We need to set up firewall rules and access rules for clients too
# (Mastodon, ejabberd, etc)
Owner

What does this mean? Why would they use a different port to connect to Postgres?

What does this mean? Why would they use a different port to connect to Postgres?
Author
Owner

I'm removing that line, this will be done as part of the Mastodon, ejabberd, gitea cookbooks. They wouldn't use a different port, but clients still need access for the specific database, user and IP (https://www.postgresql.org/docs/12/auth-pg-hba-conf.html)

I'm removing that line, this will be done as part of the Mastodon, ejabberd, gitea cookbooks. They wouldn't use a different port, but clients still need access for the specific database, user and IP (https://www.postgresql.org/docs/12/auth-pg-hba-conf.html)
raucao approved these changes 2020-05-14 12:15:03 +00:00
raucao closed this pull request 2020-05-14 13:10:37 +00:00
raucao closed this pull request 2020-05-14 13:10:37 +00:00
raucao deleted branch feature/160-postgres_replication 2020-05-14 13:10:46 +00:00
Sign in to join this conversation.
No description provided.