odoo-devops-tools 1.24.4__tar.gz → 1.24.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {odoo_devops_tools-1.24.4 → odoo_devops_tools-1.24.6}/PKG-INFO +23 -31
- {odoo_devops_tools-1.24.4 → odoo_devops_tools-1.24.6}/README.md +22 -30
- odoo_devops_tools-1.24.6/odoo_devops_tools/__init__.py +1 -0
- {odoo_devops_tools-1.24.4 → odoo_devops_tools-1.24.6}/odoo_devops_tools/env.py +311 -34
- {odoo_devops_tools-1.24.4 → odoo_devops_tools-1.24.6}/odoo_devops_tools.egg-info/PKG-INFO +23 -31
- {odoo_devops_tools-1.24.4 → odoo_devops_tools-1.24.6}/pyproject.toml +1 -1
- odoo_devops_tools-1.24.4/odoo_devops_tools/__init__.py +0 -1
- {odoo_devops_tools-1.24.4 → odoo_devops_tools-1.24.6}/LICENSE +0 -0
- {odoo_devops_tools-1.24.4 → odoo_devops_tools-1.24.6}/odoo_devops_tools.egg-info/SOURCES.txt +0 -0
- {odoo_devops_tools-1.24.4 → odoo_devops_tools-1.24.6}/odoo_devops_tools.egg-info/dependency_links.txt +0 -0
- {odoo_devops_tools-1.24.4 → odoo_devops_tools-1.24.6}/odoo_devops_tools.egg-info/entry_points.txt +0 -0
- {odoo_devops_tools-1.24.4 → odoo_devops_tools-1.24.6}/odoo_devops_tools.egg-info/top_level.txt +0 -0
- {odoo_devops_tools-1.24.4 → odoo_devops_tools-1.24.6}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: odoo-devops-tools
|
|
3
|
-
Version: 1.24.
|
|
3
|
+
Version: 1.24.6
|
|
4
4
|
Summary: Build reproducible Odoo workspaces from a single project definition.
|
|
5
5
|
Author: Roman Lacko
|
|
6
6
|
License-Expression: MIT
|
|
@@ -145,15 +145,19 @@ Optionally initialize the Odoo database from the command line instead of through
|
|
|
145
145
|
|
|
146
146
|
Docker Compose runs both Odoo and PostgreSQL. Odoo is available at http://localhost:8069.
|
|
147
147
|
|
|
148
|
+
> **Note**
|
|
149
|
+
> By default, generated Compose services use `restart: unless-stopped`; to prevent a development stack from automatically starting after a host or Docker restart, run:
|
|
150
|
+
>
|
|
151
|
+
> ```bash
|
|
152
|
+
> odoo-compose --set docker:restart=no
|
|
153
|
+
> docker compose up -d --build --wait
|
|
154
|
+
> ```
|
|
155
|
+
|
|
148
156
|
### 1.1. Adding extra addons
|
|
149
157
|
|
|
150
158
|
To extend Odoo with additional functionality, add extra addons through `[addons.<name>]` sections in `odoo-project.ini`.
|
|
151
159
|
|
|
152
|
-
In this example, we add two Git-based addon repositories, `OCA/web` and `OCA/helpdesk
|
|
153
|
-
|
|
154
|
-
#### 1.1.1. Update the project file
|
|
155
|
-
|
|
156
|
-
Edit `odoo-project.ini` in the workspace root and add these addon sections:
|
|
160
|
+
In this example, we add two Git-based addon repositories, `OCA/web` and `OCA/helpdesk`:
|
|
157
161
|
|
|
158
162
|
```ini
|
|
159
163
|
[addons.oca-web]
|
|
@@ -165,29 +169,22 @@ repo = https://github.com/OCA/helpdesk.git
|
|
|
165
169
|
branch = ${odoo:version}
|
|
166
170
|
```
|
|
167
171
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
#### 1.1.2. Sync and install addons
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
Sync the configured addon repositories and refresh the generated Docker workflow artifacts:
|
|
172
|
+
Sync the addon repositories and regenerate the Docker environment:
|
|
174
173
|
|
|
175
174
|
```bash
|
|
176
175
|
odoo-compose --sync-addons
|
|
177
176
|
docker compose up -d --build --wait
|
|
178
177
|
```
|
|
179
178
|
|
|
180
|
-
The
|
|
181
|
-
|
|
182
|
-
If an addon source contains a `requirements.txt` file, its Python dependencies are included when the Docker image is rebuilt.
|
|
179
|
+
The repositories are cloned into `ROOT/odoo-addons/` and bind-mounted into the Odoo container. Python dependencies from their `requirements.txt` files are included when rebuilding the Docker image.
|
|
183
180
|
|
|
184
|
-
Install the modules
|
|
181
|
+
Install the new modules:
|
|
185
182
|
|
|
186
183
|
```bash
|
|
187
184
|
./docker/local/scripts/run.sh -i web_notify,helpdesk_mgmt --without-demo=all --stop-after-init
|
|
188
185
|
```
|
|
189
186
|
|
|
190
|
-
For subsequent addon updates, use
|
|
187
|
+
For subsequent addon updates, use:
|
|
191
188
|
|
|
192
189
|
```bash
|
|
193
190
|
./docker/local/scripts/update.sh
|
|
@@ -618,11 +615,7 @@ Odoo starts with the generated configuration from `./odoo-configs/odoo-server.co
|
|
|
618
615
|
|
|
619
616
|
To extend Odoo with additional functionality, add extra addons through `[addons.<name>]` sections in `odoo-project.ini`.
|
|
620
617
|
|
|
621
|
-
In this example, we add two Git-based addon repositories, `OCA/web` and `OCA/helpdesk
|
|
622
|
-
|
|
623
|
-
#### 2.1.1. Update the project file
|
|
624
|
-
|
|
625
|
-
Edit `odoo-project.ini` in the workspace root and add these addon sections:
|
|
618
|
+
In this example, we add two Git-based addon repositories, `OCA/web` and `OCA/helpdesk`:
|
|
626
619
|
|
|
627
620
|
```ini
|
|
628
621
|
[addons.oca-web]
|
|
@@ -634,31 +627,27 @@ repo = https://github.com/OCA/helpdesk.git
|
|
|
634
627
|
branch = ${odoo:version}
|
|
635
628
|
```
|
|
636
629
|
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
#### 2.1.2. Sync and install addons
|
|
640
|
-
|
|
641
|
-
Sync the sources and recreate the Python environment so dependencies from the new addon repositories are included:
|
|
630
|
+
Sync the addon repositories and recreate the Python environment to include their dependencies:
|
|
642
631
|
|
|
643
632
|
```bash
|
|
644
633
|
odoo-compose-venv --sync-all --create-venv
|
|
645
634
|
```
|
|
646
635
|
|
|
647
|
-
The
|
|
636
|
+
The repositories are cloned into `ROOT/odoo-addons/` and automatically added to the generated `addons_path`. Python dependencies from their `requirements.txt` files are included in the virtual environment.
|
|
648
637
|
|
|
649
|
-
|
|
638
|
+
Install the new modules:
|
|
650
639
|
|
|
651
640
|
```bash
|
|
652
641
|
./odoo-scripts/run.sh -i web_notify,helpdesk_mgmt
|
|
653
642
|
```
|
|
654
643
|
|
|
655
|
-
For subsequent addon updates, use
|
|
644
|
+
For subsequent addon updates, use:
|
|
656
645
|
|
|
657
646
|
```bash
|
|
658
647
|
./odoo-scripts/update.sh
|
|
659
648
|
```
|
|
660
649
|
|
|
661
|
-
The
|
|
650
|
+
The update script uses `click-odoo-update` with the workspace Odoo configuration.
|
|
662
651
|
|
|
663
652
|
### 2.2. Using system Python instead of managed Python
|
|
664
653
|
|
|
@@ -1298,6 +1287,7 @@ The following sections are supported:
|
|
|
1298
1287
|
|
|
1299
1288
|
- The project file can have any filename when passed explicitly. When `INI` is omitted, `odoo-compose` uses the existing `ROOT/odoo-project.ini`; if it is missing, use `--init` to create it explicitly from the bundled default template. Remote INI sources and merged include layers are materialized as `ROOT/odoo-project.ini`.
|
|
1300
1289
|
- INI interpolation is supported, so values such as `${odoo:version}` can be reused across sections.
|
|
1290
|
+
- Use `\${section:key}` for a literal `${section:key}`.
|
|
1301
1291
|
- Multiple INI layers can be composed with `-i/--include`. Later layers override earlier layers; multi-line values are replaced as whole option values, not appended.
|
|
1302
1292
|
- The optional `[vars]` section is useful for reusable values referenced as `${vars:name}`.
|
|
1303
1293
|
- Values from `[vars]` can be overridden or injected from the CLI with `-e name=value` / `--extra-var name=value`.
|
|
@@ -1431,6 +1421,7 @@ commit = abcdef1
|
|
|
1431
1421
|
|
|
1432
1422
|
This section is optional.
|
|
1433
1423
|
|
|
1424
|
+
- `restart` — restart policy for Odoo, PostgreSQL and optional Mailpit (`no`, `always`, `unless-stopped`, or `on-failure`). Default: `unless-stopped`.
|
|
1434
1425
|
- `base_image` — Docker image used as the base image in generated Dockerfiles. Default: `odoo:${odoo:version}`.
|
|
1435
1426
|
- `odoo_source` — selects the Odoo source for Docker. `image` uses Odoo from `base_image`; `workspace` uses the workspace Odoo source. Default: `image`.
|
|
1436
1427
|
- `postgres_version` — PostgreSQL major version used by the local Docker Compose database service. Default: `16`.
|
|
@@ -1447,6 +1438,7 @@ Example:
|
|
|
1447
1438
|
|
|
1448
1439
|
```ini
|
|
1449
1440
|
[docker]
|
|
1441
|
+
restart = no
|
|
1450
1442
|
postgres_version = 18
|
|
1451
1443
|
restic_version = 0.19.1
|
|
1452
1444
|
mailpit_enabled = true
|
|
@@ -117,15 +117,19 @@ Optionally initialize the Odoo database from the command line instead of through
|
|
|
117
117
|
|
|
118
118
|
Docker Compose runs both Odoo and PostgreSQL. Odoo is available at http://localhost:8069.
|
|
119
119
|
|
|
120
|
+
> **Note**
|
|
121
|
+
> By default, generated Compose services use `restart: unless-stopped`; to prevent a development stack from automatically starting after a host or Docker restart, run:
|
|
122
|
+
>
|
|
123
|
+
> ```bash
|
|
124
|
+
> odoo-compose --set docker:restart=no
|
|
125
|
+
> docker compose up -d --build --wait
|
|
126
|
+
> ```
|
|
127
|
+
|
|
120
128
|
### 1.1. Adding extra addons
|
|
121
129
|
|
|
122
130
|
To extend Odoo with additional functionality, add extra addons through `[addons.<name>]` sections in `odoo-project.ini`.
|
|
123
131
|
|
|
124
|
-
In this example, we add two Git-based addon repositories, `OCA/web` and `OCA/helpdesk
|
|
125
|
-
|
|
126
|
-
#### 1.1.1. Update the project file
|
|
127
|
-
|
|
128
|
-
Edit `odoo-project.ini` in the workspace root and add these addon sections:
|
|
132
|
+
In this example, we add two Git-based addon repositories, `OCA/web` and `OCA/helpdesk`:
|
|
129
133
|
|
|
130
134
|
```ini
|
|
131
135
|
[addons.oca-web]
|
|
@@ -137,29 +141,22 @@ repo = https://github.com/OCA/helpdesk.git
|
|
|
137
141
|
branch = ${odoo:version}
|
|
138
142
|
```
|
|
139
143
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
#### 1.1.2. Sync and install addons
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
Sync the configured addon repositories and refresh the generated Docker workflow artifacts:
|
|
144
|
+
Sync the addon repositories and regenerate the Docker environment:
|
|
146
145
|
|
|
147
146
|
```bash
|
|
148
147
|
odoo-compose --sync-addons
|
|
149
148
|
docker compose up -d --build --wait
|
|
150
149
|
```
|
|
151
150
|
|
|
152
|
-
The
|
|
153
|
-
|
|
154
|
-
If an addon source contains a `requirements.txt` file, its Python dependencies are included when the Docker image is rebuilt.
|
|
151
|
+
The repositories are cloned into `ROOT/odoo-addons/` and bind-mounted into the Odoo container. Python dependencies from their `requirements.txt` files are included when rebuilding the Docker image.
|
|
155
152
|
|
|
156
|
-
Install the modules
|
|
153
|
+
Install the new modules:
|
|
157
154
|
|
|
158
155
|
```bash
|
|
159
156
|
./docker/local/scripts/run.sh -i web_notify,helpdesk_mgmt --without-demo=all --stop-after-init
|
|
160
157
|
```
|
|
161
158
|
|
|
162
|
-
For subsequent addon updates, use
|
|
159
|
+
For subsequent addon updates, use:
|
|
163
160
|
|
|
164
161
|
```bash
|
|
165
162
|
./docker/local/scripts/update.sh
|
|
@@ -590,11 +587,7 @@ Odoo starts with the generated configuration from `./odoo-configs/odoo-server.co
|
|
|
590
587
|
|
|
591
588
|
To extend Odoo with additional functionality, add extra addons through `[addons.<name>]` sections in `odoo-project.ini`.
|
|
592
589
|
|
|
593
|
-
In this example, we add two Git-based addon repositories, `OCA/web` and `OCA/helpdesk
|
|
594
|
-
|
|
595
|
-
#### 2.1.1. Update the project file
|
|
596
|
-
|
|
597
|
-
Edit `odoo-project.ini` in the workspace root and add these addon sections:
|
|
590
|
+
In this example, we add two Git-based addon repositories, `OCA/web` and `OCA/helpdesk`:
|
|
598
591
|
|
|
599
592
|
```ini
|
|
600
593
|
[addons.oca-web]
|
|
@@ -606,31 +599,27 @@ repo = https://github.com/OCA/helpdesk.git
|
|
|
606
599
|
branch = ${odoo:version}
|
|
607
600
|
```
|
|
608
601
|
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
#### 2.1.2. Sync and install addons
|
|
612
|
-
|
|
613
|
-
Sync the sources and recreate the Python environment so dependencies from the new addon repositories are included:
|
|
602
|
+
Sync the addon repositories and recreate the Python environment to include their dependencies:
|
|
614
603
|
|
|
615
604
|
```bash
|
|
616
605
|
odoo-compose-venv --sync-all --create-venv
|
|
617
606
|
```
|
|
618
607
|
|
|
619
|
-
The
|
|
608
|
+
The repositories are cloned into `ROOT/odoo-addons/` and automatically added to the generated `addons_path`. Python dependencies from their `requirements.txt` files are included in the virtual environment.
|
|
620
609
|
|
|
621
|
-
|
|
610
|
+
Install the new modules:
|
|
622
611
|
|
|
623
612
|
```bash
|
|
624
613
|
./odoo-scripts/run.sh -i web_notify,helpdesk_mgmt
|
|
625
614
|
```
|
|
626
615
|
|
|
627
|
-
For subsequent addon updates, use
|
|
616
|
+
For subsequent addon updates, use:
|
|
628
617
|
|
|
629
618
|
```bash
|
|
630
619
|
./odoo-scripts/update.sh
|
|
631
620
|
```
|
|
632
621
|
|
|
633
|
-
The
|
|
622
|
+
The update script uses `click-odoo-update` with the workspace Odoo configuration.
|
|
634
623
|
|
|
635
624
|
### 2.2. Using system Python instead of managed Python
|
|
636
625
|
|
|
@@ -1270,6 +1259,7 @@ The following sections are supported:
|
|
|
1270
1259
|
|
|
1271
1260
|
- The project file can have any filename when passed explicitly. When `INI` is omitted, `odoo-compose` uses the existing `ROOT/odoo-project.ini`; if it is missing, use `--init` to create it explicitly from the bundled default template. Remote INI sources and merged include layers are materialized as `ROOT/odoo-project.ini`.
|
|
1272
1261
|
- INI interpolation is supported, so values such as `${odoo:version}` can be reused across sections.
|
|
1262
|
+
- Use `\${section:key}` for a literal `${section:key}`.
|
|
1273
1263
|
- Multiple INI layers can be composed with `-i/--include`. Later layers override earlier layers; multi-line values are replaced as whole option values, not appended.
|
|
1274
1264
|
- The optional `[vars]` section is useful for reusable values referenced as `${vars:name}`.
|
|
1275
1265
|
- Values from `[vars]` can be overridden or injected from the CLI with `-e name=value` / `--extra-var name=value`.
|
|
@@ -1403,6 +1393,7 @@ commit = abcdef1
|
|
|
1403
1393
|
|
|
1404
1394
|
This section is optional.
|
|
1405
1395
|
|
|
1396
|
+
- `restart` — restart policy for Odoo, PostgreSQL and optional Mailpit (`no`, `always`, `unless-stopped`, or `on-failure`). Default: `unless-stopped`.
|
|
1406
1397
|
- `base_image` — Docker image used as the base image in generated Dockerfiles. Default: `odoo:${odoo:version}`.
|
|
1407
1398
|
- `odoo_source` — selects the Odoo source for Docker. `image` uses Odoo from `base_image`; `workspace` uses the workspace Odoo source. Default: `image`.
|
|
1408
1399
|
- `postgres_version` — PostgreSQL major version used by the local Docker Compose database service. Default: `16`.
|
|
@@ -1419,6 +1410,7 @@ Example:
|
|
|
1419
1410
|
|
|
1420
1411
|
```ini
|
|
1421
1412
|
[docker]
|
|
1413
|
+
restart = no
|
|
1422
1414
|
postgres_version = 18
|
|
1423
1415
|
restic_version = 0.19.1
|
|
1424
1416
|
mailpit_enabled = true
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.24.6"
|
|
@@ -37,6 +37,77 @@ from . import __version__
|
|
|
37
37
|
|
|
38
38
|
_logger = logging.getLogger("odoo-compose")
|
|
39
39
|
|
|
40
|
+
|
|
41
|
+
class _IniInterpolation(configparser.ExtendedInterpolation):
|
|
42
|
+
"""Interpolate ${section:option}; literal dollars need no escaping.
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
def before_set(self, parser, section, option, value):
|
|
46
|
+
# Literal '$' and '$$' are permitted in every INI value.
|
|
47
|
+
return value
|
|
48
|
+
|
|
49
|
+
def _interpolate_some(self, parser, option, accum, rest, section, map, depth):
|
|
50
|
+
rawval = parser.get(section, option, raw=True, fallback=rest)
|
|
51
|
+
if depth > configparser.MAX_INTERPOLATION_DEPTH:
|
|
52
|
+
raise configparser.InterpolationDepthError(option, section, rawval)
|
|
53
|
+
|
|
54
|
+
while rest:
|
|
55
|
+
pos = rest.find("${")
|
|
56
|
+
if pos < 0:
|
|
57
|
+
accum.append(rest)
|
|
58
|
+
return
|
|
59
|
+
|
|
60
|
+
prefix = rest[:pos]
|
|
61
|
+
slash_count = len(prefix) - len(prefix.rstrip("\\"))
|
|
62
|
+
accum.append(prefix[:len(prefix) - slash_count] + "\\" * (slash_count // 2))
|
|
63
|
+
match = self._KEYCRE.match(rest, pos)
|
|
64
|
+
|
|
65
|
+
if slash_count % 2:
|
|
66
|
+
# An odd number of backslashes makes the reference literal.
|
|
67
|
+
if match:
|
|
68
|
+
accum.append(match.group(0))
|
|
69
|
+
rest = rest[match.end():]
|
|
70
|
+
else:
|
|
71
|
+
accum.append("${")
|
|
72
|
+
rest = rest[pos + 2:]
|
|
73
|
+
continue
|
|
74
|
+
|
|
75
|
+
if match is None:
|
|
76
|
+
raise configparser.InterpolationSyntaxError(
|
|
77
|
+
option, section, "bad interpolation variable reference %r" % rest[pos:]
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
path = match.group(1).split(":")
|
|
81
|
+
rest = rest[match.end():]
|
|
82
|
+
sect = section
|
|
83
|
+
opt = option
|
|
84
|
+
try:
|
|
85
|
+
if len(path) == 1:
|
|
86
|
+
opt = parser.optionxform(path[0])
|
|
87
|
+
value = map[opt]
|
|
88
|
+
elif len(path) == 2:
|
|
89
|
+
sect = path[0]
|
|
90
|
+
opt = parser.optionxform(path[1])
|
|
91
|
+
value = parser.get(sect, opt, raw=True)
|
|
92
|
+
else:
|
|
93
|
+
raise configparser.InterpolationSyntaxError(
|
|
94
|
+
option, section, "More than one ':' found: %r" % match.group(0)
|
|
95
|
+
)
|
|
96
|
+
except (KeyError, configparser.NoSectionError, configparser.NoOptionError):
|
|
97
|
+
raise configparser.InterpolationMissingOptionError(
|
|
98
|
+
option, section, rawval, ":".join(path)
|
|
99
|
+
) from None
|
|
100
|
+
|
|
101
|
+
if value is not None:
|
|
102
|
+
if "${" in value:
|
|
103
|
+
self._interpolate_some(
|
|
104
|
+
parser, opt, accum, value, sect,
|
|
105
|
+
dict(parser.items(sect, raw=True)), depth + 1,
|
|
106
|
+
)
|
|
107
|
+
else:
|
|
108
|
+
accum.append(value)
|
|
109
|
+
|
|
110
|
+
|
|
40
111
|
_GIT_INI_PREFIX = "git+"
|
|
41
112
|
_URL_INI_TIMEOUT_SECONDS = 30
|
|
42
113
|
_URL_INI_MAX_BYTES = 1024 * 1024
|
|
@@ -160,6 +231,7 @@ _INI_SET_SUPPORTED_OPTIONS = {
|
|
|
160
231
|
"db_mem_limit",
|
|
161
232
|
"mailpit_cpus",
|
|
162
233
|
"mailpit_mem_limit",
|
|
234
|
+
"restart",
|
|
163
235
|
},
|
|
164
236
|
}
|
|
165
237
|
_INI_SET_ADDON_SUPPORTED_OPTIONS = {
|
|
@@ -246,6 +318,7 @@ class DockerConfig:
|
|
|
246
318
|
mailpit_enabled: bool = False
|
|
247
319
|
mailpit_version: str = _DEFAULT_DOCKER_MAILPIT_VERSION
|
|
248
320
|
mailpit_webui_port: int = _DEFAULT_DOCKER_MAILPIT_WEBUI_PORT
|
|
321
|
+
restart: str = "unless-stopped"
|
|
249
322
|
odoo_cpus: Optional[str] = None
|
|
250
323
|
odoo_mem_limit: Optional[str] = None
|
|
251
324
|
db_cpus: Optional[str] = None
|
|
@@ -453,7 +526,9 @@ def _require_list_str(d: Dict[str, Any], key: str) -> list[str]:
|
|
|
453
526
|
return [x.strip() for x in v]
|
|
454
527
|
|
|
455
528
|
|
|
456
|
-
def _render_resolved_ini(
|
|
529
|
+
def _render_resolved_ini(
|
|
530
|
+
cp: configparser.ConfigParser, *, redact: bool = False, escape_references: bool = False,
|
|
531
|
+
) -> str:
|
|
457
532
|
"""Render an interpolated INI copy. ConfigParser does not preserve comments."""
|
|
458
533
|
rendered = configparser.ConfigParser(interpolation=None)
|
|
459
534
|
|
|
@@ -463,6 +538,14 @@ def _render_resolved_ini(cp: configparser.ConfigParser, *, redact: bool = False)
|
|
|
463
538
|
value = cp.get(section, option, raw=False)
|
|
464
539
|
if redact and _is_sensitive_key(option):
|
|
465
540
|
value = "******"
|
|
541
|
+
if escape_references:
|
|
542
|
+
# This INI may be reloaded: a resolved literal ${...} must not
|
|
543
|
+
# become a new reference. Backslashes before it must round-trip.
|
|
544
|
+
value = re.sub(
|
|
545
|
+
r"(\\*)\$\{",
|
|
546
|
+
lambda m: "\\" * (2 * len(m.group(1)) + 1) + "${",
|
|
547
|
+
value,
|
|
548
|
+
)
|
|
466
549
|
rendered.set(section, option, value)
|
|
467
550
|
|
|
468
551
|
buf = io.StringIO()
|
|
@@ -477,7 +560,7 @@ def _ini_for_audit_log(cp: configparser.ConfigParser) -> str:
|
|
|
477
560
|
|
|
478
561
|
def _ini_for_effective_file(cp: configparser.ConfigParser) -> str:
|
|
479
562
|
"""Return resolved INI content suitable for saving as the effective project file."""
|
|
480
|
-
return _render_resolved_ini(cp, redact=False)
|
|
563
|
+
return _render_resolved_ini(cp, redact=False, escape_references=True)
|
|
481
564
|
|
|
482
565
|
|
|
483
566
|
def _ini_for_merged_source_file(cp: configparser.ConfigParser) -> str:
|
|
@@ -814,6 +897,144 @@ def _save_effective_ini_copy(
|
|
|
814
897
|
)
|
|
815
898
|
|
|
816
899
|
|
|
900
|
+
def _update_ini_values_preserving_layout(
|
|
901
|
+
content: str,
|
|
902
|
+
vars_overrides: Optional[Dict[str, str]],
|
|
903
|
+
ini_overrides: Optional[Dict[str, Dict[str, str]]],
|
|
904
|
+
) -> str:
|
|
905
|
+
"""Apply CLI overrides without rewriting unrelated INI lines or interpolation."""
|
|
906
|
+
values: Dict[str, Dict[str, str]] = {}
|
|
907
|
+
if vars_overrides:
|
|
908
|
+
values["vars"] = dict(vars_overrides)
|
|
909
|
+
if ini_overrides:
|
|
910
|
+
for section, options in ini_overrides.items():
|
|
911
|
+
values.setdefault(section, {}).update(options)
|
|
912
|
+
if not values:
|
|
913
|
+
return content
|
|
914
|
+
|
|
915
|
+
newline = "\r\n" if "\r\n" in content else "\n"
|
|
916
|
+
lines = content.splitlines(keepends=True)
|
|
917
|
+
def ini_value(value: str) -> str:
|
|
918
|
+
# Keep multi-line CLI values indented as valid INI continuation lines.
|
|
919
|
+
return value.replace("\r\n", "\n").replace("\r", "\n").replace("\n", newline + " ")
|
|
920
|
+
sections: Dict[str, tuple[int, int]] = {}
|
|
921
|
+
current_section = None
|
|
922
|
+
start = 0
|
|
923
|
+
header_pattern = re.compile(r"^[ \t]*\[([^\]\r\n]+)\][ \t]*(?:[;#].*)?$")
|
|
924
|
+
for index, line in enumerate(lines):
|
|
925
|
+
match = header_pattern.fullmatch(line.rstrip("\r\n"))
|
|
926
|
+
if match:
|
|
927
|
+
if current_section is not None:
|
|
928
|
+
sections[current_section] = (start, index)
|
|
929
|
+
current_section = match.group(1)
|
|
930
|
+
start = index + 1
|
|
931
|
+
if current_section is not None:
|
|
932
|
+
sections[current_section] = (start, len(lines))
|
|
933
|
+
|
|
934
|
+
# Process sections in reverse file order so earlier indices remain stable.
|
|
935
|
+
for section, (start, end) in sorted(
|
|
936
|
+
((name, bounds) for name, bounds in sections.items() if name in values),
|
|
937
|
+
key=lambda item: item[1][0], reverse=True,
|
|
938
|
+
):
|
|
939
|
+
pending = {key.lower(): (key, value) for key, value in values.pop(section).items()}
|
|
940
|
+
option_pattern = re.compile(r"^([ \t]*[^:=\s][^:=]*?)([ \t]*[=:][ \t]*)(.*)$")
|
|
941
|
+
for index in range(end - 1, start - 1, -1):
|
|
942
|
+
line = lines[index]
|
|
943
|
+
match = option_pattern.fullmatch(line.rstrip("\r\n"))
|
|
944
|
+
if not match:
|
|
945
|
+
continue
|
|
946
|
+
option = match.group(1).strip().lower()
|
|
947
|
+
if option not in pending:
|
|
948
|
+
continue
|
|
949
|
+
_name, value = pending.pop(option)
|
|
950
|
+
ending = line[len(line.rstrip("\r\n")):]
|
|
951
|
+
# Remove any continuation lines of the previous multi-line value.
|
|
952
|
+
next_index = index + 1
|
|
953
|
+
while next_index < len(lines) and next_index < end:
|
|
954
|
+
continuation = lines[next_index]
|
|
955
|
+
stripped = continuation.strip()
|
|
956
|
+
if stripped and continuation[:1] in " \t" and not stripped.startswith(("#", ";")):
|
|
957
|
+
del lines[next_index]
|
|
958
|
+
end -= 1
|
|
959
|
+
elif not stripped or stripped.startswith(("#", ";")):
|
|
960
|
+
next_index += 1
|
|
961
|
+
else:
|
|
962
|
+
break
|
|
963
|
+
lines[index] = f"{match.group(1)}{match.group(2)}{ini_value(value)}{ending}"
|
|
964
|
+
if pending:
|
|
965
|
+
new_lines = [f"{key} = {ini_value(value)}{newline}" for key, value in pending.values()]
|
|
966
|
+
# Ensure a missing final line ending doesn't join the new option.
|
|
967
|
+
if end > 0 and lines[end - 1] and not lines[end - 1].endswith(("\r", "\n")):
|
|
968
|
+
lines[end - 1] += newline
|
|
969
|
+
lines[end:end] = new_lines
|
|
970
|
+
|
|
971
|
+
for section, options in values.items():
|
|
972
|
+
if lines and not lines[-1].endswith(("\r", "\n")):
|
|
973
|
+
lines[-1] += newline
|
|
974
|
+
if lines and lines[-1].strip():
|
|
975
|
+
lines.append(newline)
|
|
976
|
+
lines.append(f"[{section}]{newline}")
|
|
977
|
+
lines.extend(f"{key} = {ini_value(value)}{newline}" for key, value in options.items())
|
|
978
|
+
return "".join(lines)
|
|
979
|
+
|
|
980
|
+
|
|
981
|
+
def _save_workspace_ini_overrides(
|
|
982
|
+
source_ini: Path,
|
|
983
|
+
workspace_ini: Path,
|
|
984
|
+
vars_overrides: Optional[Dict[str, str]],
|
|
985
|
+
ini_overrides: Optional[Dict[str, Dict[str, str]]],
|
|
986
|
+
) -> None:
|
|
987
|
+
"""Persist --set/-e only to ROOT/odoo-project.ini, preserving source layout."""
|
|
988
|
+
# Reject invalid effective values before touching the workspace file.
|
|
989
|
+
load_project_config(
|
|
990
|
+
source_ini, vars_overrides=vars_overrides,
|
|
991
|
+
ini_overrides=ini_overrides, log_resolved=False, log_overrides=False,
|
|
992
|
+
)
|
|
993
|
+
cp = _read_ini(source_ini, vars_overrides, ini_overrides, log_overrides=False)
|
|
994
|
+
resolved_ini = _ini_for_effective_file(cp)
|
|
995
|
+
original = source_ini.read_bytes().decode("utf-8")
|
|
996
|
+
updated = _update_ini_values_preserving_layout(original, vars_overrides, ini_overrides)
|
|
997
|
+
workspace_ini.parent.mkdir(parents=True, exist_ok=True)
|
|
998
|
+
source_copy = workspace_ini.parent / ".odt-env" / "last-source-project.ini"
|
|
999
|
+
source_copy.parent.mkdir(parents=True, exist_ok=True)
|
|
1000
|
+
shutil.copy2(source_ini, source_copy)
|
|
1001
|
+
_chmod_private(source_copy)
|
|
1002
|
+
# Preserve existing CRLF/LF line endings byte for byte, including on Windows.
|
|
1003
|
+
temp_path = workspace_ini.with_suffix(workspace_ini.suffix + ".tmp")
|
|
1004
|
+
temp_path.write_bytes(updated.encode("utf-8"))
|
|
1005
|
+
os.replace(temp_path, workspace_ini)
|
|
1006
|
+
_chmod_private(workspace_ini)
|
|
1007
|
+
resolved_copy = _save_resolved_project_ini_copy(workspace_ini, resolved_ini)
|
|
1008
|
+
_logger.info(
|
|
1009
|
+
"Saved CLI overrides to workspace INI: %s (original source: %s, resolved copy: %s)",
|
|
1010
|
+
workspace_ini, source_copy, resolved_copy,
|
|
1011
|
+
)
|
|
1012
|
+
|
|
1013
|
+
|
|
1014
|
+
def _refresh_last_ini_snapshots(
|
|
1015
|
+
layout: Layout,
|
|
1016
|
+
ini_path: Path,
|
|
1017
|
+
vars_overrides: Optional[Dict[str, str]],
|
|
1018
|
+
ini_overrides: Optional[Dict[str, Dict[str, str]]],
|
|
1019
|
+
source_snapshot_ready: bool = False,
|
|
1020
|
+
) -> None:
|
|
1021
|
+
"""Keep current source and resolved INI snapshots on every provisioning run."""
|
|
1022
|
+
cp = _read_ini(
|
|
1023
|
+
ini_path,
|
|
1024
|
+
vars_overrides=vars_overrides,
|
|
1025
|
+
ini_overrides=ini_overrides,
|
|
1026
|
+
log_overrides=False,
|
|
1027
|
+
)
|
|
1028
|
+
resolved_ini = _ini_for_effective_file(cp)
|
|
1029
|
+
source_snapshot = layout.root / ".odt-env" / "last-source-project.ini"
|
|
1030
|
+
if not source_snapshot_ready:
|
|
1031
|
+
source_snapshot.parent.mkdir(parents=True, exist_ok=True)
|
|
1032
|
+
if not _same_path(ini_path, source_snapshot):
|
|
1033
|
+
shutil.copy2(ini_path, source_snapshot)
|
|
1034
|
+
_chmod_private(source_snapshot)
|
|
1035
|
+
_save_resolved_project_ini_copy(layout.root / _DEFAULT_PROJECT_INI_NAME, resolved_ini)
|
|
1036
|
+
|
|
1037
|
+
|
|
817
1038
|
def _existing_workspace_db_name(root: Path) -> Optional[str]:
|
|
818
1039
|
"""Keep a database name already persisted in the workspace across INI refreshes."""
|
|
819
1040
|
ini_path = root / _DEFAULT_PROJECT_INI_NAME
|
|
@@ -1014,7 +1235,7 @@ def _read_ini(
|
|
|
1014
1235
|
ini_overrides: Optional[Dict[str, Dict[str, str]]] = None,
|
|
1015
1236
|
log_overrides: bool = True,
|
|
1016
1237
|
) -> configparser.ConfigParser:
|
|
1017
|
-
cp = configparser.ConfigParser(interpolation=
|
|
1238
|
+
cp = configparser.ConfigParser(interpolation=_IniInterpolation())
|
|
1018
1239
|
read_ok = cp.read(entry_ini, encoding="utf-8")
|
|
1019
1240
|
if not read_ok:
|
|
1020
1241
|
raise Exception(f"Failed to read INI config: {entry_ini}")
|
|
@@ -1143,6 +1364,16 @@ def _validate_tcp_port(value: str, option: str) -> int:
|
|
|
1143
1364
|
return port
|
|
1144
1365
|
|
|
1145
1366
|
|
|
1367
|
+
def _validate_docker_restart_policy(value: str, option: str) -> str:
|
|
1368
|
+
policy = (value or "").strip().lower()
|
|
1369
|
+
if policy not in {"no", "always", "unless-stopped", "on-failure"}:
|
|
1370
|
+
raise Exception(
|
|
1371
|
+
f"Invalid option '{option}' in section [docker] "
|
|
1372
|
+
"(expected one of: no, always, unless-stopped, on-failure)."
|
|
1373
|
+
)
|
|
1374
|
+
return policy
|
|
1375
|
+
|
|
1376
|
+
|
|
1146
1377
|
def _validate_docker_cpus(value: str, option: str) -> Optional[str]:
|
|
1147
1378
|
raw = (value or "").strip()
|
|
1148
1379
|
if not raw:
|
|
@@ -1442,6 +1673,7 @@ def load_project_config(
|
|
|
1442
1673
|
"db_mem_limit",
|
|
1443
1674
|
"mailpit_cpus",
|
|
1444
1675
|
"mailpit_mem_limit",
|
|
1676
|
+
"restart",
|
|
1445
1677
|
}
|
|
1446
1678
|
for key in cp._sections.get("docker", {}).keys():
|
|
1447
1679
|
if key not in supported_docker_options:
|
|
@@ -1450,7 +1682,7 @@ def load_project_config(
|
|
|
1450
1682
|
"Supported options: base_image, mailpit_enabled, mailpit_version, "
|
|
1451
1683
|
"mailpit_webui_port, odoo_source, postgres_version, restic_version, "
|
|
1452
1684
|
"odoo_cpus, odoo_mem_limit, db_cpus, db_mem_limit, "
|
|
1453
|
-
"mailpit_cpus, mailpit_mem_limit."
|
|
1685
|
+
"mailpit_cpus, mailpit_mem_limit, restart."
|
|
1454
1686
|
)
|
|
1455
1687
|
|
|
1456
1688
|
base_image = (
|
|
@@ -1490,6 +1722,11 @@ def load_project_config(
|
|
|
1490
1722
|
if cp.has_option("docker", "mailpit_webui_port")
|
|
1491
1723
|
else _DEFAULT_DOCKER_MAILPIT_WEBUI_PORT
|
|
1492
1724
|
),
|
|
1725
|
+
restart=(
|
|
1726
|
+
_validate_docker_restart_policy(cp.get("docker", "restart"), "restart")
|
|
1727
|
+
if cp.has_option("docker", "restart")
|
|
1728
|
+
else "unless-stopped"
|
|
1729
|
+
),
|
|
1493
1730
|
odoo_cpus=(
|
|
1494
1731
|
_validate_docker_cpus(cp.get("docker", "odoo_cpus"), "odoo_cpus")
|
|
1495
1732
|
if cp.has_option("docker", "odoo_cpus") else None
|
|
@@ -4381,6 +4618,7 @@ def render_docker_compose(layout: Layout, cfg: ProjectConfig) -> str:
|
|
|
4381
4618
|
ports = _render_docker_compose_ports(cfg.config)
|
|
4382
4619
|
volumes = _render_docker_compose_volumes(layout, cfg)
|
|
4383
4620
|
build_context = _yaml_quote_scalar(_compose_host_path(layout, layout.docker_local_dir))
|
|
4621
|
+
restart_value = '"no"' if cfg.docker.restart == "no" else cfg.docker.restart
|
|
4384
4622
|
postgres_data_path = (
|
|
4385
4623
|
"/var/lib/postgresql"
|
|
4386
4624
|
if cfg.docker.postgres_version >= 18
|
|
@@ -4403,7 +4641,7 @@ def render_docker_compose(layout: Layout, cfg: ProjectConfig) -> str:
|
|
|
4403
4641
|
mailpit_service = f"""
|
|
4404
4642
|
mailpit:
|
|
4405
4643
|
image: ghcr.io/axllent/mailpit:{cfg.docker.mailpit_version}
|
|
4406
|
-
restart:
|
|
4644
|
+
restart: {restart_value}
|
|
4407
4645
|
{mailpit_resources} environment:
|
|
4408
4646
|
MP_DATABASE: /data/mailpit.db
|
|
4409
4647
|
MP_DISABLE_VERSION_CHECK: "true"
|
|
@@ -4432,7 +4670,7 @@ def render_docker_compose(layout: Layout, cfg: ProjectConfig) -> str:
|
|
|
4432
4670
|
return f"""services:
|
|
4433
4671
|
db:
|
|
4434
4672
|
image: postgres:{cfg.docker.postgres_version}
|
|
4435
|
-
restart:
|
|
4673
|
+
restart: {restart_value}
|
|
4436
4674
|
{db_resources} logging:
|
|
4437
4675
|
driver: local
|
|
4438
4676
|
options:
|
|
@@ -4454,7 +4692,7 @@ def render_docker_compose(layout: Layout, cfg: ProjectConfig) -> str:
|
|
|
4454
4692
|
odoo:
|
|
4455
4693
|
build:
|
|
4456
4694
|
context: {build_context}
|
|
4457
|
-
restart:
|
|
4695
|
+
restart: {restart_value}
|
|
4458
4696
|
{odoo_resources} logging:
|
|
4459
4697
|
driver: local
|
|
4460
4698
|
options:
|
|
@@ -7298,7 +7536,15 @@ def sync_project(
|
|
|
7298
7536
|
source_ini_layers: Optional[list[str]] = None,
|
|
7299
7537
|
project_ini_status: Optional[str] = None,
|
|
7300
7538
|
preserved_db_name: Optional[str] = None,
|
|
7539
|
+
source_snapshot_ready: bool = False,
|
|
7301
7540
|
) -> None:
|
|
7541
|
+
root = (root_override or ini_path.parent).resolve()
|
|
7542
|
+
layout = Layout.from_root(root)
|
|
7543
|
+
_refresh_last_ini_snapshots(
|
|
7544
|
+
layout, ini_path, vars_overrides, ini_overrides,
|
|
7545
|
+
source_snapshot_ready=source_snapshot_ready,
|
|
7546
|
+
)
|
|
7547
|
+
|
|
7302
7548
|
if no_provisioning_log:
|
|
7303
7549
|
_sync_project_impl(
|
|
7304
7550
|
ini_path=ini_path,
|
|
@@ -7321,10 +7567,15 @@ def sync_project(
|
|
|
7321
7567
|
project_ini_status=project_ini_status,
|
|
7322
7568
|
preserved_db_name=preserved_db_name,
|
|
7323
7569
|
)
|
|
7570
|
+
if target == "venv":
|
|
7571
|
+
workspace_ini = root / _DEFAULT_PROJECT_INI_NAME
|
|
7572
|
+
if workspace_ini.is_file():
|
|
7573
|
+
_save_resolved_project_ini_copy(
|
|
7574
|
+
workspace_ini,
|
|
7575
|
+
_ini_for_effective_file(_read_ini(workspace_ini, log_overrides=False)),
|
|
7576
|
+
)
|
|
7324
7577
|
return
|
|
7325
7578
|
|
|
7326
|
-
root = (root_override or ini_path.parent).resolve()
|
|
7327
|
-
layout = Layout.from_root(root)
|
|
7328
7579
|
run_id = _safe_run_id()
|
|
7329
7580
|
started_at = _utc_now_iso()
|
|
7330
7581
|
argv = _redact_cli_args(cli_argv or sys.argv)
|
|
@@ -7378,7 +7629,9 @@ def sync_project(
|
|
|
7378
7629
|
|
|
7379
7630
|
_write_provisioning_record(layout, run_id, record)
|
|
7380
7631
|
|
|
7381
|
-
copied_source_ini_path = _copy_source_ini_for_manifest(
|
|
7632
|
+
copied_source_ini_path = _copy_source_ini_for_manifest(
|
|
7633
|
+
layout, run_id, layout.root / ".odt-env" / "last-source-project.ini",
|
|
7634
|
+
)
|
|
7382
7635
|
if copied_source_ini_path is not None:
|
|
7383
7636
|
source_ini_path = copied_source_ini_path
|
|
7384
7637
|
record["artifacts"]["source_ini"] = str(source_ini_path)
|
|
@@ -7450,6 +7703,10 @@ def sync_project(
|
|
|
7450
7703
|
effective_resolved = _resolved_ini_for_manifest(effective_ini, None, None)
|
|
7451
7704
|
if effective_resolved is not None:
|
|
7452
7705
|
_write_text_file(resolved_ini_path, effective_resolved, private=True, atomic=True)
|
|
7706
|
+
_save_resolved_project_ini_copy(
|
|
7707
|
+
effective_ini,
|
|
7708
|
+
_ini_for_effective_file(_read_ini(effective_ini, log_overrides=False)),
|
|
7709
|
+
)
|
|
7453
7710
|
|
|
7454
7711
|
cfg = load_project_config(
|
|
7455
7712
|
effective_ini if effective_ini.is_file() else ini_path,
|
|
@@ -7748,7 +8005,7 @@ def _copy_url_ini_to_root(
|
|
|
7748
8005
|
"Use a raw file URL instead."
|
|
7749
8006
|
)
|
|
7750
8007
|
|
|
7751
|
-
probe = configparser.ConfigParser(interpolation=
|
|
8008
|
+
probe = configparser.ConfigParser(interpolation=_IniInterpolation())
|
|
7752
8009
|
try:
|
|
7753
8010
|
probe.read_string(text)
|
|
7754
8011
|
except configparser.Error as e:
|
|
@@ -7924,7 +8181,7 @@ def _read_merged_ini_layers(layer_paths: list[Path]) -> configparser.ConfigParse
|
|
|
7924
8181
|
if not layer_paths:
|
|
7925
8182
|
raise Exception("At least one INI layer is required.")
|
|
7926
8183
|
|
|
7927
|
-
cp = configparser.ConfigParser(interpolation=
|
|
8184
|
+
cp = configparser.ConfigParser(interpolation=_IniInterpolation())
|
|
7928
8185
|
try:
|
|
7929
8186
|
read_ok = cp.read(layer_paths, encoding="utf-8")
|
|
7930
8187
|
except configparser.Error as e:
|
|
@@ -8021,11 +8278,16 @@ def _prepare_included_project_ini(
|
|
|
8021
8278
|
output_path = root / _DEFAULT_PROJECT_INI_NAME
|
|
8022
8279
|
_save_ini_layer_source_copies(root, layer_paths)
|
|
8023
8280
|
_merge_ini_layers_to_workspace_ini(layer_paths, output_path)
|
|
8024
|
-
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
8281
|
+
if vars_overrides or ini_overrides:
|
|
8282
|
+
_save_workspace_ini_overrides(
|
|
8283
|
+
output_path, output_path, vars_overrides, ini_overrides,
|
|
8284
|
+
)
|
|
8285
|
+
else:
|
|
8286
|
+
_save_effective_ini_copy(
|
|
8287
|
+
output_path,
|
|
8288
|
+
vars_overrides=vars_overrides,
|
|
8289
|
+
ini_overrides=ini_overrides,
|
|
8290
|
+
)
|
|
8029
8291
|
return output_path
|
|
8030
8292
|
|
|
8031
8293
|
|
|
@@ -8479,10 +8741,8 @@ def main(target: str = "docker", prog: str = "odoo-compose") -> None:
|
|
|
8479
8741
|
try:
|
|
8480
8742
|
ini_path, _bundle_manifest = extract_workspace_bundle(bundle_path, bundle_root)
|
|
8481
8743
|
if vars_overrides or ini_overrides:
|
|
8482
|
-
|
|
8483
|
-
ini_path,
|
|
8484
|
-
vars_overrides=vars_overrides,
|
|
8485
|
-
ini_overrides=ini_overrides,
|
|
8744
|
+
_save_workspace_ini_overrides(
|
|
8745
|
+
ini_path, ini_path, vars_overrides, ini_overrides,
|
|
8486
8746
|
)
|
|
8487
8747
|
sync_project(
|
|
8488
8748
|
ini_path,
|
|
@@ -8511,6 +8771,7 @@ def main(target: str = "docker", prog: str = "odoo-compose") -> None:
|
|
|
8511
8771
|
f"created ROOT/{_DEFAULT_PROJECT_INI_NAME} from workspace bundle "
|
|
8512
8772
|
f"{_path_for_report(bundle_path)}"
|
|
8513
8773
|
),
|
|
8774
|
+
source_snapshot_ready=bool(vars_overrides or ini_overrides),
|
|
8514
8775
|
)
|
|
8515
8776
|
except Exception as e:
|
|
8516
8777
|
_logger.error('%s', e)
|
|
@@ -8525,6 +8786,7 @@ def main(target: str = "docker", prog: str = "odoo-compose") -> None:
|
|
|
8525
8786
|
source_ini_layers: list[str] = []
|
|
8526
8787
|
project_ini_status: Optional[str] = None
|
|
8527
8788
|
preserved_db_name: Optional[str] = None
|
|
8789
|
+
source_snapshot_ready = False
|
|
8528
8790
|
|
|
8529
8791
|
if init_project and not implicit_ini:
|
|
8530
8792
|
parser.error("--init can only be used when INI is omitted and no -i/--include is provided.")
|
|
@@ -8583,16 +8845,15 @@ def main(target: str = "docker", prog: str = "odoo-compose") -> None:
|
|
|
8583
8845
|
if project_ini_status is None:
|
|
8584
8846
|
project_ini_status = f"used existing ROOT/{_DEFAULT_PROJECT_INI_NAME}"
|
|
8585
8847
|
|
|
8586
|
-
if
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
|
|
8590
|
-
|
|
8848
|
+
if vars_overrides or ini_overrides:
|
|
8849
|
+
_save_workspace_ini_overrides(
|
|
8850
|
+
ini_path, ini_path, vars_overrides, ini_overrides,
|
|
8851
|
+
)
|
|
8852
|
+
elif created_default_ini:
|
|
8591
8853
|
_save_effective_ini_copy(
|
|
8592
|
-
ini_path,
|
|
8593
|
-
vars_overrides=vars_overrides,
|
|
8594
|
-
ini_overrides=ini_overrides,
|
|
8854
|
+
ini_path, vars_overrides=vars_overrides, ini_overrides=ini_overrides,
|
|
8595
8855
|
)
|
|
8856
|
+
source_snapshot_ready = bool(vars_overrides or ini_overrides or created_default_ini)
|
|
8596
8857
|
|
|
8597
8858
|
except SystemExit:
|
|
8598
8859
|
raise
|
|
@@ -8641,6 +8902,7 @@ def main(target: str = "docker", prog: str = "odoo-compose") -> None:
|
|
|
8641
8902
|
vars_overrides=vars_overrides,
|
|
8642
8903
|
ini_overrides=ini_overrides,
|
|
8643
8904
|
)
|
|
8905
|
+
source_snapshot_ready = True
|
|
8644
8906
|
except Exception as e:
|
|
8645
8907
|
_logger.error('%s', e)
|
|
8646
8908
|
raise SystemExit(1)
|
|
@@ -8694,11 +8956,15 @@ def main(target: str = "docker", prog: str = "odoo-compose") -> None:
|
|
|
8694
8956
|
else:
|
|
8695
8957
|
ini_path = _copy_url_ini_to_root(url_ini_source, root_override)
|
|
8696
8958
|
|
|
8697
|
-
|
|
8698
|
-
|
|
8699
|
-
|
|
8700
|
-
|
|
8701
|
-
|
|
8959
|
+
if vars_overrides or ini_overrides:
|
|
8960
|
+
_save_workspace_ini_overrides(
|
|
8961
|
+
ini_path, ini_path, vars_overrides, ini_overrides,
|
|
8962
|
+
)
|
|
8963
|
+
else:
|
|
8964
|
+
_save_effective_ini_copy(
|
|
8965
|
+
ini_path, vars_overrides=vars_overrides, ini_overrides=ini_overrides,
|
|
8966
|
+
)
|
|
8967
|
+
source_snapshot_ready = True
|
|
8702
8968
|
except Exception as e:
|
|
8703
8969
|
_logger.error('%s', e)
|
|
8704
8970
|
raise SystemExit(1)
|
|
@@ -8715,6 +8981,16 @@ def main(target: str = "docker", prog: str = "odoo-compose") -> None:
|
|
|
8715
8981
|
if target == "venv":
|
|
8716
8982
|
preserved_db_name = _existing_workspace_db_name(effective_root)
|
|
8717
8983
|
default_ini_path = effective_root / _DEFAULT_PROJECT_INI_NAME
|
|
8984
|
+
if vars_overrides or ini_overrides:
|
|
8985
|
+
try:
|
|
8986
|
+
_save_workspace_ini_overrides(
|
|
8987
|
+
ini_path, default_ini_path, vars_overrides, ini_overrides,
|
|
8988
|
+
)
|
|
8989
|
+
ini_path = default_ini_path
|
|
8990
|
+
source_snapshot_ready = True
|
|
8991
|
+
except Exception as e:
|
|
8992
|
+
_logger.error('%s', e)
|
|
8993
|
+
raise SystemExit(1)
|
|
8718
8994
|
if _same_path(ini_path, default_ini_path):
|
|
8719
8995
|
project_ini_status = f"used existing ROOT/{_DEFAULT_PROJECT_INI_NAME}"
|
|
8720
8996
|
elif default_ini_path.is_file():
|
|
@@ -8767,6 +9043,7 @@ def main(target: str = "docker", prog: str = "odoo-compose") -> None:
|
|
|
8767
9043
|
source_ini_layers=source_ini_layers,
|
|
8768
9044
|
project_ini_status=project_ini_status,
|
|
8769
9045
|
preserved_db_name=preserved_db_name,
|
|
9046
|
+
source_snapshot_ready=source_snapshot_ready,
|
|
8770
9047
|
)
|
|
8771
9048
|
except Exception as e:
|
|
8772
9049
|
_logger.error(f'{e}')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: odoo-devops-tools
|
|
3
|
-
Version: 1.24.
|
|
3
|
+
Version: 1.24.6
|
|
4
4
|
Summary: Build reproducible Odoo workspaces from a single project definition.
|
|
5
5
|
Author: Roman Lacko
|
|
6
6
|
License-Expression: MIT
|
|
@@ -145,15 +145,19 @@ Optionally initialize the Odoo database from the command line instead of through
|
|
|
145
145
|
|
|
146
146
|
Docker Compose runs both Odoo and PostgreSQL. Odoo is available at http://localhost:8069.
|
|
147
147
|
|
|
148
|
+
> **Note**
|
|
149
|
+
> By default, generated Compose services use `restart: unless-stopped`; to prevent a development stack from automatically starting after a host or Docker restart, run:
|
|
150
|
+
>
|
|
151
|
+
> ```bash
|
|
152
|
+
> odoo-compose --set docker:restart=no
|
|
153
|
+
> docker compose up -d --build --wait
|
|
154
|
+
> ```
|
|
155
|
+
|
|
148
156
|
### 1.1. Adding extra addons
|
|
149
157
|
|
|
150
158
|
To extend Odoo with additional functionality, add extra addons through `[addons.<name>]` sections in `odoo-project.ini`.
|
|
151
159
|
|
|
152
|
-
In this example, we add two Git-based addon repositories, `OCA/web` and `OCA/helpdesk
|
|
153
|
-
|
|
154
|
-
#### 1.1.1. Update the project file
|
|
155
|
-
|
|
156
|
-
Edit `odoo-project.ini` in the workspace root and add these addon sections:
|
|
160
|
+
In this example, we add two Git-based addon repositories, `OCA/web` and `OCA/helpdesk`:
|
|
157
161
|
|
|
158
162
|
```ini
|
|
159
163
|
[addons.oca-web]
|
|
@@ -165,29 +169,22 @@ repo = https://github.com/OCA/helpdesk.git
|
|
|
165
169
|
branch = ${odoo:version}
|
|
166
170
|
```
|
|
167
171
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
#### 1.1.2. Sync and install addons
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
Sync the configured addon repositories and refresh the generated Docker workflow artifacts:
|
|
172
|
+
Sync the addon repositories and regenerate the Docker environment:
|
|
174
173
|
|
|
175
174
|
```bash
|
|
176
175
|
odoo-compose --sync-addons
|
|
177
176
|
docker compose up -d --build --wait
|
|
178
177
|
```
|
|
179
178
|
|
|
180
|
-
The
|
|
181
|
-
|
|
182
|
-
If an addon source contains a `requirements.txt` file, its Python dependencies are included when the Docker image is rebuilt.
|
|
179
|
+
The repositories are cloned into `ROOT/odoo-addons/` and bind-mounted into the Odoo container. Python dependencies from their `requirements.txt` files are included when rebuilding the Docker image.
|
|
183
180
|
|
|
184
|
-
Install the modules
|
|
181
|
+
Install the new modules:
|
|
185
182
|
|
|
186
183
|
```bash
|
|
187
184
|
./docker/local/scripts/run.sh -i web_notify,helpdesk_mgmt --without-demo=all --stop-after-init
|
|
188
185
|
```
|
|
189
186
|
|
|
190
|
-
For subsequent addon updates, use
|
|
187
|
+
For subsequent addon updates, use:
|
|
191
188
|
|
|
192
189
|
```bash
|
|
193
190
|
./docker/local/scripts/update.sh
|
|
@@ -618,11 +615,7 @@ Odoo starts with the generated configuration from `./odoo-configs/odoo-server.co
|
|
|
618
615
|
|
|
619
616
|
To extend Odoo with additional functionality, add extra addons through `[addons.<name>]` sections in `odoo-project.ini`.
|
|
620
617
|
|
|
621
|
-
In this example, we add two Git-based addon repositories, `OCA/web` and `OCA/helpdesk
|
|
622
|
-
|
|
623
|
-
#### 2.1.1. Update the project file
|
|
624
|
-
|
|
625
|
-
Edit `odoo-project.ini` in the workspace root and add these addon sections:
|
|
618
|
+
In this example, we add two Git-based addon repositories, `OCA/web` and `OCA/helpdesk`:
|
|
626
619
|
|
|
627
620
|
```ini
|
|
628
621
|
[addons.oca-web]
|
|
@@ -634,31 +627,27 @@ repo = https://github.com/OCA/helpdesk.git
|
|
|
634
627
|
branch = ${odoo:version}
|
|
635
628
|
```
|
|
636
629
|
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
#### 2.1.2. Sync and install addons
|
|
640
|
-
|
|
641
|
-
Sync the sources and recreate the Python environment so dependencies from the new addon repositories are included:
|
|
630
|
+
Sync the addon repositories and recreate the Python environment to include their dependencies:
|
|
642
631
|
|
|
643
632
|
```bash
|
|
644
633
|
odoo-compose-venv --sync-all --create-venv
|
|
645
634
|
```
|
|
646
635
|
|
|
647
|
-
The
|
|
636
|
+
The repositories are cloned into `ROOT/odoo-addons/` and automatically added to the generated `addons_path`. Python dependencies from their `requirements.txt` files are included in the virtual environment.
|
|
648
637
|
|
|
649
|
-
|
|
638
|
+
Install the new modules:
|
|
650
639
|
|
|
651
640
|
```bash
|
|
652
641
|
./odoo-scripts/run.sh -i web_notify,helpdesk_mgmt
|
|
653
642
|
```
|
|
654
643
|
|
|
655
|
-
For subsequent addon updates, use
|
|
644
|
+
For subsequent addon updates, use:
|
|
656
645
|
|
|
657
646
|
```bash
|
|
658
647
|
./odoo-scripts/update.sh
|
|
659
648
|
```
|
|
660
649
|
|
|
661
|
-
The
|
|
650
|
+
The update script uses `click-odoo-update` with the workspace Odoo configuration.
|
|
662
651
|
|
|
663
652
|
### 2.2. Using system Python instead of managed Python
|
|
664
653
|
|
|
@@ -1298,6 +1287,7 @@ The following sections are supported:
|
|
|
1298
1287
|
|
|
1299
1288
|
- The project file can have any filename when passed explicitly. When `INI` is omitted, `odoo-compose` uses the existing `ROOT/odoo-project.ini`; if it is missing, use `--init` to create it explicitly from the bundled default template. Remote INI sources and merged include layers are materialized as `ROOT/odoo-project.ini`.
|
|
1300
1289
|
- INI interpolation is supported, so values such as `${odoo:version}` can be reused across sections.
|
|
1290
|
+
- Use `\${section:key}` for a literal `${section:key}`.
|
|
1301
1291
|
- Multiple INI layers can be composed with `-i/--include`. Later layers override earlier layers; multi-line values are replaced as whole option values, not appended.
|
|
1302
1292
|
- The optional `[vars]` section is useful for reusable values referenced as `${vars:name}`.
|
|
1303
1293
|
- Values from `[vars]` can be overridden or injected from the CLI with `-e name=value` / `--extra-var name=value`.
|
|
@@ -1431,6 +1421,7 @@ commit = abcdef1
|
|
|
1431
1421
|
|
|
1432
1422
|
This section is optional.
|
|
1433
1423
|
|
|
1424
|
+
- `restart` — restart policy for Odoo, PostgreSQL and optional Mailpit (`no`, `always`, `unless-stopped`, or `on-failure`). Default: `unless-stopped`.
|
|
1434
1425
|
- `base_image` — Docker image used as the base image in generated Dockerfiles. Default: `odoo:${odoo:version}`.
|
|
1435
1426
|
- `odoo_source` — selects the Odoo source for Docker. `image` uses Odoo from `base_image`; `workspace` uses the workspace Odoo source. Default: `image`.
|
|
1436
1427
|
- `postgres_version` — PostgreSQL major version used by the local Docker Compose database service. Default: `16`.
|
|
@@ -1447,6 +1438,7 @@ Example:
|
|
|
1447
1438
|
|
|
1448
1439
|
```ini
|
|
1449
1440
|
[docker]
|
|
1441
|
+
restart = no
|
|
1450
1442
|
postgres_version = 18
|
|
1451
1443
|
restic_version = 0.19.1
|
|
1452
1444
|
mailpit_enabled = true
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.24.4"
|
|
File without changes
|
{odoo_devops_tools-1.24.4 → odoo_devops_tools-1.24.6}/odoo_devops_tools.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{odoo_devops_tools-1.24.4 → odoo_devops_tools-1.24.6}/odoo_devops_tools.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{odoo_devops_tools-1.24.4 → odoo_devops_tools-1.24.6}/odoo_devops_tools.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|