Skip to content

Commit d8097ad

Browse files
authored
Merge pull request plone#1245 from plone/migrate-docker-docs
Document Docker/Container usage with Plone 6
2 parents 3b4052a + 9aab3b3 commit d8097ad

File tree

13 files changed

+1107
-2
lines changed

13 files changed

+1107
-2
lines changed

docs/glossary.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,3 +286,15 @@ DPI
286286
https://developer.mozilla.org/en-US/docs/Web/CSS/resolution#dpi
287287
```
288288
```
289+
290+
Docker
291+
[Docker](https://docker.com) is an open platform for developing, shipping, and running applications using containers.
292+
293+
RelStorage
294+
[RelStorage](https://relstorage.readthedocs.io) is a storage implementation for ZODB that stores pickles in a relational database.
295+
296+
ZEO
297+
[ZEO](https://zeo.readthedocs.io) is a client-server storage for ZODB for sharing a single storage among many clients.
298+
299+
PostgreSQL
300+
[PostgreSQL](https://www.postgresql.org/) is a powerful, open source object-relational database.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
html_meta:
3+
"description": "Examples of Plone 6 setup with containers"
4+
"property=og:description": "Examples of Plone 6 setup with containers"
5+
"property=og:title": "Example usage of Plone 6 with containers"
6+
"keywords": "Plone 6, install, installation, docker, containers"
7+
---
8+
# Examples
9+
10+
```{toctree}
11+
:maxdepth: 2
12+
:hidden: true
13+
14+
nginx-volto-plone
15+
nginx-volto-plone-zeo
16+
nginx-volto-plone-postgresql
17+
nginx-plone
18+
```
19+
20+
Examples of projects running Plone using `docker-compose`
21+
22+
| Project example | Description |
23+
| ------------------------------------------------------------ | ------------------------------------------------------- |
24+
| [nginx-volto-plone](nginx-volto-plone) | Stack with nginx, Frontend and Backend |
25+
| [nginx-volto-plone-zeo](nginx-volto-plone-zeo) | Stack with nginx, Frontend, Backend and ZEO server |
26+
| [nginx-volto-plone-postgresql](nginx-volto-plone-postgresql) | Stack with nginx, Frontend, Backend and PostgreSQL DB |
27+
| [nginx-plone](nginx-plone) | Stack with nginx, and Backend (Plone Classic) |
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Nginx, Plone Classic
2+
3+
Simple setup with one backend and data being persisted in a Docker volume.
4+
5+
## Setup
6+
7+
Create an empty project directory named `nginx-plone`
8+
9+
```shell
10+
mkdir nginx-plone
11+
```
12+
13+
Change into your project directory.
14+
15+
```shell
16+
cd nginx-plone
17+
```
18+
19+
### nginx configuration
20+
21+
Add a `default.conf` that will be used by the nginx image:
22+
23+
```nginx
24+
upstream backend {
25+
server backend:8080;
26+
}
27+
28+
server {
29+
listen 80 default_server;
30+
server_name plone.localhost;
31+
32+
location ~ / {
33+
proxy_set_header Host $host;
34+
proxy_set_header X-Real-IP $remote_addr;
35+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
36+
proxy_set_header X-Forwarded-Proto $scheme;
37+
proxy_redirect http:// https://;
38+
proxy_pass http://backend;
39+
}
40+
}
41+
```
42+
43+
### Service configuration with docker-compose
44+
45+
Now, let's create a `docker-compose.yml` file:
46+
47+
```yaml
48+
version: "3"
49+
services:
50+
51+
webserver:
52+
image: nginx
53+
volumes:
54+
- ./default.conf:/etc/nginx/conf.d/default.conf
55+
depends_on:
56+
- backend
57+
ports:
58+
- "80:80"
59+
60+
backend:
61+
image: plone/plone-backend:6.0.0a4
62+
environment:
63+
SITE: Plone
64+
TYPE: classic
65+
volumes:
66+
- data:/data
67+
ports:
68+
- "8080:8080"
69+
70+
volumes:
71+
data: {}
72+
```
73+
74+
## Build the project
75+
76+
Start the stack with `docker-compose` (or `docker compose` for newer versions)
77+
78+
```shell
79+
docker-compose up -d
80+
```
81+
82+
This will pulls the needed images, and starts Plone.
83+
84+
## Access Plone via Browser
85+
86+
After startup, go to `http://plone.localhost/` and you should see the site.
87+
88+
## Shutdown and cleanup
89+
90+
The command docker-compose down removes the containers and default network, but preserves the Plone database.
91+
92+
The command docker-compose down --volumes removes the containers, default network, and the Plone database.
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# Nginx, Frontend, Backend, Postgres
2+
3+
Very simple setup with only one or more backend instances accessing a Postgres server and data being persisted in a Docker volume.
4+
5+
## Setup
6+
7+
Create an empty project directory named `nginx-volto-plone-postgresql`
8+
9+
```shell
10+
mkdir nginx-volto-plone-postgresql
11+
```
12+
13+
Change into your project directory.
14+
15+
```shell
16+
cd nginx-volto-plone-postgresql
17+
```
18+
19+
### nginx configuration
20+
21+
Add a `default.conf` that will be used by the nginx image:
22+
23+
```nginx
24+
upstream backend {
25+
server backend:8080;
26+
}
27+
upstream frontend {
28+
server frontend:3000;
29+
}
30+
31+
server {
32+
listen 80 default_server;
33+
server_name plone.localhost;
34+
35+
location ~ /\+\+api\+\+($|/.*) {
36+
rewrite ^/(\+\+api\+\+\/?)+($|/.*) /VirtualHostBase/http/$server_name/Plone/++api++/VirtualHostRoot/$1 break;
37+
proxy_pass http://backend;
38+
}
39+
40+
location ~ / {
41+
location ~* \.(js|jsx|css|less|swf|eot|ttf|otf|woff|woff2)$ {
42+
add_header Cache-Control "public";
43+
expires +1y;
44+
proxy_pass http://frontend;
45+
}
46+
location ~* static.*\.(ico|jpg|jpeg|png|gif|svg)$ {
47+
add_header Cache-Control "public";
48+
expires +1y;
49+
proxy_pass http://frontend;
50+
}
51+
52+
location ~ /(@@download|@@images|@@ical_view) {
53+
rewrite ^(.*) /VirtualHostBase/http/$server_name/Plone/VirtualHostRoot$1 break;
54+
proxy_pass http://backend;
55+
break;
56+
}
57+
58+
proxy_set_header Host $host;
59+
proxy_set_header X-Real-IP $remote_addr;
60+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
61+
proxy_set_header X-Forwarded-Proto $scheme;
62+
proxy_redirect http:// https://;
63+
proxy_pass http://frontend;
64+
}
65+
}
66+
```
67+
68+
### Service configuration with docker-compose
69+
70+
Now, let's create a `docker-compose.yml` file:
71+
72+
```yaml
73+
version: "3"
74+
services:
75+
76+
webserver:
77+
image: nginx
78+
volumes:
79+
- ./default.conf:/etc/nginx/conf.d/default.conf
80+
depends_on:
81+
- backend
82+
- frontend
83+
ports:
84+
- "80:80"
85+
86+
frontend:
87+
image: plone/plone-frontend:latest
88+
environment:
89+
RAZZLE_INTERNAL_API_PATH: http://backend:8080/Plone
90+
ports:
91+
- "3000:3000"
92+
depends_on:
93+
- backend
94+
95+
backend:
96+
image: plone/plone-backend:6.0.0a4
97+
environment:
98+
SITE: Plone
99+
RELSTORAGE_DSN: "dbname='plone' user='plone' host='db' password='plone'"
100+
ports:
101+
- "8080:8080"
102+
depends_on:
103+
- db
104+
105+
db:
106+
image: postgres
107+
environment:
108+
POSTGRES_USER: plone
109+
POSTGRES_PASSWORD: plone
110+
POSTGRES_DB: plone
111+
volumes:
112+
- data:/var/lib/postgresql/data
113+
ports:
114+
- "5432:5432"
115+
116+
volumes:
117+
data: {}
118+
```
119+
120+
## Build the project
121+
122+
Start the stack with `docker-compose` (or `docker compose` for newer versions)
123+
124+
```shell
125+
docker-compose up -d
126+
```
127+
128+
This will pulls the needed images, and starts Plone.
129+
130+
## Access Plone via Browser
131+
132+
After startup, go to `http://plone.localhost/` and you should see the site.
133+
134+
## Increase the number of backends
135+
136+
To use two containers for backend, run `docker-compose` with `--scale`
137+
138+
```shell
139+
docker-compose up --scale backend=2
140+
```
141+
142+
## Shutdown and cleanup
143+
144+
The command docker-compose down removes the containers and default network, but preserves the Plone database.
145+
146+
The command docker-compose down --volumes removes the containers, default network, and the Plone database.

0 commit comments

Comments
 (0)