Set the folder for the server database - Docker installation

Operating system

Linux

Joplin version

3.0.1

Desktop version info

Joplin Server v3.0.1 installed on a Docker Container

Sync target

Joplin Server

What issue do you have?

I run a Joplin server on a Raspberry following this guide: Joplin Server Documentation - #13 by joplin_user
It seems working very well and I connected many devices all syncronized.

My point is: how to dowload/export the full database for a backup? I need a clear procedure to be prepared in case of failures of something.
I read about setting a specific folder setting about store all the data but I got this:

$ sudo docker exec -it be7b5614eab5 node packages/server/dist/app.js storage import --connection 'Type=Filesystem; Path=/mnt/ssd1/Joplin-DB'
node:internal/modules/cjs/loader:1143
  throw err;
  ^

Error: Cannot find module '/home/joplin/packages/server/packages/server/dist/app.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
    at Module._load (node:internal/modules/cjs/loader:981:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v18.20.4

What is the specific issue about? How to solve?
What do you suggest about?

I think it is good also to have only a periodic backup of the full database (including all the data) somewhere. To do that I thought to use the following commands:

pg_dump -U <joplin.db_user> --clean --no-owner --no-privileges -d <joplin.db_name> > db-dump.sql

and then to restore:

psql -U <joplin.new_db_user> -d template1 -c "DROP DATABASE <joplin.db_name>"
psql -U <joplin.new_db_user> -d template1 -c "CREATE DATABASE <joplin.db_name>"
psql -U <joplin.new_db_user> <joplin.db_name> < /tmp/db-dump.sql

The point is that I don't know how to find the db name and db user, and if the procedure effectively works, it is good or you suggest something better.
Anyway if you give a clear list of commands it will be very helpful.

I tried this command:

$ sudo docker exec -e PGPASSWORD=<password> <ID_container> pg_dump -U <id_user> <db_name> | gzip > /mnt/ssd1/Joplin-DB/backup_$(date +%Y%m%d_%H%M%S).sql.gz

and it downloaded a big gz file. Is it only a DB without data, or it contains all the data? If I upload this on a new server, is it like having already all the data inside? How to upload this on an existing Joplin server database? How to extract from it only the data?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.