more settings of systemd for postgress

This commit is contained in:
Artur Gurgul1 2025-08-07 21:05:37 +02:00
parent 688d23527f
commit dd1c82e804
5 changed files with 35 additions and 19 deletions

View file

@ -1,17 +1,19 @@
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'
#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'
unix_socket_directories = '<%= unix_socket %>'
password_encryption = scram-sha-256
ssl = on
## TODO Add support for ssl
#ssl = on
#ssl_ca_file = ''
ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem'
#ssl_crl_file = ''
@ -36,7 +38,7 @@ log_line_prefix = '%m [%p] %q%u@%d '
log_timezone = 'Etc/UTC'
cluster_name = '15/main'
#cluster_name = '15/main'
datestyle = 'iso, mdy'
timezone = 'Etc/UTC'
@ -48,5 +50,5 @@ lc_time = 'C.UTF-8'
default_text_search_config = 'pg_catalog.english'
# include files ending in '.conf' from
include_dir = 'conf.d'
# include_dir = 'conf.d'

View file

@ -3,12 +3,17 @@ Description=PostgreSQL <%= version %>
After=network.target
[Service]
Type=notify
# Type=notify
Type=simple
User=postgresql
Group=servicesql
Group=services
ExecStart=<%= postgres_bin %> -D <%= database_dir %>
StandardOutput=journal
StandardError=journal
ExecStart=<%= postgres_bin %> -D <%= database_dir %>/data
ExecReload=/bin/kill -HUP $MAINPID
KillMode=mixed
TimeoutSec=300
@ -16,8 +21,10 @@ Restart=on-failure
NotifyAccess=all
# Security
ProtectSystem=full
ProtectHome=true
#ProtectSystem=full
#ProtectHome=true
#ReadWritePaths=<%= database_dir %>
PrivateTmp=true
NoNewPrivileges=true