NAS backup procedure

Hi,
MM is really a great software even for a small workgroup or a family.
Is’s working seamless on a NAS in private lan, is very useful indeed, quick and secure(at leas I suppose so :slight_smile: ).
I would backup all the posts images and video shared on a channel.

Has someone and idea how to backup it ?
Mattermost Version: 5.0.0
Database Schema Version: 5.0.0
Database: postgres

please remember ON a qnapNAS.
Other details : the MMapp is NOT on docker (it runs but no container is shown).
there are different folders hidden
using Putty via ssh ?
what commands ?

Of course a good backup is also useful if it be loaded and checked : in my mind the backup for all dbs will be loaded on a new MM version on windows (at example)?
Is it feasible? (or a linux machine??)

How ?

Is a really important question and Qnap seems not really interested to help me.
I hope in this forum to give some sort of support.
Thank you!

Hi wdbusy and welcome to the Mattermost forums!

I’m not sure if this version information is correct, this would be a very old version. Can you please login to your Mattermost server using the webapp and click on the menu at the top left then and on the “About” button at the bottom? I think there’s an issue with some clients that display the wrong server version in their own about screens.

Backing up Mattermost is actually pretty easy, not sure what instructions you followed and how your filesystem looks like now, but by default, Mattermost is installed to /opt/mattermost (this might be different on your QNAP installation) and it is connected to a database (in your case, a PostgreSQL database). Is it safe to assume that the PostgreSQL database is already hosted on your QNAP?

