{"id":1572,"date":"2022-07-29T15:47:54","date_gmt":"2022-07-29T13:47:54","guid":{"rendered":"https:\/\/hobbykeller.spdns.de\/?p=1572"},"modified":"2022-07-29T16:01:16","modified_gmt":"2022-07-29T14:01:16","slug":"simple-backup-solution-for-mayan-edms","status":"publish","type":"post","link":"https:\/\/hobbykeller.spdns.de\/?p=1572","title":{"rendered":"Simple backup solution for Mayan EDMS"},"content":{"rendered":"\n<p>When it comes to backing up Mayan, we essentially have to back up two components:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>The <code>\/opt\/mayan-edms\/media<\/code> directory<\/li><li>The PostgreSQL database<\/li><\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Remote storage location<\/h2>\n\n\n\n<p>First thing we need is a remote storage location. We go for an NFS share which we mount on the Mayan System. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Initial setup<\/h3>\n\n\n\n<p>Setup on the storage machine is the same as <a rel=\"noreferrer noopener\" href=\"https:\/\/hobbykeller.spdns.de\/?p=1213\" data-type=\"post\" data-id=\"1213\" target=\"_blank\">section 1.1 of the Raspibackup instructions<\/a>.<\/p>\n\n\n\n<p>The backup path on the destination machine is: <code>\/home\/nfs\/mayanha<\/code> with ownership privileges for <code>nobody<\/code>:<code>nogroup<\/code>.<\/p>\n\n\n\n<p>On the Mayan server, set up a mount point as follows:<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"font:ubuntu-mono lang:default decode:true \" title=\"Adding Mountpoint on the Mayan Server\">sudo mkdir -p \/mnt\/nfs\nsudo chown nobody:nogroup \/mnt\/nfs<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Mounting the NFS system<\/h3>\n\n\n\n<p>In order to perform a backup, mount the remote NFS system to the mountpoint you created on the Mayan machine:<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"font:ubuntu-mono lang:default decode:true \" title=\"Mount NFS share on Mayan Machine\">sudo mount 192.168.4.41:\/home\/nfs\/mayanha \/mnt\/nfs<\/pre><\/div>\n\n\n\n<p>In case you get a message like the one below, your client machine lacks the <code>nfs-common<\/code> (distros other than Ubuntu may call it <code>nfs-utils<\/code>) package. Just issue <code>sudo apt install nfs-common<\/code>.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"font:ubuntu-mono font-size:13 lang:default decode:true \" title=\"Error message when missing the nfs-common package\">mount: \/mnt\/nfs: bad option; for several filesystems (e.g. nfs, cifs) you might need a \/sbin\/mount.&lt;type&gt; helper program.\n<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Backup Operation<\/h2>\n\n\n\n<p>To backup the PostgreSQL data base, on the Mayan Machine issue the following command:<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:default decode:true \" title=\"Backing up the complete PostgreSQL Server\">sudo -u postgres pg_dumpall | gzip &gt; \/mnt\/nfs\/20220727_mayan_postgresql.gz<\/pre><\/div>\n\n\n\n<p>We prefer to have the complete PostgreSQL Server dumped instead of the single Mayan data base because we don&#8217;t have to care about user privileges and passwords that way.<\/p>\n\n\n\n<p>Next we will backup the \/opt\/mayan-edms\/media directory as per the backup instructions of the Mayan online documentation. <\/p>\n\n\n\n<p>We slightly deviate from the instructions given in the Mayan documentation in two points:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>We stop the <code>supervisor<\/code> daemon to prevent Mayan EDMS from altering the files in the media directory while the backup is running.<\/li><li>We leave out the <code>v<\/code>erbose option in the <code>tar<\/code> command as the verbose option results in an endless list of files which (a) slows down the creation of the tar.gz file and (b) prevents us from properly noticing error messages that might be relevant but gets lost in the file list.<\/li><\/ol>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"font:ubuntu-mono lang:default decode:true \" title=\"Dumping the Mayan media directory\">sudo service supervisor stop\nsudo tar -zcf \/mnt\/nfs\/20220728_mayan_media.tar.gz \/opt\/mayan-edms\/media\/<\/pre><\/div>\n\n\n\n<p>After the backup don&#8217;t forget to reengage the supervisor service:<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"font:ubuntu-mono font-size:13 lang:default decode:true \" title=\"Reengaging the supervisor service\" >sudo service supervisor start<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Open Questions<\/h3>\n\n\n\n<p>Notice that the there are other files and directories under \/opt\/mayan-edms\/media:<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"font:ubuntu-mono lang:default decode:true \" title=\"Mayan EDMS directory\">ilek@mayanha:\/opt\/mayan-edms$ ls -alh\ntotal 32K\ndrwxr-xr-x  7 mayan mayan 4.0K Jun  8 20:24 .\ndrwxr-xr-x  3 root  root  4.0K Jun  8 19:07 ..\ndrwxr-xr-x  3 mayan mayan 4.0K Jul 23 13:15 bin\ndrwxr-xr-x  3 mayan mayan 4.0K Jun  8 19:08 include\ndrwxr-xr-x  3 mayan mayan 4.0K Jun  8 19:07 lib\nlrwxrwxrwx  1 mayan mayan    3 Jun  8 19:07 lib64 -&gt; lib\ndrwxrwxr-x 10 mayan mayan 4.0K Jun 11 10:39 media\n-rw-r--r--  1 mayan mayan   70 Jun  8 19:07 pyvenv.cfg\ndrwxrwxr-x  3 mayan mayan 4.0K Jun  8 19:08 share\n<\/pre><\/div>\n\n\n\n<p>This means that upon restore writing just expanding the backup of the <code>media<\/code> subdirectory will <strong>not<\/strong> reproduce the complete mayan installation.<\/p>\n\n\n\n<p>It should rather be assumed that you have an <strong>&#8217;empty&#8217; Mayan EDMS installation<\/strong> installed for which you will have to overwrite the media directory with the content from your backup file.<\/p>\n\n\n\n<div class=\"wp-block-simple-alerts-for-gutenberg-alert-boxes sab-alert sab-alert-primary\" role=\"alert\">Keep in mind that when creating the empty Mayan installation into which you later  restore, you make sure to use the same passwords as for the installation you just backed up. In particular, you should use identical passwords for&#8230;<br>&#8211; the postgres super user of your database<br>&#8211; the mayan user of your database<br>&#8211; the redis user password<br>&#8211; the rabbitiq user password<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">\u00d7<\/span><\/button><\/div>\n\n\n\n<p>Furthermore, looking at the upgrade instructions in the Mayan online documentation, there are <strong>additional files that (might) have to be customized<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>\/etc\/supervisor\/conf.d\/mayan-edms.conf<\/code> (this is even outside the <code>\/opt\/mayan-edms\/<\/code> directory), this file looks unsuspicious though and unless there have not been explicit customizations, the conf file created from an empty Mayan installation should be fine.<\/li><li>\/etc\/redis\/redis.conf (again outside the \/opt\/mayan-edms\/ directory), note that this file holds the redis password<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>When it comes to backing up Mayan, we essentially have to back up two components: The \/opt\/mayan-edms\/media directory The PostgreSQL database Remote storage location First thing we need is a<span class=\"more-button\"><a href=\"https:\/\/hobbykeller.spdns.de\/?p=1572\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\">Simple backup solution for Mayan EDMS<\/span><\/a><\/span><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[64,1],"tags":[77,289,273],"class_list":["post-1572","post","type-post","status-publish","format-standard","hentry","category-linux","category-uncategorized","tag-backup","tag-mayan-edms","tag-nfs"],"_links":{"self":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/1572","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1572"}],"version-history":[{"count":10,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/1572\/revisions"}],"predecessor-version":[{"id":1585,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/1572\/revisions\/1585"}],"wp:attachment":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1572"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1572"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1572"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}