Recompile assets when GITLAB_RELATIVE_URL_ROOT is used Fixes #481

This commit is contained in:
Sameer Naik 2015-10-25 12:15:06 +05:30
parent e9e3061b4c
commit 6218d2ce72
2 changed files with 23 additions and 2 deletions

View File

@ -2,6 +2,9 @@
This file only reflects the changes that are made in the the docker image. Please refer to the upstream GitLab [CHANGELOG](https://github.com/gitlabhq/gitlabhq/blob/master/CHANGELOG) for the list of changes in GitLab.
**latest**
- Recompile assets when `GITLAB_RELATIVE_URL_ROOT` is used Fixes #481
**8.1.0-1**
- temporary fix for http/https cloning when `GITLAB_RELATIVE_URL_ROOT` is used

View File

@ -789,6 +789,14 @@ fi
# configure relative_url_root
sed 's,{{GITLAB_RELATIVE_URL_ROOT}},'"${GITLAB_RELATIVE_URL_ROOT}"',' -i /etc/supervisor/conf.d/gitlab-git-http-server.conf
if [[ -n ${GITLAB_RELATIVE_URL_ROOT} ]]; then
# create symlink to assets in tmp/cache
rm -rf tmp/cache
sudo -HEu ${GITLAB_USER} ln -s ${GITLAB_DATA_DIR}/tmp/cache tmp/cache
# create symlink to assets in public/assets
rm -rf public/assets
sudo -HEu ${GITLAB_USER} ln -s ${GITLAB_DATA_DIR}/tmp/public/assets public/assets
sed 's,{{GITLAB_RELATIVE_URL_ROOT__with_trailing_slash}},'"${GITLAB_RELATIVE_URL_ROOT}/"',' -i /etc/nginx/sites-enabled/gitlab
sed 's,# alias'"${GITLAB_INSTALL_DIR}"'/public,alias '"${GITLAB_INSTALL_DIR}"'/public,' -i /etc/nginx/sites-enabled/gitlab
@ -923,8 +931,18 @@ appInit () {
rm -rf ${GITLAB_DATA_DIR}/tmp
sudo -HEu ${GITLAB_USER} mkdir -p ${GITLAB_DATA_DIR}/tmp/
# clear the cache
sudo -HEu ${GITLAB_USER} bundle exec rake cache:clear >/dev/null 2>&1
# assets need to be recompiled when GITLAB_RELATIVE_URL_ROOT is used
if [[ -n ${GITLAB_RELATIVE_URL_ROOT} ]]; then
# create the tmp/cache and tmp/public/assets directory
sudo -HEu ${GITLAB_USER} mkdir -p ${GITLAB_DATA_DIR}/tmp/cache/
sudo -HEu ${GITLAB_USER} mkdir -p ${GITLAB_DATA_DIR}/tmp/public/assets/
echo "GITLAB_RELATIVE_URL_ROOT in use, recompiling assets, this could take a while..."
sudo -HEu ${GITLAB_USER} bundle exec rake assets:clean assets:precompile cache:clear >/dev/null 2>&1
else
# clear the cache
sudo -HEu ${GITLAB_USER} bundle exec rake cache:clear >/dev/null 2>&1
fi
# update VERSION information
sudo -HEu ${GITLAB_USER} echo "${GITLAB_VERSION}" > ${GITLAB_DATA_DIR}/tmp/VERSION