mirror of
https://github.com/sameersbn/docker-gitlab.git
synced 2026-01-18 13:58:25 +00:00
recompile assets when GITLAB_RELATIVE_URL_ROOT is used
This commit is contained in:
parent
9a221888ed
commit
eade4fe5bf
@ -960,6 +960,25 @@ initialize_datadir() {
|
||||
chmod 700 ${GITLAB_DATA_DIR}/.ssh
|
||||
chmod 600 ${GITLAB_DATA_DIR}/.ssh/authorized_keys
|
||||
chown -R ${GITLAB_USER}: ${GITLAB_DATA_DIR}/.ssh
|
||||
|
||||
# recompile and persist assets when relative_url is in use
|
||||
if [[ -n ${GITLAB_RELATIVE_URL_ROOT} ]]; then
|
||||
mkdir -p ${GITLAB_TEMP_DIR}/cache
|
||||
chmod 755 ${GITLAB_TEMP_DIR}/cache
|
||||
chown ${GITLAB_USER}: ${GITLAB_TEMP_DIR}/cache
|
||||
|
||||
mkdir -p ${GITLAB_TEMP_DIR}/assets
|
||||
chmod 755 ${GITLAB_TEMP_DIR}/assets
|
||||
chown ${GITLAB_USER}: ${GITLAB_TEMP_DIR}/assets
|
||||
|
||||
# symlink ${GITLAB_INSTALL_DIR}/tmp/cache -> ${GITLAB_TEMP_DIR}/cache
|
||||
rm -rf ${GITLAB_INSTALL_DIR}/tmp/cache
|
||||
exec_as_git ln -s ${GITLAB_TEMP_DIR}/cache ${GITLAB_INSTALL_DIR}/tmp/cache
|
||||
|
||||
# symlink ${GITLAB_INSTALL_DIR}/public/assets -> ${GITLAB_TEMP_DIR}/assets
|
||||
rm -rf ${GITLAB_INSTALL_DIR}/public/assets
|
||||
exec_as_git ln -s ${GITLAB_TEMP_DIR}/assets ${GITLAB_INSTALL_DIR}/public/assets
|
||||
fi
|
||||
}
|
||||
|
||||
sanitize_datadir() {
|
||||
@ -1190,8 +1209,14 @@ migrate_database() {
|
||||
fi
|
||||
|
||||
# clear cache if relative_url has changed.
|
||||
[[ -f ${GITLAB_DATA_DIR}/tmp/GITLAB_RELATIVE_URL_ROOT ]] && CACHE_GITLAB_RELATIVE_URL_ROOT=$(cat ${GITLAB_DATA_DIR}/tmp/GITLAB_RELATIVE_URL_ROOT)
|
||||
if [[ ! -f ${GITLAB_DATA_DIR}/tmp/GITLAB_RELATIVE_URL_ROOT || ${GITLAB_RELATIVE_URL_ROOT} != ${CACHE_GITLAB_RELATIVE_URL_ROOT} ]]; then
|
||||
[[ -f ${GITLAB_TEMP_DIR}/GITLAB_RELATIVE_URL_ROOT ]] && CACHE_GITLAB_RELATIVE_URL_ROOT=$(cat ${GITLAB_TEMP_DIR}/GITLAB_RELATIVE_URL_ROOT)
|
||||
if [[ ! -f ${GITLAB_TEMP_DIR}/GITLAB_RELATIVE_URL_ROOT || ${GITLAB_RELATIVE_URL_ROOT} != ${CACHE_GITLAB_RELATIVE_URL_ROOT} ]]; then
|
||||
# assets need to be recompiled when GITLAB_RELATIVE_URL_ROOT is used
|
||||
if [[ -n ${GITLAB_RELATIVE_URL_ROOT} ]]; then
|
||||
echo "Recompiling assets (relative_url in use), this could take a while..."
|
||||
exec_as_git bundle exec rake assets:clean assets:precompile >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
echo "Clearing cache..."
|
||||
exec_as_git bundle exec rake cache:clear >/dev/null 2>&1
|
||||
echo "${GITLAB_RELATIVE_URL_ROOT}" > ${GITLAB_TEMP_DIR}/GITLAB_RELATIVE_URL_ROOT
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user