Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data not persistent across reboots #19

Open
jinyeow opened this issue Jan 22, 2022 · 13 comments
Open

Data not persistent across reboots #19

jinyeow opened this issue Jan 22, 2022 · 13 comments

Comments

@jinyeow
Copy link

jinyeow commented Jan 22, 2022

After I restarted my docker container, my users data did not persist. I can see 3 users (default admin, the pre-reboot admin, the pre-reboot user) but the pre-reboot users names are some random alphanumeric string, and I can't login with the username/password I had setup previously.

I had only started using it, so I'm not sure about the other workout data. But I am wondering what else I need to do/may have missed to make this persistent across restarts of the container.

My docker-compose.yml:

  1   version: '3.7' 
  2   services:
  3   wger:
  4     container_name: wger
  5     image: wger/server:latest
  6     volumes:
  7       - ./static:/home/wger/static
  8       - ./media:/home/wger/media
  9     ports:
 10       - 8097:8000
 11     environment:
 12       PUID: 1000
 13       PGID: 1000
 14       TZ: Australia/Sydney
 15     env_file:
 16       - ./prod.env
 17     depends_on:
 18       - db
 19       - cache
 20     restart: unless-stopped
 21
 22   db:
 23     image: postgres:12-alpine
 24     volumes:
 25       - ./postgres-data:/var/lib/postgresql/data/
 26     expose:
 27       - 5432
 28     environment:
 29       - POSTGRES_USER=wger
 30       - POSTGRES_PASSWORD=wger
 31       - POSTGRES_DB=wger
 32
 33   cache:
 34     restart: unless-stopped
 35     image: redis:latest
 36     expose:
 37       - 6379
@rolandgeider
Copy link
Member

That sounds really strange, why would the usernames change? I'll try to reproduce this

@rolandgeider
Copy link
Member

Sorry, could not reproduce this, even after deleting all the containers, everything was picked up the way it should

@alancarrillo
Copy link

Same for me. Data not persistent after Recreate for update. No workout, no users, no new exercises. Portainer creation same issue.


version: '3.7'

services:
web:
image: wger/server:latest
volumes:
- /volume1/docker/wger/static:/home/wger/static
- /volume1/docker/wger/media:/home/wger/media
ports:
- 8097:8000
env_file:
- ./prod.env
depends_on:
- db
- cache

db:
image: postgres:12-alpine
volumes:
- /volume1/docker/wger/postgres-data:/var/lib/postgresql/data/
expose:
- 5432
environment:
- POSTGRES_USER=wger
- POSTGRES_PASSWORD=wger
- POSTGRES_DB=wger

cache:
restart: always
image: redis:latest
expose:
- 6379

volumes:
postgres-data:
static:
media:

@rolandgeider
Copy link
Member

@alancarrillo do you get some error or anything suspicious in the startup logs or something?

@alancarrillo
Copy link

@alancarrillo do you get some error or anything suspicious in the startup logs or something?

No, no errors, no warnings, anything suspicious. The log:

