You are not logged in.
I'm trying to install GitLab, and am getting an error on the step to initialize the database:
/usr/share/webapps/gitlab $ sudo -u gitlab $(cat environment | xargs) bundle exec rake gitlab:setup
This will create the necessary database tables and seed the database.
You will lose any previous data stored in the database.
Do you want to continue (yes/no)? yes
Database 'gitlabhq_production' does not exist
FATAL: no pg_hba.conf entry for host "[local]", user "gitlab", database "postgres", SSL off
Couldn't create 'gitlabhq_production' database. Please check your configuration.
rake aborted!
ActiveRecord::NoDatabaseError: FATAL: no pg_hba.conf entry for host "[local]", user "gitlab", database "postgres", SSL offwhen I run "psql -l" I get the following:
[postgres@hostname ~]$ psql -l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
---------------------+----------+----------+-------------+-------------+-----------------------
gitlab_db | gitlab | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
gitlabhq_production | gitlab | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(5 rows)I had originally attempted to use the database name gitlab_db, with the "database: " line in "/etc/webapps/gitlab/database.yml" altered accordingly. I was getting a similar error, so I added a database with the "official" name "gitlabhq_production" and reverted "database.yml", but it didn't fix my error.
I've tried a few different things in "pg_hba.conf" regarding database permissions, but none have worked so far. Here are my current permissions lines:
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
# local all all trust
local all postgres peer
# local all root trust
local gitlab_db gitlab trust
local gitlabhq_production gitlab trustAny input or ideas on how I might fix the error?
Last edited by bbus (2021-03-19 06:53:25)
Offline
FATAL: no pg_hba.conf entry for host "[local]", user "gitlab", database "postgres", SSL off
Is that the *exact*, verbatim error? Because there should be no brackets [] in that error message. It sounds like you have a typo in the GitLab installer configs.
Offline
Yeah, I copied it straight from the terminal.
Combing through the configs, I have a couple of questions:
resque.yml has "url: unix:/run/redis/redis.sock" (i.e. one forward slash after unix:)
puma.rb has "bind 'unix:///run/gitlab/gitlab.socket'" (i.e. three slashes after unix:)
It seems the difference may be a language thing, ruby (I presume that's what the *.rb means) may need the extra two slashes, and whatever parses the yaml file doesn't?
Next, the wiki says to "not worry about configuring the other databases listed in /etc/webapps/gitlab/database.yml",
so I commented out the rest of the file (i.e. the "development", "staging", and "test" sections).
Should I also comment out the "development" and "test" sections at the bottom of gitlab.yml? Further, should I also comment the same sections of resque.yml?
Edit:
Another piece is that gitlab.yml references a "/var/lib/gitlab/.gitlab_workhorse_secret".
I do not have that file, and the wiki doesn't mention it. Is it auto generated?
Additionally, the "HTTPS/SSL" section mentions to "modify /etc/webapps/gitlab/shell.yml". I also don't have this file. Does it get generated with the step that initializes the database?
Last edited by bbus (2021-03-18 16:08:45)
Offline
According to https://dba.stackexchange.com/questions … ostgres-ss the square brackets indicate it is connecting via socket.
I was finally able to get the "gitlab:setup" command to complete successfully, but only after changing the pg_hba.conf to "trust" all connections for all local users.
So this turns into a question about how to properly limit the permissions of the GitLab database via PostgreSQL.
Should I open a new topic for that?
Last edited by bbus (2021-03-19 06:52:09)
Offline
I was finally able to get the "gitlab:setup" command to complete successfully
Just a reminder - please update the wiki page with your finding. If the wiki instructions contain inaccuracies please fix it as well.
Read it before posting http://www.catb.org/esr/faqs/smart-questions.html
Ruby gems repository done right https://bbs.archlinux.org/viewtopic.php?id=182729
Fast initramfs generator with security in mind https://wiki.archlinux.org/index.php/Booster
Offline
Yes, I intend to get to that this weekend.
I'll also open a new topic focusing on initializing GitLab with restricted PostgreSQL permissions. I'll post it in the "networking, server, and protection" forum, referencing this issue. Hopefully the mods don't deem it too newbie, moving it back. I believe my pg_hba.conf was correct for what I wanted to do.
Meanwhile, I'll mark this solved. I appreciate your guidance in helping me dig into a few specific things I hadn't focused on yet.
Offline