@@ -37,10 +37,12 @@ For example, you might not want to run the application on port 80 because some
37
37
other service in your network is already using it. For this, simply create a new
38
38
file called ` docker-compose.override.yml ` with the following content:
39
39
40
- services:
41
- nginx:
42
- ports:
43
- - "8080:80"
40
+ ``` yml
41
+ services :
42
+ nginx :
43
+ ports :
44
+ - " 8080:80"
45
+ ` ` `
44
46
45
47
Now the port setting will be overwritten from the configured nginx service when
46
48
you do a ` docker compose up`. However, note that compose will concatenate both sets
@@ -53,29 +55,33 @@ and add it after the provided `prod.env` for the web service (again, this is
53
55
` docker-compose.override.yml` ). There you add the settings that you changed, and only
54
56
those, which makes it easier to troubleshoot, etc. :
55
57
56
- web:
57
- env_file:
58
- - ./config/prod.env
59
- - ./config/my.env
58
+ ` ` ` yml
59
+ web:
60
+ env_file:
61
+ - ./config/prod.env
62
+ - ./config/my.env
63
+ ` ` `
60
64
61
65
To add a web interface for the celery queue, add a new service to the override file :
62
66
63
- celery_flower:
64
- image: wger/server:latest
65
- container_name: wger_celery_flower
66
- command: /start-flower
67
- env_file:
68
- - ./config/prod.env
69
- ports:
70
- - "5555:5555"
71
- healthcheck:
72
- test: wget --no-verbose --tries=1 http://localhost:5555/healthcheck
73
- interval: 10s
74
- timeout: 5s
75
- retries: 5
76
- depends_on:
77
- celery_worker:
78
- condition: service_healthy
67
+ ` ` ` yml
68
+ celery_flower:
69
+ image: wger/server:latest
70
+ container_name: wger_celery_flower
71
+ command: /start-flower
72
+ env_file:
73
+ - ./config/prod.env
74
+ ports:
75
+ - "5555:5555"
76
+ healthcheck:
77
+ test: wget --no-verbose --tries=1 http://localhost:5555/healthcheck
78
+ interval: 10s
79
+ timeout: 5s
80
+ retries: 5
81
+ depends_on:
82
+ celery_worker:
83
+ condition: service_healthy
84
+ ` ` `
79
85
80
86
For more information and possibilities consult <https://docs.docker.com/compose/extends/>
81
87
@@ -84,23 +90,27 @@ For more information and possibilities consult <https://docs.docker.com/compose/
84
90
1. Cd into the environment of your choice.
85
91
2. To start all services :
86
92
87
- docker compose up -d
88
-
93
+ ` ` ` sh
94
+ docker compose up -d
95
+ ` ` `
96
+
89
97
Optionally download current exercises, exercise images and the ingredients
90
98
from wger.de. Please note that `load-online-fixtures` will overwrite any local
91
99
changes you might have while `sync-ingredients` should be used afterward once
92
100
you have imported the initial fixtures :
93
101
94
- docker compose exec web python3 manage.py sync-exercises
95
- docker compose exec web python3 manage.py download-exercise-images
96
- docker compose exec web python3 manage.py download-exercise-videos
97
-
98
- # Loads a base set of ingredients
99
- docker compose exec web wger load-online-fixtures
100
-
101
- # optionally run this afterwards to sync all the ingredients (around 1GB,
102
- # this process takes a loooong time):
103
- docker compose exec web python3 manage.py sync-ingredients-async
102
+ ` ` ` sh
103
+ docker compose exec web python3 manage.py sync-exercises
104
+ docker compose exec web python3 manage.py download-exercise-images
105
+ docker compose exec web python3 manage.py download-exercise-videos
106
+
107
+ # Loads a base set of ingredients
108
+ docker compose exec web wger load-online-fixtures
109
+
110
+ # optionally run this afterwards to sync all the ingredients (around 1GB,
111
+ # this process takes a loooong time):
112
+ docker compose exec web python3 manage.py sync-ingredients-async
113
+ ` ` `
104
114
105
115
(these steps are configured by default to run regularly in the background, but
106
116
can also run on startup as well, see the options in `prod.env`.)
@@ -114,35 +124,47 @@ password **adminadmin**
114
124
115
125
Just remove the containers and pull the newest version :
116
126
117
- docker compose down
118
- docker compose pull
119
- docker compose up
127
+ ` ` ` sh
128
+ docker compose down
129
+ docker compose pull
130
+ docker compose up
131
+ ` ` `
120
132
121
133
# ## 3 - Lifecycle Management
122
134
123
135
To stop all services issue a stop command, this will preserve all containers
124
136
and volumes :
125
137
126
- docker compose stop
138
+ ` ` ` sh
139
+ docker compose stop
140
+ ` ` `
127
141
128
142
To start everything up again :
129
143
130
- docker compose start
144
+ ` ` ` sh
145
+ docker compose start
146
+ ` ` `
131
147
132
148
To remove all containers (except for the volumes)
133
149
134
- docker compose down
150
+ ` ` ` sh
151
+ docker compose down
152
+ ` ` `
135
153
136
154
To view the logs :
137
155
138
- docker compose logs -f
156
+ ` ` ` sh
157
+ docker compose logs -f
158
+ ` ` `
139
159
140
160
You might need to issue other commands or do other manual work in the container,
141
161
e.g.
142
162
143
- docker compose exec web yarn install
144
- docker compose exec --user root web /bin/bash
145
- docker compose exec --user postgres db psql wger -U wger
163
+ ` ` ` sh
164
+ docker compose exec web yarn install
165
+ docker compose exec --user root web /bin/bash
166
+ docker compose exec --user postgres db psql wger -U wger
167
+ ` ` `
146
168
147
169
# # Deployment
148
170
@@ -215,7 +237,7 @@ this can be done with a simple file. Create the file `/etc/systemd/system/wger.s
215
237
and enter the following content (check where the absolute path of the docker
216
238
command is with `which docker`)
217
239
218
- ```
240
+ ` ` ` ini
219
241
[Unit]
220
242
Description=wger docker compose service
221
243
PartOf=docker.service
@@ -243,7 +265,7 @@ after a reboot.
243
265
**Database volume:** The most important thing to backup. For this just make
244
266
a dump and restore it when needed
245
267
246
- ```
268
+ ` ` ` sh
247
269
# Stop all other containers so the db is not changed while you export it
248
270
docker compose stop web nginx cache celery_worker celery_beat
249
271
docker compose exec db pg_dumpall --clean --username wger > backup.sql
0 commit comments