Skip to content

Commit befbe95

Browse files
committed
added backup/restore commands
1 parent 1d6b0b9 commit befbe95

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ A typical docker-compose.yml looks like this:
2323

2424
services:
2525
db:
26-
image: postgres:11
26+
image: postgres
2727
volumes:
2828
- pgdata:/var/lib/postgresql/data
2929
restart: always
@@ -36,7 +36,7 @@ A typical docker-compose.yml looks like this:
3636
depends_on:
3737
- db
3838
restart: always
39-
command: bash -c "python manage.py collectstatic --no-input && python manage.py makemigrations && python manage.py migrate && gunicorn --workers=3 pyobs_weather.wsgi -b 0.0.0.0:8000"
39+
command: bash -c "python manage.py collectstatic --no-input && python manage.py migrate && gunicorn --workers=3 pyobs_weather.wsgi -b 0.0.0.0:8000"
4040

4141
redis:
4242
image: redis
@@ -115,4 +115,19 @@ With all three files in one directory, you can easily do
115115
./manage.py createsuperuser
116116

117117
The web frontend should now be accessible via web browser at http://localhost:8002/ and the admin panel
118-
at http://localhost:8002/admin.
118+
at http://localhost:8002/admin.
119+
120+
121+
## Backup and restore config
122+
123+
Easiest way to backup the whole weather database is using the `dumpdata` command:
124+
125+
./manage.py dumpdata --indent 2 weather > weather.json
126+
127+
Probably you want to exclude the actual sensor readings and only backup the configuration:
128+
129+
./manage.py dumpdata --indent 2 weather --exclude weather.value > weather.json
130+
131+
In a fresh setup, you can restore the data via the 'loaddata' command:
132+
133+
./manage.py loaddata weather.json

0 commit comments

Comments
 (0)