Skip to content

Instantly share code, notes, and snippets.

@jameinel
Created June 10, 2020 10:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jameinel/c10f81ad708513eafa489a3cdb0ce046 to your computer and use it in GitHub Desktop.
Save jameinel/c10f81ad708513eafa489a3cdb0ce046 to your computer and use it in GitHub Desktop.
"options":
"extra_packages":
"description": >
Space separated list of extra deb packages to install.
"type": "string"
"default": ""
"package_status":
"default": "install"
"type": "string"
"description": >
The status of service-affecting packages will be set to this
value in the dpkg database. Valid values are "install" and "hold".
"install_sources":
"description": >
List of extra apt sources, per charm-helpers standard
format (a yaml list of strings encoded as a string). Each source
may be either a line that can be added directly to
sources.list(5), or in the form ppa:<user>/<ppa-name> for adding
Personal Package Archives, or a distribution component to enable.
"type": "string"
"default": ""
"install_keys":
"description": >
List of signing keys for install_sources package sources, per
charmhelpers standard format (a yaml list of strings encoded as
a string). The keys should be the full ASCII armoured GPG public
keys. While GPG key ids are also supported and looked up on a
keyserver, operators should be aware that this mechanism is
insecure. null can be used if a standard package signing key is
used that will already be installed on the machine, and for PPA
sources where the package signing key is securely retrieved from
Launchpad.
"type": "string"
"default": ""
"snap_proxy":
"description": >
DEPRECATED. Use snap-http-proxy and snap-https-proxy model configuration settings.
HTTP/HTTPS web proxy for Snappy to use when accessing the snap store.
"type": "string"
"default": ""
"snap_proxy_url":
"default": ""
"type": "string"
"description": >
DEPRECATED. Use snap-store-proxy model configuration setting.
The address of a Snap Store Proxy to use for snaps e.g. http://snap-proxy.example.com
"snapd_refresh":
"default": ""
"type": "string"
"description": >
How often snapd handles updates for installed snaps. The default
(an empty string) is 4x per day. Set to "max" to check once per month
based on the charm deployment date. You may also set a custom string as
described in the 'refresh.timer' section here:
https://forum.snapcraft.io/t/system-options/87
"nagios_context":
"default": "juju"
"type": "string"
"description": |
Used by the nrpe subordinate charms.
A string that will be prepended to instance name to set the host name
in nagios. So for instance the hostname would be something like:
juju-myservice-0
If you're running multiple environments with the same services in them
this allows you to differentiate between them.
"nagios_servicegroups":
"default": ""
"type": "string"
"description": |
A comma-separated list of nagios servicegroups.
If left empty, the nagios_context will be used as the servicegroup
"admin_addresses":
"default": ""
"type": "string"
"description": >
A comma-separated list of IP Addresses (or single IP) admin tools
like pgAdmin3 will connect from. The IP addresses added here will
be included in the pg_hba.conf file allowing ip connections to all
databases on the server from the given IP addresses using md5
password encryption. IP address ranges are also supported, using
the standard format described in the PostgreSQL reference guide.
"locale":
"default": "C"
"type": "string"
"description": >
Locale of service, defining language, default collation order,
and default formatting of numbers, currency, dates & times. Can only be
set when deploying the first unit of a service.
"encoding":
"default": "UTF-8"
"type": "string"
"description": >
Default encoding used to store text in this service. Can only be
set when deploying the first unit of a service.
"relation_database_privileges":
"default": "ALL"
"type": "string"
"description": >
A comma-separated list of database privileges to grant to relation
users on their databases. The defaults allow to connect to the
database (CONNECT), create objects such as tables (CREATE), and
create temporary tables (TEMPORARY). Client charms that create
objects in the database are responsible to granting suitable
access on those objects to other roles and users (or PUBLIC) using
standard GRANT statements.
"version":
"default": ""
"type": "string"
"description": >
Version of PostgreSQL that we want to install. Supported versions
are "9.3", "9.4", "9.5", "9.6", "10", "11" & "12". The default
version for the deployed Ubuntu release is used when the version
is unspecified.
"extra_pg_conf":
# The defaults here match the defaults chosen by the charm,
# so removing them will not change them. They are listed
# as documentation. The charm actually loads the non-calculated
# defaults from this config.yaml file to make it unlikely it will
# get out of sync with reality.
"default": |
# Additional service specific postgresql.conf settings.
listen_addresses='*'
ssl=true
# log_timezone=UTC Bug #1580331
log_checkpoints=true
log_connections=true
log_disconnections=true
log_autovacuum_min_duration=-1
log_line_prefix='%t [%p]: [%l-1] db=%d,user=%u '
archive_mode=on
archive_command='/bin/true'
hot_standby=true
max_wal_senders=10
# max_wal_senders=num_units * 2 + 5
# wal_level=hot_standby (<9.4) or logical (>=9.4)
# shared_buffers=total_ram*0.25
# effective_cache_size=total_ram*0.75
default_statistics_target=250
from_collapse_limit=16
join_collapse_limit=16
wal_buffers=-1
checkpoint_completion_target=0.9
# password_encryption=true
max_connections=100
autovacuum_freeze_max_age=2000000000
vacuum_freeze_table_age=1600000000
"type": "string"
"description": >
postgresql.conf settings, one per line in standard key=value
PostgreSQL format. These settings will generally override
any values selected by the charm. The charm however will
attempt to ensure minimum requirements for the charm's
operation are met.
"extra_pg_auth":
"type": "string"
"default": ""
"description": >
A extra pg_hba.conf auth rules. This will be included as-is
into the pg_hba.conf file. Note that this should not be needed
as db relations already create those rules the right way. Use
this feature to allow clients to connect from outside the
environment, or to configure replication between unrelated
PostgreSQL services using the manual_replication option.
"idle_reap_secs":
"type": "int"
"default": !!int "900"
"description": >
Terminate transactions that have been idle more than this many
seconds. While this may seem harsh, in most environments it is
preferable to allowing them to create database bloat and hold
locks needed by well behaved transactions. Set to 0 to disable.
"performance_tuning":
"default": "Mixed"
"type": "string"
"description": >
DEPRECATED AND IGNORED. The pgtune project has been abandoned
and the packages dropped from Debian and Ubuntu. The charm
still performs some basic tuning, which users can tweak using
extra_pg_config.
"manual_replication":
"type": "boolean"
"default": !!bool "false"
"description": >
Enable or disable charm managed replication. When manual_replication
is True, the operator is responsible for maintaining recovery.conf
and performing any necessary database mirroring. The charm will
still advertise the unit as standalone, master or hot standby to
relations based on whether the system is in recovery mode or not.
Note that this option makes it possible to create a PostgreSQL
service with multiple master units, which is a very silly thing
to do unless you are also using multi-master software like BDR.
"backup_schedule":
"default": "13 4 * * *"
"type": "string"
"description": "Cron-formatted schedule for regular database backups."
"backup_retention_count":
"default": !!int "7"
"type": "int"
"description": "Number of backups to retain."
"backup_dir":
"default": "/var/lib/postgresql/backups"
"type": "string"
"description": >
Directory to place backups in.
"pgdg":
"description": >
Enable the PostgreSQL Global Development Group APT repository
(https://wiki.postgresql.org/wiki/Apt). This package source provides
official PostgreSQL packages for Ubuntu LTS releases beyond those
provided by the main Ubuntu archive.
"type": "boolean"
"default": !!bool "false"
"wal_e_storage_uri":
"type": "string"
"default": ""
"description": |
Specify storage to be used by WAL-E. Every PostgreSQL service must use
a unique URI. Backups will be unrecoverable if it is not unique. The
URI's scheme must be one of 'swift' (OpenStack Swift), 's3' (Amazon AWS)
or 'wabs' (Windows Azure). For example:
'swift://some-container/directory/or/whatever'
's3://some-bucket/directory/or/whatever'
'wabs://some-bucket/directory/or/whatever'
Setting the wal_e_storage_uri enables regular WAL-E filesystem level
backups (per wal_e_backup_schedule), and log shipping to the configured
storage. Point-in-time recovery becomes possible, as is disabling the
streaming_replication configuration item and relying solely on
log shipping for replication.
"wal_e_backup_schedule":
"type": "string"
"default": "13 0 * * *"
"description": >
Cron-formatted schedule for WAL-E database backups. If
wal_e_backup_schedule is unset, WAL files will never be removed from
WAL-E storage.
"wal_e_backup_retention":
"type": "int"
"default": !!int "2"
"description": >
Number of recent base backups and WAL files to retain.
You need enough space for this many backups plus one more, as
an old backup will only be removed after a new one has been
successfully made to replace it.
"wal_archive_warn_threshold":
"type": "int"
"default": !!int "300"
"description": >
How many seconds the oldest un-uploaded WAL database backup can be
before the Nagios check will issue a warning.
"wal_archive_crit_threshold":
"type": "int"
"default": !!int "600"
"description": >
How many seconds the oldest un-uploaded WAL database backup can be
before the Nagios check will issue a critical error.
"streaming_replication":
"type": "boolean"
"default": !!bool "true"
"description": >
Enable streaming replication. Normally, streaming replication is
always used, and any log shipping configured is used as a fallback.
Turning this off without configuring log shipping is an error.
"os_username":
"type": "string"
"default": ""
"description": "OpenStack Swift username."
"os_password":
"type": "string"
"default": ""
"description": "OpenStack Swift password."
"os_auth_url":
"type": "string"
"default": ""
"description": "OpenStack Swift authentication URL."
"os_tenant_name":
"type": "string"
"default": ""
"description": "OpenStack Swift tenant name."
"aws_access_key_id":
"type": "string"
"default": ""
"description": "EXPERIMENTAL. Amazon AWS access key id."
"aws_secret_access_key":
"type": "string"
"default": ""
"description": "EXPERIMENTAL. Amazon AWS secret access key."
"aws_region":
"type": "string"
"default": ""
"description": "EXPERIMENTAL. Amazon AWS region (eg. us-east-1)"
"wabs_account_name":
"type": "string"
"default": ""
"description": "EXPERIMENTAL. Windows Azure account name."
"wabs_access_key":
"type": "string"
"default": ""
"description": "EXPERIMENTAL. Windows Azure access key."
# statsd-compatible metrics
"metrics_target":
"default": ""
"type": "string"
"description": >
Destination for statsd-format metrics, format "host:port". If
not present and valid, metrics disabled.
"metrics_prefix":
"default": "dev.$UNIT.postgresql"
"type": "string"
"description": >
Prefix for metrics. Special value $UNIT can be used to include the
name of the unit in the prefix.
"metrics_sample_interval":
"default": !!int "5"
"type": "int"
"description": "Period for metrics cron job to run in minutes"
# DEPRECATED SETTINGS.
# Remove them one day. They remain here to avoid making existing
# configurations fail.
"advisory_lock_restart_key":
"default": !!int "765"
"type": "int"
"description": "DEPRECATED and ignored."
"extra-packages":
"default": ""
"type": "string"
"description": "DEPRECATED. Use extra_packages."
"listen_port":
"default": !!int "-1"
"type": "int"
"description": "DEPRECATED. Use extra_pg_conf."
"max_connections":
"default": !!int "100"
"type": "int"
"description": "DEPRECATED. Use extra_pg_conf."
"max_prepared_transactions":
"default": !!int "0"
"type": "int"
"description": "DEPRECATED. Use extra_pg_conf."
"ssl":
"default": "True"
"type": "string"
"description": "DEPRECATED. Use extra_pg_conf."
"log_min_duration_statement":
"default": !!int "-1"
"type": "int"
"description": "DEPRECATED. Use extra_pg_conf."
"log_checkpoints":
"default": !!bool "false"
"type": "boolean"
"description": "DEPRECATED. Use extra_pg_conf."
"log_connections":
"default": !!bool "false"
"type": "boolean"
"description": "DEPRECATED. Use extra_pg_conf."
"log_disconnections":
"default": !!bool "false"
"type": "boolean"
"description": "DEPRECATED. Use extra_pg_conf."
"log_temp_files":
"default": "-1"
"type": "string"
"description": "DEPRECATED. Use extra_pg_conf."
"log_line_prefix":
"default": "%t [%p]: [%l-1] db=%d,user=%u "
"type": "string"
"description": "DEPRECATED. Use extra_pg_conf."
"log_lock_waits":
"default": !!bool "false"
"type": "boolean"
"description": "DEPRECATED. Use extra_pg_conf."
"log_timezone":
"default": "UTC"
"type": "string"
"description": "DEPRECATED. Use extra_pg_conf."
"autovacuum":
"default": !!bool "true"
"type": "boolean"
"description": "DEPRECATED. Use extra_pg_conf."
"log_autovacuum_min_duration":
"default": !!int "-1"
"type": "int"
"description": "DEPRECATED. Use extra_pg_conf."
"autovacuum_analyze_threshold":
"default": !!int "50"
"type": "int"
"description": "DEPRECATED. Use extra_pg_conf."
"autovacuum_vacuum_scale_factor":
"default": !!float "0.2"
"type": "float"
"description": "DEPRECATED. Use extra_pg_conf."
"autovacuum_analyze_scale_factor":
"default": !!float "0.1"
"type": "float"
"description": "DEPRECATED. Use extra_pg_conf."
"autovacuum_vacuum_cost_delay":
"default": "20ms"
"type": "string"
"description": "DEPRECATED. Use extra_pg_conf."
"search_path":
"default": "\"$user\",public"
"type": "string"
"description": "DEPRECATED. Use extra_pg_conf."
"standard_conforming_strings":
"default": !!bool "true"
"type": "boolean"
"description": "DEPRECATED. Use extra_pg_conf."
"hot_standby":
"default": !!bool "false"
"type": "boolean"
"description": "DEPRECATED. Use extra_pg_conf."
"hot_standby_feedback":
"default": !!bool "false"
"type": "boolean"
"description": "DEPRECATED. Use extra_pg_conf."
"wal_level":
"default": "minimal"
"type": "string"
"description": "DEPRECATED. Use extra_pg_conf."
"max_wal_senders":
"default": !!int "0"
"type": "int"
"description": "DEPRECATED. Use extra_pg_conf."
"wal_keep_segments":
"default": !!int "0"
"type": "int"
"description": "DEPRECATED. Use extra_pg_conf."
"replicated_wal_keep_segments":
"default": !!int "500"
"type": "int"
"description": "DEPRECATED. Use extra_pg_conf."
"archive_mode":
"default": !!bool "false"
"type": "boolean"
"description": "DEPRECATED. Use extra_pg_conf."
"archive_command":
"default": ""
"type": "string"
"description": "DEPRECATED. Use extra_pg_conf."
"work_mem":
"default": "1MB"
"type": "string"
"description": "DEPRECATED. Use extra_pg_conf."
"maintenance_work_mem":
"default": "1MB"
"type": "string"
"description": "DEPRECATED. Use extra_pg_conf."
"kernel_shmall":
"default": !!int "0"
"type": "int"
"description": "DEPRECATED and ignored."
"kernel_shmmax":
"default": !!int "0"
"type": "int"
"description": "DEPRECATED and ignored."
"shared_buffers":
"default": ""
"type": "string"
"description": "DEPRECATED. Use extra_pg_conf."
"effective_cache_size":
"default": ""
"type": "string"
"description": "DEPRECATED. Use extra_pg_conf."
"default_statistics_target":
"default": !!int "-1"
"type": "int"
"description": "DEPRECATED. Use extra_pg_conf."
"collapse_limit":
"default": !!int "-1"
"type": "int"
"description": "DEPRECATED. Use extra_pg_conf."
"temp_buffers":
"default": "1MB"
"type": "string"
"description": "DEPRECATED. Use extra_pg_conf."
"wal_buffers":
"default": "-1"
"type": "string"
"description": "DEPRECATED. Use extra_pg_conf."
"checkpoint_segments":
"default": !!int "10"
"type": "int"
"description": "DEPRECATED. Use extra_pg_conf."
"checkpoint_completion_target":
"default": !!float "0.9"
"type": "float"
"description": "DEPRECATED. Use extra_pg_conf."
"checkpoint_timeout":
"default": ""
"type": "string"
"description": "DEPRECATED. Use extra_pg_conf."
"fsync":
"type": "boolean"
"default": !!bool "true"
"description": "DEPRECATED. Use extra_pg_conf."
"synchronous_commit":
"type": "boolean"
"default": !!bool "true"
"description": "DEPRECATED. Use extra_pg_conf."
"full_page_writes":
"type": "boolean"
"default": !!bool "true"
"description": "DEPRECATED. Use extra_pg_conf."
"random_page_cost":
"default": !!float "4.0"
"type": "float"
"description": "DEPRECATED. Use extra_pg_conf."
--------------------------------------------------------------------------------- benchmark: 2 tests ---------------------------------------------------------------------------------
Name (time in ms) Min Max Mean StdDev Median IQR Outliers OPS Rounds Iterations
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_yamlcload 1.9424 (1.0) 8.0460 (1.0) 2.2825 (1.0) 0.9221 (1.0) 2.1019 (1.0) 0.1065 (1.0) 18;26 438.1241 (1.0) 458 1
test_yamlload 28.7869 (14.82) 37.7593 (4.69) 31.5777 (13.83) 1.7031 (1.85) 31.3268 (14.90) 0.5829 (5.47) 4;6 31.6679 (0.07) 33 1
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
import yaml
def test_yamlload(benchmark):
with open('config.yaml') as f:
content = f.read()
benchmark(yaml.load, content, Loader=yaml.SafeLoader)
def test_yamlcload(benchmark):
with open('config.yaml') as f:
content = f.read()
benchmark(yaml.load, content, Loader=yaml.CSafeLoader)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment