environment/lib/setup/postgresql.rb

40 lines
889 B
Ruby
Raw Normal View History

2025-08-06 16:50:03 +02:00
module Setup
require_relative '../templates'
2025-08-07 16:29:11 +02:00
require_relative "../user"
require_relative "../execute"
2025-08-07 14:23:42 +02:00
# dat execute postgres
# example.rcp
2025-08-06 16:50:03 +02:00
module PostgreSQL
extend Templates
2025-08-07 13:02:01 +02:00
2025-08-06 16:50:03 +02:00
# attr_accessor :te
2025-08-07 14:23:42 +02:00
def self.init_db(context)
2025-08-07 13:02:01 +02:00
system(" -D /opt/pgsql/16/data")
end
2025-08-06 16:50:03 +02:00
2025-08-07 14:23:42 +02:00
def self.install(context)
# puts context.bin_dir
#make_config
# pg_hba = render("pg_hba.conf")
#
# # test = render("test", te: "This is a test string")
# posgresql_conf = render("postgresql")
2025-08-07 13:02:01 +02:00
service = render(
"postgresql.service",
2025-08-07 14:23:42 +02:00
postgres_bin: File.join(context.bin_dir, "/bin/postgres"),
version: context.version,
database_dir: context.data_dir
2025-08-07 13:02:01 +02:00
)
2025-08-07 16:29:11 +02:00
# puts service
2025-08-07 14:23:42 +02:00
2025-08-07 16:29:11 +02:00
user_context = Execute::UserInstallContext.new(context.user_name, :service)
User.install(user_context)
2025-08-06 16:50:03 +02:00
end
end
end