Switch to using structure.sql from schema.rb for database initialization
This commit is contained in:
parent
fde38bf386
commit
fa5f0e7560
3 changed files with 5 additions and 7 deletions
3
debian/gitlab.postinst
vendored
3
debian/gitlab.postinst
vendored
|
@ -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"'
|
||||
|
||||
|
|
7
debian/rake-tasks.sh
vendored
7
debian/rake-tasks.sh
vendored
|
@ -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 {} \;'
|
||||
|
|
2
debian/rules
vendored
2
debian/rules
vendored
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue