From 645c713439078a829295e48d2a08ab73ba61c16b Mon Sep 17 00:00:00 2001 From: Pirate Praveen Date: Sat, 27 Jun 2020 22:49:49 +0530 Subject: [PATCH 1/4] Switch to using structure.sql from schema.rb for database initialization --- debian/gitlab.postinst | 3 --- debian/rake-tasks.sh | 7 ++++--- debian/rules | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/debian/gitlab.postinst b/debian/gitlab.postinst index b770cd0118..26b419fafc 100755 --- a/debian/gitlab.postinst +++ b/debian/gitlab.postinst @@ -129,9 +129,6 @@ case "$1" in # Make yarn.lock writable chown ${gitlab_user}: /var/lib/gitlab/yarn.lock - # Make db/structure.sql writable - chown ${gitlab_user}: /var/lib/gitlab/db/structure.sql - runuser -u ${gitlab_user} -- sh -c "chmod 700 ${gitlab_uploads_path}" runuser -u ${gitlab_user} -- sh -c 'git config --global core.autocrlf "input"' diff --git a/debian/rake-tasks.sh b/debian/rake-tasks.sh index 7520014dcd..17af885b08 100755 --- a/debian/rake-tasks.sh +++ b/debian/rake-tasks.sh @@ -13,13 +13,13 @@ db_relations="$(LANG=C runuser -u postgres -- sh -c "psql gitlab_production -c \ if [ "$db_relations" = "No relations found." ] || \ [ "$db_relations" = "Did not find any relations." ]; then echo "Initializing database..." - test -f ${gitlab_home}/db/schema.rb || \ + test -f ${gitlab_home}/db/structure.sql || \ runuser -u ${gitlab_user} -- sh -c \ - "cp ${gitlab_data_dir}/db/schema.rb.template ${gitlab_data_dir}/db/schema.rb" + "cp ${gitlab_data_dir}/db/structure.sql.template ${gitlab_data_dir}/db/structure.sql" runuser -u ${gitlab_user} -- sh -c \ "touch ${gitlab_data_dir}/.gitlab_shell_secret" runuser -u ${gitlab_user} -- sh -c 'touch /var/lib/gitlab/secrets.yml' - runuser -u ${gitlab_user} -- sh -c '/usr/bin/bundle exec rake db:schema:load' + runuser -u ${gitlab_user} -- sh -c '/usr/bin/bundle exec rake db:structure:load' else echo "gitlab_production database is not empty, skipping gitlab setup" fi @@ -31,6 +31,7 @@ chmod 0700 ${gitlab_data_dir}/.gitlab_shell_secret echo "Installing node modules..." runuser -u ${gitlab_user} -- sh -c 'install -d /var/lib/gitlab/.node_modules' +runuser -u ${gitlab_user} -- sh -c 'install -d /var/lib/gitlab/.cache' runuser -u ${gitlab_user} -- sh -c 'yarnpkg install' # Remove write permissions of .yarn-metadata.json files runuser -u ${gitlab_user} -- sh -c 'test -d "/var/lib/gitlab/.cache/yarn/v6" && find /var/lib/gitlab/.cache/yarn/v6/ -name .yarn-metadata.json -perm -a=w -exec chmod 644 {} \;' diff --git a/debian/rules b/debian/rules index 4def8e4b98..9c98ebd0ec 100755 --- a/debian/rules +++ b/debian/rules @@ -13,7 +13,7 @@ override_dh_install: find debian/gitlab/usr/share/gitlab/ -name .eslintrc.yml -delete mv debian/gitlab/usr/share/gitlab/app/assets/javascripts/locale \ debian/gitlab/usr/share/gitlab/app/assets/javascripts/locale.static - mv debian/gitlab/var/lib/gitlab/db/schema.rb debian/gitlab/var/lib/gitlab/db/schema.rb.template + mv debian/gitlab/var/lib/gitlab/db/structure.sql debian/gitlab/var/lib/gitlab/db/structure.sql.template sed -i 's/__NEW_VERSION__/${DEB_VERSION}/g' debian/gitlab/usr/lib/gitlab/templates/gitlab-debian.conf.example override_dh_installinit: From e23b02efe9c047a058c1a373b355793dd310f43d Mon Sep 17 00:00:00 2001 From: Pirate Praveen Date: Sat, 27 Jun 2020 23:05:49 +0530 Subject: [PATCH 2/4] Add rack-timeout gem to Gemfile --- debian/patches/0770-add-rack-timeout.patch | 18 ++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 19 insertions(+) create mode 100644 debian/patches/0770-add-rack-timeout.patch diff --git a/debian/patches/0770-add-rack-timeout.patch b/debian/patches/0770-add-rack-timeout.patch new file mode 100644 index 0000000000..6b80080df1 --- /dev/null +++ b/debian/patches/0770-add-rack-timeout.patch @@ -0,0 +1,18 @@ +--- a/Gemfile ++++ b/Gemfile +@@ -80,7 +80,6 @@ + + # API + gem 'grape', '~> 1.3', '>= 1.3.3' +-gem 'rack-timeout' + gem 'grape-entity', '~> 0.7.1' + gem 'rack-cors', '~> 1.0', '>= 1.0.6', require: 'rack/cors' + +@@ -160,6 +159,7 @@ + + # Application server + gem 'rack', '~> 2.0', '>= 2.0.9' ++gem 'rack-timeout', require: false + + group :unicorn do + gem 'unicorn', '~> 5.5' diff --git a/debian/patches/series b/debian/patches/series index 3ecc7e166f..825650c05c 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -24,4 +24,5 @@ 0741-add-graphql-tag.patch 0750-fix-relative-paths.patch 0760-update-grape.patch +0770-add-rack-timeout.patch 0790-protobuf-compat.patch From 290aa15f4e84305cd8e8b71d4e4c6d22b83acf97 Mon Sep 17 00:00:00 2001 From: Pirate Praveen Date: Sat, 27 Jun 2020 23:07:23 +0530 Subject: [PATCH 3/4] Relax dependency on ruby-grape-entity --- debian/control | 2 +- debian/patches/0780-relax-grape-entity.patch | 11 +++++++++++ debian/patches/series | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 debian/patches/0780-relax-grape-entity.patch diff --git a/debian/control b/debian/control index 48cb19f163..753535f309 100644 --- a/debian/control +++ b/debian/control @@ -99,7 +99,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, ruby-grape (>= 1.3.3~), # https://gitlab.com/gitlab-org/gitlab/-/issues/219623 ruby-rack-timeout, - ruby-grape-entity (>= 0.7.1~), + ruby-grape-entity (>= 0.8.0~), ruby-rack-cors (>= 1.0.6~), # GraphQL API ruby-graphql (>= 1.10.5~), diff --git a/debian/patches/0780-relax-grape-entity.patch b/debian/patches/0780-relax-grape-entity.patch new file mode 100644 index 0000000000..96ccb72709 --- /dev/null +++ b/debian/patches/0780-relax-grape-entity.patch @@ -0,0 +1,11 @@ +--- a/Gemfile ++++ b/Gemfile +@@ -80,7 +80,7 @@ + + # API + gem 'grape', '~> 1.3', '>= 1.3.3' +-gem 'grape-entity', '~> 0.7.1' ++gem 'grape-entity', '~> 0.8.0' + gem 'rack-cors', '~> 1.0', '>= 1.0.6', require: 'rack/cors' + + # GraphQL API diff --git a/debian/patches/series b/debian/patches/series index 825650c05c..d48f701c27 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -25,4 +25,5 @@ 0750-fix-relative-paths.patch 0760-update-grape.patch 0770-add-rack-timeout.patch +0780-relax-grape-entity.patch 0790-protobuf-compat.patch From 8680a174b6560f5560c5cd87d2e64e25f38d3923 Mon Sep 17 00:00:00 2001 From: Pirate Praveen Date: Sat, 27 Jun 2020 23:08:08 +0530 Subject: [PATCH 4/4] Upload to experimental --- debian/changelog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/debian/changelog b/debian/changelog index ba4ed24efd..701adc435e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +gitlab (13.0.6-2) experimental; urgency=medium + + * Switch to using structure.sql from schema.rb for database initialization + * Add rack-timeout gem to Gemfile + * Relax dependency on ruby-grape-entity + + -- Pirate Praveen Sat, 27 Jun 2020 23:07:50 +0530 + gitlab (13.0.6-1) experimental; urgency=medium * New upstream version 13.0.6 with a security fix (CVE ID not