You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"keywords": "Plone 6, install, installation, docker, containers, Official Images"
6
+
"property=og:title": "Plone 6 image recipes"
7
+
"keywords": "Plone 6, install, installation, Docker, containers, official images"
8
8
---
9
9
10
-
# Recipes
10
+
# Docker recipes
11
11
12
-
Here you have some useful recipes when working with Plone containers
12
+
This chapter offers some useful recipes when working with Plone containers.
13
13
14
14
15
-
## Remove access log from plone containers
15
+
## Remove access log from Plone containers
16
16
17
-
When working a project generated using [cookieplone](https://github.com/plone/cookieplone) you will be creating Plone containers for your project that are based on the official `plone/plone-backend` images.
17
+
When you generate a project using [Cookieplone](https://github.com/plone/cookieplone), it creates Plone containers for your project that are based on the official [`plone/plone-backend`](https://github.com/plone/plone-backend) images.
18
18
19
-
You may have noted that when you run your container or the official `plone/plone-backend` image, the output mixes both the event log and the access log making it hard to follow the logs you may have added to your application.
19
+
When you run your container or the official `plone/plone-backend` image with logging, the output mixes both the event log and the access log, making it hard to follow the logs you may have added to your application.
20
+
In such cases, you may have a Docker Compose setup with several components including a proxy server that already provides access logs.
21
+
Instead of duplicating the logging output, it is common to remove the access logging from the Plone container.
20
22
21
-
In such cases, you may end with a `docker compose` setup with several components in which you will have a proxy server that already provides access logs.
23
+
To do so, create a custom {file}`zope.ini` file in your project's {file}`backend` folder with the following content.
22
24
23
-
So it is a common usage configuration to remove the access logging from the Plone container.
25
+
```{code-block} ini
26
+
:emphasize-lines: 17-20
24
27
25
-
To do so you will need a custom {file}`zope.ini` file in your project's {file}`backend` folder with the following content:
26
-
27
-
```ini
28
28
[app:zope]
29
29
use = egg:Zope#main
30
30
zope_conf = %(here)s/%(config_file)s
@@ -37,7 +37,6 @@ threads = 2
37
37
clear_untrusted_proxy_headers = false
38
38
max_request_body_size = 1073741824
39
39
40
-
41
40
[filter:translogger]
42
41
use = egg:Paste#translogger
43
42
setup_console_handler = False
@@ -96,33 +95,18 @@ class = StreamHandler
96
95
args = (sys.stderr,)
97
96
level = INFO
98
97
formatter = generic
99
-
100
98
```
101
99
102
-
If you compare this file with the [original zope.ini file](https://github.com/plone/plone-backend/blob/6.1.x/skeleton/etc/zope.ini) that comes with the `plone/plone-backend` container, you may realize that the only change here is that we remove `translogger` from the `pipeline`option.
103
-
104
-
This `translogger` middleware [produces logs in the Apache Combined Log Format](https://docs.pylonsproject.org/projects/waitress/en/latest/logging.html) and that is exactly what we want to remove in our setup.
100
+
Comparing this file with the [original `zope.ini` file](https://github.com/plone/plone-backend/blob/6.1.x/skeleton/etc/zope.ini) that comes with the `plone/plone-backend` container, you may realize that the only change is the `translogger`configuration was removed from the `pipeline`section.
101
+
This [`translogger` middleware produces logs in the Apache Combined Log Format](https://docs.pylonsproject.org/projects/waitress/en/latest/logging.html).
102
+
The above configuration removes it from the setup.
105
103
106
-
After adding the mentioned file in your project, you need to adjust the {file}`Dockerfile` also.
104
+
After adding the {file}`zope.ini` file in your project, adjust the {file}`Dockerfile` by inserting the command `COPY zope.ini etc/` before the `RUN` command as highlighted below.
105
+
This new command copies the {file}`zope.ini` file into the container.
107
106
107
+
```{code-block} dockerfile
108
+
:emphasize-lines: 4
108
109
109
-
In your {file}`Dockerfile` you have the following contents:
110
-
111
-
```Dockerfile
112
-
...
113
-
# Add local code
114
-
COPY scripts/ scripts/
115
-
COPY . src
116
-
117
-
# Install local requirements and pre-compile mo files
118
-
RUN <<EOT
119
-
...
120
-
```
121
-
122
-
Just before the `RUN` command, you need to copy the {file}`zope.ini` file into the container, as follows:
123
-
124
-
```Dockerfile
125
-
...
126
110
# Add local code
127
111
COPY scripts/ scripts/
128
112
COPY . src
@@ -132,5 +116,5 @@ COPY zope.ini etc/
132
116
RUN <<EOT
133
117
```
134
118
135
-
With these changes, after you build your project container as usual, it will not output the access log, but only the event log.
136
-
119
+
After making these changes, build the project container as usual.
120
+
It will no longer output the access log, but will continue to output the event log.
0 commit comments