Skip to content

Commit ad20b4b

Browse files
authored
Merge pull request plone#1311 from plone/plone-backend-version-substitutions
Allow configuration of source replacements.
2 parents 4768d17 + 6c736fc commit ad20b4b

File tree

11 files changed

+42
-24
lines changed

11 files changed

+42
-24
lines changed

docs/conf.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,3 +279,21 @@
279279
html_context = {
280280
"edit_page_url_template": "https://6.dev-docs.plone.org/contributing/index.html?{{ file_name }}#making-contributions-on-github",
281281
}
282+
283+
# An extension that allows replacements for code blocks that
284+
# are not supported in `rst_epilog` or other substitutions.
285+
# https://stackoverflow.com/a/56328457/2214933
286+
def source_replace(app, docname, source):
287+
result = source[0]
288+
for key in app.config.source_replacements:
289+
result = result.replace(key, app.config.source_replacements[key])
290+
source[0] = result
291+
292+
# Dict of replacements.
293+
source_replacements = {
294+
"{PLONE_BACKEND_VERSION}": "6.0.0b2",
295+
}
296+
297+
def setup(app):
298+
app.add_config_value('source_replacements', {}, True)
299+
app.connect('source-read', source_replace)

docs/install/containers/examples/haproxy-plone-zeo.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ services:
4040
LOG_LEVEL: "info"
4141

4242
backend:
43-
image: plone/plone-backend:6.0.0a6
43+
image: plone/plone-backend:{PLONE_BACKEND_VERSION}
4444
restart: always
4545
environment:
4646
ZEO_ADDRESS: zeo:8100

docs/install/containers/examples/nginx-plone.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ services:
7676
- "80:80"
7777

7878
backend:
79-
image: plone/plone-backend:6.0.0a6
79+
image: plone/plone-backend:{PLONE_BACKEND_VERSION}
8080
environment:
8181
SITE: Plone
8282
TYPE: classic

docs/install/containers/examples/nginx-volto-plone-postgresql.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ services:
106106
- backend
107107

108108
backend:
109-
image: plone/plone-backend:6.0.0a6
109+
image: plone/plone-backend:{PLONE_BACKEND_VERSION}
110110
environment:
111111
SITE: Plone
112112
RELSTORAGE_DSN: "dbname='plone' user='plone' host='db' password='plone'"

docs/install/containers/examples/nginx-volto-plone-zeo.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ services:
106106
- backend
107107

108108
backend:
109-
image: plone/plone-backend:6.0.0a6
109+
image: plone/plone-backend:{PLONE_BACKEND_VERSION}
110110
environment:
111111
SITE: Plone
112112
ZEO_ADDRESS: db:8100

docs/install/containers/examples/nginx-volto-plone.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ services:
104104
- backend
105105

106106
backend:
107-
image: plone/plone-backend:6.0.0a6
107+
image: plone/plone-backend:{PLONE_BACKEND_VERSION}
108108
environment:
109109
SITE: Plone
110110
volumes:

