Alan
Alan

Reputation: 3745

chef-server-ctl reconfigure fails after customizing the PostgreSQL port

I'm using Open Source Chef 11.0.10 on Ubuntu 12.04. This is a shared server where PostgreSQL and Apache are already running, so I'm trying to customize the Chef port numbers.

I've created the file /etc/chef-server/chef-server.rb, which contains the lines:

nginx['ssl_port'] = 8443
postgresql['port'] = 5433

When I execute the command:

sudo chef-server-ctl reconfigure

it fails on the line:

execute[/opt/chef-server/embedded/bin/createdb -T template0 -E UTF-8 opscode_chef] action run

and the error message says:

---- Begin output of /opt/chef-server/embedded/bin/createdb -T template0 -E UTF-8 opscode_chef ----
STDOUT:
STDERR: createdb: could not connect to database template1: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
---- End output of /opt/chef-server/embedded/bin/createdb -T template0 -E UTF-8 opscode_chef ----

Now, the Chef instance of PostgreSQL does appear to be running, in addition to the original instance:

$ ps -ef | grep postgresql | grep -v grep
postgres  1000     1  0 09:14 ?        00:00:00 /usr/lib/postgresql/9.1/bin/postgres -D /var/lib/postgresql/9.1/main -c config_file=/etc/postgresql/9.1/main/postgresql.conf
root      4830  4421  0 09:46 ?        00:00:00 runsv postgresql
root      4831  4830  0 09:46 ?        00:00:00 svlogd -tt /var/log/chef-server/postgresql
998       5579  4830  0 09:49 ?        00:00:00 /opt/chef-server/embedded/bin/postgres -D /var/opt/chef-server/postgresql/data

What did I miss?

More details:

I had used the omnibus package to do the initial chef-server install:

https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chef-server_11.0.10-1.ubuntu.12.04_amd64.deb

It failed before completion at the same step with the same error because it's trying to use the default PostgreSQL port, which is already in use.

And the Chef PostgreSQL instance is running:

$ sudo /opt/chef-server/embedded/bin/sv status postgresql
run: postgresql: (pid 5579) 86034s; run: log: (pid 4831) 86158s

Upvotes: 4

Views: 5234

Answers (2)

Sunil Shakya
Sunil Shakya

Reputation: 9447

check postgresql log file

tail -f /var/log/chef-server/postgresql/current

2015-02-28_13:29:01.48646 FATAL: could not create lock file "/tmp/.s.PGSQL.5432.lock": Permission denied 2015-02-28_13:29:02.57961 FATAL: could not create lock file "/tmp/.s.PGSQL.5432.lock": Permission denied 2015-02-28_13:29:02.57961 FATAL: could not create lock file "/tmp/.s.PGSQL.5432.lock": Permission denied

My problem is solve running following command

chmod 777 /tmp

Upvotes: 1

Alan
Alan

Reputation: 3745

I gave up trying to get Chef's PostgreSQL instance configured to use a different port.

Instead, I modified our existing PostgreSQL installation's port number to be 5433 and let Chef's instance use 5432. Now the "chef-server-ctl reconfigure" command completes successfully.

Upvotes: 4

Related Questions