From 8ddcec3f21a1051b8c6f338ea58079c5012d117c Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Wed, 8 Feb 2023 21:57:49 -0500 Subject: [PATCH 1/7] [UPD] poetry: gitpython 3.1.30 and future 0.18.3 --- poetry.lock | 12 ++++++------ pyproject.toml | 3 ++- requirements.txt | 3 ++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/poetry.lock b/poetry.lock index e751110..e18267b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1234,13 +1234,13 @@ python-dateutil = ">=2.7" [[package]] name = "future" -version = "0.18.2" +version = "0.18.3" description = "Clean single-source support for Python 3 and 2" category = "main" optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" files = [ - {file = "future-0.18.2.tar.gz", hash = "sha256:b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d"}, + {file = "future-0.18.3.tar.gz", hash = "sha256:34a17436ed1e96697a86f9de3d15a3b0be01d8bc8de9c1dffd59fb8234ed5307"}, ] [[package]] @@ -1336,14 +1336,14 @@ smmap = ">=3.0.1,<6" [[package]] name = "gitpython" -version = "3.1.29" +version = "3.1.30" description = "GitPython is a python library used to interact with Git repositories" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "GitPython-3.1.29-py3-none-any.whl", hash = "sha256:41eea0deec2deea139b459ac03656f0dd28fc4a3387240ec1d3c259a2c47850f"}, - {file = "GitPython-3.1.29.tar.gz", hash = "sha256:cc36bfc4a3f913e66805a28e84703e419d9c264c1077e537b54f0e1af85dbefd"}, + {file = "GitPython-3.1.30-py3-none-any.whl", hash = "sha256:cd455b0000615c60e286208ba540271af9fe531fa6a87cc590a7298785ab2882"}, + {file = "GitPython-3.1.30.tar.gz", hash = "sha256:769c2d83e13f5d938b7688479da374c4e3d49f71549aaf462b646db9602ea6f8"}, ] [package.dependencies] @@ -5876,4 +5876,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.7.16" -content-hash = "dd54f6a3d606782a2768478cdfde0fd5f90b2e625e13b8d3ac946b25637e4f0c" +content-hash = "3ea90fffaf8140b6d905c474af3228499514491d98f24191d521bab1ea6a1862" diff --git a/pyproject.toml b/pyproject.toml index c196a1e..8256f0a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,9 +57,10 @@ feedparser = "6.0.10" flake8 = "<6.0.0" formio-data = "^0.4.10" freezegun = "1.2.2" +future = "0.18.3" geojson = "<3.0.0" gevent = "1.5.0" -gitpython = "3.1.29" +gitpython = "3.1.30" giturlparse = "^0.10.0" greenlet = "0.4.14" html2text = "2016.9.19" diff --git a/requirements.txt b/requirements.txt index 7b923d7..3972a7c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ # For script giturlparse agithub -GitPython==3.1.29 +GitPython==3.1.30 retrying xmltodict openupgradelib @@ -107,3 +107,4 @@ pyjwt==2.5.0 pygments==2.7.4 setuptools==65.5.1 Werkzeug==0.16.1 +future==0.18.3 From e80aa593f89dc56b31d34b9154f016f2460792f0 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Fri, 10 Feb 2023 12:27:45 -0500 Subject: [PATCH 2/7] [ADD] script template_nginx --- script/nginx/template_nginx | 71 +++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 script/nginx/template_nginx diff --git a/script/nginx/template_nginx b/script/nginx/template_nginx new file mode 100644 index 0000000..9f2fef9 --- /dev/null +++ b/script/nginx/template_nginx @@ -0,0 +1,71 @@ +# TODO replace test1 by your hostname and fix server_name and run certbot +upstream erplibretest1 { + server 127.0.0.1:10000; +} +upstream erplibretest1chat { + server 127.0.0.1:10002; +} + +server { + listen 80; + + server_name test1.ca; + + # Add Headers for erplibre proxy mode + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Real-IP $remote_addr; + add_header X-Frame-Options "SAMEORIGIN"; + add_header X-XSS-Protection "1; mode=block"; + + # erplibre request log files + access_log /var/log/nginx/test1-access.log; + error_log /var/log/nginx/test1-error.log; + + # Increase proxy buffer size + proxy_buffers 16 64k; + proxy_buffer_size 128k; + + proxy_read_timeout 720s; + proxy_connect_timeout 720s; + proxy_send_timeout 720s; + + # Force timeouts if the backend dies + proxy_next_upstream error timeout invalid_header http_500 http_502 + http_503; + + types { + text/less less; + text/scss scss; + } + + # Enable data compression + gzip on; + gzip_min_length 1100; + gzip_buffers 4 32k; + gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript application/pdf image/jpeg image/png; + gzip_vary on; + client_header_buffer_size 4k; + large_client_header_buffers 4 64k; + client_max_body_size 1024M; + + location / { + proxy_pass http://erplibretest1; + # by default, do not forward anything + proxy_redirect off; + } + + location /longpolling { + proxy_pass http://erplibretest1chat; + } + + # cache some static data in memory for 60mins. + location ~ /[a-zA-Z0-9_-]*/static/ { + proxy_cache_valid 200 302 60m; + proxy_cache_valid 404 1m; + proxy_buffering on; + expires 864000; + proxy_pass http://erplibretest1; + } +} From 6b9fa748f52124e55b1d7bade4f3979b57d604cd Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Sat, 11 Feb 2023 18:48:51 -0500 Subject: [PATCH 3/7] [ADD] script statistic: code_count.sh --- script/statistic/code_count.sh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100755 script/statistic/code_count.sh diff --git a/script/statistic/code_count.sh b/script/statistic/code_count.sh new file mode 100755 index 0000000..23ef2d8 --- /dev/null +++ b/script/statistic/code_count.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +# all argument is directory/file separate by space + +./.venv/bin/pygount --duplicates --folders-to-skip="[...],*/libs/*,*/lib/*,lib" --names-to-skip="[...],*.min.*" --suffix=py,xml,html,js,css,scss --format=summary "$@" From 3f8dfcd39290eaf34ee90489a672b3c75b51b8a3 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Mon, 13 Feb 2023 18:00:36 -0500 Subject: [PATCH 4/7] [ADD] script update_addons_all.sh and update_prod_to_dev.sh - first script help to update all modules for a database - second script help to test a production database without affecting it --- script/addons/update_addons_all.sh | 11 +++++++++++ script/addons/update_prod_to_dev.sh | 11 +++++++++++ 2 files changed, 22 insertions(+) create mode 100755 script/addons/update_addons_all.sh create mode 100755 script/addons/update_prod_to_dev.sh diff --git a/script/addons/update_addons_all.sh b/script/addons/update_addons_all.sh new file mode 100755 index 0000000..9a717b1 --- /dev/null +++ b/script/addons/update_addons_all.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +echo "Update all on BD '$1'" + +./run.sh --no-http --stop-after-init -d "$1" -u all + +retVal=$? +if [[ $retVal -ne 0 ]]; then + echo "Error run.sh into update_addons_all.sh" + exit 1 +fi diff --git a/script/addons/update_prod_to_dev.sh b/script/addons/update_prod_to_dev.sh new file mode 100755 index 0000000..071c701 --- /dev/null +++ b/script/addons/update_prod_to_dev.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +# This script will remove mail configuration, remove backup configuration, and force admin user to test/test +echo "Update prod to dev on BD '$1'" + +./script/addons/install_addons.sh "$1" user_test,disable_mail_server,disable_auto_backup + +retVal=$? +if [[ $retVal -ne 0 ]]; then + echo "Error install_addons.sh into update_prod_to_dev.sh" + exit 1 +fi From 5535a81213f519cf94b52fe5d9333c262e5d5231 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Tue, 14 Feb 2023 16:01:43 -0500 Subject: [PATCH 5/7] [REM] script install OSX: move docker installation to FAQ --- doc/FAQ.md | 15 +++++++++++++++ script/install/install_OSX_dependency.sh | 6 ------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/doc/FAQ.md b/doc/FAQ.md index db4934c..ea13d20 100644 --- a/doc/FAQ.md +++ b/doc/FAQ.md @@ -109,3 +109,18 @@ git branch -av git reset --hard REF_OF_REMOTES/m > git reset --hard remotes/origin/rel/8953/zd552kl/7.1.1-11.40.208 ``` + +## OSX installation + +### Docker installation + +This guide works in the past, but it's now broken + +```bash +echo "\n--- Installing docker --" +brew install minikube docker docker-compose docker-machine +brew cask install virtualbox +docker-machine create --driver virtualbox default +docker-machine env default +eval "$(docker-machine env default)" +``` diff --git a/script/install/install_OSX_dependency.sh b/script/install/install_OSX_dependency.sh index 3b1a7d2..3480572 100755 --- a/script/install/install_OSX_dependency.sh +++ b/script/install/install_OSX_dependency.sh @@ -28,12 +28,6 @@ echo "\n--- Installing Python 3 + pip3 --" brew install git python3 wget pyenv brew link git brew link wget -echo "\n--- Installing docker --" -brew install minikube docker docker-compose docker-machine -brew cask install virtualbox -docker-machine create --driver virtualbox default -docker-machine env default -eval "$(docker-machine env default)" echo "\n---- Installing nodeJS NPM and rtlcss for LTR support ----" brew install nodejs npm openssl sudo npm install -g rtlcss From 06bb6a0cc733ccdf500fbd9517f3263ababc57eb Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Tue, 14 Feb 2023 16:47:04 -0500 Subject: [PATCH 6/7] [UPD] test: help in red to read log when got error --- script/test/run_parallel_test.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/script/test/run_parallel_test.py b/script/test/run_parallel_test.py index a630f4d..dd999a7 100755 --- a/script/test/run_parallel_test.py +++ b/script/test/run_parallel_test.py @@ -117,6 +117,7 @@ def extract_result(result, test_name, lst_error, lst_warning): def check_result(task_list, tpl_result): + status = True lst_error = [] lst_warning = [] @@ -125,6 +126,9 @@ def check_result(task_list, tpl_result): result, task_list[i].cr_code.co_name, lst_error, lst_warning ) + if lst_error: + status = False + if lst_warning: print(f"{Fore.YELLOW}{len(lst_warning)} WARNING{Fore.RESET}") i = 0 @@ -148,6 +152,7 @@ def check_result(task_list, tpl_result): str_result = f"{Fore.GREEN}SUCCESS 🍰" print(f"{Fore.BLUE}Summary TEST {str_result}{Fore.RESET}") + return status def print_log(lst_task, tpl_result): @@ -165,7 +170,6 @@ def print_log(lst_task, tpl_result): if result[0]: f.write(result[0]) f.write("\n") - print(f"Log file {LOG_FILE}") async def run_command_get_output(*args, cwd=None): @@ -1290,7 +1294,13 @@ def run_all_test(config) -> None: finally: loop.close() print_log(task_list, tpl_result) - check_result(task_list, tpl_result) + status = check_result(task_list, tpl_result) + if status: + log_file_print = LOG_FILE + else: + log_file_print = f"{Fore.RED}{LOG_FILE}{Fore.RESET}" + + print(f"Log file {log_file_print}") def main(): From 4c73da29b088cf2600e6a04304dd780763743743 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Tue, 14 Feb 2023 16:49:15 -0500 Subject: [PATCH 7/7] [UPD] README: use test_full_fast instead of test, more fast --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a6de9d8..83a6df4 100644 --- a/README.md +++ b/README.md @@ -54,5 +54,5 @@ To change repository like addons, see [GIT_REPO.md](doc/GIT_REPO.md) # Test Execute ERPLibre test with his code generator. ```bash -time make test +time make test_full_fast ```