docs/install/containers/images/backend.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This chapter covers Plone backend [Docker](https://www.docker.com/) images using
1818
### Simple usage
1919

2020
```shell
21-
docker run -p 8080:8080 plone/plone-backend:6.0.0a6 start
21+
docker run -p 8080:8080 plone/plone-backend:{PLONE_BACKEND_VERSION} start
2222
```
2323

2424
Then point your browser at `http://localhost:8080`.
@@ -66,13 +66,13 @@ To recreate the Plone site when restarting the container, you can pass the `DELE
6666
Plone 6 example:
6767

6868
```shell
69-
docker run -p 8080:8080 -e ADDONS="eea.api.layout" -e SITE="Plone" -e PROFILES="eea.api.layout:default" plone/plone-backend:6.0.0a6
69+
docker run -p 8080:8080 -e ADDONS="eea.api.layout" -e SITE="Plone" -e PROFILES="eea.api.layout:default" plone/plone-backend:{PLONE_BACKEND_VERSION}
7070
```
7171

7272
Plone 6 Classic example:
7373

7474
```shell
75-
docker run -p 8080:8080 -e ADDONS="eea.facetednavigation" -e SITE="Plone" -e TYPE="classic" -e PROFILES="eea.facetednavigation:default" plone/plone-backend:6.0.0a6
75+
docker run -p 8080:8080 -e ADDONS="eea.facetednavigation" -e SITE="Plone" -e TYPE="classic" -e PROFILES="eea.facetednavigation:default" plone/plone-backend:{PLONE_BACKEND_VERSION}
7676
```
7777

7878
```{warning}
@@ -106,7 +106,7 @@ version: "3"
106106
services:
107107

108108
backend:
109-
image: plone/plone-backend:6.0.0a6
109+
image: plone/plone-backend:{PLONE_BACKEND_VERSION}
110110
restart: always
111111
environment:
112112
ZEO_ADDRESS: zeo:8100
@@ -174,7 +174,7 @@ version: "3"
174174
services:
175175

176176
backend:
177-
image: plone/plone-backend:6.0.0a6
177+
image: plone/plone-backend:{PLONE_BACKEND_VERSION}
178178
environment:
179179
RELSTORAGE_DSN: "dbname='plone' user='plone' host='db' password='plone'"
180180
ports:
@@ -224,13 +224,13 @@ It is possible to install add-ons during startup time in a container created usi
224224
To do so, pass the `ADDONS` environment variable with a space separated list of requirements to be added to the image:
225225

226226
```shell
227-
docker run -p 8080:8080 -e ADDONS="pas.plugins.authomatic" plone/plone-backend:6.0.0a6 start
227+
docker run -p 8080:8080 -e ADDONS="pas.plugins.authomatic" plone/plone-backend:{PLONE_BACKEND_VERSION} start
228228
```
229229

230230
This approach also allows you to test Plone with a specific version of one of its core components
231231

232232
```shell
233-
docker run -p 8080:8080 -e ADDONS="plone.volto==3.1.0a3" plone/plone-backend:6.0.0a6 start
233+
docker run -p 8080:8080 -e ADDONS="plone.volto==3.1.0a3" plone/plone-backend:{PLONE_BACKEND_VERSION} start
234234
```
235235

236236
```{warning}
@@ -248,13 +248,13 @@ To do so, pass the `DEVELOP` environment variable with a space separated list of
248248
These packages will be installed with `pip install --editable`.
249249

250250
```shell
251-
docker run -p 8080:8080 -e DEVELOP="/app/src/mysite.policy" plone/plone-backend:6.0.0a6 start
251+
docker run -p 8080:8080 -e DEVELOP="/app/src/mysite.policy" plone/plone-backend:{PLONE_BACKEND_VERSION} start
252252
```
253253

254254
This approach also allows you to develop local packages by using a volume.
255255

256256
```shell
257-
docker run -p 8080:8080 -e DEVELOP="/app/src/mysite.policy" -v /path/to/mysite.policy:/app/src/mysite.policy plone/plone-backend:6.0.0a6 start
257+
docker run -p 8080:8080 -e DEVELOP="/app/src/mysite.policy" -v /path/to/mysite.policy:/app/src/mysite.policy plone/plone-backend:{PLONE_BACKEND_VERSION} start
258258
```
259259

260260
```{warning}
@@ -267,7 +267,7 @@ We advise against using this feature on production environments.
267267
In a directory create a `Dockerfile` file:
268268

269269
```Dockerfile
270-
FROM plone/plone-backend:6.0.0a6
270+
FROM plone/plone-backend:{PLONE_BACKEND_VERSION}
271271
272272
RUN apt-get update \
273273
&& apt-get install -y --no-install-recommends gcc \

docs/install/containers/images/frontend.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ version: "3"
100100
services:
101101

102102
backend:
103-
image: plone/plone-backend:6.0.0a6
103+
image: plone/plone-backend:{PLONE_BACKEND_VERSION}
104104
# Plone 5.2 series can be used too
105105
# image: plone/plone-backend:5.2.7
106106
ports:

docs/install/containers/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Consult [Get Docker](https://docs.docker.com/get-docker/) for details.
5959
First start the Plone Backend, naming it `plone6-backend` and creating a site with its default configuration, using the following command.
6060

6161
```shell
62-
docker run --name plone6-backend -e SITE=Plone -e CORS_ALLOW_ORIGIN='*' -d -p 8080:8080 plone/plone-backend:6.0.0a6
62+
docker run --name plone6-backend -e SITE=Plone -e CORS_ALLOW_ORIGIN='*' -d -p 8080:8080 plone/plone-backend:{PLONE_BACKEND_VERSION}
6363
```
6464

6565
Now start the Plone Frontend, linking it to the `plone6-backend`:

docs/install/source-step-by-step.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ site-packages/
6767
Install Plone 6 with constrained requirements using `pip`.
6868

6969
```shell
70-
pip install Plone -c https://dist.plone.org/release/6.0.0a6/constraints.txt
70+
pip install Plone -c https://dist.plone.org/release/{PLONE_BACKEND_VERSION}/constraints.txt
7171
```
7272

7373
````{admonition} mkwsgiinstance's minimal Zope configuration
@@ -102,7 +102,7 @@ mkwsgiinstance -u admin:admin -d .
102102
python3.9 -m venv venv
103103
source venv/bin/activate
104104
pip install -U pip wheel
105-
pip install Plone -c https://dist.plone.org/release/6.0.0a6/constraints.txt
105+
pip install Plone -c https://dist.plone.org/release/{PLONE_BACKEND_VERSION}/constraints.txt
106106
mkwsgiinstance -u admin:admin -d .
107107
```
108108
````
@@ -246,7 +246,7 @@ If you want to checkout a Plone Core package for development or just want to ove
246246

247247
```
248248
# constraints.txt with unresolvable version conflict
249-
-c https://dist.plone.org/release/6.0.0a6/constraints.txt
249+
-c https://dist.plone.org/release/{PLONE_BACKEND_VERSION}/constraints.txt
250250
plone.api>=2.0.0a3
251251
```
252252
@@ -274,7 +274,7 @@ collective.easyform
274274
{file}`constraints.txt`
275275

276276
```ini
277-
-c https://dist.plone.org/release/6.0.0a6/constraints.txt
277+
-c https://dist.plone.org/release/{PLONE_BACKEND_VERSION}/constraints.txt
278278

279279
# constraints of add-ons
280280
collective.easyform==3.4.5

0 commit comments

Comments
 (0)