fix: GITLAB_RELATIVE_URL_ROOT installation method

During the last remove of the node_modules folder it wasn’t possbile to recompile assets on the start of the container. This is neccesarry for the GITLAB_RELATIVE_URL_ROOT to work correctly.

Signed-off-by: solidnerd <niclas@mietz.io>
This commit is contained in:
solidnerd 2020-12-26 12:35:03 +01:00 committed by Niclas Mietz
parent ec81aa33d4
commit ca34ea0486
2 changed files with 9 additions and 1 deletions

View File

@ -79,7 +79,7 @@ LABEL \
EXPOSE 22/tcp 80/tcp 443/tcp
VOLUME ["${GITLAB_DATA_DIR}", "${GITLAB_LOG_DIR}"]
VOLUME ["${GITLAB_DATA_DIR}", "${GITLAB_LOG_DIR}","${GITLAB_HOME}/gitlab/node_modules"]
WORKDIR ${GITLAB_INSTALL_DIR}
ENTRYPOINT ["/sbin/entrypoint.sh"]
CMD ["app:start"]

View File

@ -1806,6 +1806,14 @@ migrate_database() {
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
if [[ ! -d ${GITLAB_HOME}/gitlab/node_modules ]]; then
mkdir -p ${GITLAB_HOME}/gitlab/node_modules
chown -R ${GITLAB_USER}: ${GITLAB_HOME}/gitlab/node_modules
fi
echo "Prepare recomplie assets... Installing missing node_modules for assets"
chown -R ${GITLAB_USER}: ${GITLAB_HOME}/gitlab/node_modules
exec_as_git yarn install --production --pure-lockfile
exec_as_git yarn add ajv@^4.0.0
echo "Recompiling assets (relative_url in use), this could take a while..."
exec_as_git bundle exec rake gitlab:assets:compile NODE_OPTIONS="--max-old-space-size=4096" >/dev/null 2>&1
fi