Not sure what tooling you have available here, but you could try to connect to your QNAP via SSH (using PuTTY on Windows, f.ex.) and once you’re logged in, elevate to a root account by using sudo or su - and then try to find the folders where Mattermost is installed.
Let’s say it’s installed in ´/opt/mattermost`, you would have to back up this folder then to get all your application data and attachments into a backup.
If QNAP has a tool to back up local directories, you could try to use that, otherwise you can always just create a zip file on the Linux CLI, f.ex. using the command:

tar czf /path/to/backup.tgz /opt/mattermost

This will create a zip file called backup.tgz in the directory /path/to/ which will contain all files and folders of the /opt/mattermost directory.
In order to back up the database, you would have to use a utility like pg_dump to dump the database.
Maybe QNAP also has a tool/config option available to store a backup of your databases, please check their configuration options, but if they don’t, you can try to manually back up the database using the following command:

pg_dump mattermost > /path/to/mattermost.sql

This command will dump the database called mattermost and will store it into the file /path/to/mattermost.sql.

Sorry for the vague instructions, but I do not have a QNAP storage at hand where I can try to install Mattermost on my own to see what the paths are and what tools are available :frowning:

Hi agriesser thank you so much for your reply!
finally a bit of light on this issue: find the folder is the first step: :sweat_smile:
mm5

First : QTS is 5.0 with last patches.
Mattermost is 5.0 yeap is really old… and I installed it as regular APP on nas using the “app center”,

About your tips :
unfortunately OPT just NOT contains any Mattermost is empty.
a folder with some mattermost: /share/CACHEDEV1_DATA/.qpkg/mattermost
but no db in it.
with winscp found some folders that contain mattermost /etc and /proc/
but in MM (console) under Local Storage Directory: there is “mattermost\data” SO ?

on the nas there is actually a db folder here :

/share/CACHEDEV1_DATA/.qpkg/mattermost/volumes/db/var/lib/postgresql

I assume that a path for a db is written in somewhere… how to find it ? I was looking on .sh and .conf…
some environment variables
(MM is not visible on container station) while is running.

pg_dump command not found!
instead tar works (If only I could find what compress)
the solution is out there… but I cannot grab it.

Thank you anyway!

I can just guess here, since I do not have a system to reproduce that, sorry.
The database is not stored in a path, it’s basically a service running so inside Mattermost, you do only have the so-called “DSN” which points to your database.
The config file you’re looking for is called config.json and it should be in your mattermost installation directory, but we do not know where it is :slight_smile:

When you open a terminal on your NAS (or after you’ve SSH’ed into it), you could try to run the following command:

find /share/CACHEDEV1_DATA/.qpkg/mattermost | head -80

and post the output here - maybe it helps me to find out the next steps.

Hello,
as always thank you to keep live this thread !
json file is here:
/share/CACHEDEV1_DATA/.qpkg/mattermost/volumes/app/mattermost/config/config.json
below the output requested.

/share/CACHEDEV1_DATA/.qpkg/mattermost
/share/CACHEDEV1_DATA/.qpkg/mattermost/.list
/share/CACHEDEV1_DATA/.qpkg/mattermost/images
/share/CACHEDEV1_DATA/.qpkg/mattermost/images/app.tar
/share/CACHEDEV1_DATA/.qpkg/mattermost/images/db.tar
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/conf
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/conf/sites-available
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/conf/sites-available/mattermost-ssl
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/conf/sites-available/mattermost
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/conf/fastcgi_params
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/conf/fastcgi.conf
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/conf/mime.types
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/conf/koi-utf
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/conf/koi-win
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/conf/nginx.conf.sample
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/conf/scgi_params
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/conf/uwsgi_params
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/conf/win-utf
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/conf/conf.d
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/conf/conf.d/mattermost.conf
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/conf/nginx.conf
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/html
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/html/index.html
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/html/50x.html
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/lib
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/lib/libcrypt.so.1
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/lib/libdl.so.2
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/lib/libpcre.so.3
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/lib/libpthread.so.0
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/sbin
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/sbin/nginx
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/cert
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/cert/nginx.key
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/cert/nginx.pem
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/logs
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/logs/error.log
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/client_body_temp
/share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/proxy_temp

and many other tmp folders.

I hope this will help you :roll_eyes:
thank you!

Alright, getting closer :slight_smile:

Can you post the output of the following command (not sure if this tool is installed on a QNAP, so if it throws an error, try the second one):

jq .SqlSettings /share/CACHEDEV1_DATA/.qpkg/mattermost/volumes/app/mattermost/config/config.json
grep -A14 SqlSettings  /share/CACHEDEV1_DATA/.qpkg/mattermost/volumes/app/mattermost/config/config.json

The output will contain a password, make sure to mask it with x’s f.ex., but do not change any non-sensitive information or the like.
Also one more output I need (in the hope that it is available):

docker ps
ps ax | grep docker
ps ax | grep matter

Thanks!

Wow agriesser!,
all(4) commands works,
now I put the result of the 2nd


just removed 4 chars and a pw.

and 4th:
2217 admin 944 S grep matter
2516 2000 46076 S mattermost
2840 admin 1212 S nginx: master process /share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/sbin/nginx -c /share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/conf/nginx.conf -p /share/CACHEDEV1_DATA/.qpkg/mattermost/nginx/
23279 70 14100 S postgres: mmuser mattermost 172.30.0.3(34430) idle
31281 70 11888 S postgres: mmuser mattermost 172.30.0.3(37232) idle
31282 70 14252 S postgres: mmuser mattermost 172.30.0.3(37234) idle

let me know what other is needed, and thank you !

Hmm… so docker ps did not return any output?

Yes of course ! All 4 commands work,
what line/process are we looking for ?
below all the lines tell me which one is needed, I will send it.
(note the output is broken for now )

Hi there,
the last output wasn’t so helpful,I suppose or something it’s wrong ?
Tell me !
Thank you.

Hi again,

I’m very sorry that I did not respond here anymore, it’s hard to debug an issue with a completely unknown platform.
What QNAP system with what firmware version do you have? I’ll check if I can get one for testing for 1-2 weeks so I can then work on this equipment on my own and provide you with the relevant answers.

Hi, and thank you for your reply,
is a small intel with fw: 5.0.0.2131 product :2 5 3be,hope this data could be useful.
But I think no difference in any other model based on intel cpu (the MM app is on qnap official site!)

Thanks, what OS version do you have? QTS? QuTS hero or QES?
Also, can you link me to the official qnap site where they talk about the Mattermost application?

Hi, sorry for the late but anyway : looking for “qnap mattermost” in a well known search engine :slight_smile: first result:
Mattermost User Guide | QNAP

it’s a “native” APP for qnap but unsupported by them. It runs on QTS (x86). (it was “update” recently but the core of the app is always 5.0, so old BUT it works)
Hope can be useful.

Of course I can google for how to set it up, but this does not answer how YOU set it up and since you’re having a specific problem, I’m trying to find out how to reproduce your specific problem and the more detailed information I have, the better I’m able to help.

I’ll see if I can get my hands on a compatible box to run some tests on it, might take some time.

Sorry Agriesser, but can you be more clear about : “how YOU set it up”
there is no paths or any “strange” command to do: select the app (MM) and the QTS install… it.
NO docker no container (of course I suppose it will be used in some ways but isn’t show to the users.)
for example a guide: you can scroll Online zusammenarbeiten auf dem QNAP-NAS - so geht's! (link direct to the image https://basic-tutorials.de/wp-content/uploads/2022/08/2022_08_09_basic_tutorials_QNAP_zusammenarbeit_BILD1.png)
click on install (red arrow) and it’s done.
Let me know.
Thank you.

Hi Agriesser,
just giving a look into config Json :
Atrestencryptkey, datasource … values are useful for you ?

So any idea ?

to stop mattermost is there a CLI command to try in this environment ?
thx

UPDATE:
in qts there is another command “system-docker ps” I got now 2 lines:

2954xxxxxxx5   mattermost/app:3xxxxxxf              "/entrypoint.sh matt…"   7 weeks ago   Up 7 weeks   8065/tcp                                       mattermost_ap                                                     p_1
fd63xxxxxxxf   mattermost/db:3xxxxxxxf               "/entrypoint.sh post…"   7 weeks ago   Up 7 weeks   5432/tcp                                       mattermost_db

xxxx covered some other real numbers/letter.
Maybe is it a light at the end of the tunnel ?

:birthday: over 1 year and counting… it’s a really hard question to solve for so interesting piece of friendly software! :frowning: