From c14824d95d1859eeb4d2615cfecc3d48992bf434 Mon Sep 17 00:00:00 2001 From: JJGadgets Date: Wed, 4 Sep 2024 14:04:20 +0800 Subject: [PATCH] fix(pg): pgBackRest SNI while reducing DNS queries --- dots/nvim/init.lua | 112 +++++++++++------- dots/nvim/lazy-lock.json | 22 ++-- .../core/db/pg/clusters/template/crunchy.yaml | 11 +- 3 files changed, 85 insertions(+), 60 deletions(-) diff --git a/dots/nvim/init.lua b/dots/nvim/init.lua index 901998e8..6f84e90e 100644 --- a/dots/nvim/init.lua +++ b/dots/nvim/init.lua @@ -1,3 +1,30 @@ +-- Vim setup here +--- Basic highly and backwards compatible plugin-less vimrc, including leader mappings for Lazy +vim.cmd("source ~/.vimrc") + +--- Clipboard via OSC 52 +local function normalPaste() -- restore non-OSC 52 paste + return { + vim.fn.split(vim.fn.getreg(""), "\n"), + vim.fn.getregtype(""), + } +end +vim.o.clipboard = "unnamedplus" +vim.g.clipboard = { + name = 'OSC 52', + cache_enabled = 1, + copy = { + ['+'] = require('vim.ui.clipboard.osc52').copy('+'), + ['*'] = require('vim.ui.clipboard.osc52').copy('*'), + }, + paste = { + --['+'] = require('vim.ui.clipboard.osc52').paste('+'), + --['*'] = require('vim.ui.clipboard.osc52').paste('*'), + ['+'] = normalPaste, + ['*'] = normalPaste, + }, +} + -- Bootstrap lazy.nvim (https://github.com/folke/lazy.nvim/blob/09d4f0db23d0391760c9e1a0501e95e21678c11a/docs/installation.mdx?plain=1#L100-L144) local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not (vim.uv or vim.loop).fs_stat(lazypath) then @@ -15,42 +42,19 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then end vim.opt.rtp:prepend(lazypath) --- Vim setup here --- Basic highly and backwards compatible plugin-less vimrc, including leader mappings for Lazy -vim.cmd("source ~/.vimrc") - --- Clipboard via OSC 52 -local function normalPaste() -- restore non-OSC 52 paste - return { - vim.fn.split(vim.fn.getreg(""), "\n"), - vim.fn.getregtype(""), - } -end -vim.o.clipboard = "unnamedplus" -vim.g.clipboard = { - name = 'OSC 52', - copy = { - ['+'] = require('vim.ui.clipboard.osc52').copy('+'), - ['*'] = require('vim.ui.clipboard.osc52').copy('*'), - }, - paste = { - --['+'] = require('vim.ui.clipboard.osc52').paste('+'), - --['*'] = require('vim.ui.clipboard.osc52').paste('*'), - ['+'] = normalPaste, - ['*'] = normalPaste, - }, - cache_enabled = 1, -} - -- Setup lazy.nvim require("lazy").setup({ + -- default to latest stable semver + --defaults = { version = "*" }, + -- check updates but don't notify + checker = { enabled = true, notify = false }, + -- # Plugins spec = { - -- # Plugins - -- colorscheme + --- colorscheme { "folke/tokyonight.nvim", lazy = false, priority = 1000, opts = { style = "night" }, config = function() vim.cmd([[colorscheme tokyonight-night]]); end, }, --- on-screen key prompts { "folke/which-key.nvim", event = "VeryLazy", opts = {} }, - -- rainbow indents + --- rainbow indents { "HiPhish/rainbow-delimiters.nvim", event = { "BufReadPre", "BufNewFile" }, }, { "lukas-reineke/indent-blankline.nvim", event = { "BufReadPre", "BufNewFile" }, @@ -72,9 +76,9 @@ require("lazy").setup({ current_line_blame = true, watch_gitdir = { follow_files = true }, }}, - -- notifications + --- notifications { "rcarriga/nvim-notify", event = "VeryLazy", opts = { stages = "static", render = "compact" } }, -- any animations will cause lag over remote connections, especially SSH via iSH on iOS - -- UI stuff + --- UI stuff --{ "folke/noice.nvim", -- dependencies = { "MunifTanjim/nui.nvim", "rcarriga/nvim-notify", }, -- event = "VeryLazy", @@ -88,33 +92,36 @@ require("lazy").setup({ -- }, -- }, --}, - -- TreeSitter + --- TreeSitter { "nvim-treesitter/nvim-treesitter", --branch = "master", - event = "VeryLazy", + event = "VeryLazy", -- causes syntax highlighting to be weird build = ":TSUpdate", config = function() require("nvim-treesitter.configs").setup({ - ensure_installed = { "c", "lua", "vim", "vimdoc", "yaml", "go", "dockerfile", "fish", "bash", "python", "javascript", "typescript", "html", "css" }, + ensure_installed = { "c", "lua", "vim", "vimdoc", "yaml", "go", "dockerfile", "fish", "bash", "python", "javascript", "typescript", "html", "css", "nix" }, --ensure_installed = 'all', ignore_install = { 'org' }, -- nvim-orgmode compatibility sync_install = false, - highlight = { enable = true }, + highlight = { + enable = true, + --disable = { "yaml", }, + }, indent = { enable = true }, }) end }, - -- telescope + --- telescope { "nvim-telescope/telescope.nvim", event = "VeryLazy", }, - -- auto brackets + --- auto brackets { 'windwp/nvim-autopairs', event = "InsertEnter", opts = {}, }, - ---- folding + --- folding { "kevinhwang91/nvim-ufo", dependencies = { "kevinhwang91/promise-async" }, event = { "BufReadPre", "BufNewFile" }, opts = { provider_selector = function(bufnr, filetype, buftype) return { "treesitter", "indent" } -- LSP takes too long to init end }}, - -- Autocomplete + --- Autocomplete { "hrsh7th/nvim-cmp", version = false, -- last release is way too old event = "InsertEnter", @@ -185,7 +192,7 @@ require("lazy").setup({ { "Dosx001/cmp-commit", ft = "gitcommit", }, { "petertriho/cmp-git", ft = "gitcommit", }, { "ray-x/lsp_signature.nvim", event = "VeryLazy", opts = {}, }, - -- LSP + --- LSP { "williamboman/mason.nvim", lazy = true }, { "williamboman/mason-lspconfig.nvim", lazy = true, opts = { automatic_installation = true } }, { "b0o/schemastore.nvim", lazy = true }, @@ -200,6 +207,19 @@ require("lazy").setup({ require("telescope").load_extension("yaml_schema") end, }, + --{ "cenk1cenk2/schema-companion.nvim", + -- dependencies = { "nvim-lua/plenary.nvim", "nvim-telescope/telescope.nvim" }, + -- ft = "yaml", + -- --opts = { + -- config = function() + -- require("schema-companion").setup({ + -- enable_telescope = true, + -- matchers = { + -- require("schema-companion.matchers.kubernetes").setup({ version = "v1.30.1" }), + -- }, + -- }) + -- end + --}, { "neovim/nvim-lspconfig", event = { "FileType" }, -- run lspconfig setup outside lazy stuff @@ -224,9 +244,12 @@ require("lazy").setup({ { name = 'Kubernetes.nvim', --description = 'Kubernetes schemas extracted from cluster by kubernetes.nvim', + --fileMatch = 'kube*/*.yaml', + --url = "https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.30.1/all.json", + --fileMatch = { 'kube/clusters/*/flux/*.yaml', 'kube/clusters/*/config/*.yaml', 'k8s/*.yaml', 'kubernetes/*.yaml', '/tmp/kubectl-edit*.yaml', }, + --url = vim.fn.stdpath("data") .. "/kubernetes.nvim/schema.json", fileMatch = '*.yaml', url = kubernetes_nvim_load(), - --fileMatch = { 'kube/*.yaml', 'k8s/*.yaml', 'kubernetes/*.yaml', '/tmp/kubectl-edit*.yaml', }, }, { name = 'Flux Kustomization', @@ -308,6 +331,7 @@ require("lazy").setup({ -- Run LSP server setup -- IMPORTANT: if the return of the args passed to setup has a parent {}, use `setup(arg)` where `arg = {...}` so the result is `setup{...}`, rather than `setup{arg}` which becomes `setup{{...}}` if vim.bo.filetype == "yaml" then lsp.yamlls.setup( require("yaml-companion").setup { builtin_matchers = { kubernetes = { enabled = true }, }, lspconfig = yamlls_config, schemas = yamlCompanionSchemas() } ); end + --if vim.bo.filetype == "yaml" then lsp.yamlls.setup( require("schema-companion").setup_client(yamlls_config) ); end lsp.taplo.setup { capabilities = caps(), settings = { evenBetterToml = { schema = { associations = { ['^\\.mise\\.toml$'] = 'https://mise.jdx.dev/schema/mise.json', }}}}} @@ -331,6 +355,7 @@ require("lazy").setup({ if vim.fn.executable('go') == 1 then lsp.gopls.setup{capabilities = caps(),} end lsp.tsserver.setup{capabilities = caps(),} lsp.pyright.setup{capabilities = caps(),} + lsp.nil_ls.setup{capabilities = caps(),} end }, -- Org @@ -346,9 +371,6 @@ require("lazy").setup({ { "akinsho/org-bullets.nvim", ft = { "org" }, opts = {} }, { "lukas-reineke/headlines.nvim", ft = { "org" }, opts = {} }, -- uses treesitter }, - checker = { enabled = true, notify = false }, - -- default to latest stable semver - --defaults = { version = "*" }, }) -- start rainbow_delimiters diff --git a/dots/nvim/lazy-lock.json b/dots/nvim/lazy-lock.json index fe8e32ef..463a4cec 100644 --- a/dots/nvim/lazy-lock.json +++ b/dots/nvim/lazy-lock.json @@ -10,26 +10,26 @@ "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "gitsigns.nvim": { "branch": "main", "commit": "899e993850084ea33d001ec229d237bc020c19ae" }, - "headlines.nvim": { "branch": "master", "commit": "618ef1b2502c565c82254ef7d5b04402194d9ce3" }, - "indent-blankline.nvim": { "branch": "master", "commit": "db926997af951da38e5004ec7b9fbdc480b48f5d" }, + "headlines.nvim": { "branch": "master", "commit": "7671eec1065982cdf2ba4136beb1600fe1279431" }, + "indent-blankline.nvim": { "branch": "master", "commit": "18603eb949eba08300799f64027af11ef922283f" }, "indent-rainbowline.nvim": { "branch": "master", "commit": "4977a9735583f13d5c1114f373342745dd35b3b4" }, "kubernetes.nvim": { "branch": "main", "commit": "101e63f8f92b2ae9cf6a78560bc2b2321d1264af" }, - "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" }, + "lazy.nvim": { "branch": "main", "commit": "48b52b5cfcf8f88ed0aff8fde573a5cc20b1306d" }, "lsp_signature.nvim": { "branch": "master", "commit": "a38da0a61c172bb59e34befc12efe48359884793" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "482350b050bd413931c2cdd4857443c3da7d57cb" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, - "nvim-autopairs": { "branch": "master", "commit": "19606af7c039271d5aa96bceff101e7523af3136" }, + "nvim-autopairs": { "branch": "master", "commit": "fd2badc24e675f947162a16c124d395bde80dbd6" }, "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, - "nvim-lspconfig": { "branch": "master", "commit": "3ad562700d0615818bf358268ac8914f6ce2b079" }, + "nvim-lspconfig": { "branch": "master", "commit": "0ef64599b8aa0187ee5f6d92cb39c951f348f041" }, "nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" }, - "nvim-treesitter": { "branch": "master", "commit": "64cc1ef764a0b137a642d05cacdfe1126124fb35" }, - "nvim-ufo": { "branch": "main", "commit": "b23a46aa06f5f653d107efbc67fd2aa3877ac344" }, - "org-bullets.nvim": { "branch": "main", "commit": "ab8e1d860d61239c4fe187ead15f73bb2561acd1" }, - "orgmode": { "branch": "master", "commit": "c6bdb070a97daab5e405ab7ba2fe35c5bb61c838" }, + "nvim-treesitter": { "branch": "master", "commit": "5b8b126de02ebfd92e46ed5986b3e58e870b85de" }, + "nvim-ufo": { "branch": "main", "commit": "5525f422d48f570262611ae2b6aa562c1c428bc5" }, + "org-bullets.nvim": { "branch": "main", "commit": "46ae687e22192fb806b5977d664ec98af9cf74f6" }, + "orgmode": { "branch": "master", "commit": "e3500add486b17da58ce8e42a0f799161e5761c9" }, "plenary.nvim": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" }, "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, - "rainbow-delimiters.nvim": { "branch": "master", "commit": "bb48714623a4fae73c42e4b318b4587464111769" }, - "schemastore.nvim": { "branch": "main", "commit": "6d3ba6ad250538446b2727e352e15a425d6692ef" }, + "rainbow-delimiters.nvim": { "branch": "master", "commit": "5f73b24aeb94f5274c218955573153c69ce4d1ee" }, + "schemastore.nvim": { "branch": "main", "commit": "c97985bbe5a0988767216f9b54a8e05d70ce8505" }, "telescope.nvim": { "branch": "master", "commit": "5972437de807c3bc101565175da66a1aa4f8707a" }, "tokyonight.nvim": { "branch": "main", "commit": "4b386e66a9599057587c30538d5e6192e3d1c181" }, "which-key.nvim": { "branch": "main", "commit": "bfec3d6bc0a9b0b2cb11644642f78c2c3915eef0" }, diff --git a/kube/deploy/core/db/pg/clusters/template/crunchy.yaml b/kube/deploy/core/db/pg/clusters/template/crunchy.yaml index 920a77a6..928f0cd6 100644 --- a/kube/deploy/core/db/pg/clusters/template/crunchy.yaml +++ b/kube/deploy/core/db/pg/clusters/template/crunchy.yaml @@ -65,15 +65,17 @@ spec: archive-timeout: "60" compress-type: "bz2" compress-level: "9" + repo1-storage-host: "${APP_DNS_MINIO_NAS_S3}." repo1-bundle: "y" repo1-block: "y" repo1-retention-full-type: "time" repo1-retention-full: "15" # keep 2 weeks of backups - repo1-retention-diff-type: "time" + #repo1-retention-diff-type: "time" repo1-retention-diff: "7" #repo1-path: "/pgbackrest/repo1/${PG_APP_NAME}" # NFS repo1-path: "/${PG_APP_NAME}" repo1-s3-uri-style: "path" + repo2-storage-host: "${SECRET_PGBACKREST_WAL_R2_ENDPOINT}." repo2-bundle: "y" repo2-block: "y" repo2-path: "/${PG_APP_NAME}" @@ -81,6 +83,7 @@ spec: repo2-retention-full-type: "time" repo2-retention-full: "15" # keep 2 weeks of backups repo2-cipher-type: "aes-256-cbc" + repo3-storage-host: "${APP_DNS_RGW_HTTPS}." repo3-bundle: "y" repo3-block: "y" repo3-s3-uri-style: "path" @@ -93,7 +96,7 @@ spec: repos: - name: "repo3" # Ceph RGW in-cluster s3: &rgw - endpoint: "${APP_DNS_RGW_HTTPS}." # trailing dot to prevent ndots + endpoint: "${APP_DNS_RGW_HTTPS}" # trailing dot to prevent ndots bucket: "pg-${PG_APP_NAME}" region: "us-east-1" schedules: # times staggered to avoid NFS schedule causing failed jobs due to locks @@ -102,7 +105,7 @@ spec: incremental: "15 1-5,7-23 * * *" # every hour except 06:15 - name: "repo1" # NFS s3: &minio - endpoint: "${APP_DNS_MINIO_NAS_S3}." + endpoint: "${APP_DNS_MINIO_NAS_S3}" bucket: "${SECRET_PGBACKREST_WAL_MINIO_BUCKET}" region: "us-east-1" #volume: &nfs @@ -118,7 +121,7 @@ spec: differential: "0 6 * * 2-6" # every day at 06:00 except Monday - name: "repo2" # Cloudflare R2 s3: &r2 - endpoint: "${SECRET_PGBACKREST_WAL_R2_ENDPOINT}." + endpoint: "${SECRET_PGBACKREST_WAL_R2_ENDPOINT}" bucket: "${SECRET_PGBACKREST_WAL_R2_BUCKET}-${PG_APP_NAME}" region: "us-east-1" schedules: # times staggered to avoid NFS schedule causing failed jobs due to locks