diff --git a/clients/postgres-4.json b/clients/postgres-4.json new file mode 100644 index 0000000..eed891f --- /dev/null +++ b/clients/postgres-4.json @@ -0,0 +1,4 @@ +{ + "name": "postgres-4", + "public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu6fPxOZeKloF/EgYvU0k\nOwv8bJjsCQcWaMTPle5//mRTszA6PM2z9RI+Mfr45qxTlsL9pQY8WJOWF6QOK31x\nszuqcr7oOjtAhrLI8f/oNDEDjcx325FqG9gNKQEAD7d4zodh+PhDe6x7GIyIS7lG\nIcD5Zre9iDwv8FGLR+5GLqS8SJOPL/wJkQ8w+N0f8YDFw81kiTta5NLhAx3fMDs0\n2kmoNlbmKlNZTtLjCfCV+/pa9oY6wycjck3GvobiFE/4cWaNkeGlPc+uAwlfmrOv\nHy0tq1XBX/BCvE5kMXmhnMT23JXjm2s2PgCLgEVGAXilXk/T597KDm+z4oBpAQma\nnQIDAQAB\n-----END PUBLIC KEY-----\n" +} \ No newline at end of file diff --git a/nodes/akkounts-1.json b/nodes/akkounts-1.json index 93a1617..1168a2d 100644 --- a/nodes/akkounts-1.json +++ b/nodes/akkounts-1.json @@ -18,7 +18,7 @@ "recipes": [ "kosmos-base", "kosmos-base::default", - "kosmos-postgresql::hostsfile", + "kosmos_postgresql::hostsfile", "kosmos-akkounts", "kosmos-akkounts::default", "kosmos-akkounts::nginx", diff --git a/nodes/postgres-2.json b/nodes/postgres-2.json index cd48a8c..89bcc85 100644 --- a/nodes/postgres-2.json +++ b/nodes/postgres-2.json @@ -8,17 +8,17 @@ "automatic": { "fqdn": "postgres-2", "os": "linux", - "os_version": "5.4.0-64-generic", + "os_version": "5.4.0-77-generic", "hostname": "postgres-2", "ipaddress": "192.168.122.244", "roles": [ - "postgresql_replica" + "postgresql_primary" ], "recipes": [ "kosmos-base", "kosmos-base::default", - "kosmos-postgresql::replica", - "kosmos-postgresql::firewall", + "kosmos_postgresql::primary", + "kosmos_postgresql::firewall", "apt::default", "timezone_iii::default", "timezone_iii::debian", @@ -52,4 +52,4 @@ "recipe[kosmos-base]", "role[postgresql_primary]" ] -} +} \ No newline at end of file diff --git a/nodes/postgres-4.json b/nodes/postgres-4.json new file mode 100644 index 0000000..77e5a0f --- /dev/null +++ b/nodes/postgres-4.json @@ -0,0 +1,57 @@ +{ + "name": "postgres-4", + "normal": { + "knife_zero": { + "host": "10.1.1.107" + } + }, + "automatic": { + "fqdn": "postgres-4", + "os": "linux", + "os_version": "5.4.0-91-generic", + "hostname": "postgres-4", + "ipaddress": "192.168.122.3", + "roles": [ + "postgresql_replica" + ], + "recipes": [ + "kosmos-base", + "kosmos-base::default", + "kosmos_postgresql::hostsfile", + "kosmos_postgresql::replica", + "kosmos_postgresql::firewall", + "apt::default", + "timezone_iii::default", + "timezone_iii::debian", + "ntp::default", + "ntp::apparmor", + "kosmos-base::systemd_emails", + "apt::unattended-upgrades", + "kosmos-base::firewall", + "kosmos-postfix::default", + "postfix::default", + "postfix::_common", + "postfix::_attributes", + "postfix::sasl_auth", + "hostname::default" + ], + "platform": "ubuntu", + "platform_version": "20.04", + "cloud": null, + "chef_packages": { + "chef": { + "version": "17.7.29", + "chef_root": "/opt/chef/embedded/lib/ruby/gems/3.0.0/gems/chef-17.7.29/lib", + "chef_effortless": null + }, + "ohai": { + "version": "17.7.8", + "ohai_root": "/opt/chef/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.7.8/lib/ohai" + } + } + }, + "run_list": [ + "recipe[kosmos-base]", + "role[postgresql_replica]" + ] +} \ No newline at end of file diff --git a/roles/postgresql_client.rb b/roles/postgresql_client.rb index 96b5418..f2fbb71 100644 --- a/roles/postgresql_client.rb +++ b/roles/postgresql_client.rb @@ -3,5 +3,5 @@ name "postgresql_client" run_list %w( - kosmos-postgresql::hostsfile + kosmos_postgresql::hostsfile ) diff --git a/roles/postgresql_primary.rb b/roles/postgresql_primary.rb index ba5e5be..58ef4b7 100644 --- a/roles/postgresql_primary.rb +++ b/roles/postgresql_primary.rb @@ -1,6 +1,6 @@ name "postgresql_primary" run_list %w( - kosmos-postgresql::primary - kosmos-postgresql::firewall + kosmos_postgresql::primary + kosmos_postgresql::firewall ) diff --git a/roles/postgresql_replica.rb b/roles/postgresql_replica.rb index 6d73f31..099291d 100644 --- a/roles/postgresql_replica.rb +++ b/roles/postgresql_replica.rb @@ -1,7 +1,7 @@ name "postgresql_replica" run_list %w( - kosmos-postgresql::hostsfile - kosmos-postgresql::replica - kosmos-postgresql::firewall + kosmos_postgresql::hostsfile + kosmos_postgresql::replica + kosmos_postgresql::firewall ) diff --git a/site-cookbooks/kosmos-postgresql/CHANGELOG.md b/site-cookbooks/kosmos-postgresql/CHANGELOG.md deleted file mode 100644 index 20e9a6a..0000000 --- a/site-cookbooks/kosmos-postgresql/CHANGELOG.md +++ /dev/null @@ -1,5 +0,0 @@ -# kosmos-postgresql CHANGELOG - -# 0.1.0 - -Initial release. diff --git a/site-cookbooks/kosmos_kvm/recipes/host.rb b/site-cookbooks/kosmos_kvm/recipes/host.rb index a89f7eb..1d611bd 100644 --- a/site-cookbooks/kosmos_kvm/recipes/host.rb +++ b/site-cookbooks/kosmos_kvm/recipes/host.rb @@ -2,34 +2,13 @@ # Cookbook:: kosmos_kvm # Recipe:: host # -# The MIT License (MIT) -# -# Copyright:: 2020, Kosmos Developers -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. package %w(virtinst libvirt-daemon-system) directory "/var/lib/libvirt/images/base" do recursive true owner "libvirt-qemu" - group "root" + group "kvm" mode "0750" end @@ -37,7 +16,7 @@ end remote_file "/var/lib/libvirt/images/base/ubuntu-20.04-server-cloudimg-amd64-disk-kvm.qcow2" do source "http://cloud-images.ubuntu.com/releases/focal/release/ubuntu-20.04-server-cloudimg-amd64-disk-kvm.img" owner "libvirt-qemu" - group "root" + group "kvm" mode "0640" end diff --git a/site-cookbooks/kosmos-postgresql/.gitignore b/site-cookbooks/kosmos_postgresql/.gitignore similarity index 100% rename from site-cookbooks/kosmos-postgresql/.gitignore rename to site-cookbooks/kosmos_postgresql/.gitignore diff --git a/site-cookbooks/kosmos-postgresql/Berksfile b/site-cookbooks/kosmos_postgresql/Berksfile similarity index 100% rename from site-cookbooks/kosmos-postgresql/Berksfile rename to site-cookbooks/kosmos_postgresql/Berksfile diff --git a/site-cookbooks/kosmos_postgresql/CHANGELOG.md b/site-cookbooks/kosmos_postgresql/CHANGELOG.md new file mode 100644 index 0000000..1ffdd2a --- /dev/null +++ b/site-cookbooks/kosmos_postgresql/CHANGELOG.md @@ -0,0 +1,5 @@ +# kosmos_postgresql CHANGELOG + +# 0.1.0 + +Initial release. diff --git a/site-cookbooks/kosmos-postgresql/LICENSE b/site-cookbooks/kosmos_postgresql/LICENSE similarity index 100% rename from site-cookbooks/kosmos-postgresql/LICENSE rename to site-cookbooks/kosmos_postgresql/LICENSE diff --git a/site-cookbooks/kosmos-postgresql/README.md b/site-cookbooks/kosmos_postgresql/README.md similarity index 98% rename from site-cookbooks/kosmos-postgresql/README.md rename to site-cookbooks/kosmos_postgresql/README.md index 2541424..9ea16a7 100644 --- a/site-cookbooks/kosmos-postgresql/README.md +++ b/site-cookbooks/kosmos_postgresql/README.md @@ -1,4 +1,4 @@ -# kosmos-postgresql +# kosmos_postgresql ## Usage diff --git a/site-cookbooks/kosmos-postgresql/attributes/default.rb b/site-cookbooks/kosmos_postgresql/attributes/default.rb similarity index 59% rename from site-cookbooks/kosmos-postgresql/attributes/default.rb rename to site-cookbooks/kosmos_postgresql/attributes/default.rb index dec530f..f3daf9b 100644 --- a/site-cookbooks/kosmos-postgresql/attributes/default.rb +++ b/site-cookbooks/kosmos_postgresql/attributes/default.rb @@ -1,3 +1,3 @@ # This is set to false by default, and set to true in the server resource # for replicas. -node.default['kosmos-postgresql']['ready_to_set_up_replica'] = false +node.default['kosmos_postgresql']['ready_to_set_up_replica'] = false diff --git a/site-cookbooks/kosmos-postgresql/chefignore b/site-cookbooks/kosmos_postgresql/chefignore similarity index 100% rename from site-cookbooks/kosmos-postgresql/chefignore rename to site-cookbooks/kosmos_postgresql/chefignore diff --git a/site-cookbooks/kosmos-postgresql/libraries/helpers.rb b/site-cookbooks/kosmos_postgresql/libraries/helpers.rb similarity index 100% rename from site-cookbooks/kosmos-postgresql/libraries/helpers.rb rename to site-cookbooks/kosmos_postgresql/libraries/helpers.rb diff --git a/site-cookbooks/kosmos-postgresql/metadata.rb b/site-cookbooks/kosmos_postgresql/metadata.rb similarity index 70% rename from site-cookbooks/kosmos-postgresql/metadata.rb rename to site-cookbooks/kosmos_postgresql/metadata.rb index 1b031b2..ad7ca14 100644 --- a/site-cookbooks/kosmos-postgresql/metadata.rb +++ b/site-cookbooks/kosmos_postgresql/metadata.rb @@ -1,9 +1,9 @@ -name 'kosmos-postgresql' +name 'kosmos_postgresql' maintainer 'Kosmos' maintainer_email 'ops@5apps.com' license 'MIT' -description 'Installs/Configures kosmos-postgresql' -long_description 'Installs/Configures kosmos-postgresql' +description 'Installs/Configures kosmos_postgresql' +long_description 'Installs/Configures kosmos_postgresql' version '0.1.0' chef_version '>= 12.14' if respond_to?(:chef_version) @@ -11,13 +11,13 @@ chef_version '>= 12.14' if respond_to?(:chef_version) # tracked. A `View Issues` link will be displayed on this cookbook's page when # uploaded to a Supermarket. # -# issues_url 'https://github.com//kosmos-postgresql/issues' +# issues_url 'https://github.com//kosmos_postgresql/issues' # The `source_url` points to the development repository for this cookbook. A # `View Source` link will be displayed on this cookbook's page when uploaded to # a Supermarket. # -# source_url 'https://github.com//kosmos-postgresql' +# source_url 'https://github.com//kosmos_postgresql' depends "postgresql", ">= 7.0.0" depends "build-essential" diff --git a/site-cookbooks/kosmos-postgresql/recipes/firewall.rb b/site-cookbooks/kosmos_postgresql/recipes/firewall.rb similarity index 89% rename from site-cookbooks/kosmos-postgresql/recipes/firewall.rb rename to site-cookbooks/kosmos_postgresql/recipes/firewall.rb index 7b9b380..ebc3404 100644 --- a/site-cookbooks/kosmos-postgresql/recipes/firewall.rb +++ b/site-cookbooks/kosmos_postgresql/recipes/firewall.rb @@ -1,5 +1,5 @@ # -# Cookbook:: kosmos-postgresql +# Cookbook:: kosmos_postgresql # Recipe:: firewall # diff --git a/site-cookbooks/kosmos-postgresql/recipes/hostsfile.rb b/site-cookbooks/kosmos_postgresql/recipes/hostsfile.rb similarity index 87% rename from site-cookbooks/kosmos-postgresql/recipes/hostsfile.rb rename to site-cookbooks/kosmos_postgresql/recipes/hostsfile.rb index 265f563..9000b67 100644 --- a/site-cookbooks/kosmos-postgresql/recipes/hostsfile.rb +++ b/site-cookbooks/kosmos_postgresql/recipes/hostsfile.rb @@ -1,5 +1,5 @@ # -# Cookbook:: kosmos-postgresql +# Cookbook:: kosmos_postgresql # Recipe:: hostsfile # diff --git a/site-cookbooks/kosmos-postgresql/recipes/primary.rb b/site-cookbooks/kosmos_postgresql/recipes/primary.rb similarity index 95% rename from site-cookbooks/kosmos-postgresql/recipes/primary.rb rename to site-cookbooks/kosmos_postgresql/recipes/primary.rb index b3a7534..de7466f 100644 --- a/site-cookbooks/kosmos-postgresql/recipes/primary.rb +++ b/site-cookbooks/kosmos_postgresql/recipes/primary.rb @@ -1,5 +1,5 @@ # -# Cookbook:: kosmos-postgresql +# Cookbook:: kosmos_postgresql # Recipe:: primary # diff --git a/site-cookbooks/kosmos-postgresql/recipes/replica.rb b/site-cookbooks/kosmos_postgresql/recipes/replica.rb similarity index 97% rename from site-cookbooks/kosmos-postgresql/recipes/replica.rb rename to site-cookbooks/kosmos_postgresql/recipes/replica.rb index 6525948..b1dd345 100644 --- a/site-cookbooks/kosmos-postgresql/recipes/replica.rb +++ b/site-cookbooks/kosmos_postgresql/recipes/replica.rb @@ -1,5 +1,5 @@ # -# Cookbook:: kosmos-postgresql +# Cookbook:: kosmos_postgresql # Recipe:: replica # diff --git a/site-cookbooks/kosmos-postgresql/resources/server.rb b/site-cookbooks/kosmos_postgresql/resources/server.rb similarity index 90% rename from site-cookbooks/kosmos-postgresql/resources/server.rb rename to site-cookbooks/kosmos_postgresql/resources/server.rb index f71520e..5d5fb1c 100644 --- a/site-cookbooks/kosmos-postgresql/resources/server.rb +++ b/site-cookbooks/kosmos_postgresql/resources/server.rb @@ -1,4 +1,5 @@ resource_name :postgresql_custom_server +provides :postgresql_custom_server property :postgresql_version, String, required: true, name_property: true property :role, String, required: true # Can be primary or replica @@ -41,14 +42,14 @@ action :create do action :disable end - shared_buffers = if node['memory']['total'].to_i / 1024 < 1024 # > 1GB RAM + shared_buffers = if node['memory']['total'].to_i / 1024 < 1024 # < 1GB RAM "128MB" - else # >= 1GB RAM, use 25% of total RAM - "#{node['memory']['total'].to_i / 1024 / 4}MB" + else # >= 1GB RAM, use 50% of total RAM + "#{node['memory']['total'].to_i / 1024 / 2}MB" end additional_config = { - max_connections: 100, # default + max_connections: 200, # default shared_buffers: shared_buffers, unix_socket_directories: "/var/run/postgresql", dynamic_shared_memory_type: "posix",