Skip to content

Commit 369ad8f

Browse files
authored
Merge pull request #116 from PeterDaveHello/patch-1
Improve README.md code block readability
2 parents 645e25b + 6de2793 commit 369ad8f

File tree

1 file changed

+70
-48
lines changed

1 file changed

+70
-48
lines changed

README.md

Lines changed: 70 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@ For example, you might not want to run the application on port 80 because some
3737
other service in your network is already using it. For this, simply create a new
3838
file called `docker-compose.override.yml` with the following content:
3939

40-
services:
41-
nginx:
42-
ports:
43-
- "8080:80"
40+
```yml
41+
services:
42+
nginx:
43+
ports:
44+
- "8080:80"
45+
```
4446
4547
Now the port setting will be overwritten from the configured nginx service when
4648
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
5355
`docker-compose.override.yml`). There you add the settings that you changed, and only
5456
those, which makes it easier to troubleshoot, etc.:
5557

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+
```
6064

6165
To add a web interface for the celery queue, add a new service to the override file:
6266

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+
```
7985

8086
For more information and possibilities consult <https://docs.docker.com/compose/extends/>
8187

@@ -84,23 +90,27 @@ For more information and possibilities consult <https://docs.docker.com/compose/
8490
1. Cd into the environment of your choice.
8591
2. To start all services:
8692

87-
docker compose up -d
88-
93+
```sh
94+
docker compose up -d
95+
```
96+
8997
Optionally download current exercises, exercise images and the ingredients
9098
from wger.de. Please note that `load-online-fixtures` will overwrite any local
9199
changes you might have while `sync-ingredients` should be used afterward once
92100
you have imported the initial fixtures:
93101

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+
```
104114

105115
(these steps are configured by default to run regularly in the background, but
106116
can also run on startup as well, see the options in `prod.env`.)
@@ -114,35 +124,47 @@ password **adminadmin**
114124

115125
Just remove the containers and pull the newest version:
116126

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+
```
120132

121133
### 3 - Lifecycle Management
122134

123135
To stop all services issue a stop command, this will preserve all containers
124136
and volumes:
125137

126-
docker compose stop
138+
```sh
139+
docker compose stop
140+
```
127141

128142
To start everything up again:
129143

130-
docker compose start
144+
```sh
145+
docker compose start
146+
```
131147

132148
To remove all containers (except for the volumes)
133149

134-
docker compose down
150+
```sh
151+
docker compose down
152+
```
135153

136154
To view the logs:
137155

138-
docker compose logs -f
156+
```sh
157+
docker compose logs -f
158+
```
139159

140160
You might need to issue other commands or do other manual work in the container,
141161
e.g.
142162

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+
```
146168

147169
## Deployment
148170

@@ -215,7 +237,7 @@ this can be done with a simple file. Create the file `/etc/systemd/system/wger.s
215237
and enter the following content (check where the absolute path of the docker
216238
command is with `which docker`)
217239

218-
```
240+
```ini
219241
[Unit]
220242
Description=wger docker compose service
221243
PartOf=docker.service
@@ -243,7 +265,7 @@ after a reboot.
243265
**Database volume:** The most important thing to backup. For this just make
244266
a dump and restore it when needed
245267

246-
```
268+
```sh
247269
# Stop all other containers so the db is not changed while you export it
248270
docker compose stop web nginx cache celery_worker celery_beat
249271
docker compose exec db pg_dumpall --clean --username wger > backup.sql

0 commit comments

Comments
 (0)