add postgresql
This commit is contained in:
parent
953985a3ea
commit
2578cd7a6d
10 changed files with 164 additions and 2 deletions
|
@ -33,7 +33,20 @@ require("lazy").setup({
|
||||||
{ "hrsh7th/vim-vsnip" },
|
{ "hrsh7th/vim-vsnip" },
|
||||||
|
|
||||||
-- Treesitter
|
-- Treesitter
|
||||||
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" },
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
build = ":TSUpdate",
|
||||||
|
config = function()
|
||||||
|
require("nvim-treesitter.configs").setup({
|
||||||
|
ensure_installed = { "ruby", "lua", "vim", "bash", "json" }, -- include ruby
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
additional_vim_regex_highlighting = false,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
-- Appearance
|
-- Appearance
|
||||||
{ "tomasiser/vim-code-dark" },
|
{ "tomasiser/vim-code-dark" },
|
||||||
|
|
|
@ -26,4 +26,4 @@ server {
|
||||||
ssl_certificate_key /etc/letsencrypt/live/<%= domain %>/privkey.pem;
|
ssl_certificate_key /etc/letsencrypt/live/<%= domain %>/privkey.pem;
|
||||||
include /etc/letsencrypt/options-ssl-nginx.conf;
|
include /etc/letsencrypt/options-ssl-nginx.conf;
|
||||||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
||||||
}
|
}
|
||||||
|
|
2
lib/data/templates/postgresql/pg_hba.conf.erb
Normal file
2
lib/data/templates/postgresql/pg_hba.conf.erb
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
local all all peer
|
||||||
|
hostssl all all 0.0.0.0/0 scram-sha-256
|
52
lib/data/templates/postgresql/postgresql.conf.erb
Normal file
52
lib/data/templates/postgresql/postgresql.conf.erb
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
|
||||||
|
data_directory = '/var/lib/postgresql/15/main'
|
||||||
|
hba_file = '/etc/postgresql/15/main/pg_hba.conf'
|
||||||
|
ident_file = '/etc/postgresql/15/main/pg_ident.conf'
|
||||||
|
|
||||||
|
|
||||||
|
#listen_addresses = 'localhost'
|
||||||
|
listen_addresses = '*'
|
||||||
|
port = 5432
|
||||||
|
max_connections = 100
|
||||||
|
unix_socket_directories = '/var/run/postgresql'
|
||||||
|
password_encryption = scram-sha-256
|
||||||
|
|
||||||
|
ssl = on
|
||||||
|
#ssl_ca_file = ''
|
||||||
|
ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem'
|
||||||
|
#ssl_crl_file = ''
|
||||||
|
#ssl_crl_dir = ''
|
||||||
|
ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key'
|
||||||
|
#ssl_ciphers = 'HIGH:MEDIUM:+3DES:!aNULL' # allowed SSL ciphers
|
||||||
|
#ssl_prefer_server_ciphers = on
|
||||||
|
#ssl_ecdh_curve = 'prime256v1'
|
||||||
|
#ssl_min_protocol_version = 'TLSv1.2'
|
||||||
|
#ssl_max_protocol_version = ''
|
||||||
|
#ssl_dh_params_file = ''
|
||||||
|
#ssl_passphrase_command = ''
|
||||||
|
#ssl_passphrase_command_supports_reload = off
|
||||||
|
|
||||||
|
shared_buffers = 128MB
|
||||||
|
dynamic_shared_memory_type = posix # the default is usually the first option
|
||||||
|
|
||||||
|
max_wal_size = 1GB
|
||||||
|
min_wal_size = 80MB
|
||||||
|
|
||||||
|
log_line_prefix = '%m [%p] %q%u@%d '
|
||||||
|
log_timezone = 'Etc/UTC'
|
||||||
|
|
||||||
|
|
||||||
|
cluster_name = '15/main'
|
||||||
|
|
||||||
|
datestyle = 'iso, mdy'
|
||||||
|
timezone = 'Etc/UTC'
|
||||||
|
lc_messages = 'C.UTF-8'
|
||||||
|
lc_monetary = 'C.UTF-8'
|
||||||
|
lc_numeric = 'C.UTF-8'
|
||||||
|
lc_time = 'C.UTF-8'
|
||||||
|
|
||||||
|
default_text_search_config = 'pg_catalog.english'
|
||||||
|
|
||||||
|
# include files ending in '.conf' from
|
||||||
|
include_dir = 'conf.d'
|
||||||
|
|
4
lib/data/templates/postgresql/test.erb
Normal file
4
lib/data/templates/postgresql/test.erb
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<%= te %>
|
23
lib/setup/postgresql.rb
Normal file
23
lib/setup/postgresql.rb
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
|
||||||
|
module Setup
|
||||||
|
require_relative '../templates'
|
||||||
|
|
||||||
|
module PostgreSQL
|
||||||
|
extend Templates
|
||||||
|
|
||||||
|
# attr_accessor :te
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def self.make_config
|
||||||
|
pg_hba = render("pg_hba.conf")
|
||||||
|
|
||||||
|
test = render("test", te: "This is a test string")
|
||||||
|
puts test
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.install
|
||||||
|
make_config
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
20
lib/templates.rb
Normal file
20
lib/templates.rb
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
require 'erb'
|
||||||
|
|
||||||
|
module Templates
|
||||||
|
def render(name, locals = {})
|
||||||
|
# caller_module = Module.nesting.first.to_s.split('::').last&.downcase || 'common'
|
||||||
|
caller_file = caller_locations(1, 1)[0].absolute_path
|
||||||
|
inferred_dir = File.basename(caller_file).sub(/^install-/, '').sub(/\.rb$/, '')
|
||||||
|
puts "caller name: #{inferred_dir}"
|
||||||
|
|
||||||
|
template_path = File.join(__dir__, 'data', 'templates', inferred_dir, "#{name}.erb")
|
||||||
|
template = File.read(template_path)
|
||||||
|
erb = ERB.new(template)
|
||||||
|
|
||||||
|
# erb.result(binding)
|
||||||
|
|
||||||
|
context = Struct.new(*locals.keys).new(*locals.values)
|
||||||
|
erb.result(context.instance_eval { binding })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
|
|
||||||
|
service:
|
||||||
|
name: forgejo
|
||||||
|
|
||||||
archive:
|
archive:
|
||||||
url: https://codeberg.org/forgejo/forgejo/releases/download/v12.0.1/forgejo-12.0.1-linux-amd64.xz
|
url: https://codeberg.org/forgejo/forgejo/releases/download/v12.0.1/forgejo-12.0.1-linux-amd64.xz
|
||||||
|
|
||||||
|
|
24
recipes/postgresql/debian-setup.yml
Normal file
24
recipes/postgresql/debian-setup.yml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
environment:
|
||||||
|
PG_DOMAIN: gurgul.org
|
||||||
|
|
||||||
|
|
||||||
|
packages:
|
||||||
|
- postgresql
|
||||||
|
- postgresql-contrib
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- $SUDO systemctl enable postgresql
|
||||||
|
- $SUDO systemctl start postgresql
|
||||||
|
# Installing certificates
|
||||||
|
- $SUDO mkdir /etc/postgresql/ssl
|
||||||
|
- $SUDO cp /etc/letsencrypt/live/$PG_DOMAIN/fullchain.pem /etc/postgresql/ssl/server.crt
|
||||||
|
- $SUDO cp /etc/letsencrypt/live/$PG_DOMAIN/privkey.pem /etc/postgresql/ssl/server.key
|
||||||
|
- $SUDO chown postgres:postgres /etc/postgresql/ssl/server.*
|
||||||
|
- $SUDO chmod 600 /etc/postgresql/ssl/server.key
|
||||||
|
|
||||||
|
|
||||||
|
actions:
|
||||||
|
# dat action postgresql:add-user -u user
|
||||||
|
add-user:
|
||||||
|
- sudo -u postgres createuser --no-superuser --no-createdb --no-createrole $DB_USER
|
||||||
|
- sudo -u postgres createdb -O $DB_USER $DB_USER
|
21
recipes/postgresql/debian.yml
Normal file
21
recipes/postgresql/debian.yml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
packages:
|
||||||
|
- build-essential
|
||||||
|
- libreadline-dev
|
||||||
|
- zlib1g-dev
|
||||||
|
- flex
|
||||||
|
- bison
|
||||||
|
- libssl-dev
|
||||||
|
- libxml2-dev
|
||||||
|
- libxslt1-dev
|
||||||
|
- libpam0g-dev
|
||||||
|
- libedit-dev
|
||||||
|
|
||||||
|
repository:
|
||||||
|
url: https://github.com/postgres/postgres.git
|
||||||
|
branch: REL_17_5
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- ./configure --prefix=$PREFIX
|
||||||
|
- make -j$CPUS
|
||||||
|
- make install
|
Loading…
Add table
Add a link
Reference in a new issue