Applying manager.0004_auto_20150609_1603... OK
Applying core.0002_auto_20141225_1512... OK
Applying core.0003_auto_20150217_1554... OK
Applying core.0004_auto_20150217_1914... OK
Applying core.0005_auto_20151025_2236... OK
Applying core.0006_auto_20151025_2237... OK
Applying core.0007_repetitionunit... OK
Applying core.0008_weightunit... OK
Applying core.0009_auto_20160303_2340... OK
Applying core.0010_auto_20170403_0144... OK
Applying core.0011_auto_20201201_0653... OK
Applying core.0012_auto_20210210_1228... OK
Applying core.0013_auto_20210726_1729... OK
Applying easy_thumbnails.0001_initial... OK
Applying easy_thumbnails.0002_thumbnaildimensions... OK
Applying exercises.0002_auto_20150307_1841... OK
Applying exercises.0003_auto_20160921_2000... OK
Applying exercises.0004_auto_20170404_0114... OK
Applying exercises.0005_auto_20190618_1617... OK
Applying exercises.0006_auto_20201203_0203... OK
Applying exercises.0007_auto_20201203_1042... OK
Applying exercises.0008_exercisebase... OK
Applying exercises.0009_auto_20201211_0139... OK
Applying exercises.0010_auto_20201211_0205... OK
Applying exercises.0011_auto_20201214_0033... OK
Applying exercises.0012_auto_20210327_1219... OK
Applying exercises.0013_auto_20210503_1232... OK
Applying exercises.0014_exerciseimage_style... OK
Applying gallery.0001_initial... OK
Applying mailer.0001_initial... OK
Applying mailer.0002_auto_20190618_1617... OK
Applying mailer.0003_auto_20201201_0653... OK
Applying manager.0005_auto_20160303_2008... OK
Applying manager.0006_auto_20160303_2138... OK
Applying manager.0007_auto_20160311_2258... OK
Applying manager.0008_auto_20190618_1617... OK
Applying manager.0009_auto_20201202_1559... OK
Applying manager.0010_auto_20210102_1446... OK
Applying manager.0011_remove_set_exercises... OK
Applying manager.0012_auto_20210430_1449... OK
Applying manager.0013_set_comment... OK
Applying manager.0014_auto_20210717_1858... OK
Applying manager.0015_auto_20211028_1113... OK
Applying measurements.0001_initial... OK
Applying measurements.0002_auto_20210722_1042... OK
Applying nutrition.0001_initial... OK
Applying nutrition.0002_auto_20170101_1538... OK
Applying nutrition.0003_auto_20170118_2308... OK
Applying nutrition.0004_auto_20200819_2310... OK
Applying nutrition.0005_logitem... OK
Applying nutrition.0006_auto_20201201_0653... OK
Applying nutrition.0007_auto_20201214_0013... OK
Applying nutrition.0008_auto_20210102_1446... OK
Applying nutrition.0009_meal_name... OK
Applying nutrition.0010_logitem_meal... OK
Applying sessions.0001_initial... OK
Applying sites.0001_initial... OK
Applying sites.0002_alter_domain_unique... OK
Applying weight.0001_initial... OK
Applying weight.0002_auto_20150604_2139... OK
Applying weight.0003_auto_20160416_1030... OK
Installed 1 object(s) from 1 fixture(s)
Installed 16 object(s) from 1 fixture(s)
Installed 6 object(s) from 1 fixture(s)
Installed 3 object(s) from 1 fixture(s)
Installed 5 object(s) from 1 fixture(s)
Installed 7 object(s) from 1 fixture(s)
Installed 6 object(s) from 1 fixture(s)
Installed 6 object(s) from 1 fixture(s)
Installed 512 object(s) from 1 fixture(s)
Installed 1 object(s) from 1 fixture(s)
Installed 10 object(s) from 1 fixture(s)
Installed 16 object(s) from 1 fixture(s)
Installed 7 object(s) from 1 fixture(s)
Installed 355 object(s) from 1 fixture(s)
Installed 528 object(s) from 1 fixture(s)
Installed 1 object(s) from 1 fixture(s)
Installed 1 object(s) from 1 fixture(s)
Installed 1 object(s) from 1 fixture(s)
*** Password for user admin was reset to 'adminadmin'
Installed 3 object(s) from 1 fixture(s)
yarn install v1.22.5
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
[4/5] Linking dependencies...
[5/5] Building fresh packages...
Done in 14.65s.
yarn run v1.22.5
$ sass wger/core/static/scss/main.scss:wger/core/static/yarn/bootstrap-compiled.css
Done in 8.06s.
Using django's development server...
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
February 11, 2022 - 00:23:20
Django version 3.2.12, using settings 'settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.

@rolandgeider
Copy link
Member

That it runs the migrations definitely means that the db did not survive and it's creating it new, otherwise it would just ignore them

@alancarrillo
Copy link

After firts install. Should I erase or modify something? (For example: some install carpet o config file)
What can I do for avoid migrations after upgrade? (Recreate container)

@rolandgeider
Copy link
Member

No you don't need to do anything. In theory the db should never be overwritten and I have never been able to reproduce this behavior

@alancarrillo
Copy link

Ok, I'll keep trying to get persistent data. Thank you very much for your time and work.

@rolandgeider
Copy link
Member

@alancarrillo can you try the docker-compose file from the repo and see if the problem happens there as well?

@alancarrillo
Copy link

I have tried with docker in my NAS and my NUC windows10 , with different configurations and so far the same behavior.
:/
I have 44 containers running on my NAS with no data persistence issues.

I'll figure it out one way or another. Thanx.

@alancarrillo
Copy link

A backup and restore option would be great.

@skorvek
Copy link

skorvek commented Nov 16, 2022

Try naming the volume in the compose file corresponding to a named local volume in portainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants