memos icon indicating copy to clipboard operation
memos copied to clipboard

Backup / export db

Open Fabeuss opened this issue 2 years ago • 13 comments
trafficstars

Is your feature request related to a problem?

When I updated memos to latest 0.8, container won't start... I have to delete db file to start container, but obviously all my data was gone...

Would it be possible to export database for backup purpose ?

Thanks

Describe the solution you'd like

Database export or backup file

Additional context

No response

Fabeuss avatar Nov 26 '22 11:11 Fabeuss

All your data is stored in file memo_prod.db.

You can use any tools to backup this file (i.e., your data).

Zeng1998 avatar Nov 26 '22 12:11 Zeng1998

All your data is stored in file memo_prod.db.

You can use any tools to backup this file (i.e., your data).

I know but something was broken when I updated memos so, even with the db file, I was forced to delete it for restart container... If a backup mechanism was added, maybe these issue would be resolved...?

Fabeuss avatar Nov 26 '22 12:11 Fabeuss

I can't understand, what do you mean "backup" here?

In fact, the db file is a backup file, isn't it?

Zeng1998 avatar Nov 26 '22 12:11 Zeng1998

If you failed to update memos version, there should be a backup db file in the same folder with origin db.

You can still start memos with it in previous version.

boojack avatar Nov 26 '22 13:11 boojack

@Fabeuss Can you describe how you updated it and what the error message was?

boojack avatar Nov 26 '22 13:11 boojack

Maybe related to this? I had the same problem. WychSynology - Synology NAS

p-jones avatar Nov 26 '22 13:11 p-jones

Maybe related to this? I had the same problem. WychSynology - Synology NAS

Exactely, that was my issue, thanks for screenshot 👍

Fabeuss avatar Nov 26 '22 13:11 Fabeuss

@Fabeuss Can you describe how you updated it and what the error message was?

I updated container via portainer "recreate" and pull latest version. When portainer has recreated memos, the error was "cannot open db". I was forced to delete db to restart the container.

Fabeuss avatar Nov 26 '22 13:11 Fabeuss

In your docker compose stack, change the tag to 0.8.0 like so and it should work. I had the same issue and it was due to using the "latest" tag.

version: "3.0"
services:
  memos:
    image: neosmemo/memos:0.8.0
    container_name: memos
    volumes:
      - /docker/memos/:/var/opt/memos
    ports:
      - 5230:5230

ItsNoted avatar Nov 26 '22 13:11 ItsNoted

@Fabeuss Thanks! I'll take a deep look into the related code. Maybe you can check if there is a backup file.

boojack avatar Nov 26 '22 13:11 boojack

I had the same issue and it was due to using the "latest" tag.

Do you know any detailed reason?

boojack avatar Nov 26 '22 13:11 boojack

I had the same issue and it was due to using the "latest" tag.

Do you know any detailed reason?

This is most likely due to people using Portainer and pasting the docker-compose into the stacks section. This can be fixed by backing up your db file, removing the current (older) memos image then recreating the stack to pull the latest image. Most people don't think about doing all of that in Portainer though so they get stuck with this error. Instead, they just click "deploy stack" and it doesn't pull the latest image.

ItsNoted avatar Nov 26 '22 13:11 ItsNoted

I had the same issue and it was due to using the "latest" tag.

Do you know any detailed reason?

This is most likely due to people using Portainer and pasting the docker-compose into the stacks section. This can be fixed by backing up your db file, removing the current (older) memos image then recreating the stack to pull the latest image. Most people don't think about doing all of that in Portainer though so they get stuck with this error. Instead, they just click "deploy stack" and it doesn't pull the latest image.

Weird, I've got many containers and recreating them via portainer never failed until with memos. But thanks for your notice, will try for next update

Fabeuss avatar Nov 26 '22 14:11 Fabeuss

My database was perfectly backed up but I run into the same issue the new memo version can't read the old databases. There is something wrong with the latest image 0.8.0

mariushosting avatar Nov 26 '22 21:11 mariushosting

@mariushosting @Fabeuss @p-jones If you got the issue of no such table: migration_history, please run these SQL manually into your database file. (Backup first if possible)

https://github.com/usememos/memos/blob/main/store/db/migration/prod/0.8/

boojack avatar Nov 27 '22 00:11 boojack