-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathconstants.py
More file actions
84 lines (65 loc) · 2.93 KB
/
constants.py
File metadata and controls
84 lines (65 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Copyright 2022 Canonical Ltd.
# See LICENSE file for licensing details.
"""File containing constants to be used in the charm."""
BACKUP_ID_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
PGBACKREST_BACKUP_ID_FORMAT = "%Y%m%d-%H%M%S"
DATABASE = "database"
DATABASE_DEFAULT_NAME = "postgres"
DATABASE_PORT = "5432"
PEER = "database-peers"
ALL_CLIENT_RELATIONS = [DATABASE]
REPLICATION_CONSUMER_RELATION = "replication"
REPLICATION_OFFER_RELATION = "replication-offer"
API_REQUEST_TIMEOUT = 5
PATRONI_CLUSTER_STATUS_ENDPOINT = "cluster"
BACKUP_USER = "backup"
TLS_KEY_FILE = "key.pem"
TLS_CA_FILE = "ca.pem"
TLS_CERT_FILE = "cert.pem"
TLS_CA_BUNDLE_FILE = "peer_ca_bundle.pem"
MONITORING_SNAP_SERVICE = "prometheus-postgres-exporter"
PGBACKREST_MONITORING_SNAP_SERVICE = "pgbackrest-exporter"
PATRONI_SERVICE_NAME = "snap.charmed-postgresql.patroni.service"
PATRONI_SERVICE_DEFAULT_PATH = f"/etc/systemd/system/{PATRONI_SERVICE_NAME}"
# Snap constants.
PGBACKREST_EXECUTABLE = "charmed-postgresql.pgbackrest"
# pgBackRest error codes
PGBACKREST_ARCHIVE_TIMEOUT_ERROR_CODE = (
82 # Archive timeout - unable to archive WAL files within configured timeout period
)
SNAP_COMMON_PATH = "/var/snap/charmed-postgresql/common"
SNAP_CURRENT_PATH = "/var/snap/charmed-postgresql/current"
SNAP_CONF_PATH = f"{SNAP_CURRENT_PATH}/etc"
SNAP_DATA_PATH = f"{SNAP_COMMON_PATH}/var/lib"
SNAP_LOGS_PATH = f"{SNAP_COMMON_PATH}/var/log"
PATRONI_CONF_PATH = f"{SNAP_CONF_PATH}/patroni"
PATRONI_LOGS_PATH = f"{SNAP_LOGS_PATH}/patroni"
PGBACKREST_CONF_PATH = f"{SNAP_CONF_PATH}/pgbackrest"
PGBACKREST_LOGS_PATH = f"{SNAP_LOGS_PATH}/pgbackrest"
POSTGRESQL_CONF_PATH = f"{SNAP_CONF_PATH}/postgresql"
POSTGRESQL_DATA_PATH = f"{SNAP_DATA_PATH}/postgresql"
POSTGRESQL_LOGS_PATH = f"{SNAP_LOGS_PATH}/postgresql"
UPDATE_CERTS_BIN_PATH = "/usr/sbin/update-ca-certificates"
PGBACKREST_CONFIGURATION_FILE = f"--config={PGBACKREST_CONF_PATH}/pgbackrest.conf"
METRICS_PORT = 9187
PGBACKREST_METRICS_PORT = 9854
# Labels are not confidential
REPLICATION_PASSWORD_KEY = "replication-password" # noqa: S105
REWIND_PASSWORD_KEY = "rewind-password" # noqa: S105
USER_PASSWORD_KEY = "operator-password" # noqa: S105
MONITORING_PASSWORD_KEY = "monitoring-password" # noqa: S105
RAFT_PASSWORD_KEY = "raft-password" # noqa: S105
PATRONI_PASSWORD_KEY = "patroni-password" # noqa: S105
SECRET_INTERNAL_LABEL = "internal-secret" # noqa: S105
SECRET_DELETED_LABEL = "None" # noqa: S105
SYSTEM_USERS_PASSWORD_CONFIG = "system-users" # noqa: S105
USERNAME_MAPPING_LABEL = "custom-usernames"
DATABASE_MAPPING_LABEL = "prefix-databases"
APP_SCOPE = "app"
UNIT_SCOPE = "unit"
SECRET_KEY_OVERRIDES = {"ca": "cauth"}
TRACING_PROTOCOL = "otlp_http"
BACKUP_TYPE_OVERRIDES = {"full": "full", "differential": "diff", "incremental": "incr"}
PLUGIN_OVERRIDES = {"audit": "pgaudit", "uuid_ossp": '"uuid-ossp"'}
SPI_MODULE = ["refint", "autoinc", "insert_username", "moddatetime"]
PGBACKREST_LOGROTATE_FILE = "/etc/logrotate.d/pgbackrest.logrotate"