This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Read more about pg_dump, pre-data, post-data sections and the Fc flags at: | |
# https://www.postgresql.org/docs/13/app-pgdump.html | |
# -- Dump operations from Source Database -------------------------------------------- | |
# Dumps the schema but excludes all the constraints and indexes (i.e pre-data section) | |
pg_dump -h $SOURCE_ENDPOINT --section=pre-data -U postgres -d $DB_NAME --file=schema-pre-data.dump.sql | |
# Dump the schema for the indices and constraints as well as we will need it later | |
# to apply it to the tables after the destination database is in sync. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# --- Dump roles from the Source Database ------------------------------ | |
# Dump all the roles | |
pg_dumpall -h $SOURCE_ENDPOINT --roles-only -U postgres > roles.org.dump.sql | |
# Extract only the role creation / alter SQL commands | |
awk '/CREATE/' roles.org.dump.sql > roles.dump.sql | |
# Sanitize superuser and replication roles | |
sed -i -e's/NOSUPERUSER//g; s/SUPERUSER//g; s/NOREPLICATION//g; s/REPLICATION//g' roles.dump.sql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Create replication user | |
CREATE USER rep_user WITH replication PASSWORD <PASSWORD>; | |
-- Grant SELECT and USAGE | |
GRANT SELECT ON ALL TABLES IN SCHEMA <SCHEMA> TO rep_user; | |
GRANT USAGE ON SCHEMA <SCHEMA> TO rep_user; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT tbl.table_schema, | |
tbl.table_name | |
FROM information_schema.tables tbl | |
WHERE table_type = 'BASE TABLE' | |
AND table_schema NOT IN ('pg_catalog', 'information_schema') | |
AND table_name not like 'awsdms%' | |
AND NOT EXISTS (SELECT 1 | |
FROM information_schema.key_column_usage kcu | |
WHERE kcu.table_name = tbl.table_name | |
AND kcu.table_schema = tbl.table_schema) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"service": { | |
"id": "0DD4A483-AFD6-4866-ABF9-9FC5A50A2AE7", | |
"name": "serviceA", | |
"port": 8080, | |
"address": "10.0.1.151", | |
"connect": { | |
"sidecar_service": { | |
"name": "serviceA-proxy", | |
"proxy": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"service": { | |
"name": "serviceA", | |
"port": 8080, | |
"connect": { "sidecar_service": {} } | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"name": "${service_name}", | |
"image": "${service_image}", | |
"essential": true, | |
"portMappings": [{"containerPort": 8080}], | |
"healthCheck": { | |
"command": ["CMD-SHELL","curl -f http://localhost:8080/health || exit 1"], | |
"interval": 15, | |
"retries": 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Kind = "proxy-defaults" | |
Name = "global" | |
Config { | |
local_connect_timeout_ms = 1000 | |
handshake_timeout_ms = 10000 | |
protocol = "http" | |
bind_address = "0.0.0.0" | |
bind_port = 21000 | |
envoy_stats_flush_interval = "60s" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Kind = "proxy-defaults" | |
Name = "global" | |
Config { | |
local_connect_timeout_ms = 1000 | |
handshake_timeout_ms = 10000 | |
protocol = "http" | |
bind_address = "0.0.0.0" | |
bind_port = 21000 | |
envoy_stats_flush_interval = "60s" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global: | |
scrape_interval: 10s | |
external_labels: | |
Environment: sandbox | |
Region: eu-west-1 | |
Source: prometheus | |
scrape_configs: | |
- job_name: consul-services | |
metrics_path: "/metrics" |