From e04a64d9520c0564892ffb82af9511390161e7b6 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Tue, 29 Aug 2023 02:11:51 -0500 Subject: [PATCH 01/58] increased version and removed requirements --- .env.example | 2 +- odoo/requirements.txt | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.env.example b/.env.example index 59b3ee8..da2d250 100644 --- a/.env.example +++ b/.env.example @@ -64,7 +64,7 @@ PROJECT_NAME=odoocker SUPPORT_EMAIL=mail@example.com # Containers' Tags -ODOO_TAG=14.0 +ODOO_TAG=15.0 POSTGRES_TAG=15.4 NGINX_TAG=1.25.2 NGINX_PROXY_TAG=1.3.1 diff --git a/odoo/requirements.txt b/odoo/requirements.txt index 3054caa..fb6626a 100644 --- a/odoo/requirements.txt +++ b/odoo/requirements.txt @@ -1,5 +1,2 @@ -jinja2 -sortedcontainers debugpy websocket-client -pyOpenSSL From cb0e40d74fe6c7c4ee2deef7089af4ab42423f77 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Tue, 29 Aug 2023 03:22:11 -0500 Subject: [PATCH 02/58] changed /longpolling url to /websocket and longpolling_port to gevent_port --- .env.example | 6 +++--- nginx/default.conf | 4 ++-- odoo/odoo.example.conf | 5 +++-- odoo/odoorc.sh | 7 ++++--- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.env.example b/.env.example index da2d250..74139a6 100644 --- a/.env.example +++ b/.env.example @@ -6,7 +6,7 @@ APP_ENV=local INIT= UPDATE= LOAD=base,web -WORKERS=0 +WORKERS=2 DEV_MODE=reload,qweb DOMAIN=erp.odoocker.test @@ -64,7 +64,7 @@ PROJECT_NAME=odoocker SUPPORT_EMAIL=mail@example.com # Containers' Tags -ODOO_TAG=15.0 +ODOO_TAG=16.0 POSTGRES_TAG=15.4 NGINX_TAG=1.25.2 NGINX_PROXY_TAG=1.3.1 @@ -113,7 +113,7 @@ DEBUG_INTERFACE=${HTTP_INTERFACE} HTTP_PORT=8069 DEBUG_PORT=8070 XMLRPCS_PORT=8071 -LONGPOLLING_PORT=8072 +GEVENT_PORT=8072 HTTP_ENABLE=True XMLRPCS=True PROXY_MODE=True diff --git a/nginx/default.conf b/nginx/default.conf index 97f5929..dcd7604 100644 --- a/nginx/default.conf +++ b/nginx/default.conf @@ -47,11 +47,11 @@ server { proxy_pass http://odoo:8069; } - location /longpolling { + location /websocket { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header Host $host; + proxy_set_header X-Forwarded-Host $host; proxy_pass http://odoo:8072; } } diff --git a/odoo/odoo.example.conf b/odoo/odoo.example.conf index 84e2820..30d8ee5 100644 --- a/odoo/odoo.example.conf +++ b/odoo/odoo.example.conf @@ -64,8 +64,9 @@ xmlrpcs_interface = {XMLRPCS_INTERFACE} ; --xmlrpcs-port xmlrpcs_port = {XMLRPCS_PORT} -; --longpolling_port -longpolling_port = {LONGPOLLING_PORT} +; --gevent-port | --longpolling_port (deprecated) +gevent_port = {GEVENT_PORT} +longpolling_port = False ; --no-http | --no-xmlrpc http_enable = {HTTP_ENABLE} diff --git a/odoo/odoorc.sh b/odoo/odoorc.sh index 9b841f2..4358e4f 100755 --- a/odoo/odoorc.sh +++ b/odoo/odoorc.sh @@ -35,7 +35,7 @@ defaults=( [HTTP_PORT]=${HTTP_PORT} [XMLRPCS_INTERFACE]=${XMLRPCS_INTERFACE} [XMLRPCS_PORT]=${XMLRPCS_PORT} - [LONGPOLLING_PORT]=${LONGPOLLING_PORT} + [GEVENT_PORT]=${GEVENT_PORT} [HTTP_ENABLE]=${HTTP_ENABLE} [XMLRPCS]=${XMLRPCS} [PROXY_MODE]=${PROXY_MODE} @@ -170,8 +170,9 @@ xmlrpcs_interface = {XMLRPCS_INTERFACE} ; --xmlrpcs-port xmlrpcs_port = {XMLRPCS_PORT} -; --longpolling_port -longpolling_port = {LONGPOLLING_PORT} +; --gevent-port | --longpolling_port (deprecated) +gevent_port = {GEVENT_PORT} +longpolling_port = False ; --no-http | --no-xmlrpc http_enable = {HTTP_ENABLE} From e9e6f02839e19855d7dca1dfe2c04f47826910b2 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Tue, 29 Aug 2023 03:22:59 -0500 Subject: [PATCH 03/58] changed default workers --- .env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.example b/.env.example index da2d250..849c810 100644 --- a/.env.example +++ b/.env.example @@ -6,7 +6,7 @@ APP_ENV=local INIT= UPDATE= LOAD=base,web -WORKERS=0 +WORKERS=2 DEV_MODE=reload,qweb DOMAIN=erp.odoocker.test From 97180b920e0f920d1a453379b59a88ca8433d778 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Tue, 29 Aug 2023 03:55:41 -0500 Subject: [PATCH 04/58] delete test user & token --- .env.example | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 849c810..bf53454 100644 --- a/.env.example +++ b/.env.example @@ -11,8 +11,8 @@ DEV_MODE=reload,qweb DOMAIN=erp.odoocker.test # Enterprise -GITHUB_USER=yhaelopez -GITHUB_ACCESS_TOKEN=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 +GITHUB_USER= +GITHUB_ACCESS_TOKEN= # Database ADMIN_PASSWD=odoo From cb937984db312ccdec865acddbbccf2f43fd6626 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Tue, 29 Aug 2023 03:56:17 -0500 Subject: [PATCH 05/58] delete test user & token --- .env.example | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 74139a6..3974d52 100644 --- a/.env.example +++ b/.env.example @@ -11,8 +11,8 @@ DEV_MODE=reload,qweb DOMAIN=erp.odoocker.test # Enterprise -GITHUB_USER=yhaelopez -GITHUB_ACCESS_TOKEN=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 +GITHUB_USER= +GITHUB_ACCESS_TOKEN= # Database ADMIN_PASSWD=odoo From ce2bef1bdcbf6d8f72a4ecd1b3fd5a785aac07e4 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Wed, 30 Aug 2023 20:11:07 -0500 Subject: [PATCH 06/58] cleanup readme --- README.md | 87 +++++++++++++++++++++++++++---------------------------- 1 file changed, 43 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index fba1d8c..75693a7 100644 --- a/README.md +++ b/README.md @@ -2,27 +2,18 @@ Welcome to Odoocker, a game-changer in the world of Odoo Development and Deployment. This tool is meticulously crafted to revolutionize your experience with Odoo, ensuring simplicity, efficiency, and a top-tier development journey. And while it’s rooted in the principles of the Official Odoo Docker setup, it goes several steps beyond. -**Best of all**, you don't need any prior knowledge of **Odoo** or **Docker** to start your journey with Odoocker. +Whether you're using the Community or Enterprise edition, this Docker solution is tailored just for you. + +**Best part of this?** You don't need any prior knowledge of **Docker**, **Odoo** or any technology that involves this Framework. We stick to Docker philosophy: **Use it, then learn about it.** Feel free to post a Pull Request to continue enhancing this project. ### Why Odoocker Stands Out: +1. 🌐 **Universal:** Suitable for both Odoo Community and Enterprise editions. +2. 📦 **Easy Setup:** Clone, configure `.env` file, and you're ready to deploy. +3. 🔒 **Secure:** Automatic SSL certificate renewal to keep your data safe (for production only). -1. **Minimalistic Server Approach**: In an era where less is more, we keep server clutter at bay. With Odoocker, you'll witness a decluttered server environment, stripped down to the bare essentials. This minimalism ensures optimal resource utilization, leading to faster response times, reduced chances of conflicts, and a smooth-running Odoo instance. - -2. **Usability at its Core**: Odoocker is user-centric. By keeping the interface intuitive and the processes straightforward, we ensure that even newcomers to the Odoo ecosystem can set up and deploy with relative ease. - -3. **Dynamic Yet Simple Configuration**: Customization doesn't have to be complicated. With our `.env` setup, adapting your Odoo instance to your unique needs is a breeze, ensuring you have the flexibility without the fuss. - -4. **Streamlined Development Cycle**: With our intuitive steps and tips, deploying Odoo becomes as simple as 1-2-3. The goal is clear: *to ensure developers do what they love most, code*. - -5. **Clean, Unadulterated Performance**: With a spotlight on a single Odoo instance and a decluttered server, performance optimization is a given. Expect faster load times, smoother operations, and a user experience that’s top-notch. - -In essence, Odoocker isn't just another tool in the developer's arsenal. It's a philosophy. A commitment to clean, efficient, and delightful Odoo development. So, whether you’re a seasoned Odoo veteran or just starting your journey, Odoocker is here to make sure it’s smooth sailing all the way. - -Note: We always recommend keeping abreast with the official documentation for the most detailed and updated insights. Knowledge is power, after all. - -**Note:** While we've aimed to make things simpler, always refer to the official documentation for detailed information and updates. After all, knowledge is power! +In essence, Odoocker isn't just another tool, it's a philosophy. So, whether you’re a seasoned Odoo veteran or just starting your journey, Odoocker is here to make sure it’s smooth sailing all the way. ## Contents @@ -49,9 +40,9 @@ Note: We always recommend keeping abreast with the official documentation for th # Quick Setup Guide: -1. **Clone and Prep**: Get your hands on this wonder-tool in seconds with a simple clone and a few copy commands: +1. **Clone and Configure**: ``` -git clone git@github.com:yhaelopez/odoocker.git +git clone git@github.com:odoocker/odoocker.git cp .env.example .env && cp docker-compose.override.local.yml docker-compose.override.yml ``` 2. **Hosts & Domains**: To ensure everything runs smoothly, remember to add the necessary domains to your hosts file. @@ -68,9 +59,9 @@ For *Windows*, manually add these lines to C:\Windows\System32\drivers\etc\hosts ``` # The `.env` File -The environment variables located in [`.env`](https://github.com/yhaelopez/odoocker/blob/main/.env.example) provide dynamic configurations to Odoo and the project in general. -The [`odoo.conf`](https://github.com/yhaelopez/odoocker/blob/main/odoo/odoo.example.conf) file is generated by the [`odoorc.sh`](https://github.com/yhaelopez/odoocker/blob/main/odoo/odoorc.sh) script based on the environment variables. - +The environment variables located in [`.env`](https://github.com/odoocker/odoocker/blob/main/.env.example) provide dynamic configurations to Odoo and the project in general. +The [`odoo.conf`](https://github.com/odoocker/odoocker/blob/main/odoo/odoo.example.conf) file is generated by the [`odoorc.sh`](https://github.com/odoocker/odoocker/blob/main/odoo/odoorc.sh) script based on the environment variables. +
This file is divided in sections, you most likely are going to focus on the `Main Configuration` section. This provides quick access to project and `odoo.conf` variables. The rest of section are container specific variables for different container. (Note: you may find *repeated variables* like `SUPPORT_EMAIL=${SUPPORT_EMAIL}` which interacts with different containers. This is to explicitly denote in the `.env` file that this variable is being shared through those containers. Sample `.env` file: @@ -85,7 +76,8 @@ DEV_MODE=reload,qweb DOMAIN=erp.odoocker.test # Enterprise (GitHub User with access to Odoo Enterprise [https://github.com/odoo/enterprise] Repo) -GITHUB_USER=yhaelopez +# If not present, Odoo Community will be brought up. +GITHUB_USER=odoocker GITHUB_ACCESS_TOKEN=ghp_token # Database @@ -98,32 +90,36 @@ DB_PASSWORD=odoo LOAD_LANGUAGE=es_MX ... ``` - +
## Environment-based actions: -[`odoo/entrypoint.sh`](https://github.com/yhaelopez/odoocker/blob/main/odoo/entrypoint.sh) file is the gateway for our Odoo container. Depending on the `APP_ENV` and the rest of the environment variables, it determines how to start the Odoo service (like local, testing, production, etc.) with different configurations. +[`odoo/entrypoint.sh`](https://github.com/odoocker/odoocker/blob/main/odoo/entrypoint.sh) file is the gateway for our Odoo container. Depending on the `APP_ENV` and the rest of the environment variables, it determines how to start the Odoo service (like local, testing, production, etc.) with different configurations. +
+In all environments, `odoo.conf` follows the `.env` file variables. Some environments may have command-line parameter to overwrite certain configurations. -All environments receive the whole `.env` file variables. However, some of them have fixed command-line variables specific for each environment. For example, some of them may have `--limit-time-cpu=3600` because some databases are so big that may require a huge amount of seconds. Setting 1 hour ensures any DB can be imported (this can change as needed in the specific project). These values in command line overwrite the ones in the `.env` file. - -**To bring up most of the following environments run**: +**To bring up all the environments run**: +``` +docker-compose up -d --build && docker-compose logs odoo +``` +Restart adding `down`: ``` docker-compose down && docker-compose up -d --build && docker-compose logs odoo ``` -Here are the descriptions of each of them. - ### 1. Fresh or Restore -These environments (`APP_ENV=fresh` or `APP_ENV=restore`) will have no database created and are perfect for setting up a fresh database instance or restoring a production database. +These environments (`APP_ENV=fresh` or `APP_ENV=restore`) will have no database created. Are perfect for setting up a **fresh database** instance or **restoring a production database**. ### 2. Local: This environment (`APP_ENV=local`) will strictly follow the `.env` variables with no command-line overwrites. You'll most likely be using this regularly. Use `DEV_MODE=reload,qweb` to activate hot reload when changing `python` and `xml` files. +
If you prefer to update the packages everytime you restart Odoo container, you can set `UPDATE=module1,module2,module3`. ### 3. Debug: -This environment (`APP_ENV=debug`) works same way as local, but it starts Odoo using the `debugpy` library. Thanks to our [`.vscode/launch.json`](https://github.com/yhaelopez/odoocker/blob/main/.vscode/launch.json), if you are using Visual Studio Code, you start a Debugger session and the container will be aware of your breakpoints and stop wherever you need. This is my favorite environment to work since I use the debugger a lot while developing. +This environment (`APP_ENV=debug`) works same way as local, but it starts Odoo using the `debugpy` library. Thanks to our [`.vscode/launch.json`](https://github.com/odoocker/odoocker/blob/main/.vscode/launch.json), if you are using **Visual Studio Code**, you can start a Debugger session so the container is aware of your breakpoints and stop wherever you need. This is **my favorite** environment to work since I use the debugger a lot while developing. ### 4. Testing: -This environment (`APP_ENV=testing`) is specific for running tests (and will be included in a CI/CD pipeline in a future version). It help us test the modules we are developing to ensure a safe deployment. +This environment (`APP_ENV=testing`) is specific for running tests *(and will be included in a CI/CD pipeline in a future version)*. It help us test the modules we are developing to ensure a safe deployment. +
A `test_DB_NAME` database is automagically created. The `ADDONS_TO_TEST=addon_1` are installed in that fresh DB. Use `TEST_TAGS=test_tag_1` to filter your tests. @@ -131,24 +127,24 @@ Use `TEST_TAGS=test_tag_1` to filter your tests. **NOTE: Avoid running tests without tags**; otherwise, it will trigger tests in all installed addons and we don't want this. For now, let's assume Odoo Community & Enterprise tests passed and only focus on the things you need to test. ### 5. Full: -This environment (`APP_ENV=full`) will install the `INIT` modules in a new or existing `DB_NAME`. This allows us to have a fresh production database replica. +This environment (`APP_ENV=full`) will install the `INIT` modules in a new or existing `DB_NAME`. It allows us to have a fresh production database replica. ### 6. Staging: -This environment (`APP_ENV=staging`) sets `UPDATE=all`; this allows us to *update* all installed addons at once. +This environment (`APP_ENV=staging`) sets `UPDATE=all`; it allows us to **update all installed addons at once**. +
It also allows to install new packages before the upgrade through `INIT`. - +
It's highly recommended to use this command to run this environment - ``` -docker-compose down && git pull && docker-compose pull && docker-compose build --no-cache && docker-compose up -d && docker-compose logs -f odoo +docker-compose down && docker-compose pull && docker-compose build --no-cache && docker-compose up -d && docker-compose logs -f odoo ``` -This will `pull` the latest *Odoo Community, Enterprise, Extra and Custom addons*, basically, it upgrades the whole Odoo instance to the newest. Additionally, it will also pull the latest images of the other containers in this project. +This will `pull` the latest *Odoo Community, Enterprise, Extra and Custom addons*, basically, it **upgrades the whole Odoo instance** to the newest. Additionally, it will also pull the latest images of the other containers in this project. This environment is perfect for deployments. -**NOTE: Do not bring down & up again unless you want to perform a whole update again.** +**NOTE: Do not bring down & up again, unless you want to perform a whole upgrade again.** ### 7. Production: -This is the production environment (`APP_ENV=production`). It ensures no demo data is loaded and debugging is turned off. It also brings up the `Let's Encrypt` container, so you won't worry about `SSL Certificates` anymore! Some `.env` variables are overwritten in this setup. +This environment (`APP_ENV=production`) ensures no demo data is loaded, debugging and dev_mode are turned off. It also brings up the `Let's Encrypt` container, so you won't worry about `SSL Certificates` anymore! Some `.env` variables are overwritten in this setup. - Take down previous setup of containers ``` @@ -158,6 +154,7 @@ docker-compose down ``` cp docker-compose.override.production.yml docker-compose.override.yml ``` +- Make sure the DNS record of your `DOMAIN` is pointing to your server. - Rebuild the containers ``` docker-compose up -d --build && docker-compose logs odoo @@ -167,7 +164,9 @@ docker-compose up -d --build && docker-compose logs odoo The following tips will enhance your developing and production experience. ## 1. Search through all Addons at once: -If you are using `Visual Studio Code` & the Docker Extension is installed, you can open the Odoo Container in the `ROOT_PATH`. There you will find all Odoo `Community Addons`, `Enterprise Addons`, `Extra Addons` and `Custom Addons`. The Extra and Custom addons coming from your project. +If you are using `Visual Studio Code` & the **Docker Extension** is installed, you can open the Odoo Container in the `ROOT_PATH`. There you will find all Odoo `Community Addons`, `Enterprise Addons`, `Extra Addons` and `Custom Addons` in the same folder level. +
+Using the Search Panel will allow you to look at every single reference of what you are looking for in the whole Odoo Instance and not just in your addons. ## 2. Define the following aliases: ``` @@ -182,8 +181,8 @@ alias logs='docker-compose logs -f --tail 2000 odoo' ## 3. NEVER run `docker-compose down -v` in Production ...without having a `tested backed up` database - -Have in mind that dropping volumes will destroy DB data, Odoo Conf & Filestore, *Let's Encrypt certificates, and more!*. If you execute this command several times in `prod` in a short period of time, you may reach the `Let's Encrypt` certificates limit and Odoocker won't be able to generate new ones after **several hours**. +
+Have in mind that dropping volumes will destroy DB data, Odoo Conf & Filestore, *Let's Encrypt certificates, and more!* If you execute this command several times in `prod` in a short period of time, you may reach the `Let's Encrypt certificates limit`` and Odoocker won't be able to generate new ones after **several hours**. ## 4. Odoo Shell 1. Log into the odoo container @@ -243,7 +242,7 @@ And to turn down docker-compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.pgadmin.yml down ``` -If your instance has pgAdmin, make sure you adapt this to your aliases. +If your instance has pgAdmin, make sure you adapt your aliases to this configuration. # Deployment Process Note: the deployment process is easier & faster with aliases. From 9bd6a608a3d72ac2c827cbe9889d25784c6b8f83 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Wed, 30 Aug 2023 20:13:51 -0500 Subject: [PATCH 07/58] cleanup readme --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 75693a7..98d62a3 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Welcome to Odoocker, a game-changer in the world of Odoo Development and Deployment. This tool is meticulously crafted to revolutionize your experience with Odoo, ensuring simplicity, efficiency, and a top-tier development journey. And while it’s rooted in the principles of the Official Odoo Docker setup, it goes several steps beyond. -Whether you're using the Community or Enterprise edition, this Docker solution is tailored just for you. +Whether you're using the **Community** or **Enterprise** edition, this **Docker** solution is tailored just for you. **Best part of this?** You don't need any prior knowledge of **Docker**, **Odoo** or any technology that involves this Framework. We stick to Docker philosophy: **Use it, then learn about it.** @@ -13,7 +13,7 @@ Feel free to post a Pull Request to continue enhancing this project. 2. 📦 **Easy Setup:** Clone, configure `.env` file, and you're ready to deploy. 3. 🔒 **Secure:** Automatic SSL certificate renewal to keep your data safe (for production only). -In essence, Odoocker isn't just another tool, it's a philosophy. So, whether you’re a seasoned Odoo veteran or just starting your journey, Odoocker is here to make sure it’s smooth sailing all the way. +In essence, Odoocker isn't just another tool, it's a philosophy. So, whether you’re a seasoned Odoo veteran or just starting your journey, Odoocker is here to make your journey easier. ## Contents @@ -91,6 +91,7 @@ LOAD_LANGUAGE=es_MX ... ```
+ ## Environment-based actions: [`odoo/entrypoint.sh`](https://github.com/odoocker/odoocker/blob/main/odoo/entrypoint.sh) file is the gateway for our Odoo container. Depending on the `APP_ENV` and the rest of the environment variables, it determines how to start the Odoo service (like local, testing, production, etc.) with different configurations.
From 13a05185b70ea5dd888d5a819bb5139444c559a1 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Wed, 30 Aug 2023 20:15:00 -0500 Subject: [PATCH 08/58] cleanup readme --- README.md | 88 +++++++++++++++++++++++++++---------------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index fba1d8c..1d02b99 100644 --- a/README.md +++ b/README.md @@ -2,27 +2,18 @@ Welcome to Odoocker, a game-changer in the world of Odoo Development and Deployment. This tool is meticulously crafted to revolutionize your experience with Odoo, ensuring simplicity, efficiency, and a top-tier development journey. And while it’s rooted in the principles of the Official Odoo Docker setup, it goes several steps beyond. -**Best of all**, you don't need any prior knowledge of **Odoo** or **Docker** to start your journey with Odoocker. +Whether you're using the **Community** or **Enterprise** edition, this **Docker** solution is tailored just for you. + +**Best part of this?** You don't need any prior knowledge of **Docker**, **Odoo** or any technology that involves this Framework. We stick to Docker philosophy: **Use it, then learn about it.** Feel free to post a Pull Request to continue enhancing this project. ### Why Odoocker Stands Out: +1. 🌐 **Universal:** Suitable for both Odoo Community and Enterprise editions. +2. 📦 **Easy Setup:** Clone, configure `.env` file, and you're ready to deploy. +3. 🔒 **Secure:** Automatic SSL certificate renewal to keep your data safe (for production only). -1. **Minimalistic Server Approach**: In an era where less is more, we keep server clutter at bay. With Odoocker, you'll witness a decluttered server environment, stripped down to the bare essentials. This minimalism ensures optimal resource utilization, leading to faster response times, reduced chances of conflicts, and a smooth-running Odoo instance. - -2. **Usability at its Core**: Odoocker is user-centric. By keeping the interface intuitive and the processes straightforward, we ensure that even newcomers to the Odoo ecosystem can set up and deploy with relative ease. - -3. **Dynamic Yet Simple Configuration**: Customization doesn't have to be complicated. With our `.env` setup, adapting your Odoo instance to your unique needs is a breeze, ensuring you have the flexibility without the fuss. - -4. **Streamlined Development Cycle**: With our intuitive steps and tips, deploying Odoo becomes as simple as 1-2-3. The goal is clear: *to ensure developers do what they love most, code*. - -5. **Clean, Unadulterated Performance**: With a spotlight on a single Odoo instance and a decluttered server, performance optimization is a given. Expect faster load times, smoother operations, and a user experience that’s top-notch. - -In essence, Odoocker isn't just another tool in the developer's arsenal. It's a philosophy. A commitment to clean, efficient, and delightful Odoo development. So, whether you’re a seasoned Odoo veteran or just starting your journey, Odoocker is here to make sure it’s smooth sailing all the way. - -Note: We always recommend keeping abreast with the official documentation for the most detailed and updated insights. Knowledge is power, after all. - -**Note:** While we've aimed to make things simpler, always refer to the official documentation for detailed information and updates. After all, knowledge is power! +In essence, Odoocker isn't just another tool, it's a philosophy. So, whether you’re a seasoned Odoo veteran or just starting your journey, Odoocker is here to make your journey easier. ## Contents @@ -49,9 +40,9 @@ Note: We always recommend keeping abreast with the official documentation for th # Quick Setup Guide: -1. **Clone and Prep**: Get your hands on this wonder-tool in seconds with a simple clone and a few copy commands: +1. **Clone and Configure**: ``` -git clone git@github.com:yhaelopez/odoocker.git +git clone git@github.com:odoocker/odoocker.git cp .env.example .env && cp docker-compose.override.local.yml docker-compose.override.yml ``` 2. **Hosts & Domains**: To ensure everything runs smoothly, remember to add the necessary domains to your hosts file. @@ -68,9 +59,9 @@ For *Windows*, manually add these lines to C:\Windows\System32\drivers\etc\hosts ``` # The `.env` File -The environment variables located in [`.env`](https://github.com/yhaelopez/odoocker/blob/main/.env.example) provide dynamic configurations to Odoo and the project in general. -The [`odoo.conf`](https://github.com/yhaelopez/odoocker/blob/main/odoo/odoo.example.conf) file is generated by the [`odoorc.sh`](https://github.com/yhaelopez/odoocker/blob/main/odoo/odoorc.sh) script based on the environment variables. - +The environment variables located in [`.env`](https://github.com/odoocker/odoocker/blob/main/.env.example) provide dynamic configurations to Odoo and the project in general. +The [`odoo.conf`](https://github.com/odoocker/odoocker/blob/main/odoo/odoo.example.conf) file is generated by the [`odoorc.sh`](https://github.com/odoocker/odoocker/blob/main/odoo/odoorc.sh) script based on the environment variables. +
This file is divided in sections, you most likely are going to focus on the `Main Configuration` section. This provides quick access to project and `odoo.conf` variables. The rest of section are container specific variables for different container. (Note: you may find *repeated variables* like `SUPPORT_EMAIL=${SUPPORT_EMAIL}` which interacts with different containers. This is to explicitly denote in the `.env` file that this variable is being shared through those containers. Sample `.env` file: @@ -85,7 +76,8 @@ DEV_MODE=reload,qweb DOMAIN=erp.odoocker.test # Enterprise (GitHub User with access to Odoo Enterprise [https://github.com/odoo/enterprise] Repo) -GITHUB_USER=yhaelopez +# If not present, Odoo Community will be brought up. +GITHUB_USER=odoocker GITHUB_ACCESS_TOKEN=ghp_token # Database @@ -98,32 +90,37 @@ DB_PASSWORD=odoo LOAD_LANGUAGE=es_MX ... ``` +
## Environment-based actions: -[`odoo/entrypoint.sh`](https://github.com/yhaelopez/odoocker/blob/main/odoo/entrypoint.sh) file is the gateway for our Odoo container. Depending on the `APP_ENV` and the rest of the environment variables, it determines how to start the Odoo service (like local, testing, production, etc.) with different configurations. +[`odoo/entrypoint.sh`](https://github.com/odoocker/odoocker/blob/main/odoo/entrypoint.sh) file is the gateway for our Odoo container. Depending on the `APP_ENV` and the rest of the environment variables, it determines how to start the Odoo service (like local, testing, production, etc.) with different configurations. +
+In all environments, `odoo.conf` follows the `.env` file variables. Some environments may have command-line parameter to overwrite certain configurations. -All environments receive the whole `.env` file variables. However, some of them have fixed command-line variables specific for each environment. For example, some of them may have `--limit-time-cpu=3600` because some databases are so big that may require a huge amount of seconds. Setting 1 hour ensures any DB can be imported (this can change as needed in the specific project). These values in command line overwrite the ones in the `.env` file. - -**To bring up most of the following environments run**: +**To bring up all the environments run**: +``` +docker-compose up -d --build && docker-compose logs odoo +``` +Restart adding `down`: ``` docker-compose down && docker-compose up -d --build && docker-compose logs odoo ``` -Here are the descriptions of each of them. - ### 1. Fresh or Restore -These environments (`APP_ENV=fresh` or `APP_ENV=restore`) will have no database created and are perfect for setting up a fresh database instance or restoring a production database. +These environments (`APP_ENV=fresh` or `APP_ENV=restore`) will have no database created. Are perfect for setting up a **fresh database** instance or **restoring a production database**. ### 2. Local: This environment (`APP_ENV=local`) will strictly follow the `.env` variables with no command-line overwrites. You'll most likely be using this regularly. Use `DEV_MODE=reload,qweb` to activate hot reload when changing `python` and `xml` files. +
If you prefer to update the packages everytime you restart Odoo container, you can set `UPDATE=module1,module2,module3`. ### 3. Debug: -This environment (`APP_ENV=debug`) works same way as local, but it starts Odoo using the `debugpy` library. Thanks to our [`.vscode/launch.json`](https://github.com/yhaelopez/odoocker/blob/main/.vscode/launch.json), if you are using Visual Studio Code, you start a Debugger session and the container will be aware of your breakpoints and stop wherever you need. This is my favorite environment to work since I use the debugger a lot while developing. +This environment (`APP_ENV=debug`) works same way as local, but it starts Odoo using the `debugpy` library. Thanks to our [`.vscode/launch.json`](https://github.com/odoocker/odoocker/blob/main/.vscode/launch.json), if you are using **Visual Studio Code**, you can start a Debugger session so the container is aware of your breakpoints and stop wherever you need. This is **my favorite** environment to work since I use the debugger a lot while developing. ### 4. Testing: -This environment (`APP_ENV=testing`) is specific for running tests (and will be included in a CI/CD pipeline in a future version). It help us test the modules we are developing to ensure a safe deployment. +This environment (`APP_ENV=testing`) is specific for running tests *(and will be included in a CI/CD pipeline in a future version)*. It help us test the modules we are developing to ensure a safe deployment. +
A `test_DB_NAME` database is automagically created. The `ADDONS_TO_TEST=addon_1` are installed in that fresh DB. Use `TEST_TAGS=test_tag_1` to filter your tests. @@ -131,24 +128,24 @@ Use `TEST_TAGS=test_tag_1` to filter your tests. **NOTE: Avoid running tests without tags**; otherwise, it will trigger tests in all installed addons and we don't want this. For now, let's assume Odoo Community & Enterprise tests passed and only focus on the things you need to test. ### 5. Full: -This environment (`APP_ENV=full`) will install the `INIT` modules in a new or existing `DB_NAME`. This allows us to have a fresh production database replica. +This environment (`APP_ENV=full`) will install the `INIT` modules in a new or existing `DB_NAME`. It allows us to have a fresh production database replica. ### 6. Staging: -This environment (`APP_ENV=staging`) sets `UPDATE=all`; this allows us to *update* all installed addons at once. +This environment (`APP_ENV=staging`) sets `UPDATE=all`; it allows us to **update all installed addons at once**. +
It also allows to install new packages before the upgrade through `INIT`. - +
It's highly recommended to use this command to run this environment - ``` -docker-compose down && git pull && docker-compose pull && docker-compose build --no-cache && docker-compose up -d && docker-compose logs -f odoo +docker-compose down && docker-compose pull && docker-compose build --no-cache && docker-compose up -d && docker-compose logs -f odoo ``` -This will `pull` the latest *Odoo Community, Enterprise, Extra and Custom addons*, basically, it upgrades the whole Odoo instance to the newest. Additionally, it will also pull the latest images of the other containers in this project. +This will `pull` the latest *Odoo Community, Enterprise, Extra and Custom addons*, basically, it **upgrades the whole Odoo instance** to the newest. Additionally, it will also pull the latest images of the other containers in this project. This environment is perfect for deployments. -**NOTE: Do not bring down & up again unless you want to perform a whole update again.** +**NOTE: Do not bring down & up again, unless you want to perform a whole upgrade again.** ### 7. Production: -This is the production environment (`APP_ENV=production`). It ensures no demo data is loaded and debugging is turned off. It also brings up the `Let's Encrypt` container, so you won't worry about `SSL Certificates` anymore! Some `.env` variables are overwritten in this setup. +This environment (`APP_ENV=production`) ensures no demo data is loaded, debugging and dev_mode are turned off. It also brings up the `Let's Encrypt` container, so you won't worry about `SSL Certificates` anymore! Some `.env` variables are overwritten in this setup. - Take down previous setup of containers ``` @@ -158,6 +155,7 @@ docker-compose down ``` cp docker-compose.override.production.yml docker-compose.override.yml ``` +- Make sure the DNS record of your `DOMAIN` is pointing to your server. - Rebuild the containers ``` docker-compose up -d --build && docker-compose logs odoo @@ -167,7 +165,9 @@ docker-compose up -d --build && docker-compose logs odoo The following tips will enhance your developing and production experience. ## 1. Search through all Addons at once: -If you are using `Visual Studio Code` & the Docker Extension is installed, you can open the Odoo Container in the `ROOT_PATH`. There you will find all Odoo `Community Addons`, `Enterprise Addons`, `Extra Addons` and `Custom Addons`. The Extra and Custom addons coming from your project. +If you are using `Visual Studio Code` & the **Docker Extension** is installed, you can open the Odoo Container in the `ROOT_PATH`. There you will find all Odoo `Community Addons`, `Enterprise Addons`, `Extra Addons` and `Custom Addons` in the same folder level. +
+Using the Search Panel will allow you to look at every single reference of what you are looking for in the whole Odoo Instance and not just in your addons. ## 2. Define the following aliases: ``` @@ -182,8 +182,8 @@ alias logs='docker-compose logs -f --tail 2000 odoo' ## 3. NEVER run `docker-compose down -v` in Production ...without having a `tested backed up` database - -Have in mind that dropping volumes will destroy DB data, Odoo Conf & Filestore, *Let's Encrypt certificates, and more!*. If you execute this command several times in `prod` in a short period of time, you may reach the `Let's Encrypt` certificates limit and Odoocker won't be able to generate new ones after **several hours**. +
+Have in mind that dropping volumes will destroy DB data, Odoo Conf & Filestore, *Let's Encrypt certificates, and more!* If you execute this command several times in `prod` in a short period of time, you may reach the `Let's Encrypt certificates limit`` and Odoocker won't be able to generate new ones after **several hours**. ## 4. Odoo Shell 1. Log into the odoo container @@ -243,7 +243,7 @@ And to turn down docker-compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.pgadmin.yml down ``` -If your instance has pgAdmin, make sure you adapt this to your aliases. +If your instance has pgAdmin, make sure you adapt your aliases to this configuration. # Deployment Process Note: the deployment process is easier & faster with aliases. @@ -281,4 +281,4 @@ git pull origin main 7. Set [`Production`](#7-production) environment # Footnote -This project is based on the [Official Odoo Docker](https://hub.docker.com/_/odoo/) image. We've strived to ensure a seamless integration with the original Docker setup while making necessary customizations to suit our requirements. We encourage contributors and users to frequently refer to the official documentation for foundational concepts and updates. Thank you for your continued support and trust in our project. \ No newline at end of file +This project is based on the [Official Odoo Docker](https://hub.docker.com/_/odoo/) image. We've strived to ensure a seamless integration with the original Docker setup while making necessary customizations to suit our requirements. We encourage contributors and users to frequently refer to the official documentation for foundational concepts and updates. Thank you for your continued support and trust in our project. From 072a1d6f3c0aa3399b52be931e4b89dcd869054f Mon Sep 17 00:00:00 2001 From: Yhael S Date: Wed, 30 Aug 2023 20:15:13 -0500 Subject: [PATCH 09/58] cleanup readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 98d62a3..1d02b99 100644 --- a/README.md +++ b/README.md @@ -281,4 +281,4 @@ git pull origin main 7. Set [`Production`](#7-production) environment # Footnote -This project is based on the [Official Odoo Docker](https://hub.docker.com/_/odoo/) image. We've strived to ensure a seamless integration with the original Docker setup while making necessary customizations to suit our requirements. We encourage contributors and users to frequently refer to the official documentation for foundational concepts and updates. Thank you for your continued support and trust in our project. \ No newline at end of file +This project is based on the [Official Odoo Docker](https://hub.docker.com/_/odoo/) image. We've strived to ensure a seamless integration with the original Docker setup while making necessary customizations to suit our requirements. We encourage contributors and users to frequently refer to the official documentation for foundational concepts and updates. Thank you for your continued support and trust in our project. From 7b3b84fbdb6d7584d83e6a16b1eaa68fb671e20e Mon Sep 17 00:00:00 2001 From: Fabio Tielen // Code Agency Date: Mon, 4 Sep 2023 23:38:51 +0200 Subject: [PATCH 10/58] =?UTF-8?q?=E2=9A=99=EF=B8=8F=20chore(requirements.t?= =?UTF-8?q?xt):=20add=20redis=20package=20to=20the=20requirements=20The=20?= =?UTF-8?q?redis=20package=20is=20added=20to=20the=20requirements.txt=20fi?= =?UTF-8?q?le=20to=20ensure=20that=20the=20application=20has=20the=20neces?= =?UTF-8?q?sary=20dependencies=20installed.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- odoo/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/odoo/requirements.txt b/odoo/requirements.txt index fb6626a..066fba9 100644 --- a/odoo/requirements.txt +++ b/odoo/requirements.txt @@ -1,2 +1,3 @@ debugpy websocket-client +redis \ No newline at end of file From dddafd862f6ff962ce5677f9fb8e4455ccf021b4 Mon Sep 17 00:00:00 2001 From: Fabio Tielen // Code Agency Date: Mon, 4 Sep 2023 23:54:39 +0200 Subject: [PATCH 11/58] =?UTF-8?q?=E2=9C=A8=20feat(.env.example):=20add=20c?= =?UTF-8?q?onfiguration=20options=20for=20Redis=20caching=20in=20the=20.en?= =?UTF-8?q?v.example=20file=20=E2=9C=A8=20feat(docker-compose.yml):=20add?= =?UTF-8?q?=20keydb=20service=20for=20Redis=20caching=20with=201GB=20share?= =?UTF-8?q?d=20memory=20size=20=E2=9C=A8=20feat(odoo.example.conf):=20add?= =?UTF-8?q?=20configuration=20options=20for=20Redis=20caching=20in=20the?= =?UTF-8?q?=20odoo.example.conf=20file=20The=20changes=20were=20made=20to?= =?UTF-8?q?=20add=20support=20for=20Redis=20caching=20in=20the=20applicati?= =?UTF-8?q?on.=20The=20.env.example=20file=20now=20includes=20configuratio?= =?UTF-8?q?n=20options=20for=20Redis=20caching,=20such=20as=20Redis=20host?= =?UTF-8?q?,=20port,=20password,=20URL,=20prefix,=20expiration=20time,=20a?= =?UTF-8?q?nd=20expiration=20time=20for=20anonymous=20sessions.=20The=20do?= =?UTF-8?q?cker-compose.yml=20file=20now=20includes=20a=20keydb=20service?= =?UTF-8?q?=20with=201GB=20shared=20memory=20size=20for=20Redis=20caching.?= =?UTF-8?q?=20The=20odoo.example.conf=20file=20now=20includes=20configurat?= =?UTF-8?q?ion=20options=20for=20Redis=20caching,=20such=20as=20enabling?= =?UTF-8?q?=20Redis=20caching,=20Redis=20host,=20port,=20password,=20URL,?= =?UTF-8?q?=20prefix,=20expiration=20time,=20and=20expiration=20time=20for?= =?UTF-8?q?=20anonymous=20sessions.=20These=20changes=20allow=20the=20appl?= =?UTF-8?q?ication=20to=20utilize=20Redis=20for=20caching,=20improving=20p?= =?UTF-8?q?erformance=20and=20scalability.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 14 +++++++++++++- docker-compose.yml | 15 +++++++++++++++ odoo/odoo.example.conf | 20 ++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 3974d52..a08ab2f 100644 --- a/.env.example +++ b/.env.example @@ -5,7 +5,7 @@ APP_ENV=local INIT= UPDATE= -LOAD=base,web +LOAD=base,web,session_redis WORKERS=2 DEV_MODE=reload,qweb DOMAIN=erp.odoocker.test @@ -235,3 +235,15 @@ CORS_ALLOWED_DOMAIN=${CORS_ALLOWED_DOMAIN} # ACME Companion # #----------------------# DEFAULT_EMAIL=${SUPPORT_EMAIL} + +#----------------------# +# REDIS Caching # +#----------------------# +ODOO_SESSION_REDIS = ${ODOO_SESSION_REDIS} +ODOO_SESSION_REDIS_HOST = ${ODOO_SESSION_REDIS_HOST} +ODOO_SESSION_REDIS_PORT = ${ODOO_SESSION_REDIS_PORT} +ODOO_SESSION_REDIS_PASSWORD = ${ODOO_SESSION_REDIS_PASSWORD} +ODOO_SESSION_REDIS_URL = ${ODOO_SESSION_REDIS_URL} +ODOO_SESSION_REDIS_PREFIX = ${ODOO_SESSION_REDIS_PREFIX} +ODOO_SESSION_REDIS_EXPIRATION = ${ODOO_SESSION_REDIS_EXPIRATION} +ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS = ${ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 171320c..3f9aec0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -32,6 +32,7 @@ services: args: - POSTGRES_TAG restart: unless-stopped + shm_size: 1GB tty: true volumes: - pg-data:${PGDATA} @@ -82,12 +83,26 @@ services: networks: - internal + keydb: + image: eqalpha/keydb:latest + platform: linux/amd64 + shm_size: 1GB + restart: unless-stopped + networks: + - internal + # command: keydb-server /etc/keydb/keydb.conf + volumes: + #- ./keydb.conf:/etc/keydb/keydb.conf:ro + - cache-db-data:/var/lib/keydb + volumes: data-dir: pg-data: certs: vhost: html: + cache-db-data: + networks: internal: diff --git a/odoo/odoo.example.conf b/odoo/odoo.example.conf index 30d8ee5..e935a0d 100644 --- a/odoo/odoo.example.conf +++ b/odoo/odoo.example.conf @@ -259,3 +259,23 @@ limit_time_real_cron = {LIMIT_TIME_REAL_CRON} ; --limit-request limit_request = {LIMIT_REQUEST} + +;------------------------------------------; +; Options not exposed on the command line. ; +;------------------------------------------; +; --ODOO_SESSION_REDIS +ODOO_SESSION_REDIS = {ODOO_SESSION_REDIS} ;has to be 1 or true +; --ODOO_SESSION_REDIS_HOST +ODOO_SESSION_REDIS_HOST = {ODOO_SESSION_REDIS_HOST} ;is the redis hostname (default is localhost) +; --ODOO_SESSION_REDIS_PORT +ODOO_SESSION_REDIS_PORT = {ODOO_SESSION_REDIS_PORT} ;is the redis port (default is 6379) +; --ODOO_SESSION_REDIS_PASSWORD +ODOO_SESSION_REDIS_PASSWORD = {ODOO_SESSION_REDIS_PASSWORD} ;is the password for the AUTH command (optional) +; -- ODOO_SESSION_REDIS_URL +ODOO_SESSION_REDIS_URL = {ODOO_SESSION_REDIS_URL} ;is an alternative way to define the Redis server address. It's the preferred way when you're using the rediss:// protocol. +; -- ODOO_SESSION_REDIS_PREFIX +ODOO_SESSION_REDIS_PREFIX = {ODOO_SESSION_REDIS_PREFIX} ;is the prefix for the session keys (optional) +; -- ODOO_SESSION_REDIS_EXPIRATION +ODOO_SESSION_REDIS_EXPIRATION = {ODOO_SESSION_REDIS_EXPIRATION} ;is the time in seconds before expiration of the sessions (default is 7 days) +; -- ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS +ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS = {ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS} ;the time in seconds before expiration of the anonymous sessions (default is 3 hours) From fc0d0c98750ead08be1a91c0a8aead7019bfb942 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Wed, 27 Sep 2023 22:47:22 -0500 Subject: [PATCH 12/58] integrate keydb to odoocker --- .env.example | 150 +++++++++++++----- .gitignore | 3 + docker-compose.override.local.yml | 2 +- docker-compose.pgadmin.yml | 32 +++- docker-compose.yml | 27 ++-- nginx/default.conf | 13 +- odoo/Dockerfile | 14 +- .../__manifest__.py | 6 +- .../data/ir_config_parameter.xml | 0 ...ifest__.example.py => manifest.example.py} | 5 + odoo/odoo.example.conf | 50 +++--- odoo/odoorc.sh | 45 +++++- odoo/requirements.txt | 2 +- odoo/third-party-addons.sh | 2 + pgadmin/Dockerfile | 32 ++++ pgadmin/start_pgadmin.sh | 89 +++++++++++ postgres/Dockerfile | 5 +- postgres/entrypoint.sh | 35 +++- 18 files changed, 415 insertions(+), 97 deletions(-) rename odoo/extra-addons/{report_url => odoocker_base}/__manifest__.py (67%) rename odoo/extra-addons/{report_url => odoocker_base}/data/ir_config_parameter.xml (100%) rename odoo/{__manifest__.example.py => manifest.example.py} (91%) create mode 100755 odoo/third-party-addons.sh create mode 100644 pgadmin/Dockerfile create mode 100755 pgadmin/start_pgadmin.sh diff --git a/.env.example b/.env.example index a08ab2f..749d956 100644 --- a/.env.example +++ b/.env.example @@ -4,11 +4,11 @@ # Odoo APP_ENV=local INIT= -UPDATE= +UPDATE=custom_core LOAD=base,web,session_redis WORKERS=2 -DEV_MODE=reload,qweb -DOMAIN=erp.odoocker.test +DEV_MODE=reload,xml +DOMAIN=erp.j8c.test # Enterprise GITHUB_USER= @@ -18,7 +18,7 @@ GITHUB_ACCESS_TOKEN= ADMIN_PASSWD=odoo DB_HOST=postgres DB_PORT=5432 -DB_NAME=odoo +DB_NAME=j8c DB_USER=odoo DB_PASSWORD=odoo LOAD_LANGUAGE= @@ -31,12 +31,12 @@ LIST_DB=True DBFILTER=.* # Logging -LOG_LEVEL=debug +LOG_LEVEL=info # Additional logs LOG_HANDLER_LEVEL=INFO # Nginx -CORS_ALLOWED_DOMAIN="'http://external-domain.test'" +CORS_ALLOWED_DOMAIN="'https://odoo.j8c.com.mx'" # Testing TEST_ENABLE=False @@ -52,20 +52,46 @@ SMTP_PASSWORD= EMAIL_FROM= FROM_FILTER= +# Redis +SESSION_REDIS=true +REDIS_HOST=redis +REDIS_PORT=6379 +REDIS_PASSWORD= +# REDIS_URL= +REDIS_PREFIX=odoo +REDIS_EXPIRATION=604800 +REDIS_EXPIRATION_ANONYMOUS=10800 + +# Postgres +POSTGRES_MAIN_HOST=${DB_HOST} +POSTGRES_MAIN_PORT=${DB_PORT} +POSTGRES_MAIN_DB=postgres +POSTGRES_MAIN_USER=postgres +POSTGRES_MAIN_PASSWORD=${DB_PASSWORD} + # PgAdmin -PGADMIN_DOMAIN=pgadmin.odoocker.test +PGADMIN_DOMAIN=pgadmin.j8c.test +PGADMING_DB_NAME=pgadmin +PGADMING_DB_USER=pgadmin +PGADMIN_DB_PASSWORD=${DB_PASSWORD} +PGADMIN_DB_HOST="'postgresql://${PGADMING_DB_USER}:${PGADMIN_DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${PGADMING_DB_NAME}'" + +PGADMIN_EMAIL=contacto@juarezsoft.com.mx PGADMIN_PASSWORD=odoo +PGADMIN_SERVERS_JSON= +PGADMIN_CONFIG_SERVER_MODE=True + #------------------------------# # Project Configurations # #------------------------------# # Docker -PROJECT_NAME=odoocker -SUPPORT_EMAIL=mail@example.com +PROJECT_NAME=j8c +SUPPORT_EMAIL=contacto@juarezsoft.com.mx # Containers' Tags -ODOO_TAG=16.0 -POSTGRES_TAG=15.4 +ODOO_TAG=15.0 +POSTGRES_TAG=16.0 NGINX_TAG=1.25.2 NGINX_PROXY_TAG=1.3.1 ACME_COMPANION_TAG=2.2.8 @@ -87,6 +113,7 @@ WEBSOCKET_RATE_LIMIT_DELAY=0.2 # Custom paths COMMUNITY_ADDONS=${ROOT_PATH}/addons ENTERPRISE_ADDONS=${ROOT_PATH}/enterprise +THIRD_PARTY_ADDONS=${ROOT_PATH}/third-party-addons EXTRA_ADDONS=${ROOT_PATH}/extra-addons CUSTOM_ADDONS=${ROOT_PATH}/custom-addons LOG_PATH=/var/log/odoo/odoo.log @@ -101,7 +128,7 @@ DEMO=False WITHOUT_DEMO=all IMPORT_PARTIAL=False PIDFILE= -ADDONS_PATH=${COMMUNITY_ADDONS},${ENTERPRISE_ADDONS},${EXTRA_ADDONS},${CUSTOM_ADDONS} +ADDONS_PATH=${COMMUNITY_ADDONS},${ENTERPRISE_ADDONS},${THIRD_PARTY_ADDONS},${EXTRA_ADDONS},${CUSTOM_ADDONS} UPGRADE_PATH= SERVER_WIDE_MODULES=${LOAD} DATA_DIR=/var/lib/odoo @@ -113,7 +140,7 @@ DEBUG_INTERFACE=${HTTP_INTERFACE} HTTP_PORT=8069 DEBUG_PORT=8070 XMLRPCS_PORT=8071 -GEVENT_PORT=8072 +LONGPOLLING_PORT=8072 HTTP_ENABLE=True XMLRPCS=True PROXY_MODE=True @@ -172,7 +199,7 @@ SHELL_INTERFACE=ptpython STOP_AFTER_INIT=False OSV_MEMORY_COUNT_LIMIT=False TRANSIENT_AGE_LIMIT=1.0 -MAX_CRON_THREADS=2 +MAX_CRON_THREADS=1 UNACCENT=${UNACCENT} GEOIP_DATABASE=/usr/share/GeoIP/GeoLite2-City.mmdb WORKERS=${WORKERS} @@ -193,11 +220,11 @@ TEMP_DOCKER_SOCK=/tmp/docker.sock #----------------# # Postgres # #----------------# -POSTGRES_HOST=${DB_HOST} -POSTGRES_PORT=${DB_PORT} -POSTGRES_DB=postgres -POSTGRES_USER=${DB_USER} -POSTGRES_PASSWORD=${DB_PASSWORD} +POSTGRES_HOST=${POSTGRES_MAIN_HOST} +POSTGRES_PORT=${POSTGRES_MAIN_PORT} +POSTGRES_DB=${POSTGRES_MAIN_DB} +POSTGRES_USER=${POSTGRES_MAIN_USER} +POSTGRES_PASSWORD=${POSTGRES_MAIN_PASSWORD} PGDATA=/var/lib/postgresql/data/${PROJECT_NAME} #-------------# @@ -210,16 +237,6 @@ LETSENCRYPT_HOST=${DOMAIN} LETSENCRYPT_EMAIL=${SUPPORT_EMAIL} CORS_ALLOWED_DOMAIN=${CORS_ALLOWED_DOMAIN} -#-------------# -# PgAdmin # -#-------------# -PGADMIN_DATA=/var/lib/pgadmin -PGADMIN_VIRTUAL_HOST=${PGADMIN_DOMAIN} -PGADMIN_DEFAULT_EMAIL=${SUPPORT_EMAIL} -PGADMIN_DEFAULT_PASSWORD=${PGADMIN_PASSWORD} -PGADMIN_LETSENCRYPT_HOST=${PGADMIN_DOMAIN} -LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL} - #-------------------# # Nginx Proxy # #-------------------# @@ -236,14 +253,67 @@ CORS_ALLOWED_DOMAIN=${CORS_ALLOWED_DOMAIN} #----------------------# DEFAULT_EMAIL=${SUPPORT_EMAIL} -#----------------------# -# REDIS Caching # -#----------------------# -ODOO_SESSION_REDIS = ${ODOO_SESSION_REDIS} -ODOO_SESSION_REDIS_HOST = ${ODOO_SESSION_REDIS_HOST} -ODOO_SESSION_REDIS_PORT = ${ODOO_SESSION_REDIS_PORT} -ODOO_SESSION_REDIS_PASSWORD = ${ODOO_SESSION_REDIS_PASSWORD} -ODOO_SESSION_REDIS_URL = ${ODOO_SESSION_REDIS_URL} -ODOO_SESSION_REDIS_PREFIX = ${ODOO_SESSION_REDIS_PREFIX} -ODOO_SESSION_REDIS_EXPIRATION = ${ODOO_SESSION_REDIS_EXPIRATION} -ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS = ${ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS} \ No newline at end of file +#-------------# +# Redis # +#-------------# +ODOO_SESSION_REDIS=${SESSION_REDIS} +ODOO_SESSION_REDIS_HOST=${REDIS_HOST} +ODOO_SESSION_REDIS_PORT=${REDIS_PORT} +ODOO_SESSION_REDIS_PASSWORD=${REDIS_PASSWORD} +# ODOO_SESSION_REDIS_URL= +ODOO_SESSION_REDIS_PREFIX=${REDIS_PREFIX} +ODOO_SESSION_REDIS_EXPIRATION=${REDIS_EXPIRATION} +ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS=${REDIS_EXPIRATION_ANONYMOUS} + +#-------------# +# PgAdmin # +#-------------# +# Container +PGADMIN_DATA=/var/lib/pgadmin + +PGADMIN_SERVERS_JSON=${PGADMIN_SERVERS_JSON} + +PGADMIN_DEFAULT_EMAIL=${PGADMIN_EMAIL} +PGADMIN_DEFAULT_PASSWORD=${PGADMIN_PASSWORD} + +PGADMIN_VIRTUAL_HOST=${PGADMIN_DOMAIN} +PGADMIN_LETSENCRYPT_HOST=${PGADMIN_DOMAIN} +PGADMIN_LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL} + +# PgAdmin Configuration +PGADMIN_CONFIG_APP_NAME="'pgAdmin 4'" +PGADMIN_CONFIG_SERVER_MODE=${PGADMIN_CONFIG_SERVER_MODE} +PGADMIN_CONFIG_CONFIG_DATABASE_CONNECTION_POOL_SIZE=5 +PGADMIN_CONFIG_DEFAULT_SERVER="'127.0.0.1'" +PGADMIN_CONFIG_DEFAULT_SERVER_PORT=5050 +PGADMIN_CONFIG_MAX_SESSION_IDLE_TIME=120 +PGADMIN_CONFIG_CONFIG_DATABASE_URI=${PGADMIN_DB_HOST} + +# Password Settings +PGADMIN_CONFIG_PASSWORD_LENGTH_MIN=6 +PGADMIN_CONFIG_ALLOW_SAVE_PASSWORD=True +PGADMIN_CONFIG_ALLOW_SAVE_TUNNEL_PASSWORD=True +PGADMIN_CONFIG_MAX_LOGIN_ATTEMPTS=10 + +# Query History +PGADMIN_CONFIG_MAX_QUERY_HIST_STORED=20 + +# SMTP Server +PGADMIN_CONFIG_MAIL_SERVER="'localhost'" +PGADMIN_CONFIG_MAIL_PORT=25 +PGADMIN_CONFIG_MAIL_USE_SSL=False +PGADMIN_CONFIG_MAIL_USE_TLS=False +PGADMIN_CONFIG_MAIL_USERNAME="''" +PGADMIN_CONFIG_MAIL_PASSWORD="''" +PGADMIN_CONFIG_MAIL_DEBUG=False +PGADMIN_CONFIG_SECURITY_EMAIL_SENDER="'$PGADMIN_DEFAULT_EMAIL'" + +# Dynamic PgAdmin Servers +PGADMIN_DB1_NAME=Odoocker +PGADMIN_DB1_HOST=localhost +PGADMIN_DB1_PORT=5432 +PGADMIN_DB1_MAINTENANCE_DB=odoocker +PGADMIN_DB1_USERNAME=odoo +PGADMIN_DB1_TUNNEL_HOST=erp.odoocker.test +PGADMIN_DB1_TUNNEL_PORT=22 +PGADMIN_DB1_TUNNEL_USERNAME=ubuntu diff --git a/.gitignore b/.gitignore index d65093e..fbfe9ea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ # Ignores the main configuration file. /.env +# Ignores the pgadmin private key +pgadmin/private_key + # Ignores the docker compose local or production environment. docker-compose.override.yml diff --git a/docker-compose.override.local.yml b/docker-compose.override.local.yml index 6c6c3d8..8a9c1a6 100644 --- a/docker-compose.override.local.yml +++ b/docker-compose.override.local.yml @@ -11,7 +11,7 @@ services: restart: 'no' ports: - 5432:5432 - + nginx: restart: 'no' diff --git a/docker-compose.pgadmin.yml b/docker-compose.pgadmin.yml index 2d55e15..7fccf84 100644 --- a/docker-compose.pgadmin.yml +++ b/docker-compose.pgadmin.yml @@ -1,7 +1,13 @@ services: pgadmin: - image: dpage/pgadmin4:${PGADMIN_TAG} - restart: unless-stopped + build: + context: ./ + dockerfile: ./pgadmin/Dockerfile + args: + - PGADMIN_TAG + depends_on: + - postgres + restart: 'no' expose: - 80 volumes: @@ -11,7 +17,27 @@ services: - PGADMIN_DEFAULT_PASSWORD - VIRTUAL_HOST=${PGADMIN_VIRTUAL_HOST} - LETSENCRYPT_HOST=${PGADMIN_LETSENCRYPT_HOST} - - LETSENCRYPT_EMAIL + - LETSENCRYPT_EMAIL=${PGADMIN_LETSENCRYPT_EMAIL} + - PGADMIN_CONFIG_APP_NAME + - PGADMIN_CONFIG_CONFIG_DATABASE_CONNECTION_POOL_SIZE + - PGADMIN_CONFIG_SERVER_MODE + - PGADMIN_CONFIG_DEFAULT_SERVER + - PGADMIN_CONFIG_DEFAULT_SERVER_PORT + - PGADMIN_CONFIG_PASSWORD_LENGTH_MIN + - PGADMIN_CONFIG_MAX_SESSION_IDLE_TIME + - PGADMIN_CONFIG_CONFIG_DATABASE_URI + - PGADMIN_CONFIG_ALLOW_SAVE_PASSWORD + - PGADMIN_CONFIG_MAX_QUERY_HIST_STORED + - PGADMIN_CONFIG_MAIL_SERVER + - PGADMIN_CONFIG_MAIL_PORT + - PGADMIN_CONFIG_MAIL_USE_SSL + - PGADMIN_CONFIG_MAIL_USE_TLS + - PGADMIN_CONFIG_MAIL_USERNAME + - PGADMIN_CONFIG_MAIL_PASSWORD + - PGADMIN_CONFIG_MAIL_DEBUG + - PGADMIN_CONFIG_SECURITY_EMAIL_SENDER + - PGADMIN_CONFIG_ALLOW_SAVE_TUNNEL_PASSWORD + - PGADMIN_CONFIG_MAX_LOGIN_ATTEMPTS networks: - internal diff --git a/docker-compose.yml b/docker-compose.yml index 3f9aec0..f11a09a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,6 +10,7 @@ services: - GITHUB_USER - GITHUB_ACCESS_TOKEN - ENTERPRISE_ADDONS + - THIRD_PARTY_ADDONS - LOG_PATH depends_on: - postgres @@ -20,6 +21,7 @@ services: - ./odoo/custom-addons:${CUSTOM_ADDONS} - ./odoo/entrypoint.sh:/entrypoint.sh - ./odoo/odoorc.sh:/odoorc.sh + - ./odoo/third-party-addons.sh:/third-party-addons.sh env_file: - ./.env networks: @@ -27,12 +29,11 @@ services: postgres: build: - context: ./postgres - dockerfile: Dockerfile + context: ./ + dockerfile: ./postgres/Dockerfile args: - POSTGRES_TAG restart: unless-stopped - shm_size: 1GB tty: true volumes: - pg-data:${PGDATA} @@ -42,6 +43,12 @@ services: - POSTGRES_USER - POSTGRES_PASSWORD - PGDATA + - DB_USER + - DB_TEMPLATE + - UNACCENT_TEMPLATE + - PGADMING_DB_NAME + - PGADMING_DB_USER + - PGADMIN_DB_PASSWORD networks: - internal @@ -83,17 +90,16 @@ services: networks: - internal - keydb: + redis: image: eqalpha/keydb:latest - platform: linux/amd64 - shm_size: 1GB + platform: linux/amd64 + ports: + - 6379:6379 restart: unless-stopped networks: - internal - # command: keydb-server /etc/keydb/keydb.conf volumes: - #- ./keydb.conf:/etc/keydb/keydb.conf:ro - - cache-db-data:/var/lib/keydb + - redis-data:/var/lib/keydb volumes: data-dir: @@ -101,8 +107,7 @@ volumes: certs: vhost: html: - cache-db-data: - + redis-data: networks: internal: diff --git a/nginx/default.conf b/nginx/default.conf index dcd7604..8e3467f 100644 --- a/nginx/default.conf +++ b/nginx/default.conf @@ -23,7 +23,7 @@ server { location / { proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $host; proxy_pass http://odoo:8069; @@ -39,19 +39,12 @@ server { } } - location ~* /web/static/ { - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $remote_addr; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header Host $host; - proxy_pass http://odoo:8069; - } - location /websocket { proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Host $host; + proxy_set_header Host $host; proxy_pass http://odoo:8072; } } diff --git a/odoo/Dockerfile b/odoo/Dockerfile index 2b7724a..225809e 100644 --- a/odoo/Dockerfile +++ b/odoo/Dockerfile @@ -14,6 +14,7 @@ ARG LOG_PATH ARG GITHUB_USER ARG GITHUB_ACCESS_TOKEN ARG ENTERPRISE_ADDONS +ARG THIRD_PARTY_ADDONS ARG ODOO_RC ENV ODOO_TAG=${ODOO_TAG} \ @@ -21,6 +22,7 @@ ENV ODOO_TAG=${ODOO_TAG} \ GITHUB_USER=${GITHUB_USER} \ GITHUB_ACCESS_TOKEN=${GITHUB_ACCESS_TOKEN} \ ENTERPRISE_ADDONS=${ENTERPRISE_ADDONS} \ + THIRD_PARTY_ADDONS=${THIRD_PARTY_ADDONS} \ ODOO_RC=${ODOO_RC} #------------------------# @@ -55,6 +57,16 @@ RUN if [ -n "$GITHUB_USER" ] && [ -n "$GITHUB_ACCESS_TOKEN" ]; then \ git clone https://${GITHUB_USER}:${GITHUB_ACCESS_TOKEN}@github.com/odoo/enterprise.git ${ENTERPRISE_ADDONS} --depth 1 --branch ${ODOO_TAG} --single-branch --no-tags; \ fi +#-------------------------# +# Odoo Extra Addons # +#-------------------------# + +RUN mkdir -p ${THIRD_PARTY_ADDONS} && \ + chown odoo:odoo -R ${THIRD_PARTY_ADDONS} + +COPY --chown=odoo:odoo ./odoo/third-party-addons.sh / +RUN /third-party-addons.sh && chown odoo:odoo ${THIRD_PARTY_ADDONS} + #---------------------# # PIP Dependecies # #---------------------# @@ -64,7 +76,7 @@ RUN pip3 install --upgrade pip # Copy & Install PIP requirements COPY --chown=odoo:odoo ./odoo/requirements.txt /tmp/requirements.txt -RUN python3 -m pip install --upgrade -r /tmp/requirements.txt && \ +RUN python3 -m pip install -r /tmp/requirements.txt && \ rm /tmp/requirements.txt #---------------------# diff --git a/odoo/extra-addons/report_url/__manifest__.py b/odoo/extra-addons/odoocker_base/__manifest__.py similarity index 67% rename from odoo/extra-addons/report_url/__manifest__.py rename to odoo/extra-addons/odoocker_base/__manifest__.py index 061038e..4628660 100644 --- a/odoo/extra-addons/report_url/__manifest__.py +++ b/odoo/extra-addons/odoocker_base/__manifest__.py @@ -1,8 +1,8 @@ { - 'name': 'Report URL', - 'summary': 'Adds Report URL to Odoo Container', + 'name': 'Odoocker Base', + 'summary': 'Supercharge Odoo with Odoocker', 'description': ''' - Odoo Containers doesn't come with report.url param out of the box, so we add it for you to work with Odoocker. + Some Odoocker dependencies require to some custom values that we cover with this Addon for you. ''', 'version': '1.0.0', 'category': 'Technical', diff --git a/odoo/extra-addons/report_url/data/ir_config_parameter.xml b/odoo/extra-addons/odoocker_base/data/ir_config_parameter.xml similarity index 100% rename from odoo/extra-addons/report_url/data/ir_config_parameter.xml rename to odoo/extra-addons/odoocker_base/data/ir_config_parameter.xml diff --git a/odoo/__manifest__.example.py b/odoo/manifest.example.py similarity index 91% rename from odoo/__manifest__.example.py rename to odoo/manifest.example.py index d514518..edc1080 100644 --- a/odoo/__manifest__.example.py +++ b/odoo/manifest.example.py @@ -48,6 +48,11 @@ # ... other qweb templates ], 'assets': { + 'web.assets_frontend': [ + 'module_name/static/src/js/file.js', + 'module_name/static/src/css/style.css' + # ... other assets + ], 'web.assets_backend': [ 'module_name/static/src/js/file.js', 'module_name/static/src/css/style.css' diff --git a/odoo/odoo.example.conf b/odoo/odoo.example.conf index e935a0d..53affd4 100644 --- a/odoo/odoo.example.conf +++ b/odoo/odoo.example.conf @@ -64,9 +64,8 @@ xmlrpcs_interface = {XMLRPCS_INTERFACE} ; --xmlrpcs-port xmlrpcs_port = {XMLRPCS_PORT} -; --gevent-port | --longpolling_port (deprecated) +; --longpolling_port gevent_port = {GEVENT_PORT} -longpolling_port = False ; --no-http | --no-xmlrpc http_enable = {HTTP_ENABLE} @@ -215,7 +214,7 @@ dbfilter = {DBFILTER} ;------------------; ; Advanced options ; ;------------------; -; --dev (all, reload, qweb, werkzeug, sql, shell, assets, tests) +; --dev dev_mode = {DEV_MODE} ; --shell-interface @@ -260,22 +259,29 @@ limit_time_real_cron = {LIMIT_TIME_REAL_CRON} ; --limit-request limit_request = {LIMIT_REQUEST} -;------------------------------------------; -; Options not exposed on the command line. ; -;------------------------------------------; -; --ODOO_SESSION_REDIS -ODOO_SESSION_REDIS = {ODOO_SESSION_REDIS} ;has to be 1 or true -; --ODOO_SESSION_REDIS_HOST -ODOO_SESSION_REDIS_HOST = {ODOO_SESSION_REDIS_HOST} ;is the redis hostname (default is localhost) -; --ODOO_SESSION_REDIS_PORT -ODOO_SESSION_REDIS_PORT = {ODOO_SESSION_REDIS_PORT} ;is the redis port (default is 6379) -; --ODOO_SESSION_REDIS_PASSWORD -ODOO_SESSION_REDIS_PASSWORD = {ODOO_SESSION_REDIS_PASSWORD} ;is the password for the AUTH command (optional) -; -- ODOO_SESSION_REDIS_URL -ODOO_SESSION_REDIS_URL = {ODOO_SESSION_REDIS_URL} ;is an alternative way to define the Redis server address. It's the preferred way when you're using the rediss:// protocol. -; -- ODOO_SESSION_REDIS_PREFIX -ODOO_SESSION_REDIS_PREFIX = {ODOO_SESSION_REDIS_PREFIX} ;is the prefix for the session keys (optional) -; -- ODOO_SESSION_REDIS_EXPIRATION -ODOO_SESSION_REDIS_EXPIRATION = {ODOO_SESSION_REDIS_EXPIRATION} ;is the time in seconds before expiration of the sessions (default is 7 days) -; -- ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS -ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS = {ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS} ;the time in seconds before expiration of the anonymous sessions (default is 3 hours) +;-------------; +; Redis ; +;-------------; +; has to be 1 or true +ODOO_SESSION_REDIS = {ODOO_SESSION_REDIS} + +; is the redis hostname (default is localhost) +ODOO_SESSION_REDIS_HOST = {ODOO_SESSION_REDIS_HOST} + +; is the redis port (default is 6379) +ODOO_SESSION_REDIS_PORT = {ODOO_SESSION_REDIS_PORT} + +; is the password for the AUTH command (optional) +ODOO_SESSION_REDIS_PASSWORD = {ODOO_SESSION_REDIS_PASSWORD} + +; is an alternative way to define the Redis server address. It's the preferred way when you're using the rediss:// protocol. +ODOO_SESSION_REDIS_URL = {ODOO_SESSION_REDIS_URL} + +; is the prefix for the session keys (optional) +ODOO_SESSION_REDIS_PREFIX = {ODOO_SESSION_REDIS_PREFIX} + +; is the time in seconds before expiration of the sessions (default is 7 days) +ODOO_SESSION_REDIS_EXPIRATION = {ODOO_SESSION_REDIS_EXPIRATION} + +; the time in seconds before expiration of the anonymous sessions (default is 3 hours) +ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS = {ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS} diff --git a/odoo/odoorc.sh b/odoo/odoorc.sh index 4358e4f..f14b7ba 100755 --- a/odoo/odoorc.sh +++ b/odoo/odoorc.sh @@ -100,6 +100,22 @@ defaults=( [LIMIT_TIME_REAL]=${LIMIT_TIME_REAL} [LIMIT_TIME_REAL_CRON]=${LIMIT_TIME_REAL_CRON} [LIMIT_REQUEST]=${LIMIT_REQUEST} + + [ODOO_SESSION_REDIS]=${ODOO_SESSION_REDIS} + [ODOO_SESSION_REDIS_HOST]=${ODOO_SESSION_REDIS_HOST} + [ODOO_SESSION_REDIS_PORT]=${ODOO_SESSION_REDIS_PORT} + [ODOO_SESSION_REDIS_PASSWORD]=${ODOO_SESSION_REDIS_PASSWORD} + [ODOO_SESSION_REDIS_URL]=${ODOO_SESSION_REDIS_URL} + [ODOO_SESSION_REDIS_PREFIX]=${ODOO_SESSION_REDIS_PREFIX} + [ODOO_SESSION_REDIS_EXPIRATION]=${ODOO_SESSION_REDIS_EXPIRATION} + [ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS]=${ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS} + + [DISABLE_ATTACHMENT_STORAGE]=${DISABLE_ATTACHMENT_STORAGE} + [AWS_HOST]=${AWS_HOST} + [AWS_REGION]=${AWS_REGION} + [AWS_ACCESS_KEY_ID]=${AWS_ACCESS_KEY_ID} + [AWS_SECRET_ACCESS_KEY]=${AWS_SECRET_ACCESS_KEY} + [AWS_BUCKETNAME]=${AWS_BUCKETNAME} ) # Define the template @@ -172,7 +188,6 @@ xmlrpcs_port = {XMLRPCS_PORT} ; --gevent-port | --longpolling_port (deprecated) gevent_port = {GEVENT_PORT} -longpolling_port = False ; --no-http | --no-xmlrpc http_enable = {HTTP_ENABLE} @@ -365,6 +380,34 @@ limit_time_real_cron = {LIMIT_TIME_REAL_CRON} ; --limit-request limit_request = {LIMIT_REQUEST} + +;-------------; +; Redis ; +;-------------; +; has to be 1 or true +ODOO_SESSION_REDIS = {ODOO_SESSION_REDIS} + +; is the redis hostname (default is localhost) +ODOO_SESSION_REDIS_HOST = {ODOO_SESSION_REDIS_HOST} + +; is the redis port (default is 6379) +ODOO_SESSION_REDIS_PORT = {ODOO_SESSION_REDIS_PORT} + +; is the password for the AUTH command (optional) +ODOO_SESSION_REDIS_PASSWORD = {ODOO_SESSION_REDIS_PASSWORD} + +; is an alternative way to define the Redis server address. It's the preferred way when you're using the rediss:// protocol. +ODOO_SESSION_REDIS_URL = {ODOO_SESSION_REDIS_URL} + +; is the prefix for the session keys (optional) +ODOO_SESSION_REDIS_PREFIX = {ODOO_SESSION_REDIS_PREFIX} + +; is the time in seconds before expiration of the sessions (default is 7 days) +ODOO_SESSION_REDIS_EXPIRATION = {ODOO_SESSION_REDIS_EXPIRATION} + +; the time in seconds before expiration of the anonymous sessions (default is 3 hours) +ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS = {ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS} + EOF ) diff --git a/odoo/requirements.txt b/odoo/requirements.txt index 066fba9..759b3e9 100644 --- a/odoo/requirements.txt +++ b/odoo/requirements.txt @@ -1,3 +1,3 @@ debugpy websocket-client -redis \ No newline at end of file +redis diff --git a/odoo/third-party-addons.sh b/odoo/third-party-addons.sh new file mode 100755 index 0000000..a5d82d9 --- /dev/null +++ b/odoo/third-party-addons.sh @@ -0,0 +1,2 @@ +git clone https://github.com/camptocamp/odoo-cloud-platform.git --depth 1 --branch ${ODOO_TAG} --single-branch --no-tags; +cp -r odoo-cloud-platform/session_redis ${THIRD_PARTY_ADDONS}/session_redis diff --git a/pgadmin/Dockerfile b/pgadmin/Dockerfile new file mode 100644 index 0000000..7ad3adc --- /dev/null +++ b/pgadmin/Dockerfile @@ -0,0 +1,32 @@ +#------------------------# +# PGAdmin Server # +#------------------------# +ARG PGADMIN_TAG +FROM dpage/pgadmin4:${PGADMIN_TAG} + +# Receive ARGs from docker-compose.yml & convert them into ENVs +ARG PGADMIN_DEFAULT_EMAIL + +ENV PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL} + +# Switch to root user +USER root + +# Install bash +RUN apk add --no-cache bash jq sqlite + +# Conditionally copy the private key if it exists +COPY --chown=pgadmin:root ./pgadmin/private_key /pgadmin4/private_key +# Set permissions for the private key + +# Copy your script file into the Docker image +COPY --chown=pgadmin:root ./.env / +COPY ./pgadmin/start_pgadmin.sh /var/lib/pgadmin/start_pgadmin.sh + +# Make the script executable +RUN chmod +x /var/lib/pgadmin/start_pgadmin.sh +# Run your script +RUN /var/lib/pgadmin/start_pgadmin.sh + +# Expose the necessary port +EXPOSE 80 diff --git a/pgadmin/start_pgadmin.sh b/pgadmin/start_pgadmin.sh new file mode 100755 index 0000000..3a0d7fe --- /dev/null +++ b/pgadmin/start_pgadmin.sh @@ -0,0 +1,89 @@ +#!/bin/bash + +set -e + +# Source environment variables +set -a +source /.env +set +a + +# Check if PGADMIN_DEFAULT_EMAIL is set +if [[ -z $PGADMIN_DEFAULT_EMAIL ]]; then + echo "PGADMIN_DEFAULT_EMAIL is not set. Exiting..." + exit 1 +fi + +# Modify the email to replace @ with _ +DIR_NAME="/var/lib/pgadmin/storage/${PGADMIN_DEFAULT_EMAIL//@/_}" + +# Create the directory using the modified name +mkdir -p "$DIR_NAME" + +cp /pgadmin4/private_key "$DIR_NAME/private_key" +chown -R pgadmin:root "$DIR_NAME/private_key" + +# Generate JSON for each matching variable +DB_PATH="/var/lib/pgadmin/pgadmin4.db" +json_output="{\"Servers\":{" +index=1 +while true; do + name_var="PGADMIN_DB${index}_NAME" + if [[ -z ${!name_var} ]]; then + break + fi + + host_var="PGADMIN_DB${index}_HOST" + port_var="PGADMIN_DB${index}_PORT" + maintenance_db_var="PGADMIN_DB${index}_MAINTENANCE_DB" + username_var="PGADMIN_DB${index}_USERNAME" + tunnel_host_var="PGADMIN_DB${index}_TUNNEL_HOST" + tunnel_port_var="PGADMIN_DB${index}_TUNNEL_PORT" + tunnel_username_var="PGADMIN_DB${index}_TUNNEL_USERNAME" + + json_output+="\"$index\":$(jq -n \ + --arg name "${!name_var}" \ + --arg host "${!host_var:-localhost}" \ + --arg port "${!port_var:-5432}" \ + --arg db "${!maintenance_db_var:-${!name_var}}" \ + --arg username "${!username_var:-odoo}" \ + --arg thost "${!tunnel_host_var}" \ + --arg tport "${!tunnel_port_var:-22}" \ + --arg tuser "${!tunnel_username_var:-ubuntu}" \ + '{ + "Name": $name, + "Group": "Servers", + "Host": $host, + "Port": $port|tonumber, + "MaintenanceDB": $db, + "Username": $username, + "UseSSHTunnel": 1, + "TunnelHost": $thost, + "TunnelPort": $tport, + "TunnelUsername": $tuser, + "TunnelAuthentication": 1, + "KerberosAuthentication": false, + "ConnectionParameters": { + "sslmode": "prefer", + "connect_timeout": 10, + "sslcert": "'"$DIR_NAME"'/.postgresql/postgresql.crt", + "sslkey": "'"$DIR_NAME"'/.postgresql/postgresql.key" + }, + "Shared": true + }')," + + index=$((index + 1)) +done + +# Remove trailing comma and close JSON braces +json_output=${json_output%,} +json_output+="}}" + +# Save the well-formatted JSON to a file using jq +if [[ $PGADMIN_SERVERS_JSON ]]; then + echo $json_output | jq '.' > "$PGADMIN_SERVERS_JSON" + + # Make the Servers.json file readable for all users + chmod 755 "/pgadmin4/servers.json" + + echo "JSON configuration saved to $DIR_NAME/servers.json" +fi diff --git a/postgres/Dockerfile b/postgres/Dockerfile index 94227e6..3eb39ed 100644 --- a/postgres/Dockerfile +++ b/postgres/Dockerfile @@ -8,8 +8,11 @@ FROM postgres:${POSTGRES_TAG} RUN apt-get update && apt-get install -y \ # Unaccent extension dependencies postgresql-contrib \ + apt-utils \ # Clean up the apt cache to reduce the image size && rm -rf /var/lib/apt/lists/* +COPY --chown=postgres:postgres ./.env / + # Copy the script to create the unaccent template -COPY ./entrypoint.sh /docker-entrypoint-initdb.d/entrypoint.sh +COPY ./postgres/entrypoint.sh /docker-entrypoint-initdb.d/entrypoint.sh diff --git a/postgres/entrypoint.sh b/postgres/entrypoint.sh index de38ff1..b232538 100755 --- a/postgres/entrypoint.sh +++ b/postgres/entrypoint.sh @@ -1,3 +1,32 @@ -psql -p 5432 -U odoo -d postgres -c "CREATE DATABASE unaccent_template WITH TEMPLATE = template0" -psql -p 5432 -U odoo -d postgres -c "\\c unaccent_template" -psql -p 5432 -U odoo -d postgres -c "CREATE EXTENSION IF NOT EXISTS unaccent;" +#!/bin/bash + +set -e + +# Source environment variables +set -a +source /.env +set +a + +# Create the $DB_TEMPLATE database +psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $POSTGRES_DB -c "CREATE DATABASE $DB_TEMPLATE WITH TEMPLATE = template0;" +psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $POSTGRES_DB -c "\\c $DB_TEMPLATE;" +psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $POSTGRES_DB -c "CREATE EXTENSION IF NOT EXISTS unaccent;" + +# Create Odoo user and give proper privileges +psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $POSTGRES_DB -c "CREATE USER $DB_USER WITH PASSWORD '$DB_PASSWORD';" +psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $POSTGRES_DB -c "ALTER USER $DB_USER CREATEDB;" + +# Give Odoo user access to copy $DB_TEMPLATE +psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $POSTGRES_DB -c "GRANT ALL PRIVILEGES ON DATABASE $DB_TEMPLATE TO $DB_USER;" +psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $DB_TEMPLATE -c "ALTER DATABASE $DB_TEMPLATE OWNER TO $DB_USER;" + +# Create PgAdmin user and give proper privileges +psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $POSTGRES_DB -c "CREATE DATABASE $PGADMING_DB_NAME;" +psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $POSTGRES_DB -c "CREATE USER $PGADMING_DB_USER WITH PASSWORD '$PGADMIN_DB_PASSWORD';" +psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $POSTGRES_DB -c "GRANT ALL PRIVILEGES ON DATABASE $PGADMING_DB_NAME TO $PGADMING_DB_USER;" +psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $PGADMING_DB_NAME -c "GRANT ALL PRIVILEGES ON SCHEMA public TO $PGADMING_DB_USER;" + +# Revoke Odoo user's access to pgadmin database +psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $POSTGRES_DB -c "REVOKE CONNECT ON DATABASE $PGADMING_DB_NAME FROM $DB_USER;" + +echo "Setup completed." From 6176399594aba4d8f5b4638af0da7010d96a706e Mon Sep 17 00:00:00 2001 From: Yhael S Date: Thu, 28 Sep 2023 13:43:49 -0500 Subject: [PATCH 13/58] changed volume names --- docker-compose.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index f11a09a..cda6f9d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,7 +16,7 @@ services: - postgres tty: true volumes: - - data-dir:${DATA_DIR} + - odoo-data:${DATA_DIR} - ./odoo/extra-addons:${EXTRA_ADDONS} - ./odoo/custom-addons:${CUSTOM_ADDONS} - ./odoo/entrypoint.sh:/entrypoint.sh @@ -52,6 +52,17 @@ services: networks: - internal + redis: + image: eqalpha/keydb:latest + platform: linux/amd64 + ports: + - 6379:6379 + restart: unless-stopped + networks: + - internal + volumes: + - redis-data:/var/lib/keydb + nginx: image: nginx:${NGINX_TAG} depends_on: @@ -90,24 +101,13 @@ services: networks: - internal - redis: - image: eqalpha/keydb:latest - platform: linux/amd64 - ports: - - 6379:6379 - restart: unless-stopped - networks: - - internal - volumes: - - redis-data:/var/lib/keydb - volumes: - data-dir: + odoo-data: pg-data: + redis-data: certs: vhost: html: - redis-data: networks: internal: From 4255e2f1cc2bf7dfe2db7b4b226dacb231125c26 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Thu, 28 Sep 2023 14:11:43 -0500 Subject: [PATCH 14/58] cleanup --- .env.example | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.env.example b/.env.example index 749d956..44fceb6 100644 --- a/.env.example +++ b/.env.example @@ -4,11 +4,11 @@ # Odoo APP_ENV=local INIT= -UPDATE=custom_core +UPDATE= LOAD=base,web,session_redis WORKERS=2 DEV_MODE=reload,xml -DOMAIN=erp.j8c.test +DOMAIN=erp.odoocker.test # Enterprise GITHUB_USER= @@ -18,7 +18,7 @@ GITHUB_ACCESS_TOKEN= ADMIN_PASSWD=odoo DB_HOST=postgres DB_PORT=5432 -DB_NAME=j8c +DB_NAME=odoocker DB_USER=odoo DB_PASSWORD=odoo LOAD_LANGUAGE= @@ -36,7 +36,7 @@ LOG_LEVEL=info LOG_HANDLER_LEVEL=INFO # Nginx -CORS_ALLOWED_DOMAIN="'https://odoo.j8c.com.mx'" +CORS_ALLOWED_DOMAIN="'https://odoo.odoocker.com.mx'" # Testing TEST_ENABLE=False @@ -70,7 +70,7 @@ POSTGRES_MAIN_USER=postgres POSTGRES_MAIN_PASSWORD=${DB_PASSWORD} # PgAdmin -PGADMIN_DOMAIN=pgadmin.j8c.test +PGADMIN_DOMAIN=pgadmin.odoocker.test PGADMING_DB_NAME=pgadmin PGADMING_DB_USER=pgadmin PGADMIN_DB_PASSWORD=${DB_PASSWORD} @@ -86,7 +86,7 @@ PGADMIN_CONFIG_SERVER_MODE=True # Project Configurations # #------------------------------# # Docker -PROJECT_NAME=j8c +PROJECT_NAME=odoocker SUPPORT_EMAIL=contacto@juarezsoft.com.mx # Containers' Tags From cef72366c23368850d7a59c845c38e0f3cb1a610 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Thu, 28 Sep 2023 14:24:42 -0500 Subject: [PATCH 15/58] cleanup --- .env.example | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/.env.example b/.env.example index 44fceb6..b792f77 100644 --- a/.env.example +++ b/.env.example @@ -36,7 +36,7 @@ LOG_LEVEL=info LOG_HANDLER_LEVEL=INFO # Nginx -CORS_ALLOWED_DOMAIN="'https://odoo.odoocker.com.mx'" +CORS_ALLOWED_DOMAIN="'http://external-domain.test'" # Testing TEST_ENABLE=False @@ -52,6 +52,13 @@ SMTP_PASSWORD= EMAIL_FROM= FROM_FILTER= +# Postgres +POSTGRES_MAIN_HOST=${DB_HOST} +POSTGRES_MAIN_PORT=${DB_PORT} +POSTGRES_MAIN_DB=postgres +POSTGRES_MAIN_USER=postgres +POSTGRES_MAIN_PASSWORD=${DB_PASSWORD} + # Redis SESSION_REDIS=true REDIS_HOST=redis @@ -62,13 +69,6 @@ REDIS_PREFIX=odoo REDIS_EXPIRATION=604800 REDIS_EXPIRATION_ANONYMOUS=10800 -# Postgres -POSTGRES_MAIN_HOST=${DB_HOST} -POSTGRES_MAIN_PORT=${DB_PORT} -POSTGRES_MAIN_DB=postgres -POSTGRES_MAIN_USER=postgres -POSTGRES_MAIN_PASSWORD=${DB_PASSWORD} - # PgAdmin PGADMIN_DOMAIN=pgadmin.odoocker.test PGADMING_DB_NAME=pgadmin @@ -87,7 +87,7 @@ PGADMIN_CONFIG_SERVER_MODE=True #------------------------------# # Docker PROJECT_NAME=odoocker -SUPPORT_EMAIL=contacto@juarezsoft.com.mx +SUPPORT_EMAIL=mail@example.com # Containers' Tags ODOO_TAG=15.0 @@ -199,7 +199,7 @@ SHELL_INTERFACE=ptpython STOP_AFTER_INIT=False OSV_MEMORY_COUNT_LIMIT=False TRANSIENT_AGE_LIMIT=1.0 -MAX_CRON_THREADS=1 +MAX_CRON_THREADS=2 UNACCENT=${UNACCENT} GEOIP_DATABASE=/usr/share/GeoIP/GeoLite2-City.mmdb WORKERS=${WORKERS} @@ -260,7 +260,7 @@ ODOO_SESSION_REDIS=${SESSION_REDIS} ODOO_SESSION_REDIS_HOST=${REDIS_HOST} ODOO_SESSION_REDIS_PORT=${REDIS_PORT} ODOO_SESSION_REDIS_PASSWORD=${REDIS_PASSWORD} -# ODOO_SESSION_REDIS_URL= +ODOO_SESSION_REDIS_URL= ODOO_SESSION_REDIS_PREFIX=${REDIS_PREFIX} ODOO_SESSION_REDIS_EXPIRATION=${REDIS_EXPIRATION} ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS=${REDIS_EXPIRATION_ANONYMOUS} @@ -268,14 +268,10 @@ ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS=${REDIS_EXPIRATION_ANONYMOUS} #-------------# # PgAdmin # #-------------# -# Container +# Volume path PGADMIN_DATA=/var/lib/pgadmin -PGADMIN_SERVERS_JSON=${PGADMIN_SERVERS_JSON} - -PGADMIN_DEFAULT_EMAIL=${PGADMIN_EMAIL} -PGADMIN_DEFAULT_PASSWORD=${PGADMIN_PASSWORD} - +# Nginx Proxy Configuration PGADMIN_VIRTUAL_HOST=${PGADMIN_DOMAIN} PGADMIN_LETSENCRYPT_HOST=${PGADMIN_DOMAIN} PGADMIN_LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL} @@ -283,22 +279,26 @@ PGADMIN_LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL} # PgAdmin Configuration PGADMIN_CONFIG_APP_NAME="'pgAdmin 4'" PGADMIN_CONFIG_SERVER_MODE=${PGADMIN_CONFIG_SERVER_MODE} -PGADMIN_CONFIG_CONFIG_DATABASE_CONNECTION_POOL_SIZE=5 PGADMIN_CONFIG_DEFAULT_SERVER="'127.0.0.1'" PGADMIN_CONFIG_DEFAULT_SERVER_PORT=5050 PGADMIN_CONFIG_MAX_SESSION_IDLE_TIME=120 -PGADMIN_CONFIG_CONFIG_DATABASE_URI=${PGADMIN_DB_HOST} - -# Password Settings +PGADMIN_CONFIG_MAX_QUERY_HIST_STORED=20 +# Security Settings PGADMIN_CONFIG_PASSWORD_LENGTH_MIN=6 PGADMIN_CONFIG_ALLOW_SAVE_PASSWORD=True PGADMIN_CONFIG_ALLOW_SAVE_TUNNEL_PASSWORD=True PGADMIN_CONFIG_MAX_LOGIN_ATTEMPTS=10 +# DB Configuration +PGADMIN_CONFIG_CONFIG_DATABASE_URI=${PGADMIN_DB_HOST} +PGADMIN_CONFIG_CONFIG_DATABASE_CONNECTION_POOL_SIZE=5 +# Load Shared Servers Configuration into DB +PGADMIN_SERVERS_JSON=${PGADMIN_SERVERS_JSON} -# Query History -PGADMIN_CONFIG_MAX_QUERY_HIST_STORED=20 +# Authentication +PGADMIN_DEFAULT_EMAIL=${PGADMIN_EMAIL} +PGADMIN_DEFAULT_PASSWORD=${PGADMIN_PASSWORD} -# SMTP Server +# PgAdmin SMTP Server PGADMIN_CONFIG_MAIL_SERVER="'localhost'" PGADMIN_CONFIG_MAIL_PORT=25 PGADMIN_CONFIG_MAIL_USE_SSL=False @@ -308,7 +308,7 @@ PGADMIN_CONFIG_MAIL_PASSWORD="''" PGADMIN_CONFIG_MAIL_DEBUG=False PGADMIN_CONFIG_SECURITY_EMAIL_SENDER="'$PGADMIN_DEFAULT_EMAIL'" -# Dynamic PgAdmin Servers +# Dynamic PgAdmin Servers (Add as many as you need following copying these variables like {DB1}, {DB2}, DB3) PGADMIN_DB1_NAME=Odoocker PGADMIN_DB1_HOST=localhost PGADMIN_DB1_PORT=5432 From 36a2d5d0ca47e50794602ccbbd3552a860f5a8bc Mon Sep 17 00:00:00 2001 From: Yhael S Date: Thu, 28 Sep 2023 14:25:20 -0500 Subject: [PATCH 16/58] cleanup --- .env.example | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index b792f77..bbe829f 100644 --- a/.env.example +++ b/.env.example @@ -64,7 +64,7 @@ SESSION_REDIS=true REDIS_HOST=redis REDIS_PORT=6379 REDIS_PASSWORD= -# REDIS_URL= +REDIS_URL= REDIS_PREFIX=odoo REDIS_EXPIRATION=604800 REDIS_EXPIRATION_ANONYMOUS=10800 @@ -260,7 +260,7 @@ ODOO_SESSION_REDIS=${SESSION_REDIS} ODOO_SESSION_REDIS_HOST=${REDIS_HOST} ODOO_SESSION_REDIS_PORT=${REDIS_PORT} ODOO_SESSION_REDIS_PASSWORD=${REDIS_PASSWORD} -ODOO_SESSION_REDIS_URL= +ODOO_SESSION_REDIS_URL=${REDIS_URL} ODOO_SESSION_REDIS_PREFIX=${REDIS_PREFIX} ODOO_SESSION_REDIS_EXPIRATION=${REDIS_EXPIRATION} ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS=${REDIS_EXPIRATION_ANONYMOUS} From e6fa71769f60c78665a120c64f313276a693b976 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Thu, 28 Sep 2023 14:26:18 -0500 Subject: [PATCH 17/58] cleanup --- .env.example | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index bbe829f..74e1cbe 100644 --- a/.env.example +++ b/.env.example @@ -76,8 +76,8 @@ PGADMING_DB_USER=pgadmin PGADMIN_DB_PASSWORD=${DB_PASSWORD} PGADMIN_DB_HOST="'postgresql://${PGADMING_DB_USER}:${PGADMIN_DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${PGADMING_DB_NAME}'" -PGADMIN_EMAIL=contacto@juarezsoft.com.mx -PGADMIN_PASSWORD=odoo +PGADMIN_EMAIL=pgadmin@example.com +PGADMIN_PASSWORD=pgadmin PGADMIN_SERVERS_JSON= PGADMIN_CONFIG_SERVER_MODE=True From 22c1be3e40bded7ceb643ce1c18849404ff2ff1b Mon Sep 17 00:00:00 2001 From: Yhael S Date: Thu, 28 Sep 2023 14:36:18 -0500 Subject: [PATCH 18/58] cleanup --- .env.example | 4 ++-- odoo/odoo.example.conf | 22 +++++++++++----------- odoo/odoorc.sh | 16 ++++++++-------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.env.example b/.env.example index 74e1cbe..78b2152 100644 --- a/.env.example +++ b/.env.example @@ -90,7 +90,7 @@ PROJECT_NAME=odoocker SUPPORT_EMAIL=mail@example.com # Containers' Tags -ODOO_TAG=15.0 +ODOO_TAG=16.0 POSTGRES_TAG=16.0 NGINX_TAG=1.25.2 NGINX_PROXY_TAG=1.3.1 @@ -140,7 +140,7 @@ DEBUG_INTERFACE=${HTTP_INTERFACE} HTTP_PORT=8069 DEBUG_PORT=8070 XMLRPCS_PORT=8071 -LONGPOLLING_PORT=8072 +GEVENT_PORT=8072 HTTP_ENABLE=True XMLRPCS=True PROXY_MODE=True diff --git a/odoo/odoo.example.conf b/odoo/odoo.example.conf index 53affd4..bfea948 100644 --- a/odoo/odoo.example.conf +++ b/odoo/odoo.example.conf @@ -1,4 +1,4 @@ -[options] +options] ;------------------------------------------; ; Options not exposed on the command line. ; ;------------------------------------------; @@ -64,7 +64,7 @@ xmlrpcs_interface = {XMLRPCS_INTERFACE} ; --xmlrpcs-port xmlrpcs_port = {XMLRPCS_PORT} -; --longpolling_port +; --gevent-port | --longpolling_port (deprecated) gevent_port = {GEVENT_PORT} ; --no-http | --no-xmlrpc @@ -214,7 +214,7 @@ dbfilter = {DBFILTER} ;------------------; ; Advanced options ; ;------------------; -; --dev +; --dev (all, reload, xml, qweb, werkzeug, sql, shell, assets, tests) dev_mode = {DEV_MODE} ; --shell-interface @@ -262,26 +262,26 @@ limit_request = {LIMIT_REQUEST} ;-------------; ; Redis ; ;-------------; -; has to be 1 or true +; Possible values: 1 or true ODOO_SESSION_REDIS = {ODOO_SESSION_REDIS} -; is the redis hostname (default is localhost) +; Defaults to is localhost ODOO_SESSION_REDIS_HOST = {ODOO_SESSION_REDIS_HOST} -; is the redis port (default is 6379) +; Defaults to 6379 ODOO_SESSION_REDIS_PORT = {ODOO_SESSION_REDIS_PORT} -; is the password for the AUTH command (optional) +; Sets the password for the AUTH command (optional) ODOO_SESSION_REDIS_PASSWORD = {ODOO_SESSION_REDIS_PASSWORD} -; is an alternative way to define the Redis server address. It's the preferred way when you're using the rediss:// protocol. +; Alternative way to define the Redis server address like rediss:// protocol. ODOO_SESSION_REDIS_URL = {ODOO_SESSION_REDIS_URL} -; is the prefix for the session keys (optional) +; Prefix for the session keys (optional) ODOO_SESSION_REDIS_PREFIX = {ODOO_SESSION_REDIS_PREFIX} -; is the time in seconds before expiration of the sessions (default is 7 days) +; Time in seconds before expiration of the sessions (default is 7 days) ODOO_SESSION_REDIS_EXPIRATION = {ODOO_SESSION_REDIS_EXPIRATION} -; the time in seconds before expiration of the anonymous sessions (default is 3 hours) +; Time in seconds before expiration of the anonymous sessions (default is 3 hours) ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS = {ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS} diff --git a/odoo/odoorc.sh b/odoo/odoorc.sh index f14b7ba..f14f03f 100755 --- a/odoo/odoorc.sh +++ b/odoo/odoorc.sh @@ -336,7 +336,7 @@ dbfilter = {DBFILTER} ;------------------; ; Advanced options ; ;------------------; -; --dev +; --dev (all, reload, xml, qweb, werkzeug, sql, shell, assets, tests) dev_mode = {DEV_MODE} ; --shell-interface @@ -384,25 +384,25 @@ limit_request = {LIMIT_REQUEST} ;-------------; ; Redis ; ;-------------; -; has to be 1 or true +; Possible values: 1 or true ODOO_SESSION_REDIS = {ODOO_SESSION_REDIS} -; is the redis hostname (default is localhost) +; Defaults to is localhost ODOO_SESSION_REDIS_HOST = {ODOO_SESSION_REDIS_HOST} -; is the redis port (default is 6379) +; Defaults to 6379 ODOO_SESSION_REDIS_PORT = {ODOO_SESSION_REDIS_PORT} -; is the password for the AUTH command (optional) +; Sets the password for the AUTH command (optional) ODOO_SESSION_REDIS_PASSWORD = {ODOO_SESSION_REDIS_PASSWORD} -; is an alternative way to define the Redis server address. It's the preferred way when you're using the rediss:// protocol. +; Alternative way to define the Redis server address like rediss:// protocol. ODOO_SESSION_REDIS_URL = {ODOO_SESSION_REDIS_URL} -; is the prefix for the session keys (optional) +; Prefix for the session keys (optional) ODOO_SESSION_REDIS_PREFIX = {ODOO_SESSION_REDIS_PREFIX} -; is the time in seconds before expiration of the sessions (default is 7 days) +; Time in seconds before expiration of the sessions (default is 7 days) ODOO_SESSION_REDIS_EXPIRATION = {ODOO_SESSION_REDIS_EXPIRATION} ; the time in seconds before expiration of the anonymous sessions (default is 3 hours) From ae92bbb36af5d52a1818e718052cdb4c4a2e0307 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Thu, 28 Sep 2023 14:38:50 -0500 Subject: [PATCH 19/58] cleanup --- odoo/odoorc.sh | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/odoo/odoorc.sh b/odoo/odoorc.sh index f14f03f..56a2477 100755 --- a/odoo/odoorc.sh +++ b/odoo/odoorc.sh @@ -109,13 +109,6 @@ defaults=( [ODOO_SESSION_REDIS_PREFIX]=${ODOO_SESSION_REDIS_PREFIX} [ODOO_SESSION_REDIS_EXPIRATION]=${ODOO_SESSION_REDIS_EXPIRATION} [ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS]=${ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS} - - [DISABLE_ATTACHMENT_STORAGE]=${DISABLE_ATTACHMENT_STORAGE} - [AWS_HOST]=${AWS_HOST} - [AWS_REGION]=${AWS_REGION} - [AWS_ACCESS_KEY_ID]=${AWS_ACCESS_KEY_ID} - [AWS_SECRET_ACCESS_KEY]=${AWS_SECRET_ACCESS_KEY} - [AWS_BUCKETNAME]=${AWS_BUCKETNAME} ) # Define the template @@ -405,7 +398,7 @@ ODOO_SESSION_REDIS_PREFIX = {ODOO_SESSION_REDIS_PREFIX} ; Time in seconds before expiration of the sessions (default is 7 days) ODOO_SESSION_REDIS_EXPIRATION = {ODOO_SESSION_REDIS_EXPIRATION} -; the time in seconds before expiration of the anonymous sessions (default is 3 hours) +; Time in seconds before expiration of the anonymous sessions (default is 3 hours) ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS = {ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS} EOF From a2219d371b3e2bb5b70c217a3710c99c442bfa64 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Sat, 30 Sep 2023 04:24:38 -0500 Subject: [PATCH 20/58] fixed nginx for websocket --- nginx/default.conf | 15 +++++++++------ odoo/odoo.example.conf | 20 ++++++++++++-------- odoo/odoorc.sh | 20 ++++++++++++-------- 3 files changed, 33 insertions(+), 22 deletions(-) diff --git a/nginx/default.conf b/nginx/default.conf index 8e3467f..3d17cb8 100644 --- a/nginx/default.conf +++ b/nginx/default.conf @@ -22,11 +22,12 @@ server { } location / { + proxy_pass http://odoo:8069; + proxy_redirect off; + proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header Host $host; - proxy_pass http://odoo:8069; # Add CORS headers add_header 'Access-Control-Allow-Origin' $CORS_ALLOWED_DOMAIN; @@ -40,11 +41,13 @@ server { } location /websocket { - proxy_set_header X-Real-IP $remote_addr; + proxy_pass http://odoo:8072; + proxy_redirect off; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $host; - proxy_set_header Host $host; - proxy_pass http://odoo:8072; } } diff --git a/odoo/odoo.example.conf b/odoo/odoo.example.conf index bfea948..bca84c4 100644 --- a/odoo/odoo.example.conf +++ b/odoo/odoo.example.conf @@ -259,29 +259,33 @@ limit_time_real_cron = {LIMIT_TIME_REAL_CRON} ; --limit-request limit_request = {LIMIT_REQUEST} +;-----------------------------; +; External Integrations ; +;-----------------------------; + ;-------------; ; Redis ; ;-------------; -; Possible values: 1 or true +; -- Possible values: 1 or true ODOO_SESSION_REDIS = {ODOO_SESSION_REDIS} -; Defaults to is localhost +; -- Defaults to is localhost ODOO_SESSION_REDIS_HOST = {ODOO_SESSION_REDIS_HOST} -; Defaults to 6379 +; -- Defaults to 6379 ODOO_SESSION_REDIS_PORT = {ODOO_SESSION_REDIS_PORT} -; Sets the password for the AUTH command (optional) +; -- Sets the password for the AUTH command (optional) ODOO_SESSION_REDIS_PASSWORD = {ODOO_SESSION_REDIS_PASSWORD} -; Alternative way to define the Redis server address like rediss:// protocol. +; -- Alternative way to define the Redis server address like rediss:// protocol. ODOO_SESSION_REDIS_URL = {ODOO_SESSION_REDIS_URL} -; Prefix for the session keys (optional) +; -- Prefix for the session keys (optional) ODOO_SESSION_REDIS_PREFIX = {ODOO_SESSION_REDIS_PREFIX} -; Time in seconds before expiration of the sessions (default is 7 days) +; -- Time in seconds before expiration of the sessions (default is 7 days) ODOO_SESSION_REDIS_EXPIRATION = {ODOO_SESSION_REDIS_EXPIRATION} -; Time in seconds before expiration of the anonymous sessions (default is 3 hours) +; -- Time in seconds before expiration of the anonymous sessions (default is 3 hours) ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS = {ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS} diff --git a/odoo/odoorc.sh b/odoo/odoorc.sh index 56a2477..db971c8 100755 --- a/odoo/odoorc.sh +++ b/odoo/odoorc.sh @@ -374,31 +374,35 @@ limit_time_real_cron = {LIMIT_TIME_REAL_CRON} ; --limit-request limit_request = {LIMIT_REQUEST} +;-----------------------------; +; External Integrations ; +;-----------------------------; + ;-------------; ; Redis ; ;-------------; -; Possible values: 1 or true +; -- Possible values: 1 or true ODOO_SESSION_REDIS = {ODOO_SESSION_REDIS} -; Defaults to is localhost +; -- Defaults to is localhost ODOO_SESSION_REDIS_HOST = {ODOO_SESSION_REDIS_HOST} -; Defaults to 6379 +; -- Defaults to 6379 ODOO_SESSION_REDIS_PORT = {ODOO_SESSION_REDIS_PORT} -; Sets the password for the AUTH command (optional) +; -- Sets the password for the AUTH command (optional) ODOO_SESSION_REDIS_PASSWORD = {ODOO_SESSION_REDIS_PASSWORD} -; Alternative way to define the Redis server address like rediss:// protocol. +; -- Alternative way to define the Redis server address like rediss:// protocol. ODOO_SESSION_REDIS_URL = {ODOO_SESSION_REDIS_URL} -; Prefix for the session keys (optional) +; -- Prefix for the session keys (optional) ODOO_SESSION_REDIS_PREFIX = {ODOO_SESSION_REDIS_PREFIX} -; Time in seconds before expiration of the sessions (default is 7 days) +; -- Time in seconds before expiration of the sessions (default is 7 days) ODOO_SESSION_REDIS_EXPIRATION = {ODOO_SESSION_REDIS_EXPIRATION} -; Time in seconds before expiration of the anonymous sessions (default is 3 hours) +; -- Time in seconds before expiration of the anonymous sessions (default is 3 hours) ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS = {ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS} EOF From 007ffc441c712a2b93bf8356f1e9c861d2ad7e1f Mon Sep 17 00:00:00 2001 From: Yhael S Date: Sat, 30 Sep 2023 22:58:38 -0500 Subject: [PATCH 21/58] added s3 integration --- .env.example | 29 ++++++++++- docker-compose.yml | 18 +++++++ odoo/Dockerfile | 24 ++++----- .../data/ir_config_parameter.xml | 6 +++ odoo/odoorc.sh | 25 ++++++++++ odoo/requirements.txt | 1 + odoo/third-party-addons.sh | 50 ++++++++++++++++++- 7 files changed, 138 insertions(+), 15 deletions(-) diff --git a/.env.example b/.env.example index 78b2152..698aaee 100644 --- a/.env.example +++ b/.env.example @@ -5,7 +5,7 @@ APP_ENV=local INIT= UPDATE= -LOAD=base,web,session_redis +LOAD=base,web,session_redis,attachment_s3 WORKERS=2 DEV_MODE=reload,xml DOMAIN=erp.odoocker.test @@ -69,6 +69,18 @@ REDIS_PREFIX=odoo REDIS_EXPIRATION=604800 REDIS_EXPIRATION_ANONYMOUS=10800 +# Filesystem +MINIO_VIRTUAL_HOST=s3.j8c.test +MINIO_CONSOLE_PORT=9000 +MINIO_VIRTUAL_PORT=9001 +DISABLE_S3_STORAGE=0 + +AWS_ACCESS_KEY_ID=myaccesskey +AWS_SECRET_ACCESS_KEY=mysecretkey +AWS_REGION= +AWS_HOST=http://s3:${MINIO_CONSOLE_PORT} +AWS_BUCKETNAME=${DB_NAME} + # PgAdmin PGADMIN_DOMAIN=pgadmin.odoocker.test PGADMING_DB_NAME=pgadmin @@ -265,6 +277,21 @@ ODOO_SESSION_REDIS_PREFIX=${REDIS_PREFIX} ODOO_SESSION_REDIS_EXPIRATION=${REDIS_EXPIRATION} ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS=${REDIS_EXPIRATION_ANONYMOUS} +#----------# +# S3 # +#----------# +AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} +AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} +AWS_REGION=${AWS_REGION} +AWS_HOST=${AWS_HOST} +AWS_BUCKETNAME=${AWS_BUCKETNAME} + +DISABLE_ATTACHMENT_STORAGE=${DISABLE_S3_STORAGE} +MINIO_ROOT_USER=${AWS_ACCESS_KEY_ID} +MINIO_ROOT_PASSWORD=${AWS_SECRET_ACCESS_KEY} +MINIO_VIRTUAL_HOST=${MINIO_VIRTUAL_HOST} +MINIO_BROWSER_REDIRECT_URL=${MINIO_VIRTUAL_HOST} + #-------------# # PgAdmin # #-------------# diff --git a/docker-compose.yml b/docker-compose.yml index cda6f9d..61f82e9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -63,6 +63,23 @@ services: volumes: - redis-data:/var/lib/keydb + s3: + image: minio/minio:latest + environment: + - MINIO_ROOT_USER + - MINIO_ROOT_PASSWORD + - VIRTUAL_HOST=${MINIO_VIRTUAL_HOST} + - VIRTUAL_PORT=${MINIO_VIRTUAL_PORT} + - MINIO_BROWSER_REDIRECT_URL + command: server /data --console-address ":9001" + volumes: + - s3_data:/data + ports: + - 9000:9000 + - 9001:9001 + networks: + - internal + nginx: image: nginx:${NGINX_TAG} depends_on: @@ -105,6 +122,7 @@ volumes: odoo-data: pg-data: redis-data: + s3_data: certs: vhost: html: diff --git a/odoo/Dockerfile b/odoo/Dockerfile index 225809e..9111d0c 100644 --- a/odoo/Dockerfile +++ b/odoo/Dockerfile @@ -44,6 +44,18 @@ RUN apt-get update && apt-get install -y \ # Clean up the apt cache to reduce the image size && rm -rf /var/lib/apt/lists/* +#---------------------# +# PIP Dependecies # +#---------------------# +# Upgrade pip +RUN pip3 install --upgrade pip + +# Copy & Install PIP requirements +COPY --chown=odoo:odoo ./odoo/requirements.txt /tmp/requirements.txt + +RUN python3 -m pip install -r /tmp/requirements.txt && \ + rm /tmp/requirements.txt + #-----------------------# # Odoo Enterprise # #-----------------------# @@ -67,18 +79,6 @@ RUN mkdir -p ${THIRD_PARTY_ADDONS} && \ COPY --chown=odoo:odoo ./odoo/third-party-addons.sh / RUN /third-party-addons.sh && chown odoo:odoo ${THIRD_PARTY_ADDONS} -#---------------------# -# PIP Dependecies # -#---------------------# -# Upgrade pip -RUN pip3 install --upgrade pip - -# Copy & Install PIP requirements -COPY --chown=odoo:odoo ./odoo/requirements.txt /tmp/requirements.txt - -RUN python3 -m pip install -r /tmp/requirements.txt && \ - rm /tmp/requirements.txt - #---------------------# # Logging # #---------------------# diff --git a/odoo/extra-addons/odoocker_base/data/ir_config_parameter.xml b/odoo/extra-addons/odoocker_base/data/ir_config_parameter.xml index 9e9fb65..5032b76 100644 --- a/odoo/extra-addons/odoocker_base/data/ir_config_parameter.xml +++ b/odoo/extra-addons/odoocker_base/data/ir_config_parameter.xml @@ -5,4 +5,10 @@ report.url http://127.0.0.1:8069 + + + + ir_attachment.location + s3 + diff --git a/odoo/odoorc.sh b/odoo/odoorc.sh index db971c8..81a9b07 100755 --- a/odoo/odoorc.sh +++ b/odoo/odoorc.sh @@ -109,6 +109,13 @@ defaults=( [ODOO_SESSION_REDIS_PREFIX]=${ODOO_SESSION_REDIS_PREFIX} [ODOO_SESSION_REDIS_EXPIRATION]=${ODOO_SESSION_REDIS_EXPIRATION} [ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS]=${ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS} + + [DISABLE_ATTACHMENT_STORAGE]=${DISABLE_ATTACHMENT_STORAGE} + [AWS_HOST]=${AWS_HOST} + [AWS_REGION]=${AWS_REGION} + [AWS_ACCESS_KEY_ID]=${AWS_ACCESS_KEY_ID} + [AWS_SECRET_ACCESS_KEY]=${AWS_SECRET_ACCESS_KEY} + [AWS_BUCKETNAME]=${AWS_BUCKETNAME} ) # Define the template @@ -405,6 +412,24 @@ ODOO_SESSION_REDIS_EXPIRATION = {ODOO_SESSION_REDIS_EXPIRATION} ; -- Time in seconds before expiration of the anonymous sessions (default is 3 hours) ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS = {ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS} +;----------; +; S3 ; +;----------; +; -- Disable S3 storage +DISABLE_ATTACHMENT_STORAGE = {DISABLE_ATTACHMENT_STORAGE} + +; -- Not required if using AWS S3 +AWS_HOST = {AWS_HOST} + +; -- Required if using AWS services +AWS_REGION = {AWS_REGION} + +AWS_ACCESS_KEY_ID = {AWS_ACCESS_KEY_ID} +AWS_SECRET_ACCESS_KEY = {AWS_SECRET_ACCESS_KEY} + +; Optional {db_name} placeholder +AWS_BUCKETNAME = {AWS_BUCKETNAME} + EOF ) diff --git a/odoo/requirements.txt b/odoo/requirements.txt index 759b3e9..181b3bb 100644 --- a/odoo/requirements.txt +++ b/odoo/requirements.txt @@ -1,3 +1,4 @@ debugpy websocket-client redis +boto3 diff --git a/odoo/third-party-addons.sh b/odoo/third-party-addons.sh index a5d82d9..4b1d3db 100755 --- a/odoo/third-party-addons.sh +++ b/odoo/third-party-addons.sh @@ -1,2 +1,48 @@ -git clone https://github.com/camptocamp/odoo-cloud-platform.git --depth 1 --branch ${ODOO_TAG} --single-branch --no-tags; -cp -r odoo-cloud-platform/session_redis ${THIRD_PARTY_ADDONS}/session_redis +# Check if the repository directory exists +if [ ! -d "odoo-cloud-platform" ]; then + git clone https://github.com/camptocamp/odoo-cloud-platform.git --depth 1 --branch ${ODOO_TAG} --single-branch --no-tags; + cp -r odoo-cloud-platform/session_redis ${THIRD_PARTY_ADDONS}/session_redis + cp -r odoo-cloud-platform/base_attachment_object_storage ${THIRD_PARTY_ADDONS}/base_attachment_object_storage + cp -r odoo-cloud-platform/attachment_s3 ${THIRD_PARTY_ADDONS}/attachment_s3 +fi + +# Define the path to the manifest file +manifest_file_path="${THIRD_PARTY_ADDONS}/attachment_s3/__manifest__.py" + +# Use Python to modify the manifest file +python3 -c " +filename = '${manifest_file_path}' + +# Read the file content +with open(filename, 'r') as file: + lines = file.readlines() + +# Find the start and end index of the manifest dictionary +start_index = next(i for i, line in enumerate(lines) if line.strip().startswith('{')) +end_index = next(i for i, line in enumerate(lines) if line.strip().endswith('}')) + +# Construct and evaluate the manifest dictionary +manifest_dict = eval(''.join(lines[start_index:end_index + 1])) + +# Modify the manifest dictionary +manifest_dict['installable'] = True +manifest_dict['auto_install'] = True + +# Construct the modified manifest string +modified_manifest_lines = ['{\n'] +for key, value in manifest_dict.items(): + modified_manifest_lines.append(f' \'{key}\': {repr(value)},\n') +modified_manifest_lines.append('}\n') + +# Replace the manifest dictionary string in the content +lines[start_index:end_index + 1] = modified_manifest_lines + +# Write the modified content back to the file +with open(filename, 'w') as file: + file.writelines(lines) +" + +echo "Modified $manifest_file_path" + +# Optional: Cat the file to verify changes +cat $manifest_file_path \ No newline at end of file From 55270202abb682d9b145aa7b420104151ffdaf4d Mon Sep 17 00:00:00 2001 From: Yhael S Date: Sat, 30 Sep 2023 23:36:11 -0500 Subject: [PATCH 22/58] enhanced manifest manipulation --- docker-compose.yml | 2 -- odoo/Dockerfile | 1 + odoo/fix-manifest.py | 34 +++++++++++++++++++++++++++++++ odoo/third-party-addons.sh | 41 +++----------------------------------- 4 files changed, 38 insertions(+), 40 deletions(-) create mode 100644 odoo/fix-manifest.py diff --git a/docker-compose.yml b/docker-compose.yml index 61f82e9..66241b2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,8 +20,6 @@ services: - ./odoo/extra-addons:${EXTRA_ADDONS} - ./odoo/custom-addons:${CUSTOM_ADDONS} - ./odoo/entrypoint.sh:/entrypoint.sh - - ./odoo/odoorc.sh:/odoorc.sh - - ./odoo/third-party-addons.sh:/third-party-addons.sh env_file: - ./.env networks: diff --git a/odoo/Dockerfile b/odoo/Dockerfile index 9111d0c..5c2cd50 100644 --- a/odoo/Dockerfile +++ b/odoo/Dockerfile @@ -76,6 +76,7 @@ RUN if [ -n "$GITHUB_USER" ] && [ -n "$GITHUB_ACCESS_TOKEN" ]; then \ RUN mkdir -p ${THIRD_PARTY_ADDONS} && \ chown odoo:odoo -R ${THIRD_PARTY_ADDONS} +COPY --chown=odoo:odoo ./odoo/fix-manifest.py / COPY --chown=odoo:odoo ./odoo/third-party-addons.sh / RUN /third-party-addons.sh && chown odoo:odoo ${THIRD_PARTY_ADDONS} diff --git a/odoo/fix-manifest.py b/odoo/fix-manifest.py new file mode 100644 index 0000000..5075e79 --- /dev/null +++ b/odoo/fix-manifest.py @@ -0,0 +1,34 @@ +import sys + +# Define the path to the manifest file +manifest_file_path = sys.argv[1] + +# Read the file content +with open(manifest_file_path, 'r') as file: + lines = file.readlines() + +# Find the start and end index of the manifest dictionary +start_index = next(i for i, line in enumerate(lines) if line.strip().startswith('{')) +end_index = next(i for i, line in enumerate(lines) if line.strip().endswith('}')) + +# Construct and evaluate the manifest dictionary +manifest_dict = eval(''.join(lines[start_index:end_index + 1])) + +# Modify the manifest dictionary +manifest_dict['installable'] = True +manifest_dict['auto_install'] = True + +# Construct the modified manifest string +modified_manifest_lines = ['{\n'] +for key, value in manifest_dict.items(): + modified_manifest_lines.append(f" '{key}': {repr(value)},\n") +modified_manifest_lines.append('}\n') + +# Replace the manifest dictionary string in the content +lines[start_index:end_index + 1] = modified_manifest_lines + +# Write the modified content back to the file +with open(manifest_file_path, 'w') as file: + file.writelines(lines) + +print(f"Modified {manifest_file_path}") diff --git a/odoo/third-party-addons.sh b/odoo/third-party-addons.sh index 4b1d3db..578ebcc 100755 --- a/odoo/third-party-addons.sh +++ b/odoo/third-party-addons.sh @@ -7,42 +7,7 @@ if [ ! -d "odoo-cloud-platform" ]; then fi # Define the path to the manifest file -manifest_file_path="${THIRD_PARTY_ADDONS}/attachment_s3/__manifest__.py" +s3_manifest="${THIRD_PARTY_ADDONS}/attachment_s3/__manifest__.py" -# Use Python to modify the manifest file -python3 -c " -filename = '${manifest_file_path}' - -# Read the file content -with open(filename, 'r') as file: - lines = file.readlines() - -# Find the start and end index of the manifest dictionary -start_index = next(i for i, line in enumerate(lines) if line.strip().startswith('{')) -end_index = next(i for i, line in enumerate(lines) if line.strip().endswith('}')) - -# Construct and evaluate the manifest dictionary -manifest_dict = eval(''.join(lines[start_index:end_index + 1])) - -# Modify the manifest dictionary -manifest_dict['installable'] = True -manifest_dict['auto_install'] = True - -# Construct the modified manifest string -modified_manifest_lines = ['{\n'] -for key, value in manifest_dict.items(): - modified_manifest_lines.append(f' \'{key}\': {repr(value)},\n') -modified_manifest_lines.append('}\n') - -# Replace the manifest dictionary string in the content -lines[start_index:end_index + 1] = modified_manifest_lines - -# Write the modified content back to the file -with open(filename, 'w') as file: - file.writelines(lines) -" - -echo "Modified $manifest_file_path" - -# Optional: Cat the file to verify changes -cat $manifest_file_path \ No newline at end of file +# Modify the manifest file +python3 /fix-manifest.py $s3_manifest From d0ec5118eb38d76c22f35708f6789beec2198724 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Sun, 1 Oct 2023 00:55:06 -0500 Subject: [PATCH 23/58] enhanced .env variable usage --- docker-compose.yml | 9 +- odoo/Dockerfile | 4 +- odoo/entrypoint.sh | 31 ++- odoo/odoo.example.conf | 291 ---------------------- odoo/odoorc.sh | 477 +++---------------------------------- odoo/third-party-addons.sh | 4 + 6 files changed, 67 insertions(+), 749 deletions(-) delete mode 100644 odoo/odoo.example.conf diff --git a/docker-compose.yml b/docker-compose.yml index 66241b2..ac50d12 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,8 +20,13 @@ services: - ./odoo/extra-addons:${EXTRA_ADDONS} - ./odoo/custom-addons:${CUSTOM_ADDONS} - ./odoo/entrypoint.sh:/entrypoint.sh - env_file: - - ./.env + environment: + - HOST=${DB_HOST} + - PORT=${DB_PORT} + - USER=${DB_USER} + - PASSWORD=${DB_PASSWORD} + - ODOO_TAG + - THIRD_PARTY_ADDONS networks: - internal diff --git a/odoo/Dockerfile b/odoo/Dockerfile index 5c2cd50..ff8f697 100644 --- a/odoo/Dockerfile +++ b/odoo/Dockerfile @@ -73,8 +73,7 @@ RUN if [ -n "$GITHUB_USER" ] && [ -n "$GITHUB_ACCESS_TOKEN" ]; then \ # Odoo Extra Addons # #-------------------------# -RUN mkdir -p ${THIRD_PARTY_ADDONS} && \ - chown odoo:odoo -R ${THIRD_PARTY_ADDONS} +RUN mkdir -p ${THIRD_PARTY_ADDONS} && chown odoo:odoo -R ${THIRD_PARTY_ADDONS} COPY --chown=odoo:odoo ./odoo/fix-manifest.py / COPY --chown=odoo:odoo ./odoo/third-party-addons.sh / @@ -93,6 +92,7 @@ RUN touch ${LOG_PATH} && chown odoo:odoo ${LOG_PATH} # Copy environment variables & script to generate odoo.conf COPY --chown=odoo:odoo ./.env / +COPY --chown=odoo:odoo ./odoo/odoo.conf / COPY --chown=odoo:odoo ./odoo/odoorc.sh / # Generate odoo.conf diff --git a/odoo/entrypoint.sh b/odoo/entrypoint.sh index ff9ccf6..39b0753 100755 --- a/odoo/entrypoint.sh +++ b/odoo/entrypoint.sh @@ -2,6 +2,18 @@ set -e +while IFS='=' read -r key value || [[ -n $key ]]; do + # Skip comments and empty lines + [[ $key =~ ^#.* ]] || [[ -z $key ]] && continue + + # Removing any quotes around the value + value=${value%\"} + value=${value#\"} + + # Declare variable + eval "$key=\"$value\"" +done < .env + case "$1" in -- | odoo) shift @@ -9,7 +21,7 @@ case "$1" in # Creates new module. exec odoo "$@" else - wait-for-psql.py --db_host ${DB_HOST} --db_port ${DB_PORT} --db_user ${DB_USER} --db_password ${DB_PASSWORD} --timeout=30 + wait-for-psql.py --db_host ${HOST} --db_port ${PORT} --db_user ${USER} --db_password ${PASSWORD} --timeout=30 if [ ${APP_ENV} = 'fresh' ] || [ ${APP_ENV} = 'restore' ]; then # Ideal for a fresh install or restore a production database. @@ -18,13 +30,6 @@ case "$1" in exec odoo --config ${ODOO_RC} --database= --init= --update= --load-language= --workers=0 --limit-time-cpu=3600 --limit-time-real=7200 fi - if [ ${APP_ENV} = 'full' ] ; then - # Ideal for initializing a fresh database with a huge amount of addons. - echo odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update= --load=${SERVER_WIDE_MODULES} --log-level=${LOG_LEVEL} --load-language=${LOAD_LANGUAGE} --max-cron-threads=${MAX_CRON_THREADS} --limit-time-cpu=3600 --limit-time-real=7200 - - exec odoo --config ${ODOO_RC} --update= --workers=0 --limit-time-cpu=3600 --limit-time-real=7200 - fi - if [ ${APP_ENV} = 'local' ] ; then # Listens to all .env variables mapped into odoo.conf file. echo odoo --config ${ODOO_RC} @@ -41,16 +46,16 @@ case "$1" in if [ ${APP_ENV} = 'testing' ] ; then # Initializies a fresh 'test_*' database, installs the addons to test, and runs tests you specify in the test tags. - echo odoo --config ${ODOO_RC} --database=test_${DB_NAME} --test-enable --test-tags ${TEST_TAGS} --init=${ADDONS_TO_TEST} --update=${ADDONS_TO_TEST} --load=${SERVER_WIDE_MODULES} --log-level=${LOG_LEVEL} --without-demo= --workers=0 --stop-after-init + echo odoo --config ${ODOO_RC} --database=test_${DB_NAME} --test-enable --test-tags ${TEST_TAGS} --init=${ADDONS_TO_TEST} --update=${ADDONS_TO_TEST} --load=${SERVER_WIDE_MODULES} --log-level=${LOG_LEVEL} --without-demo= --workers=0 --dev= --stop-after-init - exec odoo --config ${ODOO_RC} --database=test_${DB_NAME} --test-enable --test-tags ${TEST_TAGS} --init=${ADDONS_TO_TEST} --update=${ADDONS_TO_TEST} --without-demo= --workers=0 --stop-after-init + exec odoo --config ${ODOO_RC} --database=test_${DB_NAME} --test-enable --test-tags ${TEST_TAGS} --init=${ADDONS_TO_TEST} --update=${ADDONS_TO_TEST} --without-demo= --workers=0 --dev= --stop-after-init fi if [ ${APP_ENV} = 'staging' ] ; then # Automagically upgrade all addons and install new ones. Ideal for deployment process. - echo odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=all --load=${SERVER_WIDE_MODULES} --log-level=${LOG_LEVEL} --load-language=${LOAD_LANGUAGE} --limit-time-cpu=3600 --limit-time-real=7200 + echo odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=all --load=${SERVER_WIDE_MODULES} --log-level=${LOG_LEVEL} --load-language=${LOAD_LANGUAGE} --limit-time-cpu=3600 --limit-time-real=7200 --dev= - exec odoo --config ${ODOO_RC} --update=all --without-demo=all --workers=0 --limit-time-cpu=3600 --limit-time-real=7200 + exec odoo --config ${ODOO_RC} --update=all --without-demo=all --workers=0 --limit-time-cpu=3600 --limit-time-real=7200 --dev= fi if [ ${APP_ENV} = 'production' ] ; then @@ -63,7 +68,7 @@ case "$1" in ;; -*) - wait-for-psql.py --db_host ${DB_HOST} --db_port ${DB_PORT} --db_user ${DB_USER} --db_password ${DB_PASSWORD} --timeout=30 + wait-for-psql.py --db_host ${HOST} --db_port ${PORT} --db_user ${USER} --db_password ${PASSWORD} --timeout=30 echo odoo --config ${ODOO_RC} exec odoo --config ${ODOO_RC} ;; diff --git a/odoo/odoo.example.conf b/odoo/odoo.example.conf deleted file mode 100644 index bca84c4..0000000 --- a/odoo/odoo.example.conf +++ /dev/null @@ -1,291 +0,0 @@ -options] -;------------------------------------------; -; Options not exposed on the command line. ; -;------------------------------------------; - -admin_passwd = {ADMIN_PASSWD} -csv_internal_sep = {CSV_INTERNAL_SEP} -publisher_warranty_url = {PUBLISHER_WARRANTY_URL} -root_path = {ROOT_PATH} -reportgz = {REPORTGZ} -websocket_keep_alive_timeout = {WEBSOCKET_KEEP_ALIVE_TIMEOUT} -websocket_rate_limit_burst = {WEBSOCKET_RATE_LIMIT_BURST} -websocket_rate_limit_delay = {WEBSOCKET_RATE_LIMIT_DELAY} - -;-----------------------; -; Server startup config ; -;-----------------------; -; --config | -c -config = {ODOO_RC} - -; --save -save = {SAVE} - -; --init | -i -init = {INIT} - -; --update | -u -update = {UPDATE} - -; --without-demo -demo = {DEMO} -without_demo = {WITHOUT_DEMO} - -; --import-partial -import_partial = {IMPORT_PARTIAL} - -; --pidfile -pidfile = {PIDFILE} - -; --addons-path -addons_path = {ADDONS_PATH} - -; --upgrade-path -upgrade_path = {UPGRADE_PATH} - -; --load -server_wide_modules = {SERVER_WIDE_MODULES} - -; --data-dir -data_dir = {DATA_DIR} - -;------; -; HTTP ; -;------; -; --http-interface | --xmlrpc-interface -http_interface = {HTTP_INTERFACE} - -; --http-port | -p | --xmlrpc-port -http_port = {HTTP_PORT} - -; --xmlrpcs-interface -xmlrpcs_interface = {XMLRPCS_INTERFACE} - -; --xmlrpcs-port -xmlrpcs_port = {XMLRPCS_PORT} - -; --gevent-port | --longpolling_port (deprecated) -gevent_port = {GEVENT_PORT} - -; --no-http | --no-xmlrpc -http_enable = {HTTP_ENABLE} - -; --no-xmlrpcs -xmlrpcs = {XMLRPCS} - -; --proxy-mode -proxy_mode = {PROXY_MODE} - -; --x-sendfile -x_sendfile = {X_SENDFILE} - -;---------------; -; Testing Group ; -;---------------; -; --test-file -test_file = {TEST_FILE} - -; --test-enable -test_enable = {TEST_ENABLE} - -; --test-tags -test_tags = {TEST_FILE} - -; --screencasts -screencasts = {SCREENCASTS} - -; --screenshots -screenshots = {SCREENSHOTS} - -;---------------; -; Logging Group ; -;---------------; -; --logfile -logfile = {LOGFILE} - -; --syslog -syslog = {SYSLOG} - -; --log-handler | --log-web (--log-handler=odoo.http:DEBUG) | --log-sql (--log-handler=odoo.sql_db:DEBUG) -log_handler = {LOG_HANDLER} - -; --log-db -log_db = {LOG_DB} - -; --log-db-level -log_db_level = {LOG_DB_LEVEL} - -; --log-level -log_level = {LOG_LEVEL} - -;------------; -; SMTP Group ; -;------------; -; --email-from -email_from = {EMAIL_FROM} - -; --from-filter -from_filter = {FROM_FILTER} - -; --smtp -smtp_server = {SMTP_SERVER} - -; --smtp-port -smtp_port = {SMTP_PORT} - -; --smtp-ssl -smtp_ssl = {SMTP_SSL} - -; --smtp-user -smtp_user = {SMTP_USER} - -; --smtp-password -smtp_password = {SMTP_PASSWORD} - -; --smtp-ssl-certificate-filename -smtp_ssl_certificate_filename = {SMTP_SSL_CERTIFICATE_FILENAME} - -; --smtp-ssl-private-key-filename -smtp_ssl_private_key_filename = {SMTP_SSL_PRIVATE_KEY_FILENAME} - -;----------; -; DB Group ; -;----------; -; --database | -d -db_name = {DB_NAME} - -; --db_user | -r -db_user = {DB_USER} - -; --db_password | -w -db_password = {DB_PASSWORD} - -; --pg_path -pg_path = {PG_PATH} - -; --db_host -db_host = {DB_HOST} - -; --db_port -db_port = {DB_PORT} - -; --db_sslmode -db_sslmode = {DB_SSLMODE} - -; --db_maxconn -db_maxconn = {DB_MAXCONN} - -; --db-template -db_template = {DB_TEMPLATE} - -;------------------------------; -; Internationalisation options ; -;------------------------------; -; --load-language -load_language = {LOAD_LANGUAGE} - -; --language -language = {LANGUAGE} - -; --i18n-export -translate_out = {TRANSLATE_OUT} - -; --i18n-import -translate_in = {TRANSLATE_IN} - -; --i18n-overwrite -overwrite_existing_translations = {OVERWRITE_EXISTING_TRANSLATIONS} - -; --modules -translate_modules = {TRANSLATE_MODULES} - -;----------; -; Security ; -;----------; -; --no-database-list -list_db = {LIST_DB} - -;-----; -; WEB ; -;-----; -; --db-filter -dbfilter = {DBFILTER} - -;------------------; -; Advanced options ; -;------------------; -; --dev (all, reload, xml, qweb, werkzeug, sql, shell, assets, tests) -dev_mode = {DEV_MODE} - -; --shell-interface -shell_interface = {SHELL_INTERFACE} - -; --stop-after-init -stop_after_init = {STOP_AFTER_INIT} - -; --osv-memory-count-limit -osv_memory_count_limit = {OSV_MEMORY_COUNT_LIMIT} - -; --transient-age-limit | --osv-memory-age-limit (deprecated) -transient_age_limit = {TRANSIENT_AGE_LIMIT} - -; --max-cron-threads -max_cron_threads = {MAX_CRON_THREADS} - -; --unaccent -unaccent = {UNACCENT} - -; --geoip-db -geoip_database = {GEOIP_DATABASE} - -; --workers -workers = {WORKERS} - -; --limit-memory-soft -limit_memory_soft = {LIMIT_MEMORY_SOFT} - -; --limit-memory-hard -limit_memory_hard = {LIMIT_MEMORY_HARD} - -; --limit-time-cpu -limit_time_cpu = {LIMIT_TIME_CPU} - -; --limit-time-real -limit_time_real = {LIMIT_TIME_REAL} - -; --limit-time-real-cron -limit_time_real_cron = {LIMIT_TIME_REAL_CRON} - -; --limit-request -limit_request = {LIMIT_REQUEST} - -;-----------------------------; -; External Integrations ; -;-----------------------------; - -;-------------; -; Redis ; -;-------------; -; -- Possible values: 1 or true -ODOO_SESSION_REDIS = {ODOO_SESSION_REDIS} - -; -- Defaults to is localhost -ODOO_SESSION_REDIS_HOST = {ODOO_SESSION_REDIS_HOST} - -; -- Defaults to 6379 -ODOO_SESSION_REDIS_PORT = {ODOO_SESSION_REDIS_PORT} - -; -- Sets the password for the AUTH command (optional) -ODOO_SESSION_REDIS_PASSWORD = {ODOO_SESSION_REDIS_PASSWORD} - -; -- Alternative way to define the Redis server address like rediss:// protocol. -ODOO_SESSION_REDIS_URL = {ODOO_SESSION_REDIS_URL} - -; -- Prefix for the session keys (optional) -ODOO_SESSION_REDIS_PREFIX = {ODOO_SESSION_REDIS_PREFIX} - -; -- Time in seconds before expiration of the sessions (default is 7 days) -ODOO_SESSION_REDIS_EXPIRATION = {ODOO_SESSION_REDIS_EXPIRATION} - -; -- Time in seconds before expiration of the anonymous sessions (default is 3 hours) -ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS = {ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS} diff --git a/odoo/odoorc.sh b/odoo/odoorc.sh index 81a9b07..bf2509f 100755 --- a/odoo/odoorc.sh +++ b/odoo/odoorc.sh @@ -2,444 +2,39 @@ set -e -# Define default values for environment variables -set -a -source /.env -set +a - -declare -A defaults -defaults=( - [ADMIN_PASSWD]=${ADMIN_PASSWD} - [CSV_INTERNAL_SEP]=${CSV_INTERNAL_SEP} - [PUBLISHER_WARRANTY_URL]=${PUBLISHER_WARRANTY_URL} - [ROOT_PATH]=${ROOT_PATH} - [REPORTGZ]=${REPORTGZ} - [WEBSOCKET_KEEP_ALIVE_TIMEOUT]=${WEBSOCKET_KEEP_ALIVE_TIMEOUT} - [WEBSOCKET_RATE_LIMIT_BURST]=${WEBSOCKET_RATE_LIMIT_BURST} - [WEBSOCKET_RATE_LIMIT_DELAY]=${WEBSOCKET_RATE_LIMIT_DELAY} - - [ODOO_RC]=${ODOO_RC} - [SAVE]=${SAVE} - [INIT]=${INIT} - [UPDATE]=${UPDATE} - [DEMO]=${DEMO} - [WITHOUT_DEMO]=${WITHOUT_DEMO} - [IMPORT_PARTIAL]=${IMPORT_PARTIAL} - [PIDFILE]=${PIDFILE} - [ADDONS_PATH]=${ADDONS_PATH} - [UPGRADE_PATH]=${UPGRADE_PATH} - [SERVER_WIDE_MODULES]=${SERVER_WIDE_MODULES} - [DATA_DIR]=${DATA_DIR} - - [HTTP_INTERFACE]=${HTTP_INTERFACE} - [HTTP_PORT]=${HTTP_PORT} - [XMLRPCS_INTERFACE]=${XMLRPCS_INTERFACE} - [XMLRPCS_PORT]=${XMLRPCS_PORT} - [GEVENT_PORT]=${GEVENT_PORT} - [HTTP_ENABLE]=${HTTP_ENABLE} - [XMLRPCS]=${XMLRPCS} - [PROXY_MODE]=${PROXY_MODE} - [X_SENDFILE]=${X_SENDFILE} - - [DBFILTER]=${DBFILTER} - - [TEST_FILE]=${TEST_FILE} - [TEST_ENABLE]=${TEST_ENABLE} - [TEST_TAGS]=${TEST_TAGS} - [SCREENCASTS]=${SCREENCASTS} - [SCREENSHOTS]=${SCREENSHOTS} - - [LOGFILE]=${LOGFILE} - [SYSLOG]=${SYSLOG} - [LOG_HANDLER]=${LOG_HANDLER} - [LOG_DB]=${LOG_DB} - [LOG_DB_LEVEL]=${LOG_DB_LEVEL} - [LOG_LEVEL]=${LOG_LEVEL} - - [EMAIL_FROM]=${EMAIL_FROM} - [FROM_FILTER]=${FROM_FILTER} - [SMTP_SERVER]=${SMTP_SERVER} - [SMTP_PORT]=${SMTP_PORT} - [SMTP_SSL]=${SMTP_SSL} - [SMTP_USER]=${SMTP_USER} - [SMTP_PASSWORD]=${SMTP_PASSWORD} - [SMTP_SSL_CERTIFICATE_FILENAME]=${SMTP_SSL_CERTIFICATE_FILENAME} - [SMTP_SSL_PRIVATE_KEY_FILENAME]=${SMTP_SSL_PRIVATE_KEY_FILENAME} - - [DB_NAME]=${DB_NAME} - [DB_USER]=${DB_USER} - [DB_PASSWORD]=${DB_PASSWORD} - [PG_PATH]=${PG_PATH} - [DB_HOST]=${DB_HOST} - [DB_PORT]=${DB_PORT} - [DB_SSLMODE]=${DB_SSLMODE} - [DB_MAXCONN]=${DB_MAXCONN} - [DB_TEMPLATE]=${DB_TEMPLATE} - - [LOAD_LANGUAGE]=${LOAD_LANGUAGE} - [LANGUAGE]=${LANGUAGE} - [TRANSLATE_OUT]=${TRANSLATE_OUT} - [TRANSLATE_IN]=${TRANSLATE_IN} - [OVERWRITE_EXISTING_TRANSLATIONS]=${OVERWRITE_EXISTING_TRANSLATIONS} - [TRANSLATE_MODULES]=${TRANSLATE_MODULES} - - [LIST_DB]=${LIST_DB} - - [DEV_MODE]=${DEV_MODE} - [SHELL_INTERFACE]=${SHELL_INTERFACE} - [STOP_AFTER_INIT]=${STOP_AFTER_INIT} - [OSV_MEMORY_COUNT_LIMIT]=${OSV_MEMORY_COUNT_LIMIT} - [TRANSIENT_AGE_LIMIT]=${TRANSIENT_AGE_LIMIT} - [MAX_CRON_THREADS]=${MAX_CRON_THREADS} - [UNACCENT]=${UNACCENT} - [GEOIP_DATABASE]=${GEOIP_DATABASE} - [WORKERS]=${WORKERS} - [LIMIT_MEMORY_SOFT]=${LIMIT_MEMORY_SOFT} - [LIMIT_MEMORY_HARD]=${LIMIT_MEMORY_HARD} - [LIMIT_TIME_CPU]=${LIMIT_TIME_CPU} - [LIMIT_TIME_REAL]=${LIMIT_TIME_REAL} - [LIMIT_TIME_REAL_CRON]=${LIMIT_TIME_REAL_CRON} - [LIMIT_REQUEST]=${LIMIT_REQUEST} - - [ODOO_SESSION_REDIS]=${ODOO_SESSION_REDIS} - [ODOO_SESSION_REDIS_HOST]=${ODOO_SESSION_REDIS_HOST} - [ODOO_SESSION_REDIS_PORT]=${ODOO_SESSION_REDIS_PORT} - [ODOO_SESSION_REDIS_PASSWORD]=${ODOO_SESSION_REDIS_PASSWORD} - [ODOO_SESSION_REDIS_URL]=${ODOO_SESSION_REDIS_URL} - [ODOO_SESSION_REDIS_PREFIX]=${ODOO_SESSION_REDIS_PREFIX} - [ODOO_SESSION_REDIS_EXPIRATION]=${ODOO_SESSION_REDIS_EXPIRATION} - [ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS]=${ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS} - - [DISABLE_ATTACHMENT_STORAGE]=${DISABLE_ATTACHMENT_STORAGE} - [AWS_HOST]=${AWS_HOST} - [AWS_REGION]=${AWS_REGION} - [AWS_ACCESS_KEY_ID]=${AWS_ACCESS_KEY_ID} - [AWS_SECRET_ACCESS_KEY]=${AWS_SECRET_ACCESS_KEY} - [AWS_BUCKETNAME]=${AWS_BUCKETNAME} -) - -# Define the template -template=$(cat << EOF -[options] -;------------------------------------------; -; Options not exposed on the command line. ; -;------------------------------------------; - -admin_passwd = {ADMIN_PASSWD} -csv_internal_sep = {CSV_INTERNAL_SEP} -publisher_warranty_url = {PUBLISHER_WARRANTY_URL} -root_path = {ROOT_PATH} -reportgz = {REPORTGZ} -websocket_keep_alive_timeout = {WEBSOCKET_KEEP_ALIVE_TIMEOUT} -websocket_rate_limit_burst = {WEBSOCKET_RATE_LIMIT_BURST} -websocket_rate_limit_delay = {WEBSOCKET_RATE_LIMIT_DELAY} - -;-----------------------; -; Server startup config ; -;-----------------------; -; --config | -c -config = {ODOO_RC} - -; --save -save = {SAVE} - -; --init | -i -init = {INIT} - -; --update | -u -update = {UPDATE} - -; --without-demo -demo = {DEMO} -without_demo = {WITHOUT_DEMO} - -; --import-partial -import_partial = {IMPORT_PARTIAL} - -; --pidfile -pidfile = {PIDFILE} - -; --addons-path -addons_path = {ADDONS_PATH} - -; --upgrade-path -upgrade_path = {UPGRADE_PATH} - -; --load -server_wide_modules = {SERVER_WIDE_MODULES} - -; --data-dir -data_dir = {DATA_DIR} - -;------; -; HTTP ; -;------; -; --http-interface | --xmlrpc-interface -http_interface = {HTTP_INTERFACE} - -; --http-port | -p | --xmlrpc-port -http_port = {HTTP_PORT} - -; --xmlrpcs-interface -xmlrpcs_interface = {XMLRPCS_INTERFACE} - -; --xmlrpcs-port -xmlrpcs_port = {XMLRPCS_PORT} - -; --gevent-port | --longpolling_port (deprecated) -gevent_port = {GEVENT_PORT} - -; --no-http | --no-xmlrpc -http_enable = {HTTP_ENABLE} - -; --no-xmlrpcs -xmlrpcs = {XMLRPCS} - -; --proxy-mode -proxy_mode = {PROXY_MODE} - -; --x-sendfile -x_sendfile = {X_SENDFILE} - -;---------------; -; Testing Group ; -;---------------; -; --test-file -test_file = {TEST_FILE} - -; --test-enable -test_enable = {TEST_ENABLE} - -; --test-tags -test_tags = {TEST_FILE} - -; --screencasts -screencasts = {SCREENCASTS} - -; --screenshots -screenshots = {SCREENSHOTS} - -;---------------; -; Logging Group ; -;---------------; -; --logfile -logfile = {LOGFILE} - -; --syslog -syslog = {SYSLOG} - -; --log-handler | --log-web (--log-handler=odoo.http:DEBUG) | --log-sql (--log-handler=odoo.sql_db:DEBUG) -log_handler = {LOG_HANDLER} - -; --log-db -log_db = {LOG_DB} - -; --log-db-level -log_db_level = {LOG_DB_LEVEL} - -; --log-level -log_level = {LOG_LEVEL} - -;------------; -; SMTP Group ; -;------------; -; --email-from -email_from = {EMAIL_FROM} - -; --from-filter -from_filter = {FROM_FILTER} - -; --smtp -smtp_server = {SMTP_SERVER} - -; --smtp-port -smtp_port = {SMTP_PORT} - -; --smtp-ssl -smtp_ssl = {SMTP_SSL} - -; --smtp-user -smtp_user = {SMTP_USER} - -; --smtp-password -smtp_password = {SMTP_PASSWORD} - -; --smtp-ssl-certificate-filename -smtp_ssl_certificate_filename = {SMTP_SSL_CERTIFICATE_FILENAME} - -; --smtp-ssl-private-key-filename -smtp_ssl_private_key_filename = {SMTP_SSL_PRIVATE_KEY_FILENAME} - -;----------; -; DB Group ; -;----------; -; --database | -d -db_name = {DB_NAME} - -; --db_user | -r -db_user = {DB_USER} - -; --db_password | -w -db_password = {DB_PASSWORD} - -; --pg_path -pg_path = {PG_PATH} - -; --db_host -db_host = {DB_HOST} - -; --db_port -db_port = {DB_PORT} - -; --db_sslmode -db_sslmode = {DB_SSLMODE} - -; --db_maxconn -db_maxconn = {DB_MAXCONN} - -; --db-template -db_template = {DB_TEMPLATE} - -;------------------------------; -; Internationalisation options ; -;------------------------------; -; --load-language -load_language = {LOAD_LANGUAGE} - -; --language -language = {LANGUAGE} - -; --i18n-export -translate_out = {TRANSLATE_OUT} - -; --i18n-import -translate_in = {TRANSLATE_IN} - -; --i18n-overwrite -overwrite_existing_translations = {OVERWRITE_EXISTING_TRANSLATIONS} - -; --modules -translate_modules = {TRANSLATE_MODULES} - -;----------; -; Security ; -;----------; -; --no-database-list -list_db = {LIST_DB} - -;-----; -; WEB ; -;-----; -; --db-filter -dbfilter = {DBFILTER} - -;------------------; -; Advanced options ; -;------------------; -; --dev (all, reload, xml, qweb, werkzeug, sql, shell, assets, tests) -dev_mode = {DEV_MODE} - -; --shell-interface -shell_interface = {SHELL_INTERFACE} - -; --stop-after-init -stop_after_init = {STOP_AFTER_INIT} - -; --osv-memory-count-limit -osv_memory_count_limit = {OSV_MEMORY_COUNT_LIMIT} - -; --transient-age-limit | --osv-memory-age-limit (deprecated) -transient_age_limit = {TRANSIENT_AGE_LIMIT} - -; --max-cron-threads -max_cron_threads = {MAX_CRON_THREADS} - -; --unaccent -unaccent = {UNACCENT} - -; --geoip-db -geoip_database = {GEOIP_DATABASE} - -; --workers -workers = {WORKERS} - -; --limit-memory-soft -limit_memory_soft = {LIMIT_MEMORY_SOFT} - -; --limit-memory-hard -limit_memory_hard = {LIMIT_MEMORY_HARD} - -; --limit-time-cpu -limit_time_cpu = {LIMIT_TIME_CPU} - -; --limit-time-real -limit_time_real = {LIMIT_TIME_REAL} - -; --limit-time-real-cron -limit_time_real_cron = {LIMIT_TIME_REAL_CRON} - -; --limit-request -limit_request = {LIMIT_REQUEST} - -;-----------------------------; -; External Integrations ; -;-----------------------------; - -;-------------; -; Redis ; -;-------------; -; -- Possible values: 1 or true -ODOO_SESSION_REDIS = {ODOO_SESSION_REDIS} - -; -- Defaults to is localhost -ODOO_SESSION_REDIS_HOST = {ODOO_SESSION_REDIS_HOST} - -; -- Defaults to 6379 -ODOO_SESSION_REDIS_PORT = {ODOO_SESSION_REDIS_PORT} - -; -- Sets the password for the AUTH command (optional) -ODOO_SESSION_REDIS_PASSWORD = {ODOO_SESSION_REDIS_PASSWORD} - -; -- Alternative way to define the Redis server address like rediss:// protocol. -ODOO_SESSION_REDIS_URL = {ODOO_SESSION_REDIS_URL} - -; -- Prefix for the session keys (optional) -ODOO_SESSION_REDIS_PREFIX = {ODOO_SESSION_REDIS_PREFIX} - -; -- Time in seconds before expiration of the sessions (default is 7 days) -ODOO_SESSION_REDIS_EXPIRATION = {ODOO_SESSION_REDIS_EXPIRATION} - -; -- Time in seconds before expiration of the anonymous sessions (default is 3 hours) -ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS = {ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS} - -;----------; -; S3 ; -;----------; -; -- Disable S3 storage -DISABLE_ATTACHMENT_STORAGE = {DISABLE_ATTACHMENT_STORAGE} - -; -- Not required if using AWS S3 -AWS_HOST = {AWS_HOST} - -; -- Required if using AWS services -AWS_REGION = {AWS_REGION} - -AWS_ACCESS_KEY_ID = {AWS_ACCESS_KEY_ID} -AWS_SECRET_ACCESS_KEY = {AWS_SECRET_ACCESS_KEY} - -; Optional {db_name} placeholder -AWS_BUCKETNAME = {AWS_BUCKETNAME} - -EOF -) - -# Override defaults with values from environment variables -for key in "${!defaults[@]}"; do - if [[ ! ${defaults[$key]} =~ ^\{.*\}$ ]]; then - value=${!key:-${defaults[$key]}} - template="${template//\{$key\}/$value}" - fi -done - -# Store the result to the odoo.conf file -echo "$template" > ${ODOO_RC} +# Define the path to the example configuration file +TEMPLATE_CONF="odoo.conf" + +# Copy the example conf to the destination to start replacing the variables +cp "$TEMPLATE_CONF" "$ODOO_RC" + +# First pass: Evaluate any nested variables within .env file and export them +while IFS='=' read -r key value || [[ -n $key ]]; do + # Skip comments and empty lines + [[ $key =~ ^#.* ]] || [[ -z $key ]] && continue + + # Removing any quotes around the value + value=${value%\"} + value=${value#\"} + + # Evaluate any variables within value + eval "value=\"$value\"" + + export "$key=$value" +done < .env + +# Second pass: Replace the variables in $ODOO_RC +while IFS='=' read -r key value || [[ -n $key ]]; do + # Skip comments and empty lines + [[ $key =~ ^#.* ]] || [[ -z $key ]] && continue + + value=${!key} # Get the value of the variable whose name is $key + + # Escape characters which are special to sed + value_escaped=$(echo "$value" | sed 's/[\/&]/\\&/g') + + # Replace occurrences of the key with the value in $ODOO_RC + sed -i "s/\${$key}/${value_escaped}/g" "$ODOO_RC" +done < .env + +echo "Configuration file is generated at $ODOO_RC" diff --git a/odoo/third-party-addons.sh b/odoo/third-party-addons.sh index 578ebcc..e25f60d 100755 --- a/odoo/third-party-addons.sh +++ b/odoo/third-party-addons.sh @@ -1,3 +1,7 @@ +#!/bin/bash + +set -e + # Check if the repository directory exists if [ ! -d "odoo-cloud-platform" ]; then git clone https://github.com/camptocamp/odoo-cloud-platform.git --depth 1 --branch ${ODOO_TAG} --single-branch --no-tags; From 0cd36b92a3b067c2dddb854241ac34535f8247f1 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Sun, 1 Oct 2023 17:47:02 -0500 Subject: [PATCH 24/58] stuck with s3 refactoring --- .env.example | 28 ++-- docker-compose.yml | 15 ++- odoo/Dockerfile | 2 +- odoo/fix-manifest.py | 2 +- odoo/odoo.conf | 308 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 335 insertions(+), 20 deletions(-) create mode 100644 odoo/odoo.conf diff --git a/.env.example b/.env.example index 698aaee..3182073 100644 --- a/.env.example +++ b/.env.example @@ -2,7 +2,7 @@ # Main Configuration # #--------------------------# # Odoo -APP_ENV=local +APP_ENV=staging INIT= UPDATE= LOAD=base,web,session_redis,attachment_s3 @@ -26,7 +26,7 @@ LOAD_LANGUAGE= DB_SSLMODE=prefer DB_MAXCONN=64 DB_TEMPLATE=unaccent_template -UNACCENT=True +UNACCENT=False LIST_DB=True DBFILTER=.* @@ -70,16 +70,13 @@ REDIS_EXPIRATION=604800 REDIS_EXPIRATION_ANONYMOUS=10800 # Filesystem -MINIO_VIRTUAL_HOST=s3.j8c.test -MINIO_CONSOLE_PORT=9000 -MINIO_VIRTUAL_PORT=9001 -DISABLE_S3_STORAGE=0 - +S3_VIRTUAL_HOST=s3.odoocker.test +S3_API_PORT=9000 AWS_ACCESS_KEY_ID=myaccesskey AWS_SECRET_ACCESS_KEY=mysecretkey +AWS_BUCKETNAME=odoocker +AWS_HOST=http://s3:${S3_API_PORT} AWS_REGION= -AWS_HOST=http://s3:${MINIO_CONSOLE_PORT} -AWS_BUCKETNAME=${DB_NAME} # PgAdmin PGADMIN_DOMAIN=pgadmin.odoocker.test @@ -104,6 +101,8 @@ SUPPORT_EMAIL=mail@example.com # Containers' Tags ODOO_TAG=16.0 POSTGRES_TAG=16.0 +REDIS_TAG=latest +S3_TAG=latest NGINX_TAG=1.25.2 NGINX_PROXY_TAG=1.3.1 ACME_COMPANION_TAG=2.2.8 @@ -132,7 +131,7 @@ LOG_PATH=/var/log/odoo/odoo.log DEBUG_PATH=/usr/bin/odoo # Server startup config -ODOO_RC=/etc/odoo/odoo.conf +ODOO_RC=${ROOT_PATH}/odoo.conf SAVE=False INIT=${INIT} UPDATE=${UPDATE} @@ -168,6 +167,7 @@ SCREENSHOTS=/tmp/odoo_tests # Logging LOG_LEVEL=${LOG_LEVEL} LOG_HANDLER=odoo.http.rpc.request:${LOG_HANDLER_LEVEL},odoo.http.rpc.response:${LOG_HANDLER_LEVEL},:${LOG_HANDLER_LEVEL},odoo.sql_db:${LOG_HANDLER_LEVEL} +LOG_DB=False LOG_DB_LEVEL=${LOG_LEVEL} SYSLOG=False LOGFILE= @@ -286,11 +286,13 @@ AWS_REGION=${AWS_REGION} AWS_HOST=${AWS_HOST} AWS_BUCKETNAME=${AWS_BUCKETNAME} -DISABLE_ATTACHMENT_STORAGE=${DISABLE_S3_STORAGE} +DISABLE_ATTACHMENT_STORAGE=0 MINIO_ROOT_USER=${AWS_ACCESS_KEY_ID} MINIO_ROOT_PASSWORD=${AWS_SECRET_ACCESS_KEY} -MINIO_VIRTUAL_HOST=${MINIO_VIRTUAL_HOST} -MINIO_BROWSER_REDIRECT_URL=${MINIO_VIRTUAL_HOST} +MINIO_VIRTUAL_HOST=${S3_VIRTUAL_HOST} +MINIO_BROWSER_REDIRECT_URL=http://${MINIO_VIRTUAL_HOST} +MINIO_API_PORT=${S3_API_PORT} +MINIO_VIRTUAL_PORT=9001 #-------------# # PgAdmin # diff --git a/docker-compose.yml b/docker-compose.yml index ac50d12..a951336 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -52,11 +52,16 @@ services: - PGADMING_DB_NAME - PGADMING_DB_USER - PGADMIN_DB_PASSWORD + - AWS_HOST + - AWS_REGION + - AWS_ACCESS_KEY_ID + - AWS_SECRET_ACCESS_KEY + - AWS_BUCKETNAME networks: - internal redis: - image: eqalpha/keydb:latest + image: eqalpha/keydb:${REDIS_TAG} platform: linux/amd64 ports: - 6379:6379 @@ -67,16 +72,16 @@ services: - redis-data:/var/lib/keydb s3: - image: minio/minio:latest + image: minio/minio:${S3_TAG} environment: - MINIO_ROOT_USER - MINIO_ROOT_PASSWORD - VIRTUAL_HOST=${MINIO_VIRTUAL_HOST} - - VIRTUAL_PORT=${MINIO_VIRTUAL_PORT} + - VIRTUAL_PORT=9001 - MINIO_BROWSER_REDIRECT_URL command: server /data --console-address ":9001" volumes: - - s3_data:/data + - s3-data:/data ports: - 9000:9000 - 9001:9001 @@ -125,7 +130,7 @@ volumes: odoo-data: pg-data: redis-data: - s3_data: + s3-data: certs: vhost: html: diff --git a/odoo/Dockerfile b/odoo/Dockerfile index ff8f697..7f465b4 100644 --- a/odoo/Dockerfile +++ b/odoo/Dockerfile @@ -77,7 +77,7 @@ RUN mkdir -p ${THIRD_PARTY_ADDONS} && chown odoo:odoo -R ${THIRD_PARTY_ADDONS} COPY --chown=odoo:odoo ./odoo/fix-manifest.py / COPY --chown=odoo:odoo ./odoo/third-party-addons.sh / -RUN /third-party-addons.sh && chown odoo:odoo ${THIRD_PARTY_ADDONS} +RUN /third-party-addons.sh && chown odoo:odoo -R ${THIRD_PARTY_ADDONS} #---------------------# # Logging # diff --git a/odoo/fix-manifest.py b/odoo/fix-manifest.py index 5075e79..5879cd8 100644 --- a/odoo/fix-manifest.py +++ b/odoo/fix-manifest.py @@ -16,7 +16,7 @@ manifest_dict = eval(''.join(lines[start_index:end_index + 1])) # Modify the manifest dictionary manifest_dict['installable'] = True -manifest_dict['auto_install'] = True +manifest_dict['auto_install'] = False # Construct the modified manifest string modified_manifest_lines = ['{\n'] diff --git a/odoo/odoo.conf b/odoo/odoo.conf new file mode 100644 index 0000000..6346b75 --- /dev/null +++ b/odoo/odoo.conf @@ -0,0 +1,308 @@ +[options] +;------------------------------------------; +; Options not exposed on the command line. ; +;------------------------------------------; + +admin_passwd = ${ADMIN_PASSWD} +csv_internal_sep = ${CSV_INTERNAL_SEP} +publisher_warranty_url = ${PUBLISHER_WARRANTY_URL} +root_path = ${ROOT_PATH} +reportgz = ${REPORTGZ} +websocket_keep_alive_timeout = ${WEBSOCKET_KEEP_ALIVE_TIMEOUT} +websocket_rate_limit_burst = ${WEBSOCKET_RATE_LIMIT_BURST} +websocket_rate_limit_delay = ${WEBSOCKET_RATE_LIMIT_DELAY} + +;-----------------------; +; Server startup config ; +;-----------------------; +; --config | -c +config = ${ODOO_RC} + +; --save +save = ${SAVE} + +; --init | -i +init = ${INIT} + +; --update | -u +update = ${UPDATE} + +; --without-demo +demo = ${DEMO} +without_demo = ${WITHOUT_DEMO} + +; --import-partial +import_partial = ${IMPORT_PARTIAL} + +; --pidfile +pidfile = ${PIDFILE} + +; --addons-path +addons_path = ${ADDONS_PATH} + +; --upgrade-path +upgrade_path = ${UPGRADE_PATH} + +; --load +server_wide_modules = ${SERVER_WIDE_MODULES} + +; --data-dir +data_dir = ${DATA_DIR} + +;------; +; HTTP ; +;------; +; --http-interface | --xmlrpc-interface +http_interface = ${HTTP_INTERFACE} + +; --http-port | -p | --xmlrpc-port +http_port = ${HTTP_PORT} + +; --xmlrpcs-interface +xmlrpcs_interface = ${XMLRPCS_INTERFACE} + +; --xmlrpcs-port +xmlrpcs_port = ${XMLRPCS_PORT} + +; --gevent-port | --longpolling_port (deprecated) +gevent_port = ${GEVENT_PORT} + +; --no-http | --no-xmlrpc +http_enable = ${HTTP_ENABLE} + +; --no-xmlrpcs +xmlrpcs = ${XMLRPCS} + +; --proxy-mode +proxy_mode = ${PROXY_MODE} + +; --x-sendfile +x_sendfile = ${X_SENDFILE} + +;---------------; +; Testing Group ; +;---------------; +; --test-file +test_file = ${TEST_FILE} + +; --test-enable +test_enable = ${TEST_ENABLE} + +; --test-tags +test_tags = ${TEST_FILE} + +; --screencasts +screencasts = ${SCREENCASTS} + +; --screenshots +screenshots = ${SCREENSHOTS} + +;---------------; +; Logging Group ; +;---------------; +; --logfile +logfile = ${LOGFILE} + +; --syslog +syslog = ${SYSLOG} + +; --log-handler | --log-web (--log-handler=odoo.http:DEBUG) | --log-sql (--log-handler=odoo.sql_db:DEBUG) +log_handler = ${LOG_HANDLER} + +; --log-db +log_db = ${LOG_DB} + +; --log-db-level +log_db_level = ${LOG_DB_LEVEL} + +; --log-level +log_level = ${LOG_LEVEL} + +;------------; +; SMTP Group ; +;------------; +; --email-from +email_from = ${EMAIL_FROM} + +; --from-filter +from_filter = ${FROM_FILTER} + +; --smtp +smtp_server = ${SMTP_SERVER} + +; --smtp-port +smtp_port = ${SMTP_PORT} + +; --smtp-ssl +smtp_ssl = ${SMTP_SSL} + +; --smtp-user +smtp_user = ${SMTP_USER} + +; --smtp-password +smtp_password = ${SMTP_PASSWORD} + +; --smtp-ssl-certificate-filename +smtp_ssl_certificate_filename = ${SMTP_SSL_CERTIFICATE_FILENAME} + +; --smtp-ssl-private-key-filename +smtp_ssl_private_key_filename = ${SMTP_SSL_PRIVATE_KEY_FILENAME} + +;----------; +; DB Group ; +;----------; +; --database | -d +db_name = ${DB_NAME} + +; --db_user | -r +db_user = ${DB_USER} + +; --db_password | -w +db_password = ${DB_PASSWORD} + +; --pg_path +pg_path = ${PG_PATH} + +; --db_host +db_host = ${DB_HOST} + +; --db_port +db_port = ${DB_PORT} + +; --db_sslmode +db_sslmode = ${DB_SSLMODE} + +; --db_maxconn +db_maxconn = ${DB_MAXCONN} + +; --db-template +db_template = ${DB_TEMPLATE} + +;------------------------------; +; Internationalisation options ; +;------------------------------; +; --load-language +load_language = ${LOAD_LANGUAGE} + +; --language +language = ${LANGUAGE} + +; --i18n-export +translate_out = ${TRANSLATE_OUT} + +; --i18n-import +translate_in = ${TRANSLATE_IN} + +; --i18n-overwrite +overwrite_existing_translations = ${OVERWRITE_EXISTING_TRANSLATIONS} + +; --modules +translate_modules = ${TRANSLATE_MODULES} + +;----------; +; Security ; +;----------; +; --no-database-list +list_db = ${LIST_DB} + +;-----; +; WEB ; +;-----; +; --db-filter +dbfilter = ${DBFILTER} + +;------------------; +; Advanced options ; +;------------------; +; --dev (all, reload, xml, qweb, werkzeug, sql, shell, assets, tests) +dev_mode = ${DEV_MODE} + +; --shell-interface +shell_interface = ${SHELL_INTERFACE} + +; --stop-after-init +stop_after_init = ${STOP_AFTER_INIT} + +; --osv-memory-count-limit +osv_memory_count_limit = ${OSV_MEMORY_COUNT_LIMIT} + +; --transient-age-limit | --osv-memory-age-limit (deprecated) +transient_age_limit = ${TRANSIENT_AGE_LIMIT} + +; --max-cron-threads +max_cron_threads = ${MAX_CRON_THREADS} + +; --unaccent +unaccent = ${UNACCENT} + +; --geoip-db +geoip_database = ${GEOIP_DATABASE} + +; --workers +workers = ${WORKERS} + +; --limit-memory-soft +limit_memory_soft = ${LIMIT_MEMORY_SOFT} + +; --limit-memory-hard +limit_memory_hard = ${LIMIT_MEMORY_HARD} + +; --limit-time-cpu +limit_time_cpu = ${LIMIT_TIME_CPU} + +; --limit-time-real +limit_time_real = ${LIMIT_TIME_REAL} + +; --limit-time-real-cron +limit_time_real_cron = ${LIMIT_TIME_REAL_CRON} + +; --limit-request +limit_request = ${LIMIT_REQUEST} + +;-----------------------------; +; External Integrations ; +;-----------------------------; + +;-------------; +; Redis ; +;-------------; +; -- Possible values: 1 or true +ODOO_SESSION_REDIS = ${ODOO_SESSION_REDIS} + +; -- Defaults to is localhost +ODOO_SESSION_REDIS_HOST = ${ODOO_SESSION_REDIS_HOST} + +; -- Defaults to 6379 +ODOO_SESSION_REDIS_PORT = ${ODOO_SESSION_REDIS_PORT} + +; -- Sets the password for the AUTH command (optional) +ODOO_SESSION_REDIS_PASSWORD = ${ODOO_SESSION_REDIS_PASSWORD} + +; -- Alternative way to define the Redis server address like rediss:// protocol. +ODOO_SESSION_REDIS_URL = ${ODOO_SESSION_REDIS_URL} + +; -- Prefix for the session keys (optional) +ODOO_SESSION_REDIS_PREFIX = ${ODOO_SESSION_REDIS_PREFIX} + +; -- Time in seconds before expiration of the sessions (default is 7 days) +ODOO_SESSION_REDIS_EXPIRATION = ${ODOO_SESSION_REDIS_EXPIRATION} + +; -- Time in seconds before expiration of the anonymous sessions (default is 3 hours) +ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS = ${ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS} + +;----------; +; S3 ; +;----------; +; Disable S3 storage +DISABLE_ATTACHMENT_STORAGE = ${DISABLE_ATTACHMENT_STORAGE} + +; Not required if using AWS S3 +AWS_HOST = ${AWS_HOST} + +; Required if using AWS services +AWS_REGION = ${AWS_REGION} +AWS_ACCESS_KEY_ID = ${AWS_ACCESS_KEY_ID} +AWS_SECRET_ACCESS_KEY = ${AWS_SECRET_ACCESS_KEY} + +; Optional ${db_name} placeholder +AWS_BUCKETNAME = ${AWS_BUCKETNAME} From 554f9f533db54cbc354b2ce35429a7ce234eb87d Mon Sep 17 00:00:00 2001 From: Yhael S Date: Fri, 6 Oct 2023 23:55:18 -0500 Subject: [PATCH 25/58] last fixes --- .env.example | 7 +++++-- docker-compose.yml | 36 ++++++++++++++++++++++-------------- odoo/fix-manifest.py | 2 +- odoo/third-party-addons.sh | 4 ++++ 4 files changed, 32 insertions(+), 17 deletions(-) diff --git a/.env.example b/.env.example index 3182073..644c024 100644 --- a/.env.example +++ b/.env.example @@ -2,7 +2,7 @@ # Main Configuration # #--------------------------# # Odoo -APP_ENV=staging +APP_ENV=local INIT= UPDATE= LOAD=base,web,session_redis,attachment_s3 @@ -68,10 +68,12 @@ REDIS_URL= REDIS_PREFIX=odoo REDIS_EXPIRATION=604800 REDIS_EXPIRATION_ANONYMOUS=10800 +REDIS_DATA=/var/lib/keydb # Filesystem S3_VIRTUAL_HOST=s3.odoocker.test S3_API_PORT=9000 +S3_CONSOLE_PORT=9001 AWS_ACCESS_KEY_ID=myaccesskey AWS_SECRET_ACCESS_KEY=mysecretkey AWS_BUCKETNAME=odoocker @@ -292,7 +294,8 @@ MINIO_ROOT_PASSWORD=${AWS_SECRET_ACCESS_KEY} MINIO_VIRTUAL_HOST=${S3_VIRTUAL_HOST} MINIO_BROWSER_REDIRECT_URL=http://${MINIO_VIRTUAL_HOST} MINIO_API_PORT=${S3_API_PORT} -MINIO_VIRTUAL_PORT=9001 +MINIO_CONSOLE_PORT=${S3_CONSOLE_PORT} +MINIO_DATA=/data #-------------# # PgAdmin # diff --git a/docker-compose.yml b/docker-compose.yml index a951336..3ee8949 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,6 +27,19 @@ services: - PASSWORD=${DB_PASSWORD} - ODOO_TAG - THIRD_PARTY_ADDONS + - ODOO_SESSION_REDIS + - ODOO_SESSION_REDIS_HOST + - ODOO_SESSION_REDIS_PORT + - ODOO_SESSION_REDIS_PASSWORD + - ODOO_SESSION_REDIS_URL + - ODOO_SESSION_REDIS_PREFIX + - ODOO_SESSION_REDIS_EXPIRATION + - ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS + - AWS_HOST + - AWS_REGION + - AWS_ACCESS_KEY_ID + - AWS_SECRET_ACCESS_KEY + - AWS_BUCKETNAME networks: - internal @@ -52,11 +65,6 @@ services: - PGADMING_DB_NAME - PGADMING_DB_USER - PGADMIN_DB_PASSWORD - - AWS_HOST - - AWS_REGION - - AWS_ACCESS_KEY_ID - - AWS_SECRET_ACCESS_KEY - - AWS_BUCKETNAME networks: - internal @@ -64,27 +72,27 @@ services: image: eqalpha/keydb:${REDIS_TAG} platform: linux/amd64 ports: - - 6379:6379 + - ${REDIS_PORT}:${REDIS_PORT} restart: unless-stopped + volumes: + - redis-data:${REDIS_DATA} networks: - internal - volumes: - - redis-data:/var/lib/keydb s3: image: minio/minio:${S3_TAG} environment: - MINIO_ROOT_USER - MINIO_ROOT_PASSWORD - - VIRTUAL_HOST=${MINIO_VIRTUAL_HOST} - - VIRTUAL_PORT=9001 - MINIO_BROWSER_REDIRECT_URL - command: server /data --console-address ":9001" + - VIRTUAL_HOST=${MINIO_VIRTUAL_HOST} + - VIRTUAL_PORT=${MINIO_CONSOLE_PORT} + command: server ${MINIO_DATA} --console-address ":${MINIO_CONSOLE_PORT}" volumes: - - s3-data:/data + - s3-data:${MINIO_DATA} ports: - - 9000:9000 - - 9001:9001 + - ${MINIO_API_PORT}:${MINIO_API_PORT} + - ${MINIO_CONSOLE_PORT}:${MINIO_CONSOLE_PORT} networks: - internal diff --git a/odoo/fix-manifest.py b/odoo/fix-manifest.py index 5879cd8..5075e79 100644 --- a/odoo/fix-manifest.py +++ b/odoo/fix-manifest.py @@ -16,7 +16,7 @@ manifest_dict = eval(''.join(lines[start_index:end_index + 1])) # Modify the manifest dictionary manifest_dict['installable'] = True -manifest_dict['auto_install'] = False +manifest_dict['auto_install'] = True # Construct the modified manifest string modified_manifest_lines = ['{\n'] diff --git a/odoo/third-party-addons.sh b/odoo/third-party-addons.sh index e25f60d..9d1ec73 100755 --- a/odoo/third-party-addons.sh +++ b/odoo/third-party-addons.sh @@ -10,8 +10,12 @@ if [ ! -d "odoo-cloud-platform" ]; then cp -r odoo-cloud-platform/attachment_s3 ${THIRD_PARTY_ADDONS}/attachment_s3 fi +# Define the path to the manifest file +redis_manifest="${THIRD_PARTY_ADDONS}/session_redis/__manifest__.py" # Define the path to the manifest file s3_manifest="${THIRD_PARTY_ADDONS}/attachment_s3/__manifest__.py" # Modify the manifest file +# python3 /fix-manifest.py $redis_manifest python3 /fix-manifest.py $s3_manifest +python3 /fix-manifest.py $redis_manifest From 85a192867753e8edaa20f17922c28b74f1c28ee7 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Fri, 6 Oct 2023 23:57:03 -0500 Subject: [PATCH 26/58] cleanup --- .env.example | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 644c024..bbe5f42 100644 --- a/.env.example +++ b/.env.example @@ -2,7 +2,7 @@ # Main Configuration # #--------------------------# # Odoo -APP_ENV=local +APP_ENV=staging INIT= UPDATE= LOAD=base,web,session_redis,attachment_s3 @@ -26,7 +26,7 @@ LOAD_LANGUAGE= DB_SSLMODE=prefer DB_MAXCONN=64 DB_TEMPLATE=unaccent_template -UNACCENT=False +UNACCENT=True LIST_DB=True DBFILTER=.* From d85b660a449de9caf6984ac2d9e11525eca076f2 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Fri, 6 Oct 2023 23:57:19 -0500 Subject: [PATCH 27/58] cleanup --- .env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.example b/.env.example index bbe5f42..69975a1 100644 --- a/.env.example +++ b/.env.example @@ -2,7 +2,7 @@ # Main Configuration # #--------------------------# # Odoo -APP_ENV=staging +APP_ENV=local INIT= UPDATE= LOAD=base,web,session_redis,attachment_s3 From 2bbaa84714020478b87ac7cea4d5bd7be8d25f16 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Sat, 7 Oct 2023 00:01:34 -0500 Subject: [PATCH 28/58] cleanup --- odoo/odoo.conf | 10 ++++++---- odoo/third-party-addons.sh | 3 +-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/odoo/odoo.conf b/odoo/odoo.conf index 6346b75..39b7ccc 100644 --- a/odoo/odoo.conf +++ b/odoo/odoo.conf @@ -293,16 +293,18 @@ ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS = ${ODOO_SESSION_REDIS_EXPIRATION_ANONYM ;----------; ; S3 ; ;----------; -; Disable S3 storage +; -- Disable S3 storage DISABLE_ATTACHMENT_STORAGE = ${DISABLE_ATTACHMENT_STORAGE} -; Not required if using AWS S3 +; -- Not required if using AWS S3 AWS_HOST = ${AWS_HOST} -; Required if using AWS services +; -- Required if using AWS services AWS_REGION = ${AWS_REGION} + +; -- AWS Authentication AWS_ACCESS_KEY_ID = ${AWS_ACCESS_KEY_ID} AWS_SECRET_ACCESS_KEY = ${AWS_SECRET_ACCESS_KEY} -; Optional ${db_name} placeholder +; Optional db_name placeholder AWS_BUCKETNAME = ${AWS_BUCKETNAME} diff --git a/odoo/third-party-addons.sh b/odoo/third-party-addons.sh index 9d1ec73..a34bc85 100755 --- a/odoo/third-party-addons.sh +++ b/odoo/third-party-addons.sh @@ -16,6 +16,5 @@ redis_manifest="${THIRD_PARTY_ADDONS}/session_redis/__manifest__.py" s3_manifest="${THIRD_PARTY_ADDONS}/attachment_s3/__manifest__.py" # Modify the manifest file -# python3 /fix-manifest.py $redis_manifest -python3 /fix-manifest.py $s3_manifest python3 /fix-manifest.py $redis_manifest +python3 /fix-manifest.py $s3_manifest From af83a19fa4fd0f5fa6ae38ed2d2bf5a6cbf2344e Mon Sep 17 00:00:00 2001 From: Yhael S Date: Sat, 7 Oct 2023 05:10:20 -0500 Subject: [PATCH 29/58] finished sentry integration --- .env.example | 2 +- odoo/odoo.conf | 17 +++++++++++++++++ odoo/requirements.txt | 1 + odoo/third-party-addons.sh | 23 +++++++++++++++-------- 4 files changed, 34 insertions(+), 9 deletions(-) diff --git a/.env.example b/.env.example index 69975a1..552183f 100644 --- a/.env.example +++ b/.env.example @@ -5,7 +5,7 @@ APP_ENV=local INIT= UPDATE= -LOAD=base,web,session_redis,attachment_s3 +LOAD=base,web,session_redis,attachment_s3,sentry WORKERS=2 DEV_MODE=reload,xml DOMAIN=erp.odoocker.test diff --git a/odoo/odoo.conf b/odoo/odoo.conf index 39b7ccc..c4a2208 100644 --- a/odoo/odoo.conf +++ b/odoo/odoo.conf @@ -263,6 +263,23 @@ limit_request = ${LIMIT_REQUEST} ; External Integrations ; ;-----------------------------; +;--------------; +; Sentry ; +;--------------; +sentry_dsn = https://84799fb74edc4053aa3368aec3c2cb89@o4504596558577664.ingest.sentry.io/4504596563230720 +sentry_enabled = true +sentry_logging_level = warn +# sentry_exclude_loggers = werkzeug +# sentry_ignore_exceptions = odoo.exceptions.AccessDenied, +# odoo.exceptions.AccessError,odoo.exceptions.MissingError, +# odoo.exceptions.RedirectWarning,odoo.exceptions.UserError, +# odoo.exceptions.ValidationError,odoo.exceptions.Warning, +# odoo.exceptions.except_orm +sentry_include_context = true +# sentry_environment = production +# sentry_release = 1 +# sentry_odoo_dir = + ;-------------; ; Redis ; ;-------------; diff --git a/odoo/requirements.txt b/odoo/requirements.txt index 181b3bb..2fa9750 100644 --- a/odoo/requirements.txt +++ b/odoo/requirements.txt @@ -2,3 +2,4 @@ debugpy websocket-client redis boto3 +sentry-sdk diff --git a/odoo/third-party-addons.sh b/odoo/third-party-addons.sh index a34bc85..1e57cd8 100755 --- a/odoo/third-party-addons.sh +++ b/odoo/third-party-addons.sh @@ -4,17 +4,24 @@ set -e # Check if the repository directory exists if [ ! -d "odoo-cloud-platform" ]; then - git clone https://github.com/camptocamp/odoo-cloud-platform.git --depth 1 --branch ${ODOO_TAG} --single-branch --no-tags; + git clone https://github.com/odoocker/odoo-cloud-platform.git --depth 1 --branch ${ODOO_TAG} --single-branch --no-tags; cp -r odoo-cloud-platform/session_redis ${THIRD_PARTY_ADDONS}/session_redis cp -r odoo-cloud-platform/base_attachment_object_storage ${THIRD_PARTY_ADDONS}/base_attachment_object_storage cp -r odoo-cloud-platform/attachment_s3 ${THIRD_PARTY_ADDONS}/attachment_s3 fi -# Define the path to the manifest file -redis_manifest="${THIRD_PARTY_ADDONS}/session_redis/__manifest__.py" -# Define the path to the manifest file -s3_manifest="${THIRD_PARTY_ADDONS}/attachment_s3/__manifest__.py" +# Check if the repository directory exists +if [ ! -d "server-tools" ]; then + git clone https://github.com/odoocker/server-tools.git --depth 1 --branch ${ODOO_TAG} --single-branch --no-tags; + cp -r server-tools/sentry ${THIRD_PARTY_ADDONS}/sentry +fi -# Modify the manifest file -python3 /fix-manifest.py $redis_manifest -python3 /fix-manifest.py $s3_manifest +# Define the path to the manifest files +redis_manifest="${THIRD_PARTY_ADDONS}/session_redis/__manifest__.py" +s3_manifest="${THIRD_PARTY_ADDONS}/attachment_s3/__manifest__.py" +sentry_manifest="${THIRD_PARTY_ADDONS}/sentry/__manifest__.py" + +# Modify the manifest files +# python3 /fix-manifest.py $redis_manifest +# python3 /fix-manifest.py $s3_manifest +# python3 /fix-manifest.py $sentry_manifest From 48cb2c06cbe8591b2514dfea79a71e5eed5f272c Mon Sep 17 00:00:00 2001 From: Yhael S Date: Sat, 7 Oct 2023 05:43:40 -0500 Subject: [PATCH 30/58] variables reaccomodation --- .env.example | 67 +++++++++++++++++++++++--------------- docker-compose.yml | 11 ++++--- odoo/odoo.conf | 11 ++++--- odoo/third-party-addons.sh | 10 ------ 4 files changed, 54 insertions(+), 45 deletions(-) diff --git a/.env.example b/.env.example index 552183f..f81a39b 100644 --- a/.env.example +++ b/.env.example @@ -26,7 +26,7 @@ LOAD_LANGUAGE= DB_SSLMODE=prefer DB_MAXCONN=64 DB_TEMPLATE=unaccent_template -UNACCENT=True +UNACCENT=False LIST_DB=True DBFILTER=.* @@ -66,19 +66,22 @@ REDIS_PORT=6379 REDIS_PASSWORD= REDIS_URL= REDIS_PREFIX=odoo +REDIS_SENTINEL_MASTER_NAME= +REDIS_SENTINEL_HOST= +REDIS_SENTINEL_PORT=26379 REDIS_EXPIRATION=604800 REDIS_EXPIRATION_ANONYMOUS=10800 -REDIS_DATA=/var/lib/keydb # Filesystem S3_VIRTUAL_HOST=s3.odoocker.test S3_API_PORT=9000 S3_CONSOLE_PORT=9001 + +AWS_HOST=http://s3:${S3_API_PORT} +AWS_REGION= AWS_ACCESS_KEY_ID=myaccesskey AWS_SECRET_ACCESS_KEY=mysecretkey AWS_BUCKETNAME=odoocker -AWS_HOST=http://s3:${S3_API_PORT} -AWS_REGION= # PgAdmin PGADMIN_DOMAIN=pgadmin.odoocker.test @@ -103,8 +106,8 @@ SUPPORT_EMAIL=mail@example.com # Containers' Tags ODOO_TAG=16.0 POSTGRES_TAG=16.0 -REDIS_TAG=latest -S3_TAG=latest +KEYDB_TAG=latest +MINIO_TAG=latest NGINX_TAG=1.25.2 NGINX_PROXY_TAG=1.3.1 ACME_COMPANION_TAG=2.2.8 @@ -159,14 +162,14 @@ XMLRPCS=True PROXY_MODE=True X_SENDFILE=False -# Testing +# Testing Group TEST_FILE=False TEST_ENABLE=${TEST_ENABLE} TEST_TAGS=${TEST_TAGS} SCREENCASTS=None SCREENSHOTS=/tmp/odoo_tests -# Logging +# Logging Group LOG_LEVEL=${LOG_LEVEL} LOG_HANDLER=odoo.http.rpc.request:${LOG_HANDLER_LEVEL},odoo.http.rpc.response:${LOG_HANDLER_LEVEL},:${LOG_HANDLER_LEVEL},odoo.sql_db:${LOG_HANDLER_LEVEL} LOG_DB=False @@ -174,7 +177,7 @@ LOG_DB_LEVEL=${LOG_LEVEL} SYSLOG=False LOGFILE= -# Email +# SMTP Group EMAIL_FROM=${EMAIL_FROM} FROM_FILTER=${FROM_FILTER} SMTP_SERVER=${SMTP_SERVER} @@ -224,6 +227,29 @@ LIMIT_TIME_REAL=480 LIMIT_TIME_REAL_CRON=600 LIMIT_REQUEST=8192 +# Redis +ODOO_SESSION_REDIS=${SESSION_REDIS} +ODOO_SESSION_REDIS_HOST=${REDIS_HOST} +ODOO_SESSION_REDIS_PORT=${REDIS_PORT} +ODOO_SESSION_REDIS_PASSWORD=${REDIS_PASSWORD} +ODOO_SESSION_REDIS_URL=${REDIS_URL} +ODOO_SESSION_REDIS_PREFIX=${REDIS_PREFIX} +ODOO_SESSION_REDIS_SENTINEL_MASTER_NAME=${REDIS_SENTINEL_MASTER_NAME} +ODOO_SESSION_REDIS_SENTINEL_HOST=${REDIS_SENTINEL_HOST} +ODOO_SESSION_REDIS_SENTINEL_PORT=${REDIS_SENTINEL_PORT} +ODOO_SESSION_REDIS_EXPIRATION=${REDIS_EXPIRATION} +ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS=${REDIS_EXPIRATION_ANONYMOUS} + +# Base Attachment Object Storage +DISABLE_ATTACHMENT_STORAGE=0 + +# S3 +AWS_HOST=${AWS_HOST} +AWS_REGION=${AWS_REGION} +AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} +AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} +AWS_BUCKETNAME=${AWS_BUCKETNAME} + #--------------# # Docker # #--------------# @@ -270,25 +296,12 @@ DEFAULT_EMAIL=${SUPPORT_EMAIL} #-------------# # Redis # #-------------# -ODOO_SESSION_REDIS=${SESSION_REDIS} -ODOO_SESSION_REDIS_HOST=${REDIS_HOST} -ODOO_SESSION_REDIS_PORT=${REDIS_PORT} -ODOO_SESSION_REDIS_PASSWORD=${REDIS_PASSWORD} -ODOO_SESSION_REDIS_URL=${REDIS_URL} -ODOO_SESSION_REDIS_PREFIX=${REDIS_PREFIX} -ODOO_SESSION_REDIS_EXPIRATION=${REDIS_EXPIRATION} -ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS=${REDIS_EXPIRATION_ANONYMOUS} +KEYDB_PORT=${REDIS_PORT} +KEYDB_DATA=/var/lib/keydb -#----------# -# S3 # -#----------# -AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} -AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} -AWS_REGION=${AWS_REGION} -AWS_HOST=${AWS_HOST} -AWS_BUCKETNAME=${AWS_BUCKETNAME} - -DISABLE_ATTACHMENT_STORAGE=0 +#-------------# +# Minio # +#-------------# MINIO_ROOT_USER=${AWS_ACCESS_KEY_ID} MINIO_ROOT_PASSWORD=${AWS_SECRET_ACCESS_KEY} MINIO_VIRTUAL_HOST=${S3_VIRTUAL_HOST} diff --git a/docker-compose.yml b/docker-compose.yml index 3ee8949..39ff117 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,6 +33,9 @@ services: - ODOO_SESSION_REDIS_PASSWORD - ODOO_SESSION_REDIS_URL - ODOO_SESSION_REDIS_PREFIX + - ODOO_SESSION_REDIS_SENTINEL_MASTER_NAME + - ODOO_SESSION_REDIS_SENTINEL_HOST + - ODOO_SESSION_REDIS_SENTINEL_PORT - ODOO_SESSION_REDIS_EXPIRATION - ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS - AWS_HOST @@ -69,18 +72,18 @@ services: - internal redis: - image: eqalpha/keydb:${REDIS_TAG} + image: eqalpha/keydb:${KEYDB_TAG} platform: linux/amd64 ports: - - ${REDIS_PORT}:${REDIS_PORT} + - ${KEYDB_PORT}:${KEYDB_PORT} restart: unless-stopped volumes: - - redis-data:${REDIS_DATA} + - redis-data:${KEYDB_DATA} networks: - internal s3: - image: minio/minio:${S3_TAG} + image: minio/minio:${MINIO_TAG} environment: - MINIO_ROOT_USER - MINIO_ROOT_PASSWORD diff --git a/odoo/odoo.conf b/odoo/odoo.conf index c4a2208..68f169d 100644 --- a/odoo/odoo.conf +++ b/odoo/odoo.conf @@ -44,7 +44,7 @@ addons_path = ${ADDONS_PATH} upgrade_path = ${UPGRADE_PATH} ; --load -server_wide_modules = ${SERVER_WIDE_MODULES} +server_wide_modules = ${LOAD} ; --data-dir data_dir = ${DATA_DIR} @@ -307,12 +307,15 @@ ODOO_SESSION_REDIS_EXPIRATION = ${ODOO_SESSION_REDIS_EXPIRATION} ; -- Time in seconds before expiration of the anonymous sessions (default is 3 hours) ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS = ${ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS} +;--------------------------------------; +; Base Attachment Object Storage ; +;--------------------------------------; +; -- Disable Attachment Object Storage +DISABLE_ATTACHMENT_STORAGE = ${DISABLE_ATTACHMENT_STORAGE} + ;----------; ; S3 ; ;----------; -; -- Disable S3 storage -DISABLE_ATTACHMENT_STORAGE = ${DISABLE_ATTACHMENT_STORAGE} - ; -- Not required if using AWS S3 AWS_HOST = ${AWS_HOST} diff --git a/odoo/third-party-addons.sh b/odoo/third-party-addons.sh index 1e57cd8..b32e745 100755 --- a/odoo/third-party-addons.sh +++ b/odoo/third-party-addons.sh @@ -15,13 +15,3 @@ if [ ! -d "server-tools" ]; then git clone https://github.com/odoocker/server-tools.git --depth 1 --branch ${ODOO_TAG} --single-branch --no-tags; cp -r server-tools/sentry ${THIRD_PARTY_ADDONS}/sentry fi - -# Define the path to the manifest files -redis_manifest="${THIRD_PARTY_ADDONS}/session_redis/__manifest__.py" -s3_manifest="${THIRD_PARTY_ADDONS}/attachment_s3/__manifest__.py" -sentry_manifest="${THIRD_PARTY_ADDONS}/sentry/__manifest__.py" - -# Modify the manifest files -# python3 /fix-manifest.py $redis_manifest -# python3 /fix-manifest.py $s3_manifest -# python3 /fix-manifest.py $sentry_manifest From 1e11d3fb37254c7e36f05bc88d4c50741c8ea1ea Mon Sep 17 00:00:00 2001 From: Yhael S Date: Sat, 7 Oct 2023 05:55:00 -0500 Subject: [PATCH 31/58] refactor --- .env.example | 12 +++++++++++- odoo/odoo.conf | 22 +++++++++------------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/.env.example b/.env.example index f81a39b..798f40c 100644 --- a/.env.example +++ b/.env.example @@ -34,6 +34,16 @@ DBFILTER=.* LOG_LEVEL=info # Additional logs LOG_HANDLER_LEVEL=INFO +# Sentry +SENTRY_DSN= +SENTRY_ENABLED=true +SENTRY_LOGGING_LEVEL=warn +SENTRY_EXCLUDE_LOGGERS= +SENTRY_IGNORE_EXCEPTIONS= +SENTRY_INCLUDE_CONTEXT=true +SENTRY_ENVIRONMENT=production +SENTRY_RELEASE= +SENTRY_ODOO_DIR= # Nginx CORS_ALLOWED_DOMAIN="'http://external-domain.test'" @@ -65,7 +75,7 @@ REDIS_HOST=redis REDIS_PORT=6379 REDIS_PASSWORD= REDIS_URL= -REDIS_PREFIX=odoo +REDIS_PREFIX=odoocker REDIS_SENTINEL_MASTER_NAME= REDIS_SENTINEL_HOST= REDIS_SENTINEL_PORT=26379 diff --git a/odoo/odoo.conf b/odoo/odoo.conf index 68f169d..f202f75 100644 --- a/odoo/odoo.conf +++ b/odoo/odoo.conf @@ -266,19 +266,15 @@ limit_request = ${LIMIT_REQUEST} ;--------------; ; Sentry ; ;--------------; -sentry_dsn = https://84799fb74edc4053aa3368aec3c2cb89@o4504596558577664.ingest.sentry.io/4504596563230720 -sentry_enabled = true -sentry_logging_level = warn -# sentry_exclude_loggers = werkzeug -# sentry_ignore_exceptions = odoo.exceptions.AccessDenied, -# odoo.exceptions.AccessError,odoo.exceptions.MissingError, -# odoo.exceptions.RedirectWarning,odoo.exceptions.UserError, -# odoo.exceptions.ValidationError,odoo.exceptions.Warning, -# odoo.exceptions.except_orm -sentry_include_context = true -# sentry_environment = production -# sentry_release = 1 -# sentry_odoo_dir = +sentry_dsn = ${SENTRY_DSN} +sentry_enabled = ${SENTRY_ENABLED} +sentry_logging_level = ${SENTRY_LOGGING_LEVEL} +sentry_exclude_loggers = ${SENTRY_EXCLUDE_LOGGERS} +sentry_ignore_exceptions = ${SENTRY_IGNORE_EXCEPTIONS} +sentry_include_context = ${SENTRY_INCLUDE_CONTEXT} +sentry_environment = ${SENTRY_ENVIRONMENT} +sentry_release = ${SENTRY_RELEASE} +sentry_odoo_dir = ${SENTRY_ODOO_DIR} ;-------------; ; Redis ; From 3595ed42cbd9764b2baff5bf2f0e05fa6b1e4fc7 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Sat, 7 Oct 2023 06:05:51 -0500 Subject: [PATCH 32/58] cleanup --- .env.example | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/.env.example b/.env.example index 798f40c..388438d 100644 --- a/.env.example +++ b/.env.example @@ -6,6 +6,7 @@ APP_ENV=local INIT= UPDATE= LOAD=base,web,session_redis,attachment_s3,sentry +ROOT_PATH=/usr/lib/python3/dist-packages/odoo WORKERS=2 DEV_MODE=reload,xml DOMAIN=erp.odoocker.test @@ -35,7 +36,7 @@ LOG_LEVEL=info # Additional logs LOG_HANDLER_LEVEL=INFO # Sentry -SENTRY_DSN= +SENTRY_DSN=https://84799fb74edc4053aa3368aec3c2cb89@o4504596558577664.ingest.sentry.io/4504596563230720 SENTRY_ENABLED=true SENTRY_LOGGING_LEVEL=warn SENTRY_EXCLUDE_LOGGERS= @@ -43,7 +44,7 @@ SENTRY_IGNORE_EXCEPTIONS= SENTRY_INCLUDE_CONTEXT=true SENTRY_ENVIRONMENT=production SENTRY_RELEASE= -SENTRY_ODOO_DIR= +SENTRY_ODOO_DIR=${ROOT_PATH} # Nginx CORS_ALLOWED_DOMAIN="'http://external-domain.test'" @@ -123,19 +124,6 @@ NGINX_PROXY_TAG=1.3.1 ACME_COMPANION_TAG=2.2.8 PGADMIN_TAG=7.6 -#------------# -# Odoo # -#------------# -# Options not exposed on the command line. -ADMIN_PASSWD=${ADMIN_PASSWD} -CSV_INTERNAL_SEP=, -PUBLISHER_WARRANTY_URL=http://services.openerp.com/publisher-warranty/ -ROOT_PATH=/usr/lib/python3/dist-packages/odoo -REPORTGZ=False -WEBSOCKET_KEEP_ALIVE_TIMEOUT=3600 -WEBSOCKET_RATE_LIMIT_BURST=10 -WEBSOCKET_RATE_LIMIT_DELAY=0.2 - # Custom paths COMMUNITY_ADDONS=${ROOT_PATH}/addons ENTERPRISE_ADDONS=${ROOT_PATH}/enterprise @@ -145,6 +133,19 @@ CUSTOM_ADDONS=${ROOT_PATH}/custom-addons LOG_PATH=/var/log/odoo/odoo.log DEBUG_PATH=/usr/bin/odoo +#------------# +# Odoo # +#------------# +# Options not exposed on the command line. +ADMIN_PASSWD=${ADMIN_PASSWD} +CSV_INTERNAL_SEP=, +PUBLISHER_WARRANTY_URL=http://services.openerp.com/publisher-warranty/ +ROOT_PATH=${ROOT_PATH} +REPORTGZ=False +WEBSOCKET_KEEP_ALIVE_TIMEOUT=3600 +WEBSOCKET_RATE_LIMIT_BURST=10 +WEBSOCKET_RATE_LIMIT_DELAY=0.2 + # Server startup config ODOO_RC=${ROOT_PATH}/odoo.conf SAVE=False From 8a1844cfa1daebb3612802ea3222046b962a80a2 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Tue, 17 Oct 2023 22:10:08 -0500 Subject: [PATCH 33/58] cleanup --- docker-compose.yml | 1 + odoo/odoorc.sh | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 39ff117..d9aea0d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,6 +26,7 @@ services: - USER=${DB_USER} - PASSWORD=${DB_PASSWORD} - ODOO_TAG + - ODOO_RC - THIRD_PARTY_ADDONS - ODOO_SESSION_REDIS - ODOO_SESSION_REDIS_HOST diff --git a/odoo/odoorc.sh b/odoo/odoorc.sh index bf2509f..51a2ed4 100755 --- a/odoo/odoorc.sh +++ b/odoo/odoorc.sh @@ -5,9 +5,6 @@ set -e # Define the path to the example configuration file TEMPLATE_CONF="odoo.conf" -# Copy the example conf to the destination to start replacing the variables -cp "$TEMPLATE_CONF" "$ODOO_RC" - # First pass: Evaluate any nested variables within .env file and export them while IFS='=' read -r key value || [[ -n $key ]]; do # Skip comments and empty lines @@ -23,6 +20,9 @@ while IFS='=' read -r key value || [[ -n $key ]]; do export "$key=$value" done < .env +# Copy the example conf to the destination to start replacing the variables +cp "$TEMPLATE_CONF" "$ODOO_RC" + # Second pass: Replace the variables in $ODOO_RC while IFS='=' read -r key value || [[ -n $key ]]; do # Skip comments and empty lines From ca55f3d0d0dcdc828a2183685dfad1be471ac414 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Thu, 19 Oct 2023 19:14:12 -0500 Subject: [PATCH 34/58] starting new ideas for docker-compose file --- docker-compose copy.yml | 152 ++++++++++++++++++ docker-compose.override.local.full.yml | 49 ++++++ ...l => docker-compose.override.local.min.yml | 0 docker-compose.yml | 71 ++++---- odoo/third-party-addons.sh | 16 +- 5 files changed, 252 insertions(+), 36 deletions(-) create mode 100644 docker-compose copy.yml create mode 100644 docker-compose.override.local.full.yml rename docker-compose.override.local.yml => docker-compose.override.local.min.yml (100%) diff --git a/docker-compose copy.yml b/docker-compose copy.yml new file mode 100644 index 0000000..d9aea0d --- /dev/null +++ b/docker-compose copy.yml @@ -0,0 +1,152 @@ +services: + odoo: + build: + context: ./ + dockerfile: ./odoo/Dockerfile + args: + - ODOO_TAG + - ODOO_RC + - ROOT_PATH + - GITHUB_USER + - GITHUB_ACCESS_TOKEN + - ENTERPRISE_ADDONS + - THIRD_PARTY_ADDONS + - LOG_PATH + depends_on: + - postgres + tty: true + volumes: + - odoo-data:${DATA_DIR} + - ./odoo/extra-addons:${EXTRA_ADDONS} + - ./odoo/custom-addons:${CUSTOM_ADDONS} + - ./odoo/entrypoint.sh:/entrypoint.sh + environment: + - HOST=${DB_HOST} + - PORT=${DB_PORT} + - USER=${DB_USER} + - PASSWORD=${DB_PASSWORD} + - ODOO_TAG + - ODOO_RC + - THIRD_PARTY_ADDONS + - ODOO_SESSION_REDIS + - ODOO_SESSION_REDIS_HOST + - ODOO_SESSION_REDIS_PORT + - ODOO_SESSION_REDIS_PASSWORD + - ODOO_SESSION_REDIS_URL + - ODOO_SESSION_REDIS_PREFIX + - ODOO_SESSION_REDIS_SENTINEL_MASTER_NAME + - ODOO_SESSION_REDIS_SENTINEL_HOST + - ODOO_SESSION_REDIS_SENTINEL_PORT + - ODOO_SESSION_REDIS_EXPIRATION + - ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS + - AWS_HOST + - AWS_REGION + - AWS_ACCESS_KEY_ID + - AWS_SECRET_ACCESS_KEY + - AWS_BUCKETNAME + networks: + - internal + + postgres: + build: + context: ./ + dockerfile: ./postgres/Dockerfile + args: + - POSTGRES_TAG + restart: unless-stopped + tty: true + volumes: + - pg-data:${PGDATA} + - ./postgres/entrypoint.sh:/docker-entrypoint-initdb.d/entrypoint.sh + environment: + - POSTGRES_DB + - POSTGRES_USER + - POSTGRES_PASSWORD + - PGDATA + - DB_USER + - DB_TEMPLATE + - UNACCENT_TEMPLATE + - PGADMING_DB_NAME + - PGADMING_DB_USER + - PGADMIN_DB_PASSWORD + networks: + - internal + + redis: + image: eqalpha/keydb:${KEYDB_TAG} + platform: linux/amd64 + ports: + - ${KEYDB_PORT}:${KEYDB_PORT} + restart: unless-stopped + volumes: + - redis-data:${KEYDB_DATA} + networks: + - internal + + s3: + image: minio/minio:${MINIO_TAG} + environment: + - MINIO_ROOT_USER + - MINIO_ROOT_PASSWORD + - MINIO_BROWSER_REDIRECT_URL + - VIRTUAL_HOST=${MINIO_VIRTUAL_HOST} + - VIRTUAL_PORT=${MINIO_CONSOLE_PORT} + command: server ${MINIO_DATA} --console-address ":${MINIO_CONSOLE_PORT}" + volumes: + - s3-data:${MINIO_DATA} + ports: + - ${MINIO_API_PORT}:${MINIO_API_PORT} + - ${MINIO_CONSOLE_PORT}:${MINIO_CONSOLE_PORT} + networks: + - internal + + nginx: + image: nginx:${NGINX_TAG} + depends_on: + - odoo + restart: unless-stopped + tty: true + expose: + - 80/tcp + volumes: + - ./nginx/nginx.conf:${NGINX_CONF} + - ./nginx/default.conf:${NGINX_DEFAULT_CONF} + environment: + - VIRTUAL_HOST + - LETSENCRYPT_HOST + - LETSENCRYPT_EMAIL + - CORS_ALLOWED_DOMAIN + networks: + - internal + + nginx-proxy: + image: nginxproxy/nginx-proxy:${NGINX_PROXY_TAG} + depends_on: + - nginx + restart: unless-stopped + tty: true + volumes: + - ./nginx-proxy/nginx.conf:${NGINX_CONF} + - ./nginx-proxy/cors.conf:${NGINX_PROXY_CORS_CONF} + - certs:${NGINX_CERTS}:ro + - vhost:${NGINX_VHOST} + - html:${NGINX_HTML} + - ${DOCKER_SOCK}:${TEMP_DOCKER_SOCK}:ro + environment: + - TRUST_DOWNSTREAM_PROXY + - CORS_ALLOWED_DOMAIN + networks: + - internal + +volumes: + odoo-data: + pg-data: + redis-data: + s3-data: + certs: + vhost: + html: + +networks: + internal: + driver: bridge diff --git a/docker-compose.override.local.full.yml b/docker-compose.override.local.full.yml new file mode 100644 index 0000000..ce310ca --- /dev/null +++ b/docker-compose.override.local.full.yml @@ -0,0 +1,49 @@ +services: + odoo: + restart: 'no' + ports: + - 8069:8069 + - 8070:8070 + - 8071:8071 + - 8072:8072 + + postgres: + restart: 'no' + ports: + - 5432:5432 + + nginx: + restart: 'no' + + nginx-proxy: + restart: 'no' + ports: + - 80:80 + + redis: + image: eqalpha/keydb:${KEYDB_TAG} + platform: linux/amd64 + ports: + - ${KEYDB_PORT}:${KEYDB_PORT} + restart: unless-stopped + volumes: + - redis-data:${KEYDB_DATA} + networks: + - internal + + s3: + image: minio/minio:${MINIO_TAG} + environment: + - MINIO_ROOT_USER + - MINIO_ROOT_PASSWORD + - MINIO_BROWSER_REDIRECT_URL + - VIRTUAL_HOST=${MINIO_VIRTUAL_HOST} + - VIRTUAL_PORT=${MINIO_CONSOLE_PORT} + command: server ${MINIO_DATA} --console-address ":${MINIO_CONSOLE_PORT}" + volumes: + - s3-data:${MINIO_DATA} + ports: + - ${MINIO_API_PORT}:${MINIO_API_PORT} + - ${MINIO_CONSOLE_PORT}:${MINIO_CONSOLE_PORT} + networks: + - internal \ No newline at end of file diff --git a/docker-compose.override.local.yml b/docker-compose.override.local.min.yml similarity index 100% rename from docker-compose.override.local.yml rename to docker-compose.override.local.min.yml diff --git a/docker-compose.yml b/docker-compose.yml index d9aea0d..5684d2e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,3 +1,5 @@ + + services: odoo: build: @@ -27,6 +29,9 @@ services: - PASSWORD=${DB_PASSWORD} - ODOO_TAG - ODOO_RC + - USE_REDIS + - USE_S3 + - USE_SENTRY - THIRD_PARTY_ADDONS - ODOO_SESSION_REDIS - ODOO_SESSION_REDIS_HOST @@ -72,34 +77,6 @@ services: networks: - internal - redis: - image: eqalpha/keydb:${KEYDB_TAG} - platform: linux/amd64 - ports: - - ${KEYDB_PORT}:${KEYDB_PORT} - restart: unless-stopped - volumes: - - redis-data:${KEYDB_DATA} - networks: - - internal - - s3: - image: minio/minio:${MINIO_TAG} - environment: - - MINIO_ROOT_USER - - MINIO_ROOT_PASSWORD - - MINIO_BROWSER_REDIRECT_URL - - VIRTUAL_HOST=${MINIO_VIRTUAL_HOST} - - VIRTUAL_PORT=${MINIO_CONSOLE_PORT} - command: server ${MINIO_DATA} --console-address ":${MINIO_CONSOLE_PORT}" - volumes: - - s3-data:${MINIO_DATA} - ports: - - ${MINIO_API_PORT}:${MINIO_API_PORT} - - ${MINIO_CONSOLE_PORT}:${MINIO_CONSOLE_PORT} - networks: - - internal - nginx: image: nginx:${NGINX_TAG} depends_on: @@ -128,9 +105,9 @@ services: volumes: - ./nginx-proxy/nginx.conf:${NGINX_CONF} - ./nginx-proxy/cors.conf:${NGINX_PROXY_CORS_CONF} - - certs:${NGINX_CERTS}:ro - - vhost:${NGINX_VHOST} - html:${NGINX_HTML} + - vhost:${NGINX_VHOST} + - certs:${NGINX_CERTS}:ro - ${DOCKER_SOCK}:${TEMP_DOCKER_SOCK}:ro environment: - TRUST_DOWNSTREAM_PROXY @@ -138,14 +115,44 @@ services: networks: - internal + redis: + image: eqalpha/keydb:${KEYDB_TAG} + platform: linux/amd64 + ports: + - ${KEYDB_PORT}:${KEYDB_PORT} + restart: unless-stopped + volumes: + - redis-data:${KEYDB_DATA} + networks: + - internal + profiles: ["dev"] + + s3: + image: minio/minio:${MINIO_TAG} + environment: + - MINIO_ROOT_USER + - MINIO_ROOT_PASSWORD + - MINIO_BROWSER_REDIRECT_URL + - VIRTUAL_HOST=${MINIO_VIRTUAL_HOST} + - VIRTUAL_PORT=${MINIO_CONSOLE_PORT} + command: server ${MINIO_DATA} --console-address ":${MINIO_CONSOLE_PORT}" + volumes: + - s3-data:${MINIO_DATA} + ports: + - ${MINIO_API_PORT}:${MINIO_API_PORT} + - ${MINIO_CONSOLE_PORT}:${MINIO_CONSOLE_PORT} + networks: + - internal + profiles: ["dev"] + volumes: odoo-data: pg-data: redis-data: s3-data: - certs: - vhost: html: + vhost: + certs: networks: internal: diff --git a/odoo/third-party-addons.sh b/odoo/third-party-addons.sh index b32e745..3873793 100755 --- a/odoo/third-party-addons.sh +++ b/odoo/third-party-addons.sh @@ -2,16 +2,24 @@ set -e -# Check if the repository directory exists -if [ ! -d "odoo-cloud-platform" ]; then +# Check if the repository directory exists and either Redis or S3 is to be used +if [[ ! -d "odoo-cloud-platform" && ( $USE_REDIS -eq 1 || $USE_S3 -eq 1 ) ]]; then git clone https://github.com/odoocker/odoo-cloud-platform.git --depth 1 --branch ${ODOO_TAG} --single-branch --no-tags; +fi + +# Check the USE_REDIS variable to decide whether to copy Redis directories +if [[ $USE_REDIS -eq 1 ]]; then cp -r odoo-cloud-platform/session_redis ${THIRD_PARTY_ADDONS}/session_redis +fi + +# Check the USE_S3 variable to decide whether to copy S3 directories +if [[ $USE_S3 -eq 1 ]]; then cp -r odoo-cloud-platform/base_attachment_object_storage ${THIRD_PARTY_ADDONS}/base_attachment_object_storage cp -r odoo-cloud-platform/attachment_s3 ${THIRD_PARTY_ADDONS}/attachment_s3 fi -# Check if the repository directory exists -if [ ! -d "server-tools" ]; then +# Check if the repository directory exists and Sentry is to be used +if [[ ! -d "server-tools" && $USE_SENTRY -eq 1 ]]; then git clone https://github.com/odoocker/server-tools.git --depth 1 --branch ${ODOO_TAG} --single-branch --no-tags; cp -r server-tools/sentry ${THIRD_PARTY_ADDONS}/sentry fi From 688a5902829b2ca8347e9767e8f2ffe6c3ed9bf4 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Thu, 19 Oct 2023 21:30:09 -0500 Subject: [PATCH 35/58] cleanup --- .env.example | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 388438d..7db34b2 100644 --- a/.env.example +++ b/.env.example @@ -36,14 +36,14 @@ LOG_LEVEL=info # Additional logs LOG_HANDLER_LEVEL=INFO # Sentry -SENTRY_DSN=https://84799fb74edc4053aa3368aec3c2cb89@o4504596558577664.ingest.sentry.io/4504596563230720 +SENTRY_DSN= SENTRY_ENABLED=true SENTRY_LOGGING_LEVEL=warn SENTRY_EXCLUDE_LOGGERS= SENTRY_IGNORE_EXCEPTIONS= SENTRY_INCLUDE_CONTEXT=true SENTRY_ENVIRONMENT=production -SENTRY_RELEASE= +SENTRY_RELEASE=1.0 SENTRY_ODOO_DIR=${ROOT_PATH} # Nginx From 70fc974b62f462b6da1baa286439b02ae3189a0a Mon Sep 17 00:00:00 2001 From: Yhael S Date: Thu, 19 Oct 2023 22:11:19 -0500 Subject: [PATCH 36/58] added profiles for containers management --- .env.example | 30 +++- docker-compose copy.yml | 152 ------------------ docker-compose.override.local.full.yml | 49 ------ ...n.yml => docker-compose.override.local.yml | 0 docker-compose.override.production.yml | 16 -- docker-compose.pgadmin.yml | 45 ------ docker-compose.yml | 70 +++++++- 7 files changed, 92 insertions(+), 270 deletions(-) delete mode 100644 docker-compose copy.yml delete mode 100644 docker-compose.override.local.full.yml rename docker-compose.override.local.min.yml => docker-compose.override.local.yml (100%) delete mode 100644 docker-compose.pgadmin.yml diff --git a/.env.example b/.env.example index 7db34b2..765a001 100644 --- a/.env.example +++ b/.env.example @@ -5,21 +5,21 @@ APP_ENV=local INIT= UPDATE= -LOAD=base,web,session_redis,attachment_s3,sentry +LOAD=base,web ROOT_PATH=/usr/lib/python3/dist-packages/odoo WORKERS=2 DEV_MODE=reload,xml DOMAIN=erp.odoocker.test # Enterprise -GITHUB_USER= -GITHUB_ACCESS_TOKEN= +GITHUB_USER=yhaelopez +GITHUB_ACCESS_TOKEN=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 # Database ADMIN_PASSWD=odoo DB_HOST=postgres DB_PORT=5432 -DB_NAME=odoocker +DB_NAME= DB_USER=odoo DB_PASSWORD=odoo LOAD_LANGUAGE= @@ -43,7 +43,7 @@ SENTRY_EXCLUDE_LOGGERS= SENTRY_IGNORE_EXCEPTIONS= SENTRY_INCLUDE_CONTEXT=true SENTRY_ENVIRONMENT=production -SENTRY_RELEASE=1.0 +SENTRY_RELEASE= SENTRY_ODOO_DIR=${ROOT_PATH} # Nginx @@ -114,6 +114,24 @@ PGADMIN_CONFIG_SERVER_MODE=True PROJECT_NAME=odoocker SUPPORT_EMAIL=mail@example.com +# Service configuration +USE_REDIS=false +USE_S3=false +USE_SENTRY=false + +# Which services are going to be brought up +COMPOSE_PROFILES=base + +# Service profiles +ODOO_PROFILES="base" +POSTGRES_PROFILES="base" +NGINX_PROFILES="base" +NGINX_PROXY_PROFILES="base" +ACME_COMPANION_PROFILES="ssl" +KEYDB_PROFILES="cache" +MINIO_PROFILES="storage" +PGADMIN_PROFILES="admin" + # Containers' Tags ODOO_TAG=16.0 POSTGRES_TAG=16.0 @@ -124,7 +142,7 @@ NGINX_PROXY_TAG=1.3.1 ACME_COMPANION_TAG=2.2.8 PGADMIN_TAG=7.6 -# Custom paths +# Odoocker paths COMMUNITY_ADDONS=${ROOT_PATH}/addons ENTERPRISE_ADDONS=${ROOT_PATH}/enterprise THIRD_PARTY_ADDONS=${ROOT_PATH}/third-party-addons diff --git a/docker-compose copy.yml b/docker-compose copy.yml deleted file mode 100644 index d9aea0d..0000000 --- a/docker-compose copy.yml +++ /dev/null @@ -1,152 +0,0 @@ -services: - odoo: - build: - context: ./ - dockerfile: ./odoo/Dockerfile - args: - - ODOO_TAG - - ODOO_RC - - ROOT_PATH - - GITHUB_USER - - GITHUB_ACCESS_TOKEN - - ENTERPRISE_ADDONS - - THIRD_PARTY_ADDONS - - LOG_PATH - depends_on: - - postgres - tty: true - volumes: - - odoo-data:${DATA_DIR} - - ./odoo/extra-addons:${EXTRA_ADDONS} - - ./odoo/custom-addons:${CUSTOM_ADDONS} - - ./odoo/entrypoint.sh:/entrypoint.sh - environment: - - HOST=${DB_HOST} - - PORT=${DB_PORT} - - USER=${DB_USER} - - PASSWORD=${DB_PASSWORD} - - ODOO_TAG - - ODOO_RC - - THIRD_PARTY_ADDONS - - ODOO_SESSION_REDIS - - ODOO_SESSION_REDIS_HOST - - ODOO_SESSION_REDIS_PORT - - ODOO_SESSION_REDIS_PASSWORD - - ODOO_SESSION_REDIS_URL - - ODOO_SESSION_REDIS_PREFIX - - ODOO_SESSION_REDIS_SENTINEL_MASTER_NAME - - ODOO_SESSION_REDIS_SENTINEL_HOST - - ODOO_SESSION_REDIS_SENTINEL_PORT - - ODOO_SESSION_REDIS_EXPIRATION - - ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS - - AWS_HOST - - AWS_REGION - - AWS_ACCESS_KEY_ID - - AWS_SECRET_ACCESS_KEY - - AWS_BUCKETNAME - networks: - - internal - - postgres: - build: - context: ./ - dockerfile: ./postgres/Dockerfile - args: - - POSTGRES_TAG - restart: unless-stopped - tty: true - volumes: - - pg-data:${PGDATA} - - ./postgres/entrypoint.sh:/docker-entrypoint-initdb.d/entrypoint.sh - environment: - - POSTGRES_DB - - POSTGRES_USER - - POSTGRES_PASSWORD - - PGDATA - - DB_USER - - DB_TEMPLATE - - UNACCENT_TEMPLATE - - PGADMING_DB_NAME - - PGADMING_DB_USER - - PGADMIN_DB_PASSWORD - networks: - - internal - - redis: - image: eqalpha/keydb:${KEYDB_TAG} - platform: linux/amd64 - ports: - - ${KEYDB_PORT}:${KEYDB_PORT} - restart: unless-stopped - volumes: - - redis-data:${KEYDB_DATA} - networks: - - internal - - s3: - image: minio/minio:${MINIO_TAG} - environment: - - MINIO_ROOT_USER - - MINIO_ROOT_PASSWORD - - MINIO_BROWSER_REDIRECT_URL - - VIRTUAL_HOST=${MINIO_VIRTUAL_HOST} - - VIRTUAL_PORT=${MINIO_CONSOLE_PORT} - command: server ${MINIO_DATA} --console-address ":${MINIO_CONSOLE_PORT}" - volumes: - - s3-data:${MINIO_DATA} - ports: - - ${MINIO_API_PORT}:${MINIO_API_PORT} - - ${MINIO_CONSOLE_PORT}:${MINIO_CONSOLE_PORT} - networks: - - internal - - nginx: - image: nginx:${NGINX_TAG} - depends_on: - - odoo - restart: unless-stopped - tty: true - expose: - - 80/tcp - volumes: - - ./nginx/nginx.conf:${NGINX_CONF} - - ./nginx/default.conf:${NGINX_DEFAULT_CONF} - environment: - - VIRTUAL_HOST - - LETSENCRYPT_HOST - - LETSENCRYPT_EMAIL - - CORS_ALLOWED_DOMAIN - networks: - - internal - - nginx-proxy: - image: nginxproxy/nginx-proxy:${NGINX_PROXY_TAG} - depends_on: - - nginx - restart: unless-stopped - tty: true - volumes: - - ./nginx-proxy/nginx.conf:${NGINX_CONF} - - ./nginx-proxy/cors.conf:${NGINX_PROXY_CORS_CONF} - - certs:${NGINX_CERTS}:ro - - vhost:${NGINX_VHOST} - - html:${NGINX_HTML} - - ${DOCKER_SOCK}:${TEMP_DOCKER_SOCK}:ro - environment: - - TRUST_DOWNSTREAM_PROXY - - CORS_ALLOWED_DOMAIN - networks: - - internal - -volumes: - odoo-data: - pg-data: - redis-data: - s3-data: - certs: - vhost: - html: - -networks: - internal: - driver: bridge diff --git a/docker-compose.override.local.full.yml b/docker-compose.override.local.full.yml deleted file mode 100644 index ce310ca..0000000 --- a/docker-compose.override.local.full.yml +++ /dev/null @@ -1,49 +0,0 @@ -services: - odoo: - restart: 'no' - ports: - - 8069:8069 - - 8070:8070 - - 8071:8071 - - 8072:8072 - - postgres: - restart: 'no' - ports: - - 5432:5432 - - nginx: - restart: 'no' - - nginx-proxy: - restart: 'no' - ports: - - 80:80 - - redis: - image: eqalpha/keydb:${KEYDB_TAG} - platform: linux/amd64 - ports: - - ${KEYDB_PORT}:${KEYDB_PORT} - restart: unless-stopped - volumes: - - redis-data:${KEYDB_DATA} - networks: - - internal - - s3: - image: minio/minio:${MINIO_TAG} - environment: - - MINIO_ROOT_USER - - MINIO_ROOT_PASSWORD - - MINIO_BROWSER_REDIRECT_URL - - VIRTUAL_HOST=${MINIO_VIRTUAL_HOST} - - VIRTUAL_PORT=${MINIO_CONSOLE_PORT} - command: server ${MINIO_DATA} --console-address ":${MINIO_CONSOLE_PORT}" - volumes: - - s3-data:${MINIO_DATA} - ports: - - ${MINIO_API_PORT}:${MINIO_API_PORT} - - ${MINIO_CONSOLE_PORT}:${MINIO_CONSOLE_PORT} - networks: - - internal \ No newline at end of file diff --git a/docker-compose.override.local.min.yml b/docker-compose.override.local.yml similarity index 100% rename from docker-compose.override.local.min.yml rename to docker-compose.override.local.yml diff --git a/docker-compose.override.production.yml b/docker-compose.override.production.yml index d01c989..f7e4055 100644 --- a/docker-compose.override.production.yml +++ b/docker-compose.override.production.yml @@ -17,22 +17,6 @@ services: - 80:80 - 443:443 - letsencrypt: - image: nginxproxy/acme-companion:${ACME_COMPANION_TAG} - depends_on: - - nginx-proxy - restart: unless-stopped - volumes_from: - - nginx-proxy:rw - volumes: - - certs:${NGINX_CERTS}:rw - - acme:${NGINX_ACME} - - ${DOCKER_SOCK}:${DOCKER_SOCK}:ro - environment: - - DEFAULT_EMAIL - networks: - - internal - volumes: acme: certs: diff --git a/docker-compose.pgadmin.yml b/docker-compose.pgadmin.yml deleted file mode 100644 index 7fccf84..0000000 --- a/docker-compose.pgadmin.yml +++ /dev/null @@ -1,45 +0,0 @@ -services: - pgadmin: - build: - context: ./ - dockerfile: ./pgadmin/Dockerfile - args: - - PGADMIN_TAG - depends_on: - - postgres - restart: 'no' - expose: - - 80 - volumes: - - pgadmin-data:${PGADMIN_DATA} - environment: - - PGADMIN_DEFAULT_EMAIL - - PGADMIN_DEFAULT_PASSWORD - - VIRTUAL_HOST=${PGADMIN_VIRTUAL_HOST} - - LETSENCRYPT_HOST=${PGADMIN_LETSENCRYPT_HOST} - - LETSENCRYPT_EMAIL=${PGADMIN_LETSENCRYPT_EMAIL} - - PGADMIN_CONFIG_APP_NAME - - PGADMIN_CONFIG_CONFIG_DATABASE_CONNECTION_POOL_SIZE - - PGADMIN_CONFIG_SERVER_MODE - - PGADMIN_CONFIG_DEFAULT_SERVER - - PGADMIN_CONFIG_DEFAULT_SERVER_PORT - - PGADMIN_CONFIG_PASSWORD_LENGTH_MIN - - PGADMIN_CONFIG_MAX_SESSION_IDLE_TIME - - PGADMIN_CONFIG_CONFIG_DATABASE_URI - - PGADMIN_CONFIG_ALLOW_SAVE_PASSWORD - - PGADMIN_CONFIG_MAX_QUERY_HIST_STORED - - PGADMIN_CONFIG_MAIL_SERVER - - PGADMIN_CONFIG_MAIL_PORT - - PGADMIN_CONFIG_MAIL_USE_SSL - - PGADMIN_CONFIG_MAIL_USE_TLS - - PGADMIN_CONFIG_MAIL_USERNAME - - PGADMIN_CONFIG_MAIL_PASSWORD - - PGADMIN_CONFIG_MAIL_DEBUG - - PGADMIN_CONFIG_SECURITY_EMAIL_SENDER - - PGADMIN_CONFIG_ALLOW_SAVE_TUNNEL_PASSWORD - - PGADMIN_CONFIG_MAX_LOGIN_ATTEMPTS - networks: - - internal - -volumes: - pgadmin-data: diff --git a/docker-compose.yml b/docker-compose.yml index 5684d2e..35f717c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -51,6 +51,7 @@ services: - AWS_BUCKETNAME networks: - internal + profiles: [$ODOO_PROFILES] postgres: build: @@ -76,6 +77,7 @@ services: - PGADMIN_DB_PASSWORD networks: - internal + profiles: [$POSTGRES_PROFILES] nginx: image: nginx:${NGINX_TAG} @@ -95,6 +97,7 @@ services: - CORS_ALLOWED_DOMAIN networks: - internal + profiles: [$NGINX_PROFILES] nginx-proxy: image: nginxproxy/nginx-proxy:${NGINX_PROXY_TAG} @@ -114,6 +117,7 @@ services: - CORS_ALLOWED_DOMAIN networks: - internal + profiles: [$NGINX_PROXY_PROFILES] redis: image: eqalpha/keydb:${KEYDB_TAG} @@ -125,7 +129,7 @@ services: - redis-data:${KEYDB_DATA} networks: - internal - profiles: ["dev"] + profiles: [$KEYDB_PROFILES] s3: image: minio/minio:${MINIO_TAG} @@ -143,16 +147,78 @@ services: - ${MINIO_CONSOLE_PORT}:${MINIO_CONSOLE_PORT} networks: - internal - profiles: ["dev"] + profiles: [$MINIO_PROFILES] + + letsencrypt: + image: nginxproxy/acme-companion:${ACME_COMPANION_TAG} + depends_on: + - nginx-proxy + restart: unless-stopped + volumes_from: + - nginx-proxy:rw + volumes: + - certs:${NGINX_CERTS}:rw + - acme:${NGINX_ACME} + - ${DOCKER_SOCK}:${DOCKER_SOCK}:ro + environment: + - DEFAULT_EMAIL + networks: + - internal + profiles: [$ACME_COMPANION_PROFILES] + + pgadmin: + build: + context: ./ + dockerfile: ./pgadmin/Dockerfile + args: + - PGADMIN_TAG + depends_on: + - postgres + restart: 'no' + expose: + - 80 + volumes: + - pgadmin-data:${PGADMIN_DATA} + environment: + - PGADMIN_DEFAULT_EMAIL + - PGADMIN_DEFAULT_PASSWORD + - VIRTUAL_HOST=${PGADMIN_VIRTUAL_HOST} + - LETSENCRYPT_HOST=${PGADMIN_LETSENCRYPT_HOST} + - LETSENCRYPT_EMAIL=${PGADMIN_LETSENCRYPT_EMAIL} + - PGADMIN_CONFIG_APP_NAME + - PGADMIN_CONFIG_CONFIG_DATABASE_CONNECTION_POOL_SIZE + - PGADMIN_CONFIG_SERVER_MODE + - PGADMIN_CONFIG_DEFAULT_SERVER + - PGADMIN_CONFIG_DEFAULT_SERVER_PORT + - PGADMIN_CONFIG_PASSWORD_LENGTH_MIN + - PGADMIN_CONFIG_MAX_SESSION_IDLE_TIME + - PGADMIN_CONFIG_CONFIG_DATABASE_URI + - PGADMIN_CONFIG_ALLOW_SAVE_PASSWORD + - PGADMIN_CONFIG_MAX_QUERY_HIST_STORED + - PGADMIN_CONFIG_MAIL_SERVER + - PGADMIN_CONFIG_MAIL_PORT + - PGADMIN_CONFIG_MAIL_USE_SSL + - PGADMIN_CONFIG_MAIL_USE_TLS + - PGADMIN_CONFIG_MAIL_USERNAME + - PGADMIN_CONFIG_MAIL_PASSWORD + - PGADMIN_CONFIG_MAIL_DEBUG + - PGADMIN_CONFIG_SECURITY_EMAIL_SENDER + - PGADMIN_CONFIG_ALLOW_SAVE_TUNNEL_PASSWORD + - PGADMIN_CONFIG_MAX_LOGIN_ATTEMPTS + networks: + - internal + profiles: [$PGADMIN_PROFILES] volumes: odoo-data: pg-data: redis-data: s3-data: + pgadmin-data: html: vhost: certs: + acme: networks: internal: From 986fffafc36149f6c2418f6b87c5a6c857be507c Mon Sep 17 00:00:00 2001 From: Yhael S Date: Thu, 19 Oct 2023 22:12:18 -0500 Subject: [PATCH 37/58] cleanup --- .env.example | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 765a001..0d81849 100644 --- a/.env.example +++ b/.env.example @@ -12,8 +12,8 @@ DEV_MODE=reload,xml DOMAIN=erp.odoocker.test # Enterprise -GITHUB_USER=yhaelopez -GITHUB_ACCESS_TOKEN=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 +GITHUB_USER= +GITHUB_ACCESS_TOKEN= # Database ADMIN_PASSWD=odoo From c3f70d3a99712cc00daa437ef925558ea3cec1e5 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Fri, 20 Oct 2023 00:07:37 -0500 Subject: [PATCH 38/58] enable separated features --- .env.example | 5 ++++- docker-compose.override.local.yml | 1 + docker-compose.override.production.yml | 18 +----------------- docker-compose.yml | 7 +++++-- odoo/Dockerfile | 8 +++++++- odoo/entrypoint.sh | 10 +++++----- odoo/odoorc.sh | 17 +++++++++++++++++ odoo/third-party-addons.sh | 23 ++++++++++------------- 8 files changed, 50 insertions(+), 39 deletions(-) diff --git a/.env.example b/.env.example index 0d81849..0de35b9 100644 --- a/.env.example +++ b/.env.example @@ -120,7 +120,7 @@ USE_S3=false USE_SENTRY=false # Which services are going to be brought up -COMPOSE_PROFILES=base +COMPOSE_PROFILES=base,cache,storage,ssl,admin # Service profiles ODOO_PROFILES="base" @@ -320,6 +320,9 @@ CORS_ALLOWED_DOMAIN=${CORS_ALLOWED_DOMAIN} #----------------------# # ACME Companion # #----------------------# +# For prod use: https://acme-v02.api.letsencrypt.org/directory +ACME_CA_URI=https://acme-staging-v02.api.letsencrypt.org/directory +CERTS_UPDATE_INTERVAL=3600 DEFAULT_EMAIL=${SUPPORT_EMAIL} #-------------# diff --git a/docker-compose.override.local.yml b/docker-compose.override.local.yml index 8a9c1a6..b5363f4 100644 --- a/docker-compose.override.local.yml +++ b/docker-compose.override.local.yml @@ -19,3 +19,4 @@ services: restart: 'no' ports: - 80:80 + - 443:443 diff --git a/docker-compose.override.production.yml b/docker-compose.override.production.yml index f7e4055..bf55c5e 100644 --- a/docker-compose.override.production.yml +++ b/docker-compose.override.production.yml @@ -1,21 +1,5 @@ services: - odoo: - restart: unless-stopped - ports: - - 127.0.0.1:8069:8069 - - 127.0.0.1:8071:8071 - - 127.0.0.1:8072:8072 - - postgres: - restart: unless-stopped - ports: - - 127.0.0.1:5432:5432 - - nginx-proxy: - restart: unless-stopped - ports: - - 80:80 - - 443:443 + volumes: acme: diff --git a/docker-compose.yml b/docker-compose.yml index 35f717c..f27093c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,8 +14,9 @@ services: - ENTERPRISE_ADDONS - THIRD_PARTY_ADDONS - LOG_PATH - depends_on: - - postgres + - USE_REDIS + - USE_S3 + - USE_SENTRY tty: true volumes: - odoo-data:${DATA_DIR} @@ -161,6 +162,8 @@ services: - acme:${NGINX_ACME} - ${DOCKER_SOCK}:${DOCKER_SOCK}:ro environment: + - ACME_CA_URI + - CERTS_UPDATE_INTERVAL - DEFAULT_EMAIL networks: - internal diff --git a/odoo/Dockerfile b/odoo/Dockerfile index 7f465b4..ebeaa6e 100644 --- a/odoo/Dockerfile +++ b/odoo/Dockerfile @@ -16,6 +16,9 @@ ARG GITHUB_ACCESS_TOKEN ARG ENTERPRISE_ADDONS ARG THIRD_PARTY_ADDONS ARG ODOO_RC +ARG USE_REDIS +ARG USE_S3 +ARG USE_SENTRY ENV ODOO_TAG=${ODOO_TAG} \ LOG_PATH=${LOG_PATH} \ @@ -23,7 +26,10 @@ ENV ODOO_TAG=${ODOO_TAG} \ GITHUB_ACCESS_TOKEN=${GITHUB_ACCESS_TOKEN} \ ENTERPRISE_ADDONS=${ENTERPRISE_ADDONS} \ THIRD_PARTY_ADDONS=${THIRD_PARTY_ADDONS} \ - ODOO_RC=${ODOO_RC} + ODOO_RC=${ODOO_RC} \ + USE_REDIS=${USE_REDIS} \ + USE_S3=${USE_S3} \ + USE_SENTRY=${USE_SENTRY} #------------------------# # APT Dependencies # diff --git a/odoo/entrypoint.sh b/odoo/entrypoint.sh index 39b0753..33fa16e 100755 --- a/odoo/entrypoint.sh +++ b/odoo/entrypoint.sh @@ -25,14 +25,14 @@ case "$1" in if [ ${APP_ENV} = 'fresh' ] || [ ${APP_ENV} = 'restore' ]; then # Ideal for a fresh install or restore a production database. - echo odoo --config ${ODOO_RC} --database= --init= --update= --load=${SERVER_WIDE_MODULES} --log-level=${LOG_LEVEL} --load-language= --workers=0 --limit-time-cpu=3600 --limit-time-real=7200 + echo odoo --config ${ODOO_RC} --database= --init= --update= --load=${LOAD} --log-level=${LOG_LEVEL} --load-language= --workers=0 --limit-time-cpu=3600 --limit-time-real=7200 exec odoo --config ${ODOO_RC} --database= --init= --update= --load-language= --workers=0 --limit-time-cpu=3600 --limit-time-real=7200 fi if [ ${APP_ENV} = 'local' ] ; then # Listens to all .env variables mapped into odoo.conf file. - echo odoo --config ${ODOO_RC} + echo odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=${UPDATE} --load=${LOAD} --workers=${WORKERS} --log-level=${LOG_LEVEL} --dev=${DEV_MODE} exec odoo --config ${ODOO_RC} fi @@ -46,21 +46,21 @@ case "$1" in if [ ${APP_ENV} = 'testing' ] ; then # Initializies a fresh 'test_*' database, installs the addons to test, and runs tests you specify in the test tags. - echo odoo --config ${ODOO_RC} --database=test_${DB_NAME} --test-enable --test-tags ${TEST_TAGS} --init=${ADDONS_TO_TEST} --update=${ADDONS_TO_TEST} --load=${SERVER_WIDE_MODULES} --log-level=${LOG_LEVEL} --without-demo= --workers=0 --dev= --stop-after-init + echo odoo --config ${ODOO_RC} --database=test_${DB_NAME} --test-enable --test-tags ${TEST_TAGS} --init=${ADDONS_TO_TEST} --update=${ADDONS_TO_TEST} --load=${LOAD} --log-level=${LOG_LEVEL} --without-demo= --workers=0 --dev= --stop-after-init exec odoo --config ${ODOO_RC} --database=test_${DB_NAME} --test-enable --test-tags ${TEST_TAGS} --init=${ADDONS_TO_TEST} --update=${ADDONS_TO_TEST} --without-demo= --workers=0 --dev= --stop-after-init fi if [ ${APP_ENV} = 'staging' ] ; then # Automagically upgrade all addons and install new ones. Ideal for deployment process. - echo odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=all --load=${SERVER_WIDE_MODULES} --log-level=${LOG_LEVEL} --load-language=${LOAD_LANGUAGE} --limit-time-cpu=3600 --limit-time-real=7200 --dev= + echo odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=all --load=${LOAD} --log-level=${LOG_LEVEL} --load-language=${LOAD_LANGUAGE} --limit-time-cpu=3600 --limit-time-real=7200 --dev= exec odoo --config ${ODOO_RC} --update=all --without-demo=all --workers=0 --limit-time-cpu=3600 --limit-time-real=7200 --dev= fi if [ ${APP_ENV} = 'production' ] ; then # Bring up Odoo ready for production. - echo odoo --config ${ODOO_RC} --database= --init= --update= --load=${SERVER_WIDE_MODULES} --workers=${WORKERS} --log-level=${LOG_LEVEL} --load-language= --without-demo=all --dev= + echo odoo --config ${ODOO_RC} --database= --init= --update= --load=${LOAD} --workers=${WORKERS} --log-level=${LOG_LEVEL} --load-language= --without-demo=all --dev= exec odoo --config ${ODOO_RC} --database= --init= --update= --load-language= --without-demo=all --dev= fi diff --git a/odoo/odoorc.sh b/odoo/odoorc.sh index 51a2ed4..dafb911 100755 --- a/odoo/odoorc.sh +++ b/odoo/odoorc.sh @@ -20,6 +20,23 @@ while IFS='=' read -r key value || [[ -n $key ]]; do export "$key=$value" done < .env +# Check the USE_REDIS variable to decide whether to copy Redis directories +if [[ $USE_REDIS == "true" ]]; then + LOAD+=",session_redis" +fi + +# Check the USE_S3 variable to decide whether to copy S3 directories +if [[ $USE_S3 == "true" ]]; then + LOAD+=",base_attachment_object_storage,attachment_s3" +fi + +# Check if the repository directory exists and Sentry is to be used +if [[ $USE_SENTRY == "true" ]]; then + LOAD+=",sentry" +fi + +echo "Loading addons: $LOAD" + # Copy the example conf to the destination to start replacing the variables cp "$TEMPLATE_CONF" "$ODOO_RC" diff --git a/odoo/third-party-addons.sh b/odoo/third-party-addons.sh index 3873793..c562ec4 100755 --- a/odoo/third-party-addons.sh +++ b/odoo/third-party-addons.sh @@ -2,24 +2,21 @@ set -e -# Check if the repository directory exists and either Redis or S3 is to be used -if [[ ! -d "odoo-cloud-platform" && ( $USE_REDIS -eq 1 || $USE_S3 -eq 1 ) ]]; then - git clone https://github.com/odoocker/odoo-cloud-platform.git --depth 1 --branch ${ODOO_TAG} --single-branch --no-tags; -fi +# Always use base_attachment_object_storage +git clone https://github.com/odoocker/odoo-cloud-platform.git --depth 1 --branch $ODOO_TAG --single-branch --no-tags; +cp -r odoo-cloud-platform/base_attachment_object_storage $THIRD_PARTY_ADDONS/base_attachment_object_storage -# Check the USE_REDIS variable to decide whether to copy Redis directories -if [[ $USE_REDIS -eq 1 ]]; then - cp -r odoo-cloud-platform/session_redis ${THIRD_PARTY_ADDONS}/session_redis +if [[ $USE_REDIS == "true" ]]; then + cp -r odoo-cloud-platform/session_redis $THIRD_PARTY_ADDONS/session_redis fi # Check the USE_S3 variable to decide whether to copy S3 directories -if [[ $USE_S3 -eq 1 ]]; then - cp -r odoo-cloud-platform/base_attachment_object_storage ${THIRD_PARTY_ADDONS}/base_attachment_object_storage - cp -r odoo-cloud-platform/attachment_s3 ${THIRD_PARTY_ADDONS}/attachment_s3 +if [[ $USE_S3 == "true" ]]; then + cp -r odoo-cloud-platform/attachment_s3 $THIRD_PARTY_ADDONS/attachment_s3 fi # Check if the repository directory exists and Sentry is to be used -if [[ ! -d "server-tools" && $USE_SENTRY -eq 1 ]]; then - git clone https://github.com/odoocker/server-tools.git --depth 1 --branch ${ODOO_TAG} --single-branch --no-tags; - cp -r server-tools/sentry ${THIRD_PARTY_ADDONS}/sentry +if [[ $USE_SENTRY == "true" ]]; then + git clone https://github.com/odoocker/server-tools.git --depth 1 --branch $ODOO_TAG --single-branch --no-tags; + cp -r server-tools/sentry $THIRD_PARTY_ADDONS/sentry fi From 284dc6958881bca1e56ce4acd7b6e6d3451b2e34 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Fri, 20 Oct 2023 00:57:28 -0500 Subject: [PATCH 39/58] cleanup --- odoo/entrypoint.sh | 17 +++++++++++++++++ odoo/odoorc.sh | 5 ++--- odoo/third-party-addons.sh | 22 ++++++++++++---------- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/odoo/entrypoint.sh b/odoo/entrypoint.sh index 33fa16e..ee70608 100755 --- a/odoo/entrypoint.sh +++ b/odoo/entrypoint.sh @@ -14,6 +14,23 @@ while IFS='=' read -r key value || [[ -n $key ]]; do eval "$key=\"$value\"" done < .env + +# Check the USE_REDIS variable to decide whether to copy Redis directories +if [[ $USE_REDIS == "true" ]]; then + LOAD+=",base_attachment_object_storage" + LOAD+=",session_redis" +fi + +# Check the USE_S3 variable to decide whether to copy S3 directories +if [[ $USE_S3 == "true" ]]; then + LOAD+=",attachment_s3" +fi + +# Check if the repository directory exists and Sentry is to be used +if [[ $USE_SENTRY == "true" ]]; then + LOAD+=",sentry" +fi + case "$1" in -- | odoo) shift diff --git a/odoo/odoorc.sh b/odoo/odoorc.sh index dafb911..886f6db 100755 --- a/odoo/odoorc.sh +++ b/odoo/odoorc.sh @@ -27,7 +27,8 @@ fi # Check the USE_S3 variable to decide whether to copy S3 directories if [[ $USE_S3 == "true" ]]; then - LOAD+=",base_attachment_object_storage,attachment_s3" + LOAD+=",base_attachment_object_storage" + LOAD+=",attachment_s3" fi # Check if the repository directory exists and Sentry is to be used @@ -35,8 +36,6 @@ if [[ $USE_SENTRY == "true" ]]; then LOAD+=",sentry" fi -echo "Loading addons: $LOAD" - # Copy the example conf to the destination to start replacing the variables cp "$TEMPLATE_CONF" "$ODOO_RC" diff --git a/odoo/third-party-addons.sh b/odoo/third-party-addons.sh index c562ec4..d101247 100755 --- a/odoo/third-party-addons.sh +++ b/odoo/third-party-addons.sh @@ -2,21 +2,23 @@ set -e -# Always use base_attachment_object_storage -git clone https://github.com/odoocker/odoo-cloud-platform.git --depth 1 --branch $ODOO_TAG --single-branch --no-tags; -cp -r odoo-cloud-platform/base_attachment_object_storage $THIRD_PARTY_ADDONS/base_attachment_object_storage +# Check if the repository directory exists and either Redis or S3 is to be used +if [[ ${USE_REDIS} == "true" || ${USE_S3} == "true" ]]; then + git clone https://github.com/odoocker/odoo-cloud-platform.git --depth 1 --branch ${ODOO_TAG} --single-branch --no-tags; +fi -if [[ $USE_REDIS == "true" ]]; then - cp -r odoo-cloud-platform/session_redis $THIRD_PARTY_ADDONS/session_redis +if [[ ${USE_REDIS} == "true" ]]; then + cp -r odoo-cloud-platform/session_redis ${THIRD_PARTY_ADDONS}/session_redis fi # Check the USE_S3 variable to decide whether to copy S3 directories -if [[ $USE_S3 == "true" ]]; then - cp -r odoo-cloud-platform/attachment_s3 $THIRD_PARTY_ADDONS/attachment_s3 +if [[ ${USE_S3} == "true" ]]; then + cp -r odoo-cloud-platform/base_attachment_object_storage ${THIRD_PARTY_ADDONS}/base_attachment_object_storage + cp -r odoo-cloud-platform/attachment_s3 ${THIRD_PARTY_ADDONS}/attachment_s3 fi # Check if the repository directory exists and Sentry is to be used -if [[ $USE_SENTRY == "true" ]]; then - git clone https://github.com/odoocker/server-tools.git --depth 1 --branch $ODOO_TAG --single-branch --no-tags; - cp -r server-tools/sentry $THIRD_PARTY_ADDONS/sentry +if [[ ${USE_SENTRY} == "true" ]]; then + git clone https://github.com/odoocker/server-tools.git --depth 1 --branch ${ODOO_TAG} --single-branch --no-tags; + cp -r server-tools/sentry ${THIRD_PARTY_ADDONS}/sentry fi From e26bd85abc595e78e067c36af2a2553626ea804c Mon Sep 17 00:00:00 2001 From: Yhael S Date: Fri, 20 Oct 2023 01:00:43 -0500 Subject: [PATCH 40/58] fixed env --- .env.example | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.env.example b/.env.example index 0de35b9..b0df16c 100644 --- a/.env.example +++ b/.env.example @@ -11,6 +11,9 @@ WORKERS=2 DEV_MODE=reload,xml DOMAIN=erp.odoocker.test +# Services +SERVICES=odoo,postgres,nginx,proxy + # Enterprise GITHUB_USER= GITHUB_ACCESS_TOKEN= @@ -92,7 +95,7 @@ AWS_HOST=http://s3:${S3_API_PORT} AWS_REGION= AWS_ACCESS_KEY_ID=myaccesskey AWS_SECRET_ACCESS_KEY=mysecretkey -AWS_BUCKETNAME=odoocker +AWS_BUCKETNAME=odoo-{db} # PgAdmin PGADMIN_DOMAIN=pgadmin.odoocker.test @@ -115,19 +118,19 @@ PROJECT_NAME=odoocker SUPPORT_EMAIL=mail@example.com # Service configuration -USE_REDIS=false -USE_S3=false +USE_REDIS=true +USE_S3=true USE_SENTRY=false # Which services are going to be brought up -COMPOSE_PROFILES=base,cache,storage,ssl,admin +COMPOSE_PROFILES=${SERVICES} # Service profiles -ODOO_PROFILES="base" -POSTGRES_PROFILES="base" -NGINX_PROFILES="base" -NGINX_PROXY_PROFILES="base" -ACME_COMPANION_PROFILES="ssl" +ODOO_PROFILES="odoo" +POSTGRES_PROFILES="postgres" +NGINX_PROFILES="nginx" +NGINX_PROXY_PROFILES="proxy" +ACME_COMPANION_PROFILES="acme" KEYDB_PROFILES="cache" MINIO_PROFILES="storage" PGADMIN_PROFILES="admin" From 10f3aa0302ab58a80e8072beb6b84e41765b65c4 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Fri, 20 Oct 2023 01:07:27 -0500 Subject: [PATCH 41/58] fixed build --- docker-compose.override.production.yml | 24 ++++++++++++++++++++---- odoo/entrypoint.sh | 7 +++---- odoo/odoorc.sh | 8 ++++---- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/docker-compose.override.production.yml b/docker-compose.override.production.yml index bf55c5e..ccec260 100644 --- a/docker-compose.override.production.yml +++ b/docker-compose.override.production.yml @@ -1,6 +1,22 @@ services: - + odoo: + restart: 'no' + ports: + - 127.0.0.1:8069:8069 + - 127.0.0.1:8070:8070 + - 127.0.0.1:8071:8071 + - 127.0.0.1:8072:8072 -volumes: - acme: - certs: + postgres: + restart: 'no' + ports: + - 127.0.0.1:5432:5432 + + nginx: + restart: 'no' + + nginx-proxy: + restart: 'no' + ports: + - 80:80 + - 443:443 diff --git a/odoo/entrypoint.sh b/odoo/entrypoint.sh index ee70608..0750905 100755 --- a/odoo/entrypoint.sh +++ b/odoo/entrypoint.sh @@ -14,19 +14,18 @@ while IFS='=' read -r key value || [[ -n $key ]]; do eval "$key=\"$value\"" done < .env - -# Check the USE_REDIS variable to decide whether to copy Redis directories +# Check the USE_REDIS to add base_attachment_object_storage & session_redis to LOAD variable if [[ $USE_REDIS == "true" ]]; then LOAD+=",base_attachment_object_storage" LOAD+=",session_redis" fi -# Check the USE_S3 variable to decide whether to copy S3 directories +# Check the USE_REDIS to add attachment_s3 to LOAD variable if [[ $USE_S3 == "true" ]]; then LOAD+=",attachment_s3" fi -# Check if the repository directory exists and Sentry is to be used +# Check the USE_REDIS to add sentry to LOAD variable if [[ $USE_SENTRY == "true" ]]; then LOAD+=",sentry" fi diff --git a/odoo/odoorc.sh b/odoo/odoorc.sh index 886f6db..a4c7a73 100755 --- a/odoo/odoorc.sh +++ b/odoo/odoorc.sh @@ -20,18 +20,18 @@ while IFS='=' read -r key value || [[ -n $key ]]; do export "$key=$value" done < .env -# Check the USE_REDIS variable to decide whether to copy Redis directories +# Check the USE_REDIS to add base_attachment_object_storage & session_redis to LOAD variable if [[ $USE_REDIS == "true" ]]; then + LOAD+=",base_attachment_object_storage" LOAD+=",session_redis" fi -# Check the USE_S3 variable to decide whether to copy S3 directories +# Check the USE_REDIS to add attachment_s3 to LOAD variable if [[ $USE_S3 == "true" ]]; then - LOAD+=",base_attachment_object_storage" LOAD+=",attachment_s3" fi -# Check if the repository directory exists and Sentry is to be used +# Check the USE_REDIS to add sentry to LOAD variable if [[ $USE_SENTRY == "true" ]]; then LOAD+=",sentry" fi From 2a1ac8a17f91e15b0d7818ec599a7d7e46e661cf Mon Sep 17 00:00:00 2001 From: Yhael S Date: Fri, 20 Oct 2023 01:09:20 -0500 Subject: [PATCH 42/58] fixed build --- odoo/entrypoint.sh | 2 +- odoo/odoorc.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/odoo/entrypoint.sh b/odoo/entrypoint.sh index 0750905..399249f 100755 --- a/odoo/entrypoint.sh +++ b/odoo/entrypoint.sh @@ -16,12 +16,12 @@ done < .env # Check the USE_REDIS to add base_attachment_object_storage & session_redis to LOAD variable if [[ $USE_REDIS == "true" ]]; then - LOAD+=",base_attachment_object_storage" LOAD+=",session_redis" fi # Check the USE_REDIS to add attachment_s3 to LOAD variable if [[ $USE_S3 == "true" ]]; then + LOAD+=",base_attachment_object_storage" LOAD+=",attachment_s3" fi diff --git a/odoo/odoorc.sh b/odoo/odoorc.sh index a4c7a73..6726828 100755 --- a/odoo/odoorc.sh +++ b/odoo/odoorc.sh @@ -22,12 +22,12 @@ done < .env # Check the USE_REDIS to add base_attachment_object_storage & session_redis to LOAD variable if [[ $USE_REDIS == "true" ]]; then - LOAD+=",base_attachment_object_storage" LOAD+=",session_redis" fi # Check the USE_REDIS to add attachment_s3 to LOAD variable if [[ $USE_S3 == "true" ]]; then + LOAD+=",base_attachment_object_storage" LOAD+=",attachment_s3" fi From d961bb291e6c6faa561cc8a5d7c7ba49ecd056ac Mon Sep 17 00:00:00 2001 From: Yhael S Date: Fri, 20 Oct 2023 01:11:37 -0500 Subject: [PATCH 43/58] fixed build --- .env.example | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index b0df16c..601a509 100644 --- a/.env.example +++ b/.env.example @@ -131,9 +131,9 @@ POSTGRES_PROFILES="postgres" NGINX_PROFILES="nginx" NGINX_PROXY_PROFILES="proxy" ACME_COMPANION_PROFILES="acme" -KEYDB_PROFILES="cache" -MINIO_PROFILES="storage" -PGADMIN_PROFILES="admin" +KEYDB_PROFILES="keydb" +MINIO_PROFILES="minio" +PGADMIN_PROFILES="pgadmin" # Containers' Tags ODOO_TAG=16.0 From 5e21d9e76eab1c1b477b8548b143d8a79a2e6057 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Fri, 20 Oct 2023 01:35:48 -0500 Subject: [PATCH 44/58] fixed build --- .env.example | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index 601a509..f2092a3 100644 --- a/.env.example +++ b/.env.example @@ -12,7 +12,8 @@ DEV_MODE=reload,xml DOMAIN=erp.odoocker.test # Services -SERVICES=odoo,postgres,nginx,proxy +SERVICES=odoo,nginx,proxy,postgres +PROJECT_NAME=odoocker # Enterprise GITHUB_USER= @@ -95,7 +96,7 @@ AWS_HOST=http://s3:${S3_API_PORT} AWS_REGION= AWS_ACCESS_KEY_ID=myaccesskey AWS_SECRET_ACCESS_KEY=mysecretkey -AWS_BUCKETNAME=odoo-{db} +AWS_BUCKETNAME=${PROJECT_NAME}-{db} # PgAdmin PGADMIN_DOMAIN=pgadmin.odoocker.test @@ -114,7 +115,7 @@ PGADMIN_CONFIG_SERVER_MODE=True # Project Configurations # #------------------------------# # Docker -PROJECT_NAME=odoocker +PROJECT_NAME=${PROJECT_NAME} SUPPORT_EMAIL=mail@example.com # Service configuration From f956cabf571ee20c6439dc84fca062867e3a3d85 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Fri, 20 Oct 2023 01:40:28 -0500 Subject: [PATCH 45/58] cleanup --- docker-compose.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index f27093c..f758533 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ - - services: odoo: build: From 84dcb0b8a465bb2a3a0d6c2d4eb42a9d457a30dc Mon Sep 17 00:00:00 2001 From: Yhael S Date: Fri, 20 Oct 2023 01:52:52 -0500 Subject: [PATCH 46/58] fixed redis prefix --- .env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.example b/.env.example index f2092a3..823ba0a 100644 --- a/.env.example +++ b/.env.example @@ -80,7 +80,7 @@ REDIS_HOST=redis REDIS_PORT=6379 REDIS_PASSWORD= REDIS_URL= -REDIS_PREFIX=odoocker +REDIS_PREFIX=${PROJECT_NAME} REDIS_SENTINEL_MASTER_NAME= REDIS_SENTINEL_HOST= REDIS_SENTINEL_PORT=26379 From 59eb85669cacbb0c2894e9c6493cbdb137e5454c Mon Sep 17 00:00:00 2001 From: Yhael S Date: Fri, 20 Oct 2023 02:09:01 -0500 Subject: [PATCH 47/58] fix --- .env.example | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index 823ba0a..e22217d 100644 --- a/.env.example +++ b/.env.example @@ -12,8 +12,13 @@ DEV_MODE=reload,xml DOMAIN=erp.odoocker.test # Services -SERVICES=odoo,nginx,proxy,postgres PROJECT_NAME=odoocker +SERVICES=odoo,nginx,proxy,postgres + +# Service configuration +USE_REDIS=false +USE_S3=false +USE_SENTRY=false # Enterprise GITHUB_USER= @@ -119,9 +124,9 @@ PROJECT_NAME=${PROJECT_NAME} SUPPORT_EMAIL=mail@example.com # Service configuration -USE_REDIS=true -USE_S3=true -USE_SENTRY=false +USE_REDIS=${USE_REDIS} +USE_S3=${USE_S3} +USE_SENTRY=${USE_SENTRY} # Which services are going to be brought up COMPOSE_PROFILES=${SERVICES} From 3cd2a13244ab0c887a72fdb5df878fa63f4fab07 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Fri, 20 Oct 2023 02:24:28 -0500 Subject: [PATCH 48/58] fix --- .env.example | 2 ++ postgres/entrypoint.sh | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.env.example b/.env.example index e22217d..a49a584 100644 --- a/.env.example +++ b/.env.example @@ -19,6 +19,7 @@ SERVICES=odoo,nginx,proxy,postgres USE_REDIS=false USE_S3=false USE_SENTRY=false +USE_PGADMIN=false # Enterprise GITHUB_USER= @@ -127,6 +128,7 @@ SUPPORT_EMAIL=mail@example.com USE_REDIS=${USE_REDIS} USE_S3=${USE_S3} USE_SENTRY=${USE_SENTRY} +USE_PGADMIN=${USE_PGADMIN} # Which services are going to be brought up COMPOSE_PROFILES=${SERVICES} diff --git a/postgres/entrypoint.sh b/postgres/entrypoint.sh index b232538..35a1b35 100755 --- a/postgres/entrypoint.sh +++ b/postgres/entrypoint.sh @@ -20,13 +20,15 @@ psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $POSTGRES_DB -c "ALTER USER $DB psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $POSTGRES_DB -c "GRANT ALL PRIVILEGES ON DATABASE $DB_TEMPLATE TO $DB_USER;" psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $DB_TEMPLATE -c "ALTER DATABASE $DB_TEMPLATE OWNER TO $DB_USER;" -# Create PgAdmin user and give proper privileges -psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $POSTGRES_DB -c "CREATE DATABASE $PGADMING_DB_NAME;" -psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $POSTGRES_DB -c "CREATE USER $PGADMING_DB_USER WITH PASSWORD '$PGADMIN_DB_PASSWORD';" -psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $POSTGRES_DB -c "GRANT ALL PRIVILEGES ON DATABASE $PGADMING_DB_NAME TO $PGADMING_DB_USER;" -psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $PGADMING_DB_NAME -c "GRANT ALL PRIVILEGES ON SCHEMA public TO $PGADMING_DB_USER;" - -# Revoke Odoo user's access to pgadmin database -psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $POSTGRES_DB -c "REVOKE CONNECT ON DATABASE $PGADMING_DB_NAME FROM $DB_USER;" +# Check the USE_REDIS to add sentry to LOAD variable +if [[ $USE_PGADMIN == "true" ]]; then + # Create PgAdmin user and give proper privileges + psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $POSTGRES_DB -c "CREATE DATABASE $PGADMING_DB_NAME;" + psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $POSTGRES_DB -c "CREATE USER $PGADMING_DB_USER WITH PASSWORD '$PGADMIN_DB_PASSWORD';" + psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $POSTGRES_DB -c "GRANT ALL PRIVILEGES ON DATABASE $PGADMING_DB_NAME TO $PGADMING_DB_USER;" + psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $PGADMING_DB_NAME -c "GRANT ALL PRIVILEGES ON SCHEMA public TO $PGADMING_DB_USER;" + # Revoke Odoo user's access to pgadmin database + psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $POSTGRES_DB -c "REVOKE CONNECT ON DATABASE $PGADMING_DB_NAME FROM $DB_USER;" +fi echo "Setup completed." From a4823e8fcce87896102254d92e9664506ee51810 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Fri, 20 Oct 2023 02:50:38 -0500 Subject: [PATCH 49/58] fix --- .env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.example b/.env.example index a49a584..68fd795 100644 --- a/.env.example +++ b/.env.example @@ -151,7 +151,7 @@ MINIO_TAG=latest NGINX_TAG=1.25.2 NGINX_PROXY_TAG=1.3.1 ACME_COMPANION_TAG=2.2.8 -PGADMIN_TAG=7.6 +PGADMIN_TAG=7.8 # Odoocker paths COMMUNITY_ADDONS=${ROOT_PATH}/addons From 10a9bcc70ccc9c5ca49d69c7322aa50a3c21bd01 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Fri, 20 Oct 2023 04:16:20 -0500 Subject: [PATCH 50/58] fix --- docker-compose.override.production.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose.override.production.yml b/docker-compose.override.production.yml index ccec260..81e0e77 100644 --- a/docker-compose.override.production.yml +++ b/docker-compose.override.production.yml @@ -1,6 +1,6 @@ services: odoo: - restart: 'no' + restart: unless-stopped ports: - 127.0.0.1:8069:8069 - 127.0.0.1:8070:8070 @@ -8,15 +8,15 @@ services: - 127.0.0.1:8072:8072 postgres: - restart: 'no' + restart: unless-stopped ports: - 127.0.0.1:5432:5432 nginx: - restart: 'no' + restart: unless-stopped nginx-proxy: - restart: 'no' + restart: unless-stopped ports: - 80:80 - 443:443 From 7d2de6e31f6e9f8fbd7c544c727919b8b2a4595b Mon Sep 17 00:00:00 2001 From: Yhael S Date: Fri, 20 Oct 2023 11:04:53 -0500 Subject: [PATCH 51/58] power up nginx --- nginx-proxy/nginx.conf | 4 ++-- nginx/default.conf | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nginx-proxy/nginx.conf b/nginx-proxy/nginx.conf index 08927f5..4d17afa 100644 --- a/nginx-proxy/nginx.conf +++ b/nginx-proxy/nginx.conf @@ -5,7 +5,7 @@ error_log /var/log/nginx/error.log notice; pid /var/run/nginx.pid; events { - worker_connections 10240; + worker_connections 1024; } http { @@ -27,7 +27,7 @@ http { proxy_read_timeout 900; send_timeout 900; - client_max_body_size 1024m; + client_max_body_size 2048m; include /etc/nginx/conf.d/*.conf; include /etc/nginx/cors.conf; diff --git a/nginx/default.conf b/nginx/default.conf index 3d17cb8..424a6be 100644 --- a/nginx/default.conf +++ b/nginx/default.conf @@ -4,7 +4,7 @@ map $http_x_cors_allowed_domain $CORS_ALLOWED_DOMAIN { } server { - client_max_body_size 1024m; + client_max_body_size 2048m; proxy_connect_timeout 900; proxy_send_timeout 900; From bd65372798d1eaf7742ff04e3bf3b196437c2110 Mon Sep 17 00:00:00 2001 From: odoocker Date: Fri, 20 Oct 2023 19:38:30 +0000 Subject: [PATCH 52/58] fixed env --- docker-compose.yml | 2 -- pgadmin/Dockerfile | 9 ++++++--- pgadmin/start_pgadmin.sh | 3 --- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index f758533..4151c34 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -173,8 +173,6 @@ services: dockerfile: ./pgadmin/Dockerfile args: - PGADMIN_TAG - depends_on: - - postgres restart: 'no' expose: - 80 diff --git a/pgadmin/Dockerfile b/pgadmin/Dockerfile index 7ad3adc..848ede4 100644 --- a/pgadmin/Dockerfile +++ b/pgadmin/Dockerfile @@ -15,9 +15,12 @@ USER root # Install bash RUN apk add --no-cache bash jq sqlite -# Conditionally copy the private key if it exists -COPY --chown=pgadmin:root ./pgadmin/private_key /pgadmin4/private_key -# Set permissions for the private key +# Check if the private key exists, copy it and set permissions if it does +RUN if [ -f ./pgadmin/private_key ]; then \ + cp ./pgadmin/private_key /pgadmin4/private_key && \ + chown pgadmin:root /pgadmin4/private_key && \ + chmod 600 /pgadmin4/private_key; \ + fi # Copy your script file into the Docker image COPY --chown=pgadmin:root ./.env / diff --git a/pgadmin/start_pgadmin.sh b/pgadmin/start_pgadmin.sh index 3a0d7fe..e8133b4 100755 --- a/pgadmin/start_pgadmin.sh +++ b/pgadmin/start_pgadmin.sh @@ -19,9 +19,6 @@ DIR_NAME="/var/lib/pgadmin/storage/${PGADMIN_DEFAULT_EMAIL//@/_}" # Create the directory using the modified name mkdir -p "$DIR_NAME" -cp /pgadmin4/private_key "$DIR_NAME/private_key" -chown -R pgadmin:root "$DIR_NAME/private_key" - # Generate JSON for each matching variable DB_PATH="/var/lib/pgadmin/pgadmin4.db" json_output="{\"Servers\":{" From cd3bd7ee83b2aecbf77df042a8aea52ead67bbed Mon Sep 17 00:00:00 2001 From: Yhael S Date: Sat, 21 Oct 2023 19:01:25 -0500 Subject: [PATCH 53/58] fixed pr template --- .github/pull_request_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 0749d0a..ee4da10 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,6 +1,6 @@ ### :rocket: Deployment - `INIT="my_custom_addon_1"` -- `ADDONS_TO_UPGRADE="my_custom_addon_2"` +- `UPDATE="my_custom_addon_2"` ### :jigsaw: Odoo/Asana Tasks - *Paste Task URL* From 0c2b41aed355e5ec5f97303e34fb6bfc17616ae5 Mon Sep 17 00:00:00 2001 From: Yhael S Date: Sun, 22 Oct 2023 02:15:34 -0500 Subject: [PATCH 54/58] fixed postgres template --- postgres/entrypoint.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/postgres/entrypoint.sh b/postgres/entrypoint.sh index 35a1b35..f6a832e 100755 --- a/postgres/entrypoint.sh +++ b/postgres/entrypoint.sh @@ -10,7 +10,8 @@ set +a # Create the $DB_TEMPLATE database psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $POSTGRES_DB -c "CREATE DATABASE $DB_TEMPLATE WITH TEMPLATE = template0;" psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $POSTGRES_DB -c "\\c $DB_TEMPLATE;" -psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $POSTGRES_DB -c "CREATE EXTENSION IF NOT EXISTS unaccent;" +psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $DB_TEMPLATE -c "CREATE EXTENSION IF NOT EXISTS unaccent;" +psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $DB_TEMPLATE -c "ALTER FUNCTION unaccent(text) IMMUTABLE;" # Create Odoo user and give proper privileges psql -p $POSTGRES_PORT -U $POSTGRES_MAIN_USER -d $POSTGRES_DB -c "CREATE USER $DB_USER WITH PASSWORD '$DB_PASSWORD';" From 78380ad296be7d8ed06185295a70536798d39a6c Mon Sep 17 00:00:00 2001 From: Yhael S Date: Sun, 22 Oct 2023 03:33:27 -0500 Subject: [PATCH 55/58] cleanup --- .env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 68fd795..bf17f74 100644 --- a/.env.example +++ b/.env.example @@ -10,6 +10,7 @@ ROOT_PATH=/usr/lib/python3/dist-packages/odoo WORKERS=2 DEV_MODE=reload,xml DOMAIN=erp.odoocker.test +ADMIN_PASSWD=odoo # Services PROJECT_NAME=odoocker @@ -26,7 +27,6 @@ GITHUB_USER= GITHUB_ACCESS_TOKEN= # Database -ADMIN_PASSWD=odoo DB_HOST=postgres DB_PORT=5432 DB_NAME= From eaab5db2cb18da6b48c4c32c86ae0760cddefc6e Mon Sep 17 00:00:00 2001 From: yhaelopez Date: Tue, 12 Dec 2023 18:57:24 -0700 Subject: [PATCH 56/58] minimal upgrades --- .env.example | 12 ++++++------ odoo/entrypoint.sh | 6 +++--- odoo/odoo.conf | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.env.example b/.env.example index bf17f74..4b485ee 100644 --- a/.env.example +++ b/.env.example @@ -7,7 +7,7 @@ INIT= UPDATE= LOAD=base,web ROOT_PATH=/usr/lib/python3/dist-packages/odoo -WORKERS=2 +WORKERS=0 DEV_MODE=reload,xml DOMAIN=erp.odoocker.test ADMIN_PASSWD=odoo @@ -145,13 +145,13 @@ PGADMIN_PROFILES="pgadmin" # Containers' Tags ODOO_TAG=16.0 -POSTGRES_TAG=16.0 +POSTGRES_TAG=16.1 KEYDB_TAG=latest MINIO_TAG=latest -NGINX_TAG=1.25.2 -NGINX_PROXY_TAG=1.3.1 -ACME_COMPANION_TAG=2.2.8 -PGADMIN_TAG=7.8 +NGINX_TAG=1.25.3 +NGINX_PROXY_TAG=1.4.0 +ACME_COMPANION_TAG=2.2.9 +PGADMIN_TAG=8.0 # Odoocker paths COMMUNITY_ADDONS=${ROOT_PATH}/addons diff --git a/odoo/entrypoint.sh b/odoo/entrypoint.sh index 399249f..8f04cc2 100755 --- a/odoo/entrypoint.sh +++ b/odoo/entrypoint.sh @@ -50,7 +50,7 @@ case "$1" in # Listens to all .env variables mapped into odoo.conf file. echo odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=${UPDATE} --load=${LOAD} --workers=${WORKERS} --log-level=${LOG_LEVEL} --dev=${DEV_MODE} - exec odoo --config ${ODOO_RC} + exec odoo --config ${ODOO_RC} --init=${INIT} --update=${UPDATE} --dev=${DEV_MODE} fi if [ ${APP_ENV} = 'debug' ] ; then @@ -76,9 +76,9 @@ case "$1" in if [ ${APP_ENV} = 'production' ] ; then # Bring up Odoo ready for production. - echo odoo --config ${ODOO_RC} --database= --init= --update= --load=${LOAD} --workers=${WORKERS} --log-level=${LOG_LEVEL} --load-language= --without-demo=all --dev= + echo odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=${UPDATE} --load=${LOAD} --workers=${WORKERS} --log-level=${LOG_LEVEL} --without-demo=${WITHOUT_DEMO} --load-language= --dev= - exec odoo --config ${ODOO_RC} --database= --init= --update= --load-language= --without-demo=all --dev= + exec odoo --config ${ODOO_RC} --init=${INIT} --update=${UPDATE} --load-language= --dev= fi fi ;; diff --git a/odoo/odoo.conf b/odoo/odoo.conf index f202f75..1c0d456 100644 --- a/odoo/odoo.conf +++ b/odoo/odoo.conf @@ -64,7 +64,7 @@ xmlrpcs_interface = ${XMLRPCS_INTERFACE} ; --xmlrpcs-port xmlrpcs_port = ${XMLRPCS_PORT} -; --gevent-port | --longpolling_port (deprecated) +; --gevent-port | --longpolling-port (deprecated) gevent_port = ${GEVENT_PORT} ; --no-http | --no-xmlrpc From 566c52813abfe98323fba0c5c051b14e4c421e5f Mon Sep 17 00:00:00 2001 From: yhaelopez Date: Tue, 12 Dec 2023 19:18:22 -0700 Subject: [PATCH 57/58] adjusted odoo version --- .env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 4b485ee..f329dad 100644 --- a/.env.example +++ b/.env.example @@ -144,7 +144,7 @@ MINIO_PROFILES="minio" PGADMIN_PROFILES="pgadmin" # Containers' Tags -ODOO_TAG=16.0 +ODOO_TAG=15.0 POSTGRES_TAG=16.1 KEYDB_TAG=latest MINIO_TAG=latest From 235b72752540a6a264286431c5ca89324704dbf4 Mon Sep 17 00:00:00 2001 From: yhaelopez Date: Tue, 12 Dec 2023 20:22:12 -0700 Subject: [PATCH 58/58] fixed 15 params --- .env.example | 2 +- odoo/odoo.conf | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index f329dad..3c589de 100644 --- a/.env.example +++ b/.env.example @@ -196,7 +196,7 @@ DEBUG_INTERFACE=${HTTP_INTERFACE} HTTP_PORT=8069 DEBUG_PORT=8070 XMLRPCS_PORT=8071 -GEVENT_PORT=8072 +LONGPOLLING_PORT=8072 HTTP_ENABLE=True XMLRPCS=True PROXY_MODE=True diff --git a/odoo/odoo.conf b/odoo/odoo.conf index 1c0d456..c285553 100644 --- a/odoo/odoo.conf +++ b/odoo/odoo.conf @@ -64,8 +64,8 @@ xmlrpcs_interface = ${XMLRPCS_INTERFACE} ; --xmlrpcs-port xmlrpcs_port = ${XMLRPCS_PORT} -; --gevent-port | --longpolling-port (deprecated) -gevent_port = ${GEVENT_PORT} +; --longpolling-port +longpolling_port = ${LONGPOLLING_PORT} ; --no-http | --no-xmlrpc http_enable = ${HTTP_ENABLE}