devlikeapro / waha

WAHA - WhatsApp HTTP API (REST API) that you can configure in a click!
https://waha.devlike.pro/
Apache License 2.0
806 stars 247 forks source link

[BUG][WEBJS] - Sessions disapper after restart #364

Closed Momaiz closed 3 weeks ago

Momaiz commented 3 weeks ago

Describe the bug

Hello Bro ,

Every time i save session in mongedb and when server restart and restart mongodb and waha container , the sessions disappers Containers created by

docker run -d -p 27017:27017 --name mongodb mongo

docker run -e WHATSAPP_SESSIONS_MONGO_URL=mongodb://localhost:27017/ --network host --name wapi -e WAHA_DASHBOARD_USERNAME=momaiz -e WAHA_DASHBOARD_PASSWORD=MSJJH@64178122 devlikeapro/waha-plus

and restart as docker restart mongodb docker restart wapi the sessions disappered

my server resources is 2 GB Memory / 2 Intel vCPUs / 70 GB Disk / FRA1 Ubuntu 24.04 (LTS) x64 and waha only work with 2 sessions

Version

{
  "version": "2024.6.2",
  "engine": "WEBJS",
  "tier": "PLUS",
  "browser": "/usr/bin/chromium"
}

How can i prevent sessions from disapper and how can i restore them ?

best regards

qwerk commented 3 weeks ago

Sessions also not saved here. my docker-compose script:

whatsapp: image: devlikeapro/waha:latest container_name: whatsapp environment:

folder are writeable for all (for testing purposes) running version: { "version": "2024.6.2", "engine": "WEBJS", "tier": "CORE", "browser": "/usr/bin/chromium" } maybe same issue, but media is not saved either.

Momaiz commented 3 weeks ago

Sessions also not saved here. my docker-compose script:

whatsapp: image: devlikeapro/waha:latest container_name: whatsapp environment: - WHATSAPP_RESTART_ALL_SESSIONS=True - WHATSAPP_FILES_LIFETIME=0 - WHATSAPP_FILES_FOLDER=/app/.media volumes: - /home/docker/whatsapp/:/app/.sessions - /home/docker/whatsapp/media:/app/.media ports: - "3100:3000" restart: unless-stopped

folder are writeable for all (for testing purposes) running version: { "version": "2024.6.2", "engine": "WEBJS", "tier": "CORE", "browser": "/usr/bin/chromium" } maybe same issue, but media is not saved either.

Thank you for answer but when i started to use mongodb as database , sessions are saved in database , so on restart it should recovered to the container again

devlikepro commented 3 weeks ago

@Momaiz for mongodb case - there's no persistent storage connected to mongodb. Sorry about that, we put example (not ready for production) in the document, will fix it!

Try this one:

   docker run -d -p 27017:27017 --name mongodb -v mongo-data:/data/db mongo

OR consider using docker-compose setup - two required services: https://github.com/devlikeapro/waha/blob/core/docker-compose.yaml#L46-L80

patron:PRO

devlikepro commented 3 weeks ago

@qwerk

"tier": "CORE",

That's the reason for your case. Saving sessions between container restarts requires PLUS docker image

devlikeapro/waha-plus

https://waha.devlike.pro/docs/how-to/plus-version/

patron:PRO