Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot install with a different data directory #699

Open
pg1671 opened this issue Feb 2, 2022 · 0 comments
Open

Cannot install with a different data directory #699

pg1671 opened this issue Feb 2, 2022 · 0 comments

Comments

@pg1671
Copy link

pg1671 commented Feb 2, 2022

👻 Brief Description

Cannot change the default_data_directory. I can update the postgresql.conf file to /data/postgresql but the service running on ubuntu is still using the default location via the -D command.

/usr/lib/postgresql/13/bin/postgres -D /var/lib/postgresql/13/main -c config_file=/etc/postgresql/13/main/postgresql.conf

I think this is because the server needs to be reloaded after the server config is set but when I include the notifies directive on the server config block I get an error.
Chef::Exceptions::ResourceNotFound occurred in Chef Infra Client run: resource postgresql_server_conf[PostgreSQL Config] is configured to notify resource service[postgresql] with action reload, but service[postgresql] cannot be found in the resource collection.

🥞 Cookbook version

Latest 10.0.0

👩‍🍳 Chef-Infra Version

17.8.25

🎩 Platform details

Ubuntu 20.04.3

Steps To Reproduce

Steps to reproduce the behavior, the notifies line causes the error.

postgresql_server_install 'My Postgresql Server install' do
    version node['app']['postgres_version']
    action :install
end

directory "/data/postgresql" do
    owner 'postgres'
    group 'postgres'
    mode 0700                   # Owner only can rwx
    action :create
    recursive true
end

 postgresql_server_conf 'PostgreSQL Config' do
    version node['app']['postgres_version']
    data_directory '/data/postgresql'
    additional_config 'listen_addresses' => '*'
    notifies :reload, 'service[postgresql]'
end

# Create the Database Instance
# moved here after setting config to try to get it to use the overridden data_directory
postgresql_server_install 'My Postgresql Server install' do
    version node['app']['postgres_version']
    password node['app']['postgres_password']
    action :create
end

🚓 Expected behavior

After install the database is created in the new directory and the postgresql service is correctly using the correct data directory via the -D command line option.

➕ Additional context

None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant