monica icon indicating copy to clipboard operation
monica copied to clipboard

settings.export_status_failed When trying to export SQL & Json backups

Open tladder opened this issue 3 years ago • 10 comments

Describe the bug I've recently imported a database from a v3.5.0 docker instance into a fresh 3.6.1 docker setup. After looking to make an export of the 3.6.1 database for backup purposes, I receive the following error: settings.export_status_failed (Also seen in the screenshot)

Screenshots Capture2

Which version are you using: A self-hosted Ubuntu 20.04 full VM running the latest docker and docker-compose. I've used phpmyadmin to import the 3.5 database into the 3.6.1 database.

My docker-compose file:

version: "3.4"

services:
  app:
    image: monica
    depends_on:
      - db
    ports:
      - 8080:80
    environment:
      - APP_KEY=REDACTED
      - DB_HOST=db
      - DB_USERNAME=usermonica
      - DB_PASSWORD=secret
      - DEFAULT_MAX_UPLOAD_SIZE=500000
    volumes:
      - data:/var/www/html/storage
    restart: always

  db:
    image: mysql:5.7
    environment:
      - MYSQL_RANDOM_ROOT_PASSWORD=true
      - MYSQL_DATABASE=monica
      - MYSQL_USER=usermonica
      - MYSQL_PASSWORD=secret
    volumes:
      - mysql:/var/lib/mysql
    restart: always

  phpmyadmin:
      image: phpmyadmin/phpmyadmin
      container_name: pma
      links:
        - db
      environment:
        PMA_HOST: db
        PMA_PORT: 3306
        PMA_ARBITRARY: 1
      restart: always
      ports:
        - 8081:80
   
volumes:
  data:
    name: data
  mysql:
    name: mysql
  dbdata:

tladder avatar Jan 30 '22 01:01 tladder

Same issue Self-hosted running Ubuntu server 20.04.3 in VM Clean install of Monicahq 3.6.1 No import of data and getting the same error when trying to export

locutus2017 avatar Jan 31 '22 20:01 locutus2017

Hello. Apart from the wrong localized message that will be fixed, it would be nice to have some logs, from the standard logs, or maybe in the failed_jobs table?

asbiin avatar Feb 06 '22 10:02 asbiin

+1

Brice187 avatar Feb 06 '22 10:02 Brice187

Unfortunately nothing interesting :-(

MariaDB [monica]> SELECT * FROM failed_jobs;
Empty set (0.001 sec)
10.42.0.1 - - [06/Feb/2022:11:49:25 +0100] "GET /settings/export HTTP/1.1" 200 5510 "https://example.com/settings" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
10.42.0.1 - - [06/Feb/2022:11:49:36 +0100] "POST /settings/exportToJson HTTP/1.1" 302 1559 "https://example.com/settings/export" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
10.42.0.1 - - [06/Feb/2022:11:49:44 +0100] "GET /settings/export HTTP/1.1" 200 5562 "https://example.com/settings/export" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
...
Screenshot 2022-02-06 at 11 52 14

UPDATE

The file gets created!

MariaDB [monica]> SELECT * FROM export_jobs;
+----+------+------------+---------+------+--------+----------+-------------------------------------------------------+---------------------+---------------------+---------------------+---------------------+
| id | uuid | account_id | user_id | type | status | location | filename                                              | started_at          | ended_at            | created_at          | updated_at          |
+----+------+------------+---------+------+--------+----------+-------------------------------------------------------+---------------------+---------------------+---------------------+---------------------+
|  3 | NULL |          1 |       1 | sql  | failed | public   | exports/rRMr1jf4gBmkk0jxa9Ki5TftlXNIU9VbSBuPUtQQ.sql  | 2022-01-29 23:19:04 | 2022-01-29 23:19:05 | 2022-01-29 23:19:04 | 2022-01-29 23:19:35 |
|  4 | NULL |          1 |       1 | sql  | failed | public   | exports/IAbRclkOqti78HkamPsKKOz8eu6zQVkCRTXOd1Cp.sql  | 2022-01-29 23:21:24 | 2022-01-29 23:21:24 | 2022-01-29 23:21:24 | 2022-01-29 23:21:54 |
|  5 | NULL |          1 |       1 | json | failed | public   | exports/E4BOInWPGvCCIKfndXDdyeOfLyROXuITVM55RyLv.json | 2022-01-29 23:24:09 | 2022-01-29 23:24:18 | 2022-01-29 23:24:09 | 2022-01-29 23:24:48 |
|  6 | NULL |          1 |       1 | json | failed | public   | exports/CI8bAdX2KDjrLjF7dTBsRvQ2Y8KxmBDo5lShEOcS.json | 2022-02-06 10:35:31 | 2022-02-06 10:35:40 | 2022-02-06 10:35:31 | 2022-02-06 10:35:40 |
|  7 | NULL |          1 |       1 | json | failed | public   | exports/UQ82hfd4iPcUX0izSytoE16MDYmE2XdyFHnUFedk.json | 2022-02-06 10:49:36 | 2022-02-06 10:49:44 | 2022-02-06 10:49:36 | 2022-02-06 10:49:44 |
+----+------+------------+---------+------+--------+----------+-------------------------------------------------------+---------------------+---------------------+---------------------+---------------------+
5 rows in set (0.000 sec)
root@monica-6497cd64dc-x64pt:/var/www/html# ls -l /var/www/html/storage/app/public/exports/UQ82hfd4iPcUX0izSytoE16MDYmE2XdyFHnUFedk.json 
-rw-r--r-- 1 www-data www-data 9029645 Feb  6 11:49 /var/www/html/storage/app/public/exports/UQ82hfd4iPcUX0izSytoE16MDYmE2XdyFHnUFedk.json

Brice187 avatar Feb 06 '22 10:02 Brice187

Any fix for this issue I did a clean install of 3.7.0 on ubuntu server VM Still same issue Screen Shot 2022-02-18 at 5 04 21 PM

locutus2017 avatar Feb 18 '22 22:02 locutus2017

@asbiin If the export tool built in to the web interface doesn't function as expected, is it likely that exporting the database manually (like via phpmyadmin) would allow it to be imported - as an alternate way to back up the database?

Thanks!

tladder avatar Mar 10 '22 18:03 tladder

This seems to still be an issue. For those of you wanting to still have access to your exports, follow these steps:

  • First use the UI to export to Json or to SQL
  • When the UI reports that the export has failed (wait until it has finished) run the following sudo docker exec monica-app-1 ls /var/www/html/storage/app/public/exports
  • If you see files, then the export has likely worked. Run the following to copy the files to your local machine sudo docker cp monica-app-1:/var/www/html/storage/app/public/exports ./exports

NOTE: this copies ALL exports to your local machine, not just the most recent ones. Also, you MUST verify that the resulting files actually contain your valid data before deleting anything in the container

DesignsWithDavid avatar Mar 31 '22 17:03 DesignsWithDavid

I can confirm this issue is still ongoing and @DesignsWithDavid workaround is also working for the time being

kavemang avatar Aug 25 '22 22:08 kavemang

Hi!

Same issue here running 'latest' Monica 3.7.0 on an 8-raspberry-cluster-docker-swarm (actually with MariaDB, but same issue with MySQL). Also for me both exports (SQL and JSON) show 'Failed' after about 30 seconds.

But opening the commandline on the app container and navigating to /var/www/html/storage/app/public/exports/ indeed shows the files being created.

That's not the best user experience, but a least a way to get and backup the exports.

wolf-rainer avatar Sep 07 '22 10:09 wolf-rainer

Hi there, I seem to be running into the same type of issue. I tried to export, but all I see is:

Screen Shot 2022-11-22 at 1 08 41 AM

Then I tried to export a few more times and now got 4 "Doing" status', but it looks like it's hung.

expionage avatar Nov 22 '22 09:11 expionage

The workaround @DesignsWithDavid mentioned was working up until a few days ago for me. JSON exports are now no longer being created inside the docker container after hitting export. Not sure what changed, it was working one day with the same dataset, then the next day it just randomly stopped working for me. SQL exports still work, for now.

edmooond avatar Aug 11 '23 10:08 edmooond