From 4e020fce6df689f80f96199c1402155d511361d4 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Tue, 20 Jul 2021 20:14:24 -0400 Subject: [PATCH] [UPD] format doc markdown - Add contributors --- doc/CONTRIBUTION.md | 25 ++++++++++------ doc/DEVELOPMENT.md | 70 +++++++++++++++++++++++++++++++++++++++------ doc/DISCOVER.md | 8 ++++++ doc/FAQ.md | 13 ++++++++- doc/GIT_REPO.md | 33 +++++++++++++++++++-- doc/HOWTO.md | 2 ++ doc/MIGRATION.md | 29 ------------------- doc/POETRY.md | 6 ++++ doc/PRODUCTION.md | 34 ++++++++++++++++++---- doc/RELEASE.md | 34 +++++++++++++++++----- doc/RUN.md | 18 +++++++++++- doc/TODO.md | 6 ++-- doc/UPDATE.md | 9 ++++-- 13 files changed, 220 insertions(+), 67 deletions(-) delete mode 100644 doc/MIGRATION.md diff --git a/doc/CONTRIBUTION.md b/doc/CONTRIBUTION.md index 4052eee..51484e4 100644 --- a/doc/CONTRIBUTION.md +++ b/doc/CONTRIBUTION.md @@ -1,16 +1,25 @@ # Thanks + ## AGILE OPS -Thanks for contributing to GIT_REPO and docker. -- [Agile OPS](https://www.linkedin.com/in/michaelfaille/) + +Thanks to [Agile OPS](https://www.linkedin.com/in/michaelfaille/) for contributing to GIT_REPO and docker. ## MathBenTech -Thanks for creating this project. -- [MathBen.Tech](https://mathben.tech) + +Thanks to [MathBenTech](https://mathben.tech) for creating ERPLibre project. + +## Marieplume + +Thanks to [Marieplume](https://marieplume.ca) for keeping the language in check. + +## OCA + +Thanks to [Odoo Community Association](https://odoo-community.org) for the collaborative development of Odoo features. ## TechnoLibre -Thanks for making this enterprise edition of ERPLibre. -- [TechnoLibre](https://technolibre.ca) + +Thanks to [TechnoLibre](https://technolibre.ca) for making this enterprise edition of ERPLibre. ## Yenthe Van Ginneken -Thanks Yenthe Van Ginneken for your scripting guides and tutorials. -- [Yenthe666 InstallScript](https://github.com/Yenthe666/InstallScript) + +Thanks [Yenthe666 InstallScript](https://github.com/Yenthe666/InstallScript) for your scripting guides and tutorials. diff --git a/doc/DEVELOPMENT.md b/doc/DEVELOPMENT.md index f470f50..57d80c7 100644 --- a/doc/DEVELOPMENT.md +++ b/doc/DEVELOPMENT.md @@ -1,13 +1,17 @@ # Development guide + Setup your environment to develop modules and debug the platform. ## Local installation procedure + ### 1. Clone the project: + ```bash git clone https://github.com/ERPLibre/ERPLibre.git ``` ### 2. Execute the script: + ```bash cd ERPLibre ./script/install_dev.sh @@ -15,157 +19,205 @@ cd ERPLibre ``` ### 3. Run ERPLibre + ```bash ./run.sh ``` ## Develop in Odoo repository -You need to remove `clone-depth="10"` from `./manifest/default.dev.xml` in order to be able to commit and push. -Make a temporary commit and regenerate with `./script/install_locally_dev.sh` + +You need to remove `clone-depth="10"` from `./manifest/default.dev.xml` in order to be able to commit and push. Make a +temporary commit and regenerate with `./script/install_locally_dev.sh` ## Fork project to create a new project independent from ERPLibre (deprecated) -ERPLibre was created with this script. It's now deprecated. -Use this script when you need to fork directly from the original source. -Don't use this script if you want to update from ERPLibre and follow mainstream development. + +ERPLibre was created with this script. It's now deprecated. Use this script when you need to fork directly from the +original source. Don't use this script if you want to update from ERPLibre and follow mainstream development. + ```bash ./script/fork_project.py --github_token GITHUB_KEY --organization NAME ``` # Fork all repos for you own organization -Go to your Github account and generate a token to access fork option with your user. Create an organization or use your personal account and choose your user name. + +Go to your Github account and generate a token to access fork option with your user. Create an organization or use your +personal account and choose your user name. This command will fork all repos and ERPLibre to your own organization. It keeps track of ERPLibre. + ```bash ./script/fork_project_ERPLibre.py --github_token GITHUB_KEY --organization NAME ``` ## Generate manifest from csv repo + Add repo in file [./source_repo_addons.csv](./source_repo_addons.csv) Execute to generate Repo manifest + ```bash ./script/fork_project_ERPLibre.py --skip_fork ``` ## Move database from prod to dev -When moving database from prod to your dev environment, you want to remove email servers and install user test in order to test the database. -Run: + +When moving database from prod to your dev environment, you want to remove email servers and install user test in order +to test the database. Run: + ```bash ./run.sh --stop-after-init -i user_test,disable_mail_server --dev all -d DATABASE ``` ## Change git url https to Git + This will update all urls in Git format: + ```bash ./script/git_change_remote_https_to_git.py ``` ## Showing repo differences between projects + Tools to display the differences between the repo and another project. + ```bash ./script/git_change_remote.py --sync_to /path/to/project/erplibre --dry_sync ``` ## Showing repo differences with manifest develop + To understand the divergences with the dev manifest. + ```bash ./script/git_show_code_diff_repo_manifest.py -m ./manifest/default.dev.xml ``` ## Sync repo with another project -Tools to synchronise the repo with another project. This will show differences and try to checkout on the same commit in all repos. + +Tools to synchronise the repo with another project. This will show differences and try to checkout on the same commit in +all repos. + ```bash ./script/git_change_remote.py --sync_to /path/to/project/erplibre ``` ## Compare two files manifests + To show differences between commits in different manifests + ```bash ./script/git_diff_repo_manifest.py --input1 ./manifest/MANIFEST1.xml --input2 ./manifest/MANIFEST2.xml ``` ## Differences between code and manifest + To show differences between actual code and manifest + ```bash ./script/git_show_code_diff_repo_manifest.py --manifest ./manifest/MANIFEST1.xml ``` ## Add repo + To access a new repo, add your URL to file [source_repo_addons.csv](../source_repo_addons.csv) Fork the repo to be able to push new code: + ```bash ./script/fork_project_ERPLibre.py ``` To regenerate only manifest.xml. + ```bash ./script/fork_project_ERPLibre.py --skip_fork ``` Check if manifest contains "auto_install" and change the value to False. + ```bash ./script/repo_remove_auto_install.py ``` ## Filter repo by group + Only keep repo tagged by group 'base' and 'code_generator' + ```bash ./script/update_manifest_local_dev_code_generator.sh ``` # Execution + ## Config file + You can limit your addons in ERPlibre config file depending on a group of your actual manifest. + ```bash ./script/git_repo_update_group.py --group base,code_generator ./script/install_locally.sh ``` + Or go back to normal + ```bash ./script/git_repo_update_group.py ./script/install_locally.sh ``` # Coding + ## Create module scaffold + ```bash source ./.venv/bin/activate python odoo/odoo-bin scaffold MODULE_NAME addons/REPO_NAME/ ``` # Pull request + ## Show all pull requests from organization + ```bash /script/pull_request_ERPLibre.py --github_token ### --organization ERPLibre ``` # Commit + Use this commit format: + ```bash git commit -am "[#ticket] subject: short sentence" ``` # Format code + ## Python + Use [black](https://github.com/psf/black) + ```bash ./script/maintenance/black.sh ./addons/TechnoLibre_odoo-code-generator ``` Or if you prefer [oca-autopep8](https://github.com/psf/black) + ```bash ./script/maintenance/autopep8.sh ./addons/TechnoLibre_odoo-code-generator ``` ## HTML and css + Use [prettier](https://github.com/prettier/prettier) + ```bash ./script/maintenance/prettier.sh ./addons/TechnoLibre_odoo-code-generator ``` ## Javascript + Use [prettier](https://github.com/prettier/prettier) + ```bash ./script/maintenance/prettier.sh --tab-width 4 ./addons/TechnoLibre_odoo-code-generator ``` diff --git a/doc/DISCOVER.md b/doc/DISCOVER.md index 138f44f..1a83a63 100644 --- a/doc/DISCOVER.md +++ b/doc/DISCOVER.md @@ -1,13 +1,17 @@ # Discover + Explore the ERPLibre solution. ## Fast installation + ### 1. Clone the project: + ```bash git clone https://github.com/ERPLibre/ERPLibre.git ``` ### 2. Run installation locally: + ```bash cd ERPLibre ./script/install_dev.sh @@ -15,14 +19,17 @@ cd ERPLibre ``` ### 3. Run ERPLibre + ```bash ./run.sh ``` ## Add repo + To access a new repo, add your URL to file [source_repo_addons.csv](../source_repo_addons.csv) Execute script: + ```bash ./script/git_repo_manifest.py git checkout -b NEW_BRANCH @@ -30,4 +37,5 @@ git commit -am "Add new repo" ./script/install_locally_dev.sh ./script/poetry_update.py ``` + [Update your repo.](./GIT_REPO.md) diff --git a/doc/FAQ.md b/doc/FAQ.md index 1d69a77..285ebd6 100644 --- a/doc/FAQ.md +++ b/doc/FAQ.md @@ -1,21 +1,31 @@ # FAQ + ## Networking + Show all open port + ```bash sudo lsof -i -P -n | grep LISTEN ``` + or + ```bash sudo netstat -lpnt | grep LISTEN ``` + or + ```bash sudo ss -lpnt | grep LISTEN ``` ## git-repo + ### error.GitError fatal bad revision + Example: + ``` error.GitError: manifests rev-list (u'^2736dfd46e8a30cf59a9cd6e93d9e56e87021f2a', 'HEAD', '--'): fatal: bad revision 'HEAD' ``` @@ -23,6 +33,7 @@ error.GitError: manifests rev-list (u'^2736dfd46e8a30cf59a9cd6e93d9e56e87021f2a' Did you modify files in .repo? To reset files from your branch into .repo: + ```bash cd .repo/manifests git branch -av @@ -32,4 +43,4 @@ git branch -av # To reset the "remotes/origin" use the same as "remotes/m" git reset --hard REF_OF_REMOTES/m > git reset --hard remotes/origin/rel/8953/zd552kl/7.1.1-11.40.208 -``` \ No newline at end of file +``` diff --git a/doc/GIT_REPO.md b/doc/GIT_REPO.md index d5d5a4c..1dd0a04 100644 --- a/doc/GIT_REPO.md +++ b/doc/GIT_REPO.md @@ -1,27 +1,34 @@ # git-repo + This is a guide to understand git-repo. Scripts in ERPLibre use git-repo automatically. -[git-repo of Google](https://code.google.com/archive/p/git-repo) is used to manage all git repositories under licence [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0.html). +[git-repo of Google](https://code.google.com/archive/p/git-repo) is used to manage all git repositories under +licence [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0.html). ## Setup repo + ```bash curl https://storage.googleapis.com/git-repo-downloads/repo > ./.venv/repo ``` ## prod + ```bash ./.venv/repo init -u https://github.com/ERPLibre/ERPLibre -b master ./.venv/repo sync ``` ## dev + ```bash ./.venv/repo init -u https://github.com/ERPLibre/ERPLibre -b 12.0_repo -m ./manifest/default.dev.xml ./.venv/repo sync ``` ## local dev + [Guide to setup locally git](https://railsware.com/blog/taming-the-git-daemon-to-quickly-share-git-repository/). + ```bash git daemon --base-path=. --export-all --reuseaddr --informative-errors --verbose & @@ -30,21 +37,31 @@ git daemon --base-path=. --export-all --reuseaddr --informative-errors --verbose ``` # Create Manifest -A [Manifest](https://gerrit.googlesource.com/git-repo/+/master/docs/manifest-format.md), is an XML file managed by git-repo to generate a repo. + +A [Manifest](https://gerrit.googlesource.com/git-repo/+/master/docs/manifest-format.md), is an XML file managed by +git-repo to generate a repo. ## Make a new version of prod + It freezes all repo, from dev to prod. This will add revision git hash in the manifest. + ```bash ./.venv/repo manifest -r -o ./default.xml ``` + Commit. + ```bash git commit -am "[#ticket] subject: short sentence" ``` + ### Mix prod and dev to create a stage version -When dev contains specific revision with default revision, you need to replace default revision with prod revision and keep specific version: + +When dev contains specific revision with default revision, you need to replace default revision with prod revision and +keep specific version: + ```bash ./script/git_merge_repo_manifest.py --input1 ./manifest/default.dev.xml --input2 ./default.xml --output ./manifest/default.staged.xml git commit -am "Updated manifest/default.staged.xml" @@ -56,32 +73,41 @@ git daemon --base-path=. --export-all --reuseaddr --informative-errors --verbose ./.venv/repo manifest -r -o ./default.xml ``` + ## Create a dev version + ```bash ./.venv/repo manifest -o ./manifest/default.dev.xml ``` + Commit. + ```bash git commit -am "[#ticket] subject: short sentence" ``` ## Useful commands + ### Search all repos with a specific branch name + ```bash ./.venv/repo forall -pc "git branch -a|grep BRANCH" ``` ### Search missing branch in all repos + ```bash ./.venv/repo forall -pc 'git branch -a|(grep /BRANCH$||echo "no match")|grep "no match"' ``` ### Search changed file in all repos + ```bash ./.venv/repo forall -pc "git status -s" ``` ### Clean all + Before cleaning, check changed file in all repos. ```bash @@ -95,6 +121,7 @@ Check the changed branch, and push changed if needed. ``` Maybe, some version diverge from your manifest. Simply clean all and relaunch your installation. + ```bash ./script/clean_repo_manifest.sh ``` diff --git a/doc/HOWTO.md b/doc/HOWTO.md index 4f2b2f0..f501c64 100644 --- a/doc/HOWTO.md +++ b/doc/HOWTO.md @@ -1,3 +1,5 @@ # HOW TO + ## Update changelog + Please read the following documentation [keepachangelog.com](https://keepachangelog.com) diff --git a/doc/MIGRATION.md b/doc/MIGRATION.md deleted file mode 100644 index 847aa87..0000000 --- a/doc/MIGRATION.md +++ /dev/null @@ -1,29 +0,0 @@ -# ERPLibre - -## Migration procedure in production - -TODO - -## Migration procedure in dev - -Example: - -update module helpdesk_mgmt and helpdesk_join_team - -update translation all - -Remove helpdesk_res_partner_team - -Delete module not found - -smile_upgrade? - -update html categorie_id - -join_team == 6 - -servicecall == 1 - ---limit-time-real 99999 -c config.conf --stop-after-init -d santelibre -i helpdesk_mrp -i erplibre_base_enterprise_mrp,erplibre_base_hackaton,helpdesk_mgmt -u helpdesk_join_team - ---limit-time-real 99999 -c config.conf --stop-after-init -d santelibre -u helpdesk_join_team diff --git a/doc/POETRY.md b/doc/POETRY.md index 5ed5658..a5f17d6 100644 --- a/doc/POETRY.md +++ b/doc/POETRY.md @@ -1,9 +1,13 @@ # Poetry + ## Add dependencies automatically + Add your dependencies in file [requirements.txt](../requirements.txt) and run script + ```bash ./script/poetry_update.py ``` + This will search all `requirements.txt` files and update `pyproject.toml` and it will update poetry Priority dependencies in ./requirements.txt, after it's ./odoo/requirements.txt, after it's highest version values. @@ -11,7 +15,9 @@ Priority dependencies in ./requirements.txt, after it's ./odoo/requirements.txt, TODO add option to only add missing dependencies and ignore update. ## Add dependencies manually + The automatic script will erase this dependency, but you can add it for your local test. + ```bash poetry add PYTHON_MODULE ``` diff --git a/doc/PRODUCTION.md b/doc/PRODUCTION.md index 5fe2558..7c9b85d 100644 --- a/doc/PRODUCTION.md +++ b/doc/PRODUCTION.md @@ -1,24 +1,27 @@ # ERPLibre production guide ## Requirement + - 5Go of disk space ## Production installation procedure ### 1. Clone the project: + ```bash git clone https://github.com/ERPLibre/ERPLibre.git cd ERPLibre ``` ### 2. Modify the parameters -Modify the file env_var.sh for production installation. -Enable nginx if you need a proxy with `EL_INSTALL_NGINX`. + +Modify the file env_var.sh for production installation. Enable nginx if you need a proxy with `EL_INSTALL_NGINX`. Redirect your DNS to the proxy's ip and add your A and AAAA into `WL_WEBSITE_NAME` with space between. ### 3. Execute the scripts: #### With proxy nginx production, install certbot before for SSL + ```bash # Snap installation # https://snapcraft.io/docs/installing-snap-on-debian @@ -33,68 +36,84 @@ sudo ln -s /snap/bin/certbot /usr/bin/certbot ``` #### Ubuntu 18.04 server + ```bash ./script/install_dev.sh ./script/install_production.sh ``` + A service is runned by SystemD. You can access it with the DNS name found in `env_var.sh` #### Ubuntu 20.04 server + Apply fix libpng12-0: https://www.linuxuprising.com/2018/05/fix-libpng12-0-missing-in-ubuntu-1804.html ```bash ./script/install_dev.sh ./script/install_production.sh ``` + A service is runned by SystemD, you can access it with the DNS name found in `env_var.sh` ### 4. SSL: + Generate a ssl certificate + ```bash sudo certbot --nginx ``` ## Watch log + ```bash sudo systemctl -feu [EL_USER] ``` ## Run by address ip + Comment the following line in `/[EL_USER]/erplibre/config.conf` + ``` #xmlrpc_interface = 127.0.0.1 #netrpc_interface = 127.0.0.1 #proxy_mode = True ``` + Add your address ip server_name in nginx config `/etc/nginx/sites-available/[EL_WEBSITE_NAME]` Restart daemon: + ```bash sudo systemctl restart nginx sudo systemctl restart [EL_USER] ``` ## Production execution + ```bash cd /[EL_USER]/erplibre ./run.sh -d [DATABASE] --no-database-list ``` ## Move prod database to dev -When moving prod database to your dev environment, you want to remove email servers and install user test to test the database. -WARNING, this is not safe for production, you will expose all data. -Run: + +When moving prod database to your dev environment, you want to remove email servers and install user test to test the +database. WARNING, this is not safe for production, you will expose all data. Run: + ```bash ./script/migrate_prod_to_test.sh DATABASE ``` ## Update production + Update all features. + ```bash ./run.sh --limit-time-real 99999 --stop-after-init -u all -d DATABASE ``` # Postgresql + To show config files: > psql -U postgres -c 'SHOW config_file' @@ -102,7 +121,9 @@ Edit this file to accept interface from all networks: > /var/lib/postgres/data/postgresql.conf # Delete an instance in production + CAUTION, this will delete user's home, it's irrevocable. + ```bash ./script/delete_production.sh ``` @@ -114,6 +135,7 @@ mkdir ~/.cloudflare ``` Edit ~/.cloudflare/cloudflare.cfg + ``` [PROFILE_NAME] email=EMAIL @@ -121,6 +143,7 @@ token=TOKEN ``` Add your cron + ```bash vim /etc/crontab # Add @@ -128,6 +151,7 @@ vim /etc/crontab ``` Check log with + ```bash sudo journalctl -feu cron ``` diff --git a/doc/RELEASE.md b/doc/RELEASE.md index 0019caa..2606177 100644 --- a/doc/RELEASE.md +++ b/doc/RELEASE.md @@ -4,7 +4,7 @@ A guide on how to generate a release. ## Clean environment before generating new release -Before the cleaning, check if existing file is not committed, not pushed or in stash. +Before the cleaning, check if existing file isn't committed, not pushed or in stash. ```bash ./.venv/repo forall -pc "git stash list" @@ -26,29 +26,50 @@ And update all from dev to merge into prod. ## Validate environment - Check if [manifest/default.dev.xml](../manifest/default.dev.xml) is ready for production. -- Run test with `make test` +- Run test : + +```bash +make test +``` ### Format code -Run `make format` to format all code. +To format all code, run: + +```bash +make format +``` ### Update image_db -Run `make image_db_create_all` to generate database images in directory `./image_db`. +To generate database images in directory `./image_db`, run: + +```bash +make image_db_create_all +``` ### Update documentations -Run `make doc_markdown` to generate Markdown in directory `./doc`. +To generate Markdown in directory `./doc`, run: + +```bash +make doc_markdown +``` ### Test docker generate -Run `make docker_build` to generate a docker. +To generate a docker, run: + +```bash +make docker_build +``` ### Test production Ubuntu environment Follow instructions in [PRODUCTION.md](./PRODUCTION.md). Test installation with code generator Geomap: + ```bash make addons_install_code_generator_full ``` @@ -157,4 +178,3 @@ To generate a list of differences between repo git commit ```bash ./script/git_change_remote.py --sync_to /path/to/directory ``` - diff --git a/doc/RUN.md b/doc/RUN.md index c2c71a6..7e74319 100644 --- a/doc/RUN.md +++ b/doc/RUN.md @@ -1,49 +1,65 @@ # Execute ERPLibre ## Start database + ```bash sudo systemctl start postgresql.service ``` ## Run ERPLibre + ### Method 1 + Simply + ```bash ./run.sh ``` With arguments + ```bash ./run.sh -h ``` ### Method 2 + Execute your own python script: + ```bash ./run.sh --log-level debug ``` ### Update all + Great idea to run it when updating Odoo, it updates each module database. + ```bash ./run.sh -d [DATABASE] -u all --log-level debug ``` ### Update module + ```bash ./run.sh -d [DATABASE] -u [module] --log-level debug ``` ### Test + First execution, install you requirements, choose a new database. + ```bash ./run.sh -d [DATABASE] -i [module to test] --test-enable --stop-after-init --log-level=test ``` + Execute your test on a specific module. + ```bash ./run.sh -d [DATABASE] -u [module to test] --test-enable --stop-after-init --log-level=test ``` + Execute your test on a specific module with tags. + ```bash ./run.sh -d [DATABASE] -u [module to test] --test-enable --stop-after-init --log-level=test --test-tags [module_name][tags] -``` \ No newline at end of file +``` diff --git a/doc/TODO.md b/doc/TODO.md index 5650e49..4ea07a8 100644 --- a/doc/TODO.md +++ b/doc/TODO.md @@ -1,11 +1,13 @@ # Note healtcheck + Table à vérifier dans pgsql: ir_ui_view Restore une BD: + - un module est installé mais n'est pas physiquement là Une DB est installé mais on n'arrive pas à l'exécuté - HEALTHCHECK CMD curl --fail http://localhost:8069/web || exit 1 +HEALTHCHECK CMD curl --fail http://localhost:8069/web || exit 1 - TODO: having the DB variable configurable \ No newline at end of file +TODO: having the DB variable configurable diff --git a/doc/UPDATE.md b/doc/UPDATE.md index 284be38..953ad05 100644 --- a/doc/UPDATE.md +++ b/doc/UPDATE.md @@ -1,20 +1,25 @@ # Update ERPLibre + ## Update all repos from the origin source + The update is possible on branch 12.0, you need to verify this branch existence. -1. Make sure all git repos are conform, remove all argument depth from manifest and regenerate. -You can clean all and regenerate. +1. Make sure all git repos are conform, remove all argument depth from manifest and regenerate. You can clean all and + regenerate. + ```bash ./script/clean_repo_manifest.sh ./script/install_locally_dev.sh ``` 2. Update all remote with ssh/git + ```bash ./script/git_change_remote_https_to_git.py ``` 3. Run update script + ```bash ./script/git_update_repo.py ```