1

I am running the latest version of the GitLab CE Omnibus package on CentOS 7. On that same machine I have other Postgres database running. I seem to be unable to change the port of the in-build Postgres instance to 5433, for example.

I have added the two following lines to the /еtc/gitlab/gitlab.rb

postgresql['enable'] = true
postgresql['port'] = 5433

And I have executed the following commands:

# gitlab-ctl reconfigure
# gitlab-rake gitlab:setup

The second of which fails with the following error:

Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "database"=>"gitlabhq_production", "pool"=>10, "username"=>"gitlab", "password"=>nil, "host"=>nil, "port"=>5433, "socket"=>nil}
-- enable_extension("plpgsql")
rake aborted!
PG::Error: 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.5433"?
3
  • I don't use gitlab, but I'd expect /etc/gitlab/gitlab/rb to tell gitlab where PostgreSQL was configured to listen. I wouldn't expect that file to configure PostgreSQL. To tell PostgreSQL where to listen, change postgresql.conf. Commented Apr 4, 2015 at 11:00
  • That's why there is the option postgresql['enable'] = true, it specifies that gitlab should use its own Postgres installation. Commented Apr 4, 2015 at 11:03
  • I read the installation docs. What I see there isn't gitlab's own PostgreSQL installation; it's just a normal PostgreSQL installation. Find the postgresql.conf file, change the port setting, and restart PostgreSQL. Review Connections and Authentication (it's a little tricky if you don't admin PostgreSQL all the time). Commented Apr 4, 2015 at 11:17

1 Answer 1

2

I don't use gitlab, so I looked over the installation docs. GitLab doesn't have "its own" PostgreSQL installation. It uses a standard install (a package-based install) for PostgreSQL.

sudo apt-get install -y postgresql postgresql-client libpq-dev

So you could approach your problem in two different ways. Since you already have PostgreSQL installed and running on port 5432 (?), you could just configure GitLab to use that instance.

Or you could set up your new installation of PostgreSQL to listen on port 5433 (set in postgresql.conf), and configure GitLab to use that instance.

Regardless of which way you go, you have to get the listening configuration (PostgreSQL) and the talking configuration (GitLab) to match, and you have to get them both to agree on authentication. PostgreSQL controls authentication through the configuration file pg_hba.conf. Ruby on Rails controls authentication through the configuration file database.yml. I presume GitLab uses some combination of database.yml and gitlab.rb, but I'm not sure about that.

Both PostgreSQL and Rails write log viles that you'll find useful in tracking down the root cause of error messages. PostgreSQL settings are in postgresql.conf (search for "ERROR REPORTING"). The default log file is /var/log/postgresql/postgresql-9.4-main.log for version 9.4 under Ubuntu Linux; CentOS might use a different directory. Rails writes to the project's log/ directory (same level as app, config, test, etc.)

Sign up to request clarification or add additional context in comments.

3 Comments

Well, that is the other solution that I was reluctant to get involved into, although it might be better so. Thing is too many ways of configuring seem to be available. Using /еtc/gitlab/gitlab.rb file is one of them, and I continue to maintain that the there is a PostgreSql database in the GitLab bundle, simply because it is version 9.3 and mine is 9.4. I think I have sorted it out my way. You only had to restart the bundled database instance with the command gitlab-ctl restart and the run gitlab-rake gitlab:setup as well. This time it finds its own database instance with it created.
I'm sure there's a version of PostgreSQL in the GitLab Omnibus package. I'm just saying that version isn't "its own" version. It's a standard package-based install of PostgreSQL. (According to the docs, at least.) Any other software on your computer that can access PostgreSQL can be configured to access it, create new databases in it, etc. There are a number of settings that have to match up (host--different for tcp connections and for unix sockets--port, database name, user name, password, each of which varies in the three default Rails environments), but that's par for the course.
Yeap, you are correct, I and already knew that. However GitLab does not install any PostgreSQL package from yum out of the box. I double and triple checked that on a fresh CentOS7 installation with no custom software installed, except for GitLab, of course. Thank you very much, anyway.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.