framework upgrade

This commit is contained in:
Yhael S
2023-08-25 02:08:56 -05:00
parent 45d19223c7
commit b822c082c7
21 changed files with 576 additions and 421 deletions

View File

@@ -1,38 +1,74 @@
#--------------------------# #--------------------------#
# Main Configuration # # Main Configuration #
#--------------------------# #--------------------------#
APP_ENV=fresh # Project
ADDONS_TO_UPDATE= PROJECT_NAME=odoocker
ADDONS_TO_INSTALL= DOMAIN=erp.odoocker.test
SUPPORT_EMAIL=mail@example.com
CORS_ALLOWED_DOMAIN="'http://external-domain.test'"
# App
APP_ENV=fresh
DEV_MODE=reload,qweb
# Odoo
ODOO_VERSION=14.0
UPDATE=
INIT=
LOAD=base,web
WORKERS=1
# Enterprise
GITHUB_USER=
GITHUB_ACCESS_TOKEN=
# Database
ADMIN_PASSWD=odoo
DB_HOST=postgres
DB_PORT=5432
DB_NAME=odoo DB_NAME=odoo
DB_USER=odoo DB_USER=odoo
DB_PASSWORD=odoo DB_PASSWORD=odoo
DB_SSLMODE=prefer
DB_MAXCONN=64
DB_TEMPLATE=unaccent_template
UNACCENT=True
LIST_DB=True
DBFILTER=.*
LOAD_LANGUAGE=
# Logging
LOG_LEVEL=info LOG_LEVEL=info
LOG_HANDLER="[':INFO']" LOG_HANDLER="[':INFO']"
# PgAdmin
PGADMIN_DOMAIN=pgadmin.odoocker.test
PGADMIN_PASSWORD=odoo
# Testing
TEST_ENABLE=False
TEST_TAGS=
ADDONS_TO_TEST=
# Mail
SMTP_SERVER= SMTP_SERVER=
SMTP_PORT=25 SMTP_PORT=25
SMTP_SSL= SMTP_SSL=
SMTP_USER= SMTP_USER=
SMTP_PASSWORD= SMTP_PASSWORD=
EMAIL_FROM= EMAIL_FROM=
FROM_FILTER=
ADMIN_PASSWD=odoo
DOMAIN=erp.odoo.test
PGADMIN_DOMAIN=pgadmin.odoo.test
PGADMIN_PASSWORD=${DB_PASSWORD}
LOAD_LANGUAGE=en_US
DEV_MODE=False
DEBUG_MODE=False
#------------------------------# #------------------------------#
# Project Configurations # # Project Configurations #
#------------------------------# #------------------------------#
PROJECT_NAME=odoocker PROJECT_NAME=${PROJECT_NAME}
DOMAIN=${DOMAIN} DOMAIN=${DOMAIN}
SUPPORT_EMAIL=example@mail.com SUPPORT_EMAIL=${SUPPORT_EMAIL}
ODOO_VERSION=${ODOO_VERSION}
GITHUB_USER=${GITHUB_USER}
GITHUB_ACCESS_TOKEN=${GITHUB_ACCESS_TOKEN}
ENTERPRISE_REPO=https://${GITHUB_USER}:${GITHUB_ACCESS_TOKEN}@github.com/odoo/enterprise.git
#------------# #------------#
# Odoo # # Odoo #
@@ -46,33 +82,37 @@ REPORTGZ=False
WEBSOCKET_KEEP_ALIVE_TIMEOUT=3600 WEBSOCKET_KEEP_ALIVE_TIMEOUT=3600
WEBSOCKET_RATE_LIMIT_BURST=10 WEBSOCKET_RATE_LIMIT_BURST=10
WEBSOCKET_RATE_LIMIT_DELAY=0.2 WEBSOCKET_RATE_LIMIT_DELAY=0.2
# Custom paths # Custom paths
COMMUNITY_ADDONS=${ROOT_PATH}/addons COMMUNITY_ADDONS=${ROOT_PATH}/addons
ENTERPRISE_ADDONS=${ROOT_PATH}/enterprise ENTERPRISE_ADDONS=${ROOT_PATH}/enterprise
EXTRA_ADDONS=${ROOT_PATH}/extra-addons EXTRA_ADDONS=${ROOT_PATH}/extra-addons
CUSTOM_ADDONS=${ROOT_PATH}/custom-addons CUSTOM_ADDONS=${ROOT_PATH}/custom-addons
LOG_PATH=/var/log/odoo/odoo.log
DEBUG_PATH=/usr/bin/odoo
# Server startup config # Server startup config
ODOO_RC=/etc/odoo/odoo.conf ODOO_RC=/etc/odoo/odoo.conf
SAVE=False SAVE=False
INIT=${ADDONS_TO_INSTALL} INIT=${INIT}
UPDATE=${ADDONS_TO_UPDATE} UPDATE=${UPDATE}
DEMO=False DEMO=False
WITHOUT_DEMO=all WITHOUT_DEMO=all
IMPORT_PARTIAL= IMPORT_PARTIAL=False
PIDFILE= PIDFILE=
ADDONS_PATH=${COMMUNITY_ADDONS},${ENTERPRISE_ADDONS},${EXTRA_ADDONS},${CUSTOM_ADDONS} ADDONS_PATH=${COMMUNITY_ADDONS},${ENTERPRISE_ADDONS},${EXTRA_ADDONS},${CUSTOM_ADDONS}
UPGRADE_PATH= UPGRADE_PATH=
SERVER_WIDE_MODULES=base,web SERVER_WIDE_MODULES=${LOAD}
DATA_DIR=/var/lib/odoo DATA_DIR=/var/lib/odoo
# HTTP # HTTP
HTTP_INTERFACE=0.0.0.0 HTTP_INTERFACE=0.0.0.0
XMLRPCS_INTERFACE=${HTTP_INTERFACE}
DEBUG_INTERFACE=${HTTP_INTERFACE}
HTTP_PORT=8069 HTTP_PORT=8069
XMLRPCS_INTERFACE=0.0.0.0 DEBUG_PORT=8070
XMLRPCS_PORT=8071 XMLRPCS_PORT=8071
GEVENT_PORT=8072 LONGPOLLING_PORT=8072
LONGPOLLING_PORT=0
HTTP_ENABLE=True HTTP_ENABLE=True
XMLRPCS=True XMLRPCS=True
PROXY_MODE=True PROXY_MODE=True
@@ -80,22 +120,22 @@ X_SENDFILE=False
# Testing # Testing
TEST_FILE=False TEST_FILE=False
TEST_ENABLE=False TEST_ENABLE=${TEST_ENABLE}
TEST_TAGS=None TEST_TAGS=${TEST_TAGS}
SCREENCASTS=None SCREENCASTS=None
SCREENSHOTS=/tmp/odoo_tests SCREENSHOTS=/tmp/odoo_tests
# Logging # Logging
LOGFILE= LOGFILE=
SYSLOG=False SYSLOG=False
LOG_HANDLER="[':INFO']" LOG_HANDLER=${LOG_HANDLER}
LOG_DB=False LOG_DB=False
LOG_DB_LEVEL=info LOG_DB_LEVEL=info
LOG_LEVEL=info LOG_LEVEL=${LOG_LEVEL}
# Email # Email
EMAIL_FROM=${EMAIL_FROM} EMAIL_FROM=${EMAIL_FROM}
FROM_FILTER=False FROM_FILTER=${FROM_FILTER}
SMTP_SERVER=${SMTP_SERVER} SMTP_SERVER=${SMTP_SERVER}
SMTP_PORT=${SMTP_PORT} SMTP_PORT=${SMTP_PORT}
SMTP_SSL=${SMTP_SSL} SMTP_SSL=${SMTP_SSL}
@@ -109,11 +149,11 @@ DB_NAME=${DB_NAME}
DB_USER=${DB_USER} DB_USER=${DB_USER}
DB_PASSWORD=${DB_PASSWORD} DB_PASSWORD=${DB_PASSWORD}
PG_PATH= PG_PATH=
DB_HOST=postgres DB_HOST=${DB_HOST}
DB_PORT=5432 DB_PORT=${DB_PORT}
DB_SSLMODE=prefer DB_SSLMODE=${DB_SSLMODE}
DB_MAXCONN=64 DB_MAXCONN=${DB_MAXCONN}
DB_TEMPLATE=unaccent_template DB_TEMPLATE=${DB_TEMPLATE}
# Internationalisation options # Internationalisation options
LOAD_LANGUAGE=${LOAD_LANGUAGE} LOAD_LANGUAGE=${LOAD_LANGUAGE}
LANGUAGE= LANGUAGE=
@@ -122,30 +162,27 @@ TRANSLATE_IN=
OVERWRITE_EXISTING_TRANSLATIONS=False OVERWRITE_EXISTING_TRANSLATIONS=False
TRANSLATE_MODULES="['all']" TRANSLATE_MODULES="['all']"
# Security # Security
LIST_DB=True LIST_DB=${LIST_DB}
# WEB # WEB
DBFILTER=.* DBFILTER=${DBFILTER}
# Advanced options # Advanced options
DEV_MODE=${DEV_MODE} DEV_MODE=${DEV_MODE}
DEBUG_MODE=${DEBUG_MODE}
SHELL_INTERFACE=ptpython SHELL_INTERFACE=ptpython
STOP_AFTER_INIT=False STOP_AFTER_INIT=False
OSV_MEMORY_COUNT_LIMIT=False OSV_MEMORY_COUNT_LIMIT=False
TRANSIENT_AGE_LIMIT=1.0 TRANSIENT_AGE_LIMIT=1.0
MAX_CRON_THREADS=2 MAX_CRON_THREADS=2
UNACCENT=True UNACCENT=${UNACCENT}
GEOIP_DATABASE=/usr/share/GeoIP/GeoLite2-City.mmdb GEOIP_DATABASE=/usr/share/GeoIP/GeoLite2-City.mmdb
WORKERS=0 WORKERS=${WORKERS}
LIMIT_MEMORY_SOFT=2147483648 LIMIT_MEMORY_SOFT=2147483648
LIMIT_MEMORY_HARD=2684354560 LIMIT_MEMORY_HARD=2684354560
LIMIT_TIME_CPU=120 LIMIT_TIME_CPU=120
LIMIT_TIME_REAL=240 LIMIT_TIME_REAL=480
LIMIT_TIME_REAL_CRON=600 LIMIT_TIME_REAL_CRON=600
LIMIT_REQUEST=8192 LIMIT_REQUEST=8192
INSTALLED_MODULES=
#--------------# #--------------#
# Docker # # Docker #
#--------------# #--------------#
@@ -171,7 +208,7 @@ NGINX_DEFAULT_CONF=/etc/nginx/conf.d/default.conf
VIRTUAL_HOST=${DOMAIN} VIRTUAL_HOST=${DOMAIN}
LETSENCRYPT_HOST=${DOMAIN} LETSENCRYPT_HOST=${DOMAIN}
LETSENCRYPT_EMAIL=${SUPPORT_EMAIL} LETSENCRYPT_EMAIL=${SUPPORT_EMAIL}
CORS_ALLOWED_DOMAIN="'https://sub.domain.com'" CORS_ALLOWED_DOMAIN=${CORS_ALLOWED_DOMAIN}
#-------------# #-------------#
# PgAdmin # # PgAdmin #

View File

@@ -1,11 +1,22 @@
## :rocket: Deployment ### :rocket: Deployment
- `ADDONS_TO_INSTALL="my_custom_addon"` - `INIT="my_custom_addon_1"`
- `ADDONS_TO_UPGRADE="contacts,sale"` - `ADDONS_TO_UPGRADE="my_custom_addon_2"`
## :memo: Changes ### :jigsaw: Odoo/Asana Tasks
- *Paste Task URL*
### :memo: Changes
**Change 1: *Title*** **Change 1: *Title***
- In detail, explain what changes were made. - In detail, explain what changes were made.
*Add links and screenshots* *Add links, videos and screenshots here*
<hr> <hr>
### :white_check_mark: Code Review Checklist
- [ ] Comments are present where appropriate and provide useful information, **not just stating what the code is obviously doing**.
- [ ] No values have been hard-coded where they should be declared as constant.
- [ ] Successfully passed all tests when implemented.
- [ ] Install package(s) without additional **WARNINGS** or **ERRORS**.
- [ ] Update package(s) without additional **WARNINGS** or **ERRORS**.
- [ ] Uninstall package(s) without additional **WARNINGS** or **ERRORS**.

3
.gitignore vendored
View File

@@ -3,3 +3,6 @@
# Ignores the docker compose local or production environment. # Ignores the docker compose local or production environment.
docker-compose.override.yml docker-compose.override.yml
# Ignores any __pycache__ folder.
__pycache__

18
.vscode/launch.json vendored
View File

@@ -2,26 +2,18 @@
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{ {
"name": "Odoocker Debug", "name": "Odoocker Debugger",
"type": "python", "type": "python",
"request": "attach", "request": "attach",
"host": "localhost", "host": "localhost",
"port": 8069, "port": 8069,
"debugServer": 8071, "debugServer": 8070,
"justMyCode": false, "justMyCode": false,
"pathMappings": [ "pathMappings": [
{ {
"localRoot": "${workspaceFolder}/odoo/custom-addons", "localRoot": "${workspaceFolder}/odoo",
"remoteRoot": "/usr/lib/python3/dist-packages/odoo/custom-addons" "remoteRoot": "/usr/lib/python3/dist-packages/odoo"
}, }
{
"localRoot": "${workspaceFolder}/odoo/extra-addons",
"remoteRoot": "/usr/lib/python3/dist-packages/odoo/extra-addons"
},
// {
// "localRoot": "${workspaceFolder}/core/odoo",
// "remoteRoot": "/usr/bin/odoo"
// }
] ]
} }
] ]

259
README.md
View File

@@ -7,22 +7,20 @@ git clone git@github.com:yhaelopez/odoocker.git
``` ```
cp .env.example .env && cp docker-compose.override.local.yml docker-compose.override.yml cp .env.example .env && cp docker-compose.override.local.yml docker-compose.override.yml
``` ```
3. Manually add entry to your `hosts` file as below (Local) 3. Manually add entry to your `hosts` file as below
``` ```
echo '127.0.0.1 erp.odoo.test' | sudo tee -a /etc/hosts echo '127.0.0.1 erp.icomsa.test' | sudo tee -a /etc/hosts
echo '127.0.0.1 pgadmin.odoo.test' | sudo tee -a /etc/hosts echo '127.0.0.1 pgadmin.icomsa.test' | sudo tee -a /etc/hosts
``` ```
- For Windows, go to `C:\Windows\System32\drivers\etc\`, and add this line: - For Windows, go to `C:\Windows\System32\drivers\etc\`, and add this line:
``` ```
127.0.0.1 erp.odoo.test 127.0.0.1 erp.icomsa.test
127.0.0.1 pgadmin.odoo.test 127.0.0.1 pgadmin.icomsa.test
``` ```
In order to understand how each environment works, take a look at `odoo/entrypoint.sh`. In order to understand how each environment works, take a look at `odoo/entrypoint.sh`.
``` **Default Master Password:** odoo
Master Password: odoo
```
## Fresh Environment ## Fresh Environment
This environment will have no database created. This environment will have no database created.
@@ -30,7 +28,7 @@ The `env.example` is ready for this stage, no modifications are needed on `.env`
1. Make sure `APP_ENV=fresh`. 1. Make sure `APP_ENV=fresh`.
2. Run 2. Run
``` ```
docker-compose up --build -d && docker-compose logs -f odoo docker-compose up -d --build && docker-compose logs -f odoo
``` ```
3. Navigate to the `DOMAIN` in your browser. 3. Navigate to the `DOMAIN` in your browser.
4. Create Database form will be displayed. 4. Create Database form will be displayed.
@@ -41,9 +39,32 @@ docker-compose stop odoo
``` ```
7. Set [`Local`](https://github.com/yhaelopez/odoocker#local-environment) environment. 7. Set [`Local`](https://github.com/yhaelopez/odoocker#local-environment) environment.
## Restore Environment
This environment will have no database created and it's ready to make an import on the production database.
1. Set `APP_ENV=restore`.
2. Run:
```
docker-compose up -d --build && docker-compose logs -f odoo
```
3. Navigate to the `DOMAIN` in your browser & Restore the production database
4. Stop the Odoo container:
```
docker-compose stop odoo
```
5. Set [`Local`](https://github.com/yhaelopez/odoocker#local-environment) environment.
#### If you are in a production server:
6. Run [`Staging`](https://github.com/yhaelopez/odoocker#staging-environment) environment.
7. Stop the Odoo container:
```
docker-compose stop odoo
```
8. Run the [`Production`](https://github.com/yhaelopez/odoocker#production-environment) environment.
## Full Environment ## Full Environment
This environment will initialize a database with `DB_NAME` and install the `INSTALLED_MODULES`. This environment will initialize a database with `DB_NAME` and install the `INSTALLED_MODULES`.
This allows us to have a fresh database will all modules installed in production. This allows us to have a fresh production database replica.
1. Make sure `APP_ENV=full`. 1. Make sure `APP_ENV=full`.
2. Make sure `DB_NAME=odoo` or whatever name you want. 2. Make sure `DB_NAME=odoo` or whatever name you want.
3. Run 3. Run
@@ -62,39 +83,16 @@ docker-compose stop odoo
``` ```
7. Set [`Local`](https://github.com/yhaelopez/odoocker#local-environment) environment. 7. Set [`Local`](https://github.com/yhaelopez/odoocker#local-environment) environment.
## Restore Environment
This environment will have no database created and it's ready to make an import on the production database.
1. Set `APP_ENV=restore`.
2. Run:
```
docker-compose up --build -d && docker-compose logs -f odoo
```
3. Navigate to the `DOMAIN` in your browser & Restore the production database
4. Stop the Odoo container:
```
docker-compose stop odoo
```
5. Set [`Local`](https://github.com/yhaelopez/odoocker#local-environment) environment.
--- If you are in a production server:
6. Set [`Staging`](https://github.com/yhaelopez/odoocker#staging-environment) environment.
7. Stop the Odoo container:
```
docker-compose stop odoo
```
8. Run the [`Production`](https://github.com/yhaelopez/odoocker#production-environment) environment.
## Local Environment ## Local Environment
This environment will help us install / update the specific modules we are working on. This environment will help us install / update the specific modules we are working on.
It's recommended to use this environment after [`Fresh`](https://github.com/yhaelopez/odoocker#fresh-environment), [`Full`](https://github.com/yhaelopez/odoocker#full-environment) or [`Restore`](https://github.com/yhaelopez/odoocker#fresh-environment) environments are run. It's recommended to use this environment after [`Fresh`](https://github.com/yhaelopez/odoocker#fresh-environment), [`Full`](https://github.com/yhaelopez/odoocker#full-environment) or [`Restore`](https://github.com/yhaelopez/odoocker#fresh-environment) environments are run.
1. Make sure `APP_ENV=local`. 1. Make sure `APP_ENV=local`.
2. Make sure `DB_NAME` is set. 2. Make sure `DB_NAME` is set.
3. Set `ADDONS_TO_UPDATE=module1,module2,module3`. 3. Set `UPDATE=module1,module2,module3`.
4. Run: 4. Run:
``` ```
docker-compose up --build -d odoo && docker-compose logs -f odoo docker-compose up -d --build && docker-compose logs -f odoo
``` ```
5. Navigate to the `DOMAIN` in your browser. 5. Navigate to the `DOMAIN` in your browser.
6. Start coding! 6. Start coding!
@@ -102,15 +100,123 @@ docker-compose up --build -d odoo && docker-compose logs -f odoo
``` ```
docker-compose restart odoo && docker-compose logs -f odoo docker-compose restart odoo && docker-compose logs -f odoo
``` ```
- If you think your package is not being updated, run: - If you need to change a .env variable, run:
``` ```
docker-compose up --build -d odoo && docker-compose logs -f odoo docker-compose up -d --build && docker-compose logs -f odoo
``` ```
8. Any time you add a new addon to `ADDONS_TO_UPDATE` re-run last step
## Additional Local Help ## Debug Environment
This environment will bring up Odoo with `debugpy` library.
It's recommended to use this environment after [`Fresh`](https://github.com/yhaelopez/odoocker#fresh-environment), [`Full`](https://github.com/yhaelopez/odoocker#full-environment) or [`Restore`](https://github.com/yhaelopez/odoocker#fresh-environment) environments are run.
It works the same exact way as [`Local`](https://github.com/yhaelopez/odoocker#local-environment), since it respects any change in `.env` file.
### Creating new Odoo Addons 1. Make sure `APP_ENV=debug`.
2. Make sure `DB_NAME` is set.
3. Set `UPDATE=module1,module2,module3`.
4. Run:
```
docker-compose up -d --build && docker-compose logs -f odoo
```
5. Navigate to the `DOMAIN` in your browser.
6. Mark breakpoints through the code.
7. Start VSCode Debugger
8. Start debugging!
9. Continue coding as if you were in [`Local`](https://github.com/yhaelopez/odoocker#local-environment)
## Testing Environment
This environment will help us test the modules we are developing to ensure a safe deployment.
A `test_*` database is automagically created, addons to test get installed, test are filtered and run by their tags.
Odoo will stop after running the tests.
1. Set `APP_ENV=testing`.
2. Set `ADDONS_TO_TEST=addon_1,addon_2`.
3. Set `TEST_TAGS=test_tag_1,test_tag_2` to fitler tests.
4. Run:
```
docker-compose down && docker-compose up -d --build && docker-compose logs -f odoo
```
## Staging Environment
This environment performs a full update on all installed modules to test if they all can be upgraded at once.
This also allows to install new packages through `INIT`
1. Set `APP_ENV=staging`
2. Set `DB_NAME` to the desired one.
3. Set `INIT` if there are any.
5. Run
```
git pull && docker-compose down && docker-compose pull && docker-compose build --no-cache && docker-compose up -d && docker-compose logs -f odoo
```
7. Check Odoo continues to work as expected.
8. Change environment immediatly after finish testing.
**Do not bring down & up again unless you want to perform a whole update again.**
## Production Environment
This environment has a preset of settings to work in production. Some `.env` variables won't work because are overwritten in the odoo command.
Let's imagine we are migrating a database from another server.
1. Set `APP_ENV=production`
2. Set prod `DB_NAME`.
3. Set prod `DB_PASSWORD`.
4. Set prod `ADMIN_PASSWD`.
5. Set prod `DOMAIN` (make sure DNS are pointing to your instance).
6. Run [`Restore`](https://github.com/yhaelopez/odoocker#restore-environment) environment
7. Run [`Staging`](https://github.com/yhaelopez/odoocker#staging-environment) environment.
8. Repace the `docker-compose.override.yml` with `docker-compose.override.production.yml`.
This will bring Let's Encrypt (Nginx-Proxy/Acme-Companion) container
```
cp docker-compose.override.production.yml docker-compose.override.yml
```
9. Rebuild the containers
```
docker-compose down && docker-compose up -d --build && docker-compose logs odoo
```
### Pro(d) Tips
The following tips will enhance your developing and production experience.
#### Define the following aliases:
```
alias odoo='cd odoo-icomsa'
alias hard-deploy='git pull && docker-compose down && docker-compose pull && docker-compose build --no-cache && docker-compose up -d && docker-compose logs -f odoo'
alias deploy='git pull && docker-compose down && docker-compose pull && docker-compose build && docker-compose up -d && docker-compose logs -f --tail 2000 odoo'
alias soft-deploy='git pull && docker-compose down && docker-compose up -d --build && docker-compose logs -f --tail 2000 odoo'
alias logs='docker-compose logs -f --tail 2000 odoo'
```
#### NEVER run
```
docker-compose down **-v**
```
...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!
Also, if you do this process several times in a short period of time, you may reach `Let's Encrypt` certificates limits and won't be able to generate new ones after **several hours**.
#### Colorize your branches
Add the following to `~/.bashrc`
```
# Color git branches
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
if [ "$color_prompt" = yes ]; then
#PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
# Color git branches
PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w \[\033[01;31m\]\$(parse_git_branch)\[\033[00m\]\$ "
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
```
#### Creating new Odoo Addons
1. Log into the odoo container 1. Log into the odoo container
``` ```
docker-compose exec -u root odoo docker-compose exec -u root odoo
@@ -125,7 +231,7 @@ odoo scaffold <addon_name>
``` ```
- The new addon will be available in the `odoo/custom_addons` folder in this project. - The new addon will be available in the `odoo/custom_addons` folder in this project.
### Using Odoo Shell #### Using Odoo Shell
1. Log into the odoo container 1. Log into the odoo container
``` ```
docker-compose exec odoo bash docker-compose exec odoo bash
@@ -135,58 +241,26 @@ docker-compose exec odoo bash
odoo shell --http-port=8071 odoo shell --http-port=8071
``` ```
5. Connect to database through any Postgres Database Manager using `localhost` and the `.env` credentials # DB Connection
- Any other Postgres Database Manager con connect to the DB using `.env` credentials.
## Testing Environment (Work in progress...) DO NOT USE ## PgAdmin Container
This environment will help us test all modules to ensure a safe deployment. - This project comes with a PgAdmin container which is loaded only in `docker-compose.override.pgadmin.yml`.
It's recommneded to use this environment after importing production database in a Fresh environment. In order to manage DB we provide a pgAdmin container.
1. Replace `docker-compose.override.yml` with `docker-compose.override.testing.yml` In order to bring this up, simply run:
This will set up the Odoo container will all the packages installed needed to run the tests.
``` ```
cp docker-compose.override.testing.yml docker-compose.override.yml docker-compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.pgadmin.yml up -d --build
``` ```
2. Clone Production Database as `test_${DB_NAME}`. And to turn down
3. Set `APP_ENV=testing`.
4. Set `DB_NAME=test_${DB_NAME}` or whatever db you set before.
5. Run:
``` ```
docker-compose down && docker-compose pull && docker-compose build --no-cache && docker-compose up -d && docker-compose logs -f odoo docker-compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.pgadmin.yml down
``` ```
## Staging If your instance has pgAdmin, make sure you adapt this to your aliases.
This environment allows us to perfom a full update on all installed modules to test if they all can be upgraded at once.
This also allows to install new packages through `ADDONS_TO_INSTALL`
1. Set `APP_ENV=staging`
2. Set `DB_NAME` to the desired one.
3. Set `ADDONS_TO_INSTALL` if there are any.
5. Run
```
git pull && docker-compose down && docker-compose pull && docker-compose build --no-cache && docker-compose up -d && docker-compose logs -f odoo
```
7. Check Odoo continues to work as expected.
8. Change environment immediatly after finish testing.
**Do not bring down & up again unless you want to perform the whole update again.** # Deployment Process
Note: the deployment process is easier & faster with aliases.
# Production
1. Set `APP_ENV=production`
2. Set prod `DB_NAME`.
3. Set prod `DB_PASSWORD`.
4. Set prod `ADMIN_PASSWD`.
5. Set prod `DOMAIN`.
6. Setup `Fresh` environment
7. Setup `Staging` environment.
8. Repace the `docker-compose.override.yml` with the production one.
This will bring Let's Encrypt (Nginx-Proxy/Acme-Companion) container
```
cp docker-compose.override.production.yml docker-compose.override.yml
```
9. Rebuild the containers
```
docker-compose down && docker-compose up -d --build && docker-compose logs odoo
```
## Deployment
1. Backup the production Databases from `/web/database/manager`. 1. Backup the production Databases from `/web/database/manager`.
2. Run 2. Run
``` ```
@@ -206,16 +280,19 @@ sudo apt update && sudo apt upgrade -y
``` ```
4. Go to the project folder in /home/ubuntu or (~) 4. Go to the project folder in /home/ubuntu or (~)
``` ```
cd ~/odoocker cd ~/odoo-icomsa
```
or with alias:
```
odoo
``` ```
5. Pull the latest `main` branch changes. 5. Pull the latest `main` branch changes.
``` ```
git pull origin main git pull origin main
``` ```
6. Set Staging environment 6. Set [`Staging`](https://github.com/yhaelopez/odoocker#staging-environment) environment
7. Make sure everything continues to work as expected. 7. Set `APP_ENV=production`
8. Set `APP_ENV=production` 8. Take down the containers, pull the latest images from docker hub, and rebuild the containers.
9. Take down the containers, pull the latest images from docker hub, and rebuild the containers.
``` ```
docker-compose down && docker-compose pull && docker-compose build --no-cache && docker-compose up -d && docker-compose logs -f odoo docker-compose down && docker-compose up -d --build && docker-compose logs -f odoo
``` ```

View File

@@ -3,6 +3,7 @@ services:
restart: 'no' restart: 'no'
ports: ports:
- 8069:8069 - 8069:8069
- 8070:8070
- 8071:8071 - 8071:8071
- 8072:8072 - 8072:8072
@@ -18,19 +19,3 @@ services:
restart: 'no' restart: 'no'
ports: ports:
- 80:80 - 80:80
pgadmin:
image: dpage/pgadmin4:7.1
restart: unless-stopped
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
networks:
- internal

View File

@@ -7,10 +7,12 @@ services:
- 127.0.0.1:8072:8072 - 127.0.0.1:8072:8072
postgres: postgres:
restart: unless-stopped
ports: ports:
- 127.0.0.1:5432:5432 - 127.0.0.1:5432:5432
nginx-proxy: nginx-proxy:
restart: unless-stopped
ports: ports:
- 80:80 - 80:80
- 443:443 - 443:443

View File

@@ -0,0 +1,19 @@
services:
pgadmin:
image: dpage/pgadmin4:7.4
restart: unless-stopped
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
networks:
- internal
volumes:
pgadmin-data:

View File

@@ -3,6 +3,15 @@ services:
build: build:
context: ./ context: ./
dockerfile: ./odoo/Dockerfile dockerfile: ./odoo/Dockerfile
args:
- ODOO_VERSION
- ODOO_RC
- ROOT_PATH
- GITHUB_USER
- GITHUB_ACCESS_TOKEN
- ENTERPRISE_REPO
- ENTERPRISE_ADDONS
- LOG_PATH
depends_on: depends_on:
- postgres - postgres
tty: true tty: true
@@ -35,7 +44,7 @@ services:
- internal - internal
nginx: nginx:
image: nginx:1.24.0 image: nginx:1.25.1
depends_on: depends_on:
- odoo - odoo
restart: unless-stopped restart: unless-stopped
@@ -54,7 +63,7 @@ services:
- internal - internal
nginx-proxy: nginx-proxy:
image: nginxproxy/nginx-proxy:1.3.0 image: nginxproxy/nginx-proxy:1.3.1
depends_on: depends_on:
- nginx - nginx
restart: unless-stopped restart: unless-stopped
@@ -78,7 +87,6 @@ volumes:
certs: certs:
vhost: vhost:
html: html:
pgadmin-data:
networks: networks:
internal: internal:

View File

@@ -1,72 +1,88 @@
ARG ODOO_VERSION=16.0 #------------------------#
# Odoo Community #
#------------------------#
ARG ODOO_VERSION
FROM odoo:${ODOO_VERSION} FROM odoo:${ODOO_VERSION}
# Switch back to root user # Switch to root user
USER root USER root
# Update & Upgrade # Receive ARGs from docker-compose.yml & convert them into ENVs
RUN apt-get update && apt-get upgrade -y ARG ROOT_PATH
ARG LOG_PATH
ARG GITHUB_USER
ARG GITHUB_ACCESS_TOKEN
ARG ENTERPRISE_REPO
ARG ENTERPRISE_ADDONS
ARG ODOO_RC
# Upgrade pip ENV ODOO_VERSION=${ODOO_VERSION} \
RUN pip3 install --upgrade pip LOG_PATH=${LOG_PATH} \
GITHUB_USER=${GITHUB_USER} \
# Set Odoo root path GITHUB_ACCESS_TOKEN=${GITHUB_ACCESS_TOKEN} \
ARG ROOT_PATH=/usr/lib/python3/dist-packages/odoo ENTERPRISE_REPO=${ENTERPRISE_REPO} \
ENTERPRISE_ADDONS=${ENTERPRISE_ADDONS} \
#---------------# ODOO_RC=${ODOO_RC}
# Logging #
#---------------#
# Set Log variables
ARG LOGPATH=/var/log/odoo
ARG LOGFILE=${LOGPATH}/odoo.log
# Create odoo.log file and give permissions.
RUN touch ${LOGFILE} && chown odoo:odoo -R ${LOGPATH}
#-----------------------#
# Odoo Enterprise #
#-----------------------#
# Install git
RUN apt-get install git -y
# Set Github Credentials
ARG GITHUB_USER=yhaelopez
ARG GITHUB_ACCESS_TOKEN=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
ARG ENTERPRISE_REPO=https://${GITHUB_USER}:${GITHUB_ACCESS_TOKEN}@github.com/odoo/enterprise.git
ARG ENTERPRISE_PATH=${ROOT_PATH}/enterprise
# Create Enterprise Path & give permissions
RUN mkdir -p ${ENTERPRISE_PATH} && chown odoo:odoo -R ${ENTERPRISE_PATH}
# Clone Enterprise Repository
RUN git clone ${ENTERPRISE_REPO} ${ROOT_PATH}/enterprise --depth 1 --branch ${ODOO_VERSION} --single-branch --no-tags
#--------------------------------#
# Fix Deprecation Warnings #
#--------------------------------#
#------------------------# #------------------------#
# APT Dependencies # # APT Dependencies #
#------------------------# #------------------------#
RUN apt-get update && apt-get install -y \
apt-utils \
git \
git-man \
less \
libcbor0 \
libcurl3-gnutls \
libedit2 \
liberror-perl \
libxmuu1 \
openssh-client \
patch \
xauth \
# Clean up the apt cache to reduce the image size
&& rm -rf /var/lib/apt/lists/*
#-----------------------# #-----------------------#
# PIP Dependencies # # Odoo Enterprise #
#-----------------------# #-----------------------#
# Copy PIP requirements
COPY ./odoo/requirements.txt /tmp/requirements.txt
# Install PIP requirements # Create Enterprise addons directory
RUN python3 -m pip install -r /tmp/requirements.txt RUN mkdir -p ${ENTERPRISE_ADDONS} && \
# RUN pip3 install debugpy chown odoo:odoo -R ${ENTERPRISE_ADDONS}
# Clone Enterprise addons if user and token are present
RUN if [ -n "$GITHUB_USER" ] && [ -n "$GITHUB_ACCESS_TOKEN" ]; then \
git clone ${ENTERPRISE_REPO} ${ENTERPRISE_ADDONS} --depth 1 --branch ${ODOO_VERSION} --single-branch --no-tags; \
fi
#---------------------#
# 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 --upgrade -r /tmp/requirements.txt && \
rm /tmp/requirements.txt
#---------------------#
# Logging #
#---------------------#
# Create odoo.log file
RUN touch ${LOG_PATH} && chown odoo:odoo ${LOG_PATH}
#-----------------------# #-----------------------#
# Odoo Conf # # Odoo Conf #
#-----------------------# #-----------------------#
# Copy environment variables at /
COPY ./.env / # Copy environment variables & script to generate odoo.conf
# Copy script to generate odoo.conf COPY --chown=odoo:odoo ./.env /
COPY ./odoo/odoorc.sh / COPY --chown=odoo:odoo ./odoo/odoorc.sh /
# Generate odoo.conf # Generate odoo.conf
RUN /odoorc.sh && chown odoo:odoo ${ODOO_RC} RUN /odoorc.sh && chown odoo:odoo ${ODOO_RC}

View File

@@ -1,2 +0,0 @@
# Ignores any __pycache__ folder.
__pycache__

View File

@@ -12,50 +12,50 @@ 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 ${DB_HOST} --db_port ${DB_PORT} --db_user ${DB_USER} --db_password ${DB_PASSWORD} --timeout=30
if [ ${APP_ENV} = 'fresh' ] || [ ${APP_ENV} = 'restore' ]; then if [ ${APP_ENV} = 'fresh' ] || [ ${APP_ENV} = 'restore' ]; then
echo odoo --config ${ODOO_RC} --database= --update= --init= --load=${SERVER_WIDE_MODULES} --workers=0 --log-handler=:INFO --log-level=info --max-cron-threads=2 --limit-time-cpu=3600 --limit-time-real=7200 --limit-time-real-cron=600 --limit-request=8192 --limit-memory-soft=2147483648 --limit-memory-hard=2684354560 --transient-age-limit=1.0 --load-language= --without-demo=True --import-partial=False --log-db= --dev=False echo odoo --config ${ODOO_RC} --database= --init= --update= --load=${SERVER_WIDE_MODULES} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --load-language= --workers=0 --limit-time-cpu=3600 --limit-time-real=7200
exec odoo --config ${ODOO_RC} --database= --update= --init= --load=${SERVER_WIDE_MODULES} --workers=0 --log-handler=:INFO --log-level=info --max-cron-threads=2 --limit-time-cpu=3600 --limit-time-real=7200 --limit-time-real-cron=600 --limit-request=8192 --limit-memory-soft=2147483648 --limit-memory-hard=2684354560 --transient-age-limit=1.0 --load-language= --without-demo=True --import-partial=False --log-db= --dev=False exec odoo --config ${ODOO_RC} --database= --init= --update= --load=${SERVER_WIDE_MODULES} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --load-language= --workers=0 --limit-time-cpu=3600 --limit-time-real=7200
fi fi
if [ ${APP_ENV} = 'full' ] ; then if [ ${APP_ENV} = 'full' ] ; then
echo odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INSTALLED_MODULES} --update= --load=${SERVER_WIDE_MODULES} --workers=0 --log-handler=:INFO --log-level=info --max-cron-threads=2 --limit-time-cpu=3600 --limit-time-real=7200 --limit-time-real-cron=600 --limit-request=8192 --limit-memory-soft=2147483648 --limit-memory-hard=2684354560 --transient-age-limit=1.0 --db-filter= --load-language=${LOAD_LANGUAGE} --without-demo=True --import-partial=False --log-db= --dev=False echo odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INSTALLED_MODULES} --update= --load=${SERVER_WIDE_MODULES} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --load-language=${LOAD_LANGUAGE} --max-cron-threads=${MAX_CRON_THREADS} --limit-time-cpu=3600 --limit-time-real=7200 --workers=0 --without-demo=all
exec odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INSTALLED_MODULES} --update= --load=${SERVER_WIDE_MODULES} --workers=0 --log-handler=:INFO --log-level=info --max-cron-threads=2 --limit-time-cpu=3600 --limit-time-real=7200 --limit-time-real-cron=600 --limit-request=8192 --limit-memory-soft=2147483648 --limit-memory-hard=2684354560 --transient-age-limit=1.0 --db-filter= --load-language=${LOAD_LANGUAGE} --without-demo=True --import-partial=False --log-db= --dev=False exec odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INSTALLED_MODULES} --update= --load=${SERVER_WIDE_MODULES} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --load-language=${LOAD_LANGUAGE} --max-cron-threads=${MAX_CRON_THREADS} --limit-time-cpu=3600 --limit-time-real=7200 --workers=0 --without-demo=all
fi fi
if [ ${APP_ENV} = 'local' ] ; then if [ ${APP_ENV} = 'local' ] ; then
# Automagically update the addons you are currently working on. # Automagically update the addons you are currently working on.
echo odoo --config ${ODOO_RC} --database=${DB_NAME} --update=${UPDATE} --init=${INIT} --load=${SERVER_WIDE_MODULES} --dev=${DEV_MODE} echo odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=${UPDATE} --load=${SERVER_WIDE_MODULES} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --workers=${WORKERS} --dev=${DEV_MODE}
exec odoo --config ${ODOO_RC} --database=${DB_NAME} --update=${UPDATE} --init=${INIT} --load=${SERVER_WIDE_MODULES} --dev=${DEV_MODE} exec odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=${UPDATE} --load=${SERVER_WIDE_MODULES} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --workers=${WORKERS} --dev=${DEV_MODE}
fi fi
if [ ${APP_ENV} = 'debug' ] ; then if [ ${APP_ENV} = 'debug' ] ; then
# Automagically update the addons you are currently working on. # Automagically update the addons you are currently working on.
exec /usr/bin/python3 -m debugpy --listen 0.0.0.0:8888 /usr/bin/odoo --config ${ODOO_RC} --database=${DB_NAME} --update=${UPDATE} --init=${INIT} --load=${SERVER_WIDE_MODULES} --dev=${DEV_MODE} echo /usr/bin/python3 -m debugpy --listen ${DEBUG_INTERFACE}:${DEBUG_PORT} ${DEBUG_PATH} --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=${UPDATE} --load=${SERVER_WIDE_MODULES} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --workers=${WORKERS} --dev=${DEV_MODE}
exec /usr/bin/python3 -m debugpy --listen 0.0.0.0:8888 /usr/bin/odoo --config ${ODOO_RC} --database=${DB_NAME} --update=${UPDATE} --init=${INIT} --load=${SERVER_WIDE_MODULES} --dev=${DEV_MODE} exec /usr/bin/python3 -m debugpy --listen ${DEBUG_INTERFACE}:${DEBUG_PORT} ${DEBUG_PATH} --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=${UPDATE} --load=${SERVER_WIDE_MODULES} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --workers=${WORKERS} --dev=${DEV_MODE}
fi fi
if [ ${APP_ENV} = 'testing' ] ; then if [ ${APP_ENV} = 'testing' ] ; then
# Work in progres... (DO NOT USE) # Runs the tests in a 'test_*' database for the addons you are currently working on via test tags.
echo odoo --config ${ODOO_RC} --database=test_${DB_NAME} --db-filter=test_${DB_NAME} --test-enable --test-commit --log-handler=:DEBUG --log-level=debug --workers=0 --init= --update= 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-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --without-demo= --workers=0 --stop-after-init
exec odoo --config ${ODOO_RC} --database=test_${DB_NAME} --db-filter=test_${DB_NAME} --test-enable --test-commit --log-handler=:DEBUG --log-level=debug --workers=0 --init= --update= exec 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-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --without-demo= --workers=0 --stop-after-init
fi fi
if [ ${APP_ENV} = 'staging' ] ; then if [ ${APP_ENV} = 'staging' ] ; then
# Automagically install/upgrade all addons # Automagically upgrade all addons and install new ones.
echo odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=all --load=${SERVER_WIDE_MODULES} --workers=0 --log-handler=:INFO --log-level=info --max-cron-threads=2 --limit-time-cpu=3600 --limit-time-real=7200 --limit-time-real-cron=600 --limit-request=8192 --limit-memory-soft=2147483648 --limit-memory-hard=2684354560 --transient-age-limit=1.0 --db-filter= --load-language=${LOAD_LANGUAGE} --without-demo=True --import-partial=False --log-db= --dev=False echo odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=all --load=${SERVER_WIDE_MODULES} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --load-language=${LOAD_LANGUAGE} --limit-time-cpu=3600 --limit-time-real=7200 --workers=0 --without-demo=all
exec odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=all --load=${SERVER_WIDE_MODULES} --workers=0 --log-handler=:INFO --log-level=info --max-cron-threads=2 --limit-time-cpu=3600 --limit-time-real=7200 --limit-time-real-cron=600 --limit-request=8192 --limit-memory-soft=2147483648 --limit-memory-hard=2684354560 --transient-age-limit=1.0 --db-filter= --load-language=${LOAD_LANGUAGE} --without-demo=True --import-partial=False --log-db= --dev=False exec odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=all --load=${SERVER_WIDE_MODULES} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --load-language=${LOAD_LANGUAGE} --limit-time-cpu=3600 --limit-time-real=7200 --workers=0 --without-demo=all
fi fi
if [ ${APP_ENV} = 'production' ] ; then if [ ${APP_ENV} = 'production' ] ; then
# Bring up Odoo without any addons to install/update. # Bring up Odoo ready for production.
echo odoo --config ${ODOO_RC} --database= --init= --update= --load-language= --db-filter= --dev=False --import-partial=False --without-demo=True --log-handler=:INFO --log-level=info --log-db= --log-db-level=warning --workers=2 --max-cron-threads=2 --log-level=info --log-handler=:INFO --limit-time-cpu=120 --limit-time-real=240 --limit-request=8192 --limit-memory-soft=2147483648 --limit-memory-hard=2684354560 --transient-age-limit=1.0 --import-partial=False echo odoo --config ${ODOO_RC} --database= --init= --update= --load=${SERVER_WIDE_MODULES} --workers=${WORKERS} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --load-language= --without-demo=all --dev=False
exec odoo --config ${ODOO_RC} --database= --init= --update= --load-language= --db-filter= --dev=False --import-partial=False --without-demo=True --log-handler=:INFO --log-level=info --log-db= --log-db-level=warning --workers=2 --max-cron-threads=2 --log-level=info --log-handler=:INFO --limit-time-cpu=120 --limit-time-real=240 --limit-request=8192 --limit-memory-soft=2147483648 --limit-memory-hard=2684354560 --transient-age-limit=1.0 --import-partial=False exec odoo --config ${ODOO_RC} --database= --init= --update= --load=${SERVER_WIDE_MODULES} --workers=${WORKERS} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --load-language= --without-demo=all --dev=False
fi fi
fi fi
;; ;;

View File

@@ -1,2 +0,0 @@
# Ignores any __pycache__ folder.
__pycache__

View File

@@ -3,249 +3,258 @@
; Options not exposed on the command line. ; ; Options not exposed on the command line. ;
;------------------------------------------; ;------------------------------------------;
admin_passwd=odoo admin_passwd = {ADMIN_PASSWD}
csv_internal_sep=, csv_internal_sep = {CSV_INTERNAL_SEP}
publisher_warranty_url=http://services.openerp.com/publisher-warranty/ publisher_warranty_url = {PUBLISHER_WARRANTY_URL}
root_path=/usr/lib/python3/dist-packages/odoo root_path = {ROOT_PATH}
reportgz=False reportgz = {REPORTGZ}
websocket_keep_alive_timeout=3600 websocket_keep_alive_timeout = {WEBSOCKET_KEEP_ALIVE_TIMEOUT}
websocket_rate_limit_burst=10 websocket_rate_limit_burst = {WEBSOCKET_RATE_LIMIT_BURST}
websocket_rate_limit_delay=0.2 websocket_rate_limit_delay = {WEBSOCKET_RATE_LIMIT_DELAY}
;-----------------------; ;-----------------------;
; Server startup config ; ; Server startup config ;
;-----------------------; ;-----------------------;
; --config | -c ; --config | -c
config=/etc/odoo/odoo.conf config = {ODOO_RC}
; --save ; --save
save=False save = {SAVE}
; --init | -i ; --init | -i
init= init = {INIT}
; --update | -u ; --update | -u
update= update = {UPDATE}
; --without-demo ; --without-demo
demo=False demo = {DEMO}
without_demo=all without_demo = {WITHOUT_DEMO}
; --import-partial ; --import-partial
import_partial= import_partial = {IMPORT_PARTIAL}
; --pidfile ; --pidfile
pidfile= pidfile = {PIDFILE}
; --addons-path ; --addons-path
addons_path=/usr/lib/python3/dist-packages/odoo/addons,/usr/lib/python3/dist-packages/odoo/enterprise,/usr/lib/python3/dist-packages/odoo/extra-addons,/usr/lib/python3/dist-packages/odoo/custom-addons addons_path = {ADDONS_PATH}
; --upgrade-path ; --upgrade-path
upgrade_path= upgrade_path = {UPGRADE_PATH}
; --load ; --load
server_wide_modules=base,web server_wide_modules = {SERVER_WIDE_MODULES}
; --data-dir ; --data-dir
data_dir=/var/lib/odoo data_dir = {DATA_DIR}
;------; ;------;
; HTTP ; ; HTTP ;
;------; ;------;
; --http-interface | --xmlrpc-interface ; --http-interface | --xmlrpc-interface
http_interface=0.0.0.0 http_interface = {HTTP_INTERFACE}
; --http-port | -p | --xmlrpc-port ; --http-port | -p | --xmlrpc-port
http_port=8069 http_port = {HTTP_PORT}
; --xmlrpcs-interface
xmlrpcs_interface = {XMLRPCS_INTERFACE}
; --xmlrpcs-port
xmlrpcs_port = {XMLRPCS_PORT}
; --longpolling_port ; --longpolling_port
longpolling_port=8072 longpolling_port = {LONGPOLLING_PORT}
; --no-http | --no-xmlrpc ; --no-http | --no-xmlrpc
http_enable=True http_enable = {HTTP_ENABLE}
; --no-xmlrpcs
xmlrpcs = {XMLRPCS}
; --proxy-mode ; --proxy-mode
proxy_mode=True proxy_mode = {PROXY_MODE}
; --x-sendfile ; --x-sendfile
x_sendfile =False x_sendfile = {X_SENDFILE}
;---------------; ;---------------;
; Testing Group ; ; Testing Group ;
;---------------; ;---------------;
; --test-file ; --test-file
test_file=False test_file = {TEST_FILE}
; --test-enable ; --test-enable
test_enable=False test_enable = {TEST_ENABLE}
; --test-tags ; --test-tags
test_tags=False test_tags = {TEST_FILE}
; --screencasts ; --screencasts
screencasts=None screencasts = {SCREENCASTS}
; --screenshots ; --screenshots
screenshots=/tmp/odoo_tests screenshots = {SCREENSHOTS}
;---------------; ;---------------;
; Logging Group ; ; Logging Group ;
;---------------; ;---------------;
; --logfile ; --logfile
logfile= logfile = {LOGFILE}
; --syslog ; --syslog
syslog=False syslog = {SYSLOG}
; --log-handler | --log-web (--log-handler=odoo.http:DEBUG) | --log-sql (--log-handler=odoo.sql_db:DEBUG) ; --log-handler | --log-web (--log-handler=odoo.http:DEBUG) | --log-sql (--log-handler=odoo.sql_db:DEBUG)
log_handler=[':INFO'] log_handler = {LOG_HANDLER}
; --log-db ; --log-db
log_db=False log_db = {LOG_DB}
; --log-db-level ; --log-db-level
log_db_level=info log_db_level = {LOG_DB_LEVEL}
; --log-level ; --log-level
log_level=info log_level = {LOG_LEVEL}
;------------; ;------------;
; SMTP Group ; ; SMTP Group ;
;------------; ;------------;
; --email-from ; --email-from
email_from= email_from = {EMAIL_FROM}
; --from-filter ; --from-filter
from_filter=False from_filter = {FROM_FILTER}
; --smtp ; --smtp
smtp_server= smtp_server = {SMTP_SERVER}
; --smtp-port ; --smtp-port
smtp_port=25 smtp_port = {SMTP_PORT}
; --smtp-ssl ; --smtp-ssl
smtp_ssl= smtp_ssl = {SMTP_SSL}
; --smtp-user ; --smtp-user
smtp_user= smtp_user = {SMTP_USER}
; --smtp-password ; --smtp-password
smtp_password= smtp_password = {SMTP_PASSWORD}
; --smtp-ssl-certificate-filename ; --smtp-ssl-certificate-filename
smtp_ssl_certificate_filename=False smtp_ssl_certificate_filename = {SMTP_SSL_CERTIFICATE_FILENAME}
; --smtp-ssl-private-key-filename ; --smtp-ssl-private-key-filename
smtp_ssl_private_key_filename=False smtp_ssl_private_key_filename = {SMTP_SSL_PRIVATE_KEY_FILENAME}
;----------; ;----------;
; DB Group ; ; DB Group ;
;----------; ;----------;
; --database | -d ; --database | -d
db_name=odoo db_name = {DB_NAME}
; --db_user | -r ; --db_user | -r
db_user=odoo db_user = {DB_USER}
; --db_password | -w ; --db_password | -w
db_password=odoo db_password = {DB_PASSWORD}
; --pg_path ; --pg_path
pg_path= pg_path = {PG_PATH}
; --db_host ; --db_host
db_host=postgres db_host = {DB_HOST}
; --db_port ; --db_port
db_port=5432 db_port = {DB_PORT}
; --db_sslmode ; --db_sslmode
db_sslmode=prefer db_sslmode = {DB_SSLMODE}
; --db_maxconn ; --db_maxconn
db_maxconn=64 db_maxconn = {DB_MAXCONN}
; --db-template ; --db-template
db_template=unaccent_template db_template = {DB_TEMPLATE}
;------------------------------; ;------------------------------;
; Internationalisation options ; ; Internationalisation options ;
;------------------------------; ;------------------------------;
; --load-language ; --load-language
load_language=en_US load_language = {LOAD_LANGUAGE}
; --language ; --language
language= language = {LANGUAGE}
; --i18n-export ; --i18n-export
translate_out= translate_out = {TRANSLATE_OUT}
; --i18n-import ; --i18n-import
translate_in= translate_in = {TRANSLATE_IN}
; --i18n-overwrite ; --i18n-overwrite
overwrite_existing_translations=False overwrite_existing_translations = {OVERWRITE_EXISTING_TRANSLATIONS}
; --modules ; --modules
translate_modules=['all'] translate_modules = {TRANSLATE_MODULES}
;----------; ;----------;
; Security ; ; Security ;
;----------; ;----------;
; --no-database-list ; --no-database-list
list_db=True list_db = {LIST_DB}
;-----; ;-----;
; WEB ; ; WEB ;
;-----; ;-----;
; --db-filter ; --db-filter
dbfilter=.* dbfilter = {DBFILTER}
;------------------; ;------------------;
; Advanced options ; ; Advanced options ;
;------------------; ;------------------;
; --dev ; --dev (all, reload, qweb, werkzeug, sql, shell, assets, tests)
dev_mode=False dev_mode = {DEV_MODE}
; --shell-interface ; --shell-interface
shell_interface=ptpython shell_interface = {SHELL_INTERFACE}
; --stop-after-init ; --stop-after-init
stop_after_init=False stop_after_init = {STOP_AFTER_INIT}
; --osv-memory-count-limit ; --osv-memory-count-limit
osv_memory_count_limit=False osv_memory_count_limit = {OSV_MEMORY_COUNT_LIMIT}
; --transient-age-limit (for deprecated --osv-memory-age-limit) ; --transient-age-limit | --osv-memory-age-limit (deprecated)
transient_age_limit=1.0 transient_age_limit = {TRANSIENT_AGE_LIMIT}
; --max-cron-threads ; --max-cron-threads
max_cron_threads=2 max_cron_threads = {MAX_CRON_THREADS}
; --unaccent ; --unaccent
unaccent=True unaccent = {UNACCENT}
; --geoip-db ; --geoip-db
geoip_database=/usr/share/GeoIP/GeoLite2-City.mmdb geoip_database = {GEOIP_DATABASE}
; --workers ; --workers
workers=0 workers = {WORKERS}
; --limit-memory-soft ; --limit-memory-soft
limit_memory_soft=2147483648 limit_memory_soft = {LIMIT_MEMORY_SOFT}
; --limit-memory-hard ; --limit-memory-hard
limit_memory_hard=2684354560 limit_memory_hard = {LIMIT_MEMORY_HARD}
; --limit-time-cpu ; --limit-time-cpu
limit_time_cpu=120 limit_time_cpu = {LIMIT_TIME_CPU}
; --limit-time-real ; --limit-time-real
limit_time_real=240 limit_time_real = {LIMIT_TIME_REAL}
; --limit-time-real-cron ; --limit-time-real-cron
limit_time_real_cron=600 limit_time_real_cron = {LIMIT_TIME_REAL_CRON}
; --limit-request ; --limit-request
limit_request=8192 limit_request = {LIMIT_REQUEST}

View File

@@ -35,7 +35,7 @@ defaults=(
[HTTP_PORT]=${HTTP_PORT} [HTTP_PORT]=${HTTP_PORT}
[XMLRPCS_INTERFACE]=${XMLRPCS_INTERFACE} [XMLRPCS_INTERFACE]=${XMLRPCS_INTERFACE}
[XMLRPCS_PORT]=${XMLRPCS_PORT} [XMLRPCS_PORT]=${XMLRPCS_PORT}
[GEVENT_PORT]=${GEVENT_PORT} [LONGPOLLING_PORT]=${LONGPOLLING_PORT}
[HTTP_ENABLE]=${HTTP_ENABLE} [HTTP_ENABLE]=${HTTP_ENABLE}
[XMLRPCS]=${XMLRPCS} [XMLRPCS]=${XMLRPCS}
[PROXY_MODE]=${PROXY_MODE} [PROXY_MODE]=${PROXY_MODE}
@@ -86,7 +86,6 @@ defaults=(
[LIST_DB]=${LIST_DB} [LIST_DB]=${LIST_DB}
[DEV_MODE]=${DEV_MODE} [DEV_MODE]=${DEV_MODE}
[DEBUG_MODE]=${DEBUG_MODE}
[SHELL_INTERFACE]=${SHELL_INTERFACE} [SHELL_INTERFACE]=${SHELL_INTERFACE}
[STOP_AFTER_INIT]=${STOP_AFTER_INIT} [STOP_AFTER_INIT]=${STOP_AFTER_INIT}
[OSV_MEMORY_COUNT_LIMIT]=${OSV_MEMORY_COUNT_LIMIT} [OSV_MEMORY_COUNT_LIMIT]=${OSV_MEMORY_COUNT_LIMIT}
@@ -122,252 +121,248 @@ websocket_rate_limit_delay = {WEBSOCKET_RATE_LIMIT_DELAY}
;-----------------------; ;-----------------------;
; Server startup config ; ; Server startup config ;
;-----------------------; ;-----------------------;
; `--config | -c` ; --config | -c
config = {ODOO_RC} config = {ODOO_RC}
; `--save` ; --save
save = {SAVE} save = {SAVE}
; `--init | -i` ; --init | -i
init = {INIT} init = {INIT}
; `--update | -u` ; --update | -u
update = {UPDATE} update = {UPDATE}
; `--without-demo` ; --without-demo
demo = {DEMO} demo = {DEMO}
without_demo = {WITHOUT_DEMO} without_demo = {WITHOUT_DEMO}
; `--import-partial` ; --import-partial
import_partial = {IMPORT_PARTIAL} import_partial = {IMPORT_PARTIAL}
; `--pidfile` ; --pidfile
pidfile = {PIDFILE} pidfile = {PIDFILE}
; `--addons-path` ; --addons-path
addons_path = {ADDONS_PATH} addons_path = {ADDONS_PATH}
; `--upgrade-path` ; --upgrade-path
upgrade_path = {UPGRADE_PATH} upgrade_path = {UPGRADE_PATH}
; `--load` ; --load
server_wide_modules = {SERVER_WIDE_MODULES} server_wide_modules = {SERVER_WIDE_MODULES}
; `--data-dir` ; --data-dir
data_dir = {DATA_DIR} data_dir = {DATA_DIR}
;------; ;------;
; HTTP ; ; HTTP ;
;------; ;------;
; `--http-interface | --xmlrpc-interface` ; --http-interface | --xmlrpc-interface
http_interface = {HTTP_INTERFACE} http_interface = {HTTP_INTERFACE}
; `--http-port | -p | --xmlrpc-port` ; --http-port | -p | --xmlrpc-port
http_port = {HTTP_PORT} http_port = {HTTP_PORT}
; `--xmlrpcs-interface` ; --xmlrpcs-interface
xmlrpcs_interface = {XMLRPCS_INTERFACE} xmlrpcs_interface = {XMLRPCS_INTERFACE}
; `--xmlrpcs-port` ; --xmlrpcs-port
xmlrpcs_port = {XMLRPCS_PORT} xmlrpcs_port = {XMLRPCS_PORT}
; `--gevent-port | --longpolling_port` (deprecated) ; --longpolling_port
gevent_port = {GEVENT_PORT} longpolling_port = {LONGPOLLING_PORT}
longpolling_port = 0
; `--no-http | --no-xmlrpc` ; --no-http | --no-xmlrpc
http_enable = {HTTP_ENABLE} http_enable = {HTTP_ENABLE}
; `--no-xmlrpcs` ; --no-xmlrpcs
xmlrpcs = {XMLRPCS} xmlrpcs = {XMLRPCS}
; `--proxy-mode` ; --proxy-mode
proxy_mode = {PROXY_MODE} proxy_mode = {PROXY_MODE}
; `--x-sendfile` ; --x-sendfile
x_sendfile = {X_SENDFILE} x_sendfile = {X_SENDFILE}
;---------------; ;---------------;
; Testing Group ; ; Testing Group ;
;---------------; ;---------------;
; `--test-file` ; --test-file
test_file = {TEST_FILE} test_file = {TEST_FILE}
; `--test-enable` ; --test-enable
test_enable = {TEST_ENABLE} test_enable = {TEST_ENABLE}
; `--test-tags` ; --test-tags
test_tags = {TEST_FILE} test_tags = {TEST_FILE}
; `--screencasts` ; --screencasts
screencasts = {SCREENCASTS} screencasts = {SCREENCASTS}
; `--screenshots` ; --screenshots
screenshots = {SCREENSHOTS} screenshots = {SCREENSHOTS}
;---------------; ;---------------;
; Logging Group ; ; Logging Group ;
;---------------; ;---------------;
; `--logfile` ; --logfile
logfile = {LOGFILE} logfile = {LOGFILE}
; `--syslog` ; --syslog
syslog = {SYSLOG} syslog = {SYSLOG}
; `--log-handler | --log-web (--log-handler=odoo.http:DEBUG) | --log-sql (--log-handler=odoo.sql_db:DEBUG)` ; --log-handler | --log-web (--log-handler=odoo.http:DEBUG) | --log-sql (--log-handler=odoo.sql_db:DEBUG)
log_handler = {LOG_HANDLER} log_handler = {LOG_HANDLER}
; `--log-db` ; --log-db
log_db = {LOG_DB} log_db = {LOG_DB}
; `--log-db-level` ; --log-db-level
log_db_level = {LOG_DB_LEVEL} log_db_level = {LOG_DB_LEVEL}
; `--log-level` ; --log-level
log_level = {LOG_LEVEL} log_level = {LOG_LEVEL}
;------------; ;------------;
; SMTP Group ; ; SMTP Group ;
;------------; ;------------;
; `--email-from` ; --email-from
email_from = {EMAIL_FROM} email_from = {EMAIL_FROM}
; `--from-filter` ; --from-filter
from_filter = {FROM_FILTER} from_filter = {FROM_FILTER}
; `--smtp` ; --smtp
smtp_server = {SMTP_SERVER} smtp_server = {SMTP_SERVER}
; `--smtp-port` ; --smtp-port
smtp_port = {SMTP_PORT} smtp_port = {SMTP_PORT}
; `--smtp-ssl` ; --smtp-ssl
smtp_ssl = {SMTP_SSL} smtp_ssl = {SMTP_SSL}
; `--smtp-user` ; --smtp-user
smtp_user = {SMTP_USER} smtp_user = {SMTP_USER}
; `--smtp-password` ; --smtp-password
smtp_password = {SMTP_PASSWORD} smtp_password = {SMTP_PASSWORD}
; `--smtp-ssl-certificate-filename` ; --smtp-ssl-certificate-filename
smtp_ssl_certificate_filename = {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 = {SMTP_SSL_PRIVATE_KEY_FILENAME} smtp_ssl_private_key_filename = {SMTP_SSL_PRIVATE_KEY_FILENAME}
;----------; ;----------;
; DB Group ; ; DB Group ;
;----------; ;----------;
; `--database | -d` ; --database | -d
db_name = {DB_NAME} db_name = {DB_NAME}
; `--db_user | -r` ; --db_user | -r
db_user = {DB_USER} db_user = {DB_USER}
; `--db_password | -w` ; --db_password | -w
db_password = {DB_PASSWORD} db_password = {DB_PASSWORD}
; `--pg_path` ; --pg_path
pg_path = {PG_PATH} pg_path = {PG_PATH}
; `--db_host` ; --db_host
db_host = {DB_HOST} db_host = {DB_HOST}
; `--db_port` ; --db_port
db_port = {DB_PORT} db_port = {DB_PORT}
; `--db_sslmode` ; --db_sslmode
db_sslmode = {DB_SSLMODE} db_sslmode = {DB_SSLMODE}
; `--db_maxconn` ; --db_maxconn
db_maxconn = {DB_MAXCONN} db_maxconn = {DB_MAXCONN}
; `--db-template` ; --db-template
db_template = {DB_TEMPLATE} db_template = {DB_TEMPLATE}
;------------------------------; ;------------------------------;
; Internationalisation options ; ; Internationalisation options ;
;------------------------------; ;------------------------------;
; `--load-language` ; --load-language
load_language = {LOAD_LANGUAGE} load_language = {LOAD_LANGUAGE}
; `--language` ; --language
language = {LANGUAGE} language = {LANGUAGE}
; `--i18n-export` ; --i18n-export
translate_out = {TRANSLATE_OUT} translate_out = {TRANSLATE_OUT}
; `--i18n-import` ; --i18n-import
translate_in = {TRANSLATE_IN} translate_in = {TRANSLATE_IN}
; `--i18n-overwrite` ; --i18n-overwrite
overwrite_existing_translations = {OVERWRITE_EXISTING_TRANSLATIONS} overwrite_existing_translations = {OVERWRITE_EXISTING_TRANSLATIONS}
; `--modules ` ; --modules
translate_modules = {TRANSLATE_MODULES} translate_modules = {TRANSLATE_MODULES}
;----------; ;----------;
; Security ; ; Security ;
;----------; ;----------;
; `--no-database-list` ; --no-database-list
list_db = {LIST_DB} list_db = {LIST_DB}
;-----; ;-----;
; WEB ; ; WEB ;
;-----; ;-----;
; `--db-filter` ; --db-filter
dbfilter = {DBFILTER} dbfilter = {DBFILTER}
;------------------; ;------------------;
; Advanced options ; ; Advanced options ;
;------------------; ;------------------;
; `--dev` ; --dev
dev_mode = {DEV_MODE} dev_mode = {DEV_MODE}
; ; --shell-interface
debug_mode = {DEV_MODE}
; `--shell-interface`
shell_interface = {SHELL_INTERFACE} shell_interface = {SHELL_INTERFACE}
; `--stop-after-init` ; --stop-after-init
stop_after_init = {STOP_AFTER_INIT} stop_after_init = {STOP_AFTER_INIT}
; `--osv-memory-count-limit` ; --osv-memory-count-limit
osv_memory_count_limit = {OSV_MEMORY_COUNT_LIMIT} osv_memory_count_limit = {OSV_MEMORY_COUNT_LIMIT}
; `--transient-age-limit | --osv-memory-age-limit` (deprecated) ; --transient-age-limit | --osv-memory-age-limit (deprecated)
transient_age_limit = {TRANSIENT_AGE_LIMIT} transient_age_limit = {TRANSIENT_AGE_LIMIT}
; `--max-cron-threads` ; --max-cron-threads
max_cron_threads = {MAX_CRON_THREADS} max_cron_threads = {MAX_CRON_THREADS}
; `--unaccent` ; --unaccent
unaccent = {UNACCENT} unaccent = {UNACCENT}
; `--geoip-db` ; --geoip-db
geoip_database = {GEOIP_DATABASE} geoip_database = {GEOIP_DATABASE}
; `--workers` ; --workers
workers = {WORKERS} workers = {WORKERS}
; `--limit-memory-soft` ; --limit-memory-soft
limit_memory_soft = {LIMIT_MEMORY_SOFT} limit_memory_soft = {LIMIT_MEMORY_SOFT}
; `--limit-memory-hard` ; --limit-memory-hard
limit_memory_hard = {LIMIT_MEMORY_HARD} limit_memory_hard = {LIMIT_MEMORY_HARD}
; `--limit-time-cpu` ; --limit-time-cpu
limit_time_cpu = {LIMIT_TIME_CPU} limit_time_cpu = {LIMIT_TIME_CPU}
; `--limit-time-real` ; --limit-time-real
limit_time_real = {LIMIT_TIME_REAL} limit_time_real = {LIMIT_TIME_REAL}
; `--limit-time-real-cron` ; --limit-time-real-cron
limit_time_real_cron = {LIMIT_TIME_REAL_CRON} limit_time_real_cron = {LIMIT_TIME_REAL_CRON}
; `--limit-request` ; --limit-request
limit_request = {LIMIT_REQUEST} limit_request = {LIMIT_REQUEST}
EOF EOF
) )

View File

@@ -1 +1,5 @@
jinja2
sortedcontainers
debugpy debugpy
websocket-client
pyOpenSSL

View File

@@ -1,13 +1,14 @@
FROM postgres:15.2 FROM postgres:15.3
# Update apt packages
RUN apt-get update && apt-get upgrade -y
#------------------------# #------------------------#
# APT Dependencies # # APT Dependencies #
#------------------------# #------------------------#
# Update apt packages
RUN apt-get update && apt-get install -y \
# Unaccent extension dependencies # Unaccent extension dependencies
RUN apt-get install -y postgresql-contrib postgresql-contrib \
# Clean up the apt cache to reduce the image size
&& rm -rf /var/lib/apt/lists/*
# Copy the script to create the unaccent template # Copy the script to create the unaccent template
COPY ./entrypoint.sh /docker-entrypoint-initdb.d/entrypoint.sh COPY ./entrypoint.sh /docker-entrypoint-initdb.d/entrypoint.sh