Package: gitlab
Version: 13.4.7-1~fto10+1
Followup-For: Bug #901379

Dear Maintainer,

attached you find a patch, that checks whether the configured database
host is "localhost".
The initialization procedure (which works only locally, at the moment)
is only executed if this check succeeds.

The proper solution would probably be to use a rake/rails tool for
sending the database initialization script (structure.sql), but this
does not seem to be possible at the momemnt (according to an IRC
discussion on #debian-gitlab).

Cheers,
Lars
--- /usr/lib/gitlab/scripts/rake-tasks.sh.orig  2020-12-12 19:27:28.938197472 
+0100
+++ /usr/lib/gitlab/scripts/rake-tasks.sh       2020-12-12 19:11:29.465932077 
+0100
@@ -13,8 +13,11 @@
 runuser -u ${gitlab_user} -- sh -c '/usr/bin/bundle install --local'
 
 # Check if the db is already present
+db_host=$(sed -n '/^production:$/,/^$/p' /etc/gitlab/database.yml | grep 
"host:" | awk '{print $2}')
 db_relations="$(LANG=C runuser -u postgres -- sh -c "psql gitlab_production -c 
\"\d\"" 2>&1)"
-if [ "$db_relations" = "No relations found." ] || \
+if [ -n "$db_host" ] && [ "$db_host" != "localhost" ]; then
+  echo "gitlab_production database is remote ($db_host), assuming it is 
already initialized"
+elif [ "$db_relations" = "No relations found." ] || \
   [ "$db_relations" = "Did not find any relations." ]; then
   echo "Initializing database..."
   test -f ${gitlab_home}/db/structure.sql || \

Reply via email to