diff --git a/config/appsettings.json b/config/appsettings.json index 78d87d805f..178cee0333 100644 --- a/config/appsettings.json +++ b/config/appsettings.json @@ -432,7 +432,7 @@ }, "oform": { "img": ["static-oforms.teamlab.info"], - "def": ["cmsoforms.teamlab.info"] + "def": ["cmsoforms.teamlab.info", "oforms.teamlab.info"] } }, "logocolors": [ diff --git a/debuginfo.py b/debuginfo.py new file mode 100755 index 0000000000..a6fc574dcd --- /dev/null +++ b/debuginfo.py @@ -0,0 +1,97 @@ +#!/usr/bin/python3 + +import os +from git import Repo +from datetime import datetime + +rd = os.path.dirname(os.path.abspath(__file__)) +root_dir = os.path.abspath(os.path.join(rd, "..")) + +CLIENT = "client" +SERVER = "server" +BUILDTOOLS = "buildtools" +REPO_CLIENT_URL = f"https://github.com/ONLYOFFICE/DocSpace-client" +REPO_SERVER_URL = f"https://github.com/ONLYOFFICE/DocSpace-server" +REPO_BUILDTOOLS_URL = f"https://github.com/ONLYOFFICE/DocSpace-buildtools" +LIMIT_DAYS = 30 +MESSAGE_SEPARATOR = '__MESSAGE_SEPARATOR__' +SEP = 'ยง' + +# https://git-scm.com/docs/pretty-formats +format = f"%H{SEP}%as{SEP}%an{SEP}%s %b{MESSAGE_SEPARATOR}" + +data = {} + + +def fetchCommits(url, type): + path = os.path.join(root_dir, type) + #print(path, os.path.exists(path)) + if os.path.exists(path) == False: + print("Error folder does not exists", path) + return + + repo = Repo(path) + + info = f"| [DocSpace-{type}]({url}) | [{repo.active_branch.name}]({url}/tree/{repo.active_branch.name}) | [{repo.head.commit}]({url}/commit/{repo.head.commit}) |{os.linesep}" + + commits_str = repo.git.log(f"--pretty=format: {format}", "--no-merges", f"--since={LIMIT_DAYS}.days") + #print(commits_str) + + commits = commits_str.strip().split(MESSAGE_SEPARATOR) + #print(commits) + + for item in commits: + elements = item.replace('\n', '').split(SEP) + + if len(elements) != 4: + continue + + hash = elements[0].strip() + date = datetime.strptime(elements[1].strip(), "%Y-%m-%d") + name = elements[2].strip() + text = elements[3].strip().capitalize() + + if date not in data: + data[date] = {} + + if name not in data[date]: + data[date][name] = [] + + data[date][name].append(f"- [{type}]: {text} [`{hash[0:7]}`]({url}/commit/{hash})") + + return info + +result = f"## Changelog{os.linesep}" + +result += f"| Repo | Branch | Last Commit |{os.linesep}" +result += f"| :- | :- | :- |{os.linesep}" + +result += fetchCommits(REPO_CLIENT_URL, CLIENT) +result += fetchCommits(REPO_SERVER_URL, SERVER) +result += fetchCommits(REPO_BUILDTOOLS_URL, BUILDTOOLS) + +# Create debuginfo.md content +for date in sorted(data, reverse=True): + niceDate = date.strftime("%d %B %Y") + result += f"### {niceDate}{os.linesep}" + for name in sorted(data[date]): + result += f"#### {name}{os.linesep}" + for commit in data[date][name]: + result += f"{commit}{os.linesep}" + +print(result) + +pathMD = os.path.join(root_dir, CLIENT, "public/debuginfo.md") +# Open text file in write mode +text_file = open(pathMD, "w") + +# Write content to file +n = text_file.write(result) + +if n == len(result): + print("Success! String written to text file.") +else: + print("Failure! String not written to text file.") + +# Close file +text_file.close() \ No newline at end of file diff --git a/install/OneClickInstall/install-Docker.sh b/install/OneClickInstall/install-Docker.sh index 519d082620..1a6289bbd6 100644 --- a/install/OneClickInstall/install-Docker.sh +++ b/install/OneClickInstall/install-Docker.sh @@ -947,7 +947,7 @@ domain_check () { echo "Select 'N' to cancel ${PACKAGE_SYSNAME^^} ${PRODUCT_NAME} installation." if read_continue_installation; then if [[ -f "$DOCKER_DAEMON_FILE" ]]; then - sed -i '/{/a\ "dns": ["8.8.8.8", "8.8.4.4"],' "$DOCKER_DAEMON_FILE" + sed -i 's!{!& "dns": ["8.8.8.8", "8.8.4.4"],!' "$DOCKER_DAEMON_FILE" else echo "{\"dns\": [\"8.8.8.8\", \"8.8.4.4\"]}" | tee "$DOCKER_DAEMON_FILE" >/dev/null fi diff --git a/install/common/build-frontend.sh b/install/common/build-frontend.sh index 9304bae8f2..a5f74e9910 100644 --- a/install/common/build-frontend.sh +++ b/install/common/build-frontend.sh @@ -57,10 +57,12 @@ done echo "== FRONT-END-BUILD ==" cd ${SRC_PATH} -yarn install # debug config if [ "$DEBUG_INFO" = true ]; then - yarn debug-info + pip install -r ${SRC_PATH}/buildtools/requirements.txt + python3 ${SRC_PATH}/buildtools/debuginfo.py fi +cd ${SRC_PATH}/client +yarn install yarn ${BUILD_ARGS} yarn ${DEPLOY_ARGS} diff --git a/install/docker/Dockerfile.app b/install/docker/Dockerfile.app index 0a2869c6e4..5ee20f103f 100644 --- a/install/docker/Dockerfile.app +++ b/install/docker/Dockerfile.app @@ -28,6 +28,7 @@ RUN apt-get -y update && \ sudo \ locales \ git \ + python3-pip \ npm && \ locale-gen en_US.UTF-8 && \ npm install --global yarn && \ @@ -54,7 +55,7 @@ RUN cd ${SRC_PATH} && \ sed -i "s/\"number\".*,/\"number\": \"${PRODUCT_VERSION}.${BUILD_NUMBER}\",/g" /app/onlyoffice/config/appsettings.json && \ sed -e 's/#//' -i /etc/nginx/conf.d/onlyoffice.conf && \ cd ${SRC_PATH}/buildtools/install/common/ && \ - bash build-frontend.sh -sp "${SRC_PATH}/client" -ba "${BUILD_ARGS}" -da "${DEPLOY_ARGS}" -di "${DEBUG_INFO}" && \ + bash build-frontend.sh -sp "${SRC_PATH}" -ba "${BUILD_ARGS}" -da "${DEPLOY_ARGS}" -di "${DEBUG_INFO}" && \ bash build-backend.sh -sp "${SRC_PATH}/server" && \ bash publish-backend.sh -pc "${PUBLISH_CNF}" -sp "${SRC_PATH}/server" -bp "${BUILD_PATH}" && \ cp -rf ${SRC_PATH}/server/products/ASC.Files/Server/DocStore ${BUILD_PATH}/products/ASC.Files/server/ && \ diff --git a/install/docker/docker-healthchecks-entrypoint.sh b/install/docker/docker-healthchecks-entrypoint.sh index fecc4a3d88..04dd04ee20 100755 --- a/install/docker/docker-healthchecks-entrypoint.sh +++ b/install/docker/docker-healthchecks-entrypoint.sh @@ -31,6 +31,7 @@ STUDIO_NOTIFY_HOST=${STUDIO_NOTIFY_HOST:-"${CONTAINER_PREFIX}studio-notify:${SER API_HOST=${API_HOST:-"${CONTAINER_PREFIX}api:${SERVICE_PORT}"} STUDIO_HOST=${STUDIO_HOST:-"${CONTAINER_PREFIX}studio:${SERVICE_PORT}"} +sed -i "/\"Name\": \"ASC.ApiCache\"/,/{/d" ${PATH_TO_CONF}/appsettings.json sed -i "s!localhost:5010!${API_SYSTEM_HOST}!g" ${PATH_TO_CONF}/appsettings.json sed -i "s!localhost:5012!${BACKUP_HOST}!g" ${PATH_TO_CONF}/appsettings.json sed -i "s!localhost:5032!${BACKUP_BACKGRUOND_TASKS_HOST}!g" ${PATH_TO_CONF}/appsettings.json diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000..edc51ee8c8 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +gitdb==4.0.11 +GitPython==3.1.40 +smmap==5.0.1