Nico640 / docker-unms

All-in-one docker image for Ubiquiti UISP (formerly UNMS). Supports x86_64 and ARM (Raspberry Pi).
https://hub.docker.com/r/nico640/docker-unms
213 stars 26 forks source link

Unable to restore backup file #62

Closed bmg12249 closed 2 years ago

bmg12249 commented 2 years ago

hi, i upgraded to bullseye on raspberry pi after having problems installing on previous buster and all went well but i am unable to restore my backup file from 1.3.11. It goes through the motions and looks like its restoring but eventually returns to the uisp setup page. any pointers?? thanks

bmg12249 commented 2 years ago

hi, actually i don't think this is a problem at your end as i see other people have the same problem from time to time on the uisp forum.

Nico640 commented 2 years ago

Check the logs after trying to restore the backup (docker logs container_name) and post them here. Also, you can try to create a new 1.3.11 container, restore the backup and then upgrade to 1.4.2.

bmg12249 commented 2 years ago

hi logs below. thanks Sentry release: Version: 1.4.2+4b508a57da.2022-01-16T00:54:44+01:00 Waiting for database containers Restoring backups and/or running migrations yarn run v1.22.15 $ yarn backup:apply && yarn migrate && yarn check-crm-db $ node -r ts-node/register/transpile-only ./cli/apply-backup {"name":"UNMS","hostname":"b1d5e1dea693","pid":4492,"level":30,"msg":"Restoring UCRM backup","time":"2022-02-08T16:30:14.796Z","v":0} {"name":"UNMS","hostname":"b1d5e1dea693","pid":4492,"level":30,"msg":"Restoring UISP backup","time":"2022-02-08T16:33:30.629Z","v":0} {"name":"UNMS","hostname":"b1d5e1dea693","pid":4492,"level":30,"msg":"Destroying SSH connection to cloud.","time":"2022-02-08T16:33:35.268Z","v":0} {"name":"UNMS","hostname":"b1d5e1dea693","pid":4492,"level":50,"err":{"message":"500 - \"sh: /ssh-proxy.sh: not found\n\"","name":"StatusCodeError","stack":"StatusCodeError: 500 - \"sh: /ssh-proxy.sh: not found\n\"\n at new StatusCodeError (/home/app/unms/node_modules/request-promise-core/lib/errors.js:32:15)\n at Request.plumbing.callback (/home/app/unms/node_modules/request-promise-core/lib/plumbing.js:104:33)\n at Request.RP$callback [as _callback] (/home/app/unms/node_modules/request-promise-core/lib/plumbing.js:46:31)\n at Request.self.callback (/home/app/unms/node_modules/request/request.js:185:22)\n at Request.emit (node:events:390:28)\n at Request.emit (node:domain:475:12)\n at Request. (/home/app/unms/node_modules/request/request.js:1154:10)\n at Request.emit (node:events:390:28)\n at Request.emit (node:domain:475:12)\n at IncomingMessage. (/home/app/unms/node_modules/request/request.js:1076:12)"},"msg":"Failed to destroy SSH tunnel to cloud","time":"2022-02-08T16:33:35.339Z","v":0} {"name":"UNMS","hostname":"b1d5e1dea693","pid":4492,"level":30,"msg":"Restoring database","time":"2022-02-08T16:33:35.342Z","v":0} {"name":"UNMS","hostname":"b1d5e1dea693","pid":4492,"level":30,"msg":"Connected to SiriDB server version: 2.0.44","time":"2022-02-08T16:33:35.398Z","v":0} {"name":"UNMS","hostname":"b1d5e1dea693","pid":4492,"level":30,"msg":"Adjusting limits for SiriDB database 'unms'","time":"2022-02-08T16:33:35.401Z","v":0} {"name":"UNMS","hostname":"b1d5e1dea693","pid":4492,"level":30,"msg":"Adjusting limits for SiriDB database 'unms_archive'","time":"2022-02-08T16:33:35.415Z","v":0} Extension 'uuid-ossp:1.1 installed. Extension 'pgcrypto:1.3 installed. Extension 'cube:1.4 installed. Extension 'earthdistance:1.1 installed. Extension 'unaccent:1.1 installed. Extension 'pg_stat_statements:1.8 installed. == Initial migration: migrating ======= == Initial migration: migrated (2.651s) == 20201113095804-add-udapi-version (1.4.0): migrating ======= == 20201113095804-add-udapi-version: migrated (0.044s) == 20201118104122-add_table_data_link_statistics (1.4.0): migrating ======= == 20201118104122-add_table_data_link_statistics: migrated (0.083s) == 20201203140108-remove-data-link-statistics-table (1.4.0): migrating ======= == 20201203140108-remove-data-link-statistics-table: migrated (0.041s) == 20210105143421-wireless-antenna-built-in (1.4.0): migrating ======= == 20210105143421-wireless-antenna-built-in: migrated (0.03s) == 20210106144535-add-table-mac_token (1.4.0): migrating ======= == 20210106144535-add-table-mac_token: migrated (0.064s) == 20210118131621-add-bridge-version (1.4.0): migrating ======= == 20210118131621-add-bridge-version: migrated (0.026s) == 20210122095039-uisp-interface-id-statistics (1.4.0): migrating ======= == 20210122095039-uisp-interface-id-statistics: migrated (0.696s) == 20210127121849-alter-column-backup-id-device-backup (1.4.0): migrating ======= == 20210127121849-alter-column-backup-id-device-backup: migrated (0.063s) == 20210128154842-add-token-ip (1.4.0): migrating ======= == 20210128154842-add-token-ip: migrated (0.096s) == 20210202091538-wifiman-url (1.4.0): migrating ======= == 20210202091538-wifiman-url: migrated (0.039s) == 20210211145338-device-capabilities-gps (1.4.0): migrating ======= == 20210211145338-device-capabilities-gps: migrated (0.031s) == 20210223135229-stations-mcs-index (1.4.0): migrating ======= == 20210223135229-stations-mcs-index: migrated (0.029s) == 20210322095417-clear-table-config (1.4.0): migrating ======= == 20210322095417-clear-table-config: migrated (0.027s) == 20210419173912-remove-wifiman-enum-type (1.4.0): migrating ======= == 20210419173912-remove-wifiman-enum-type: migrated (0.036s) == 20210421145122-turn-on-new-dashboard (1.4.0): migrating ======= == 20210421145122-turn-on-new-dashboard: migrated (0.018s) == 20210422184346-add-new-poe-enum-values (1.4.0): migrating ======= == 20210422184346-add-new-poe-enum-values: migrated (0.027s) == 20210426132739-add-gw-connectivity-provider (1.4.0): migrating ======= == 20210426132739-add-gw-connectivity-provider: migrated (0.026s) == 20210426154023-add-gateway-stats-table (1.4.0): migrating ======= == 20210426154023-add-gateway-stats-table: migrated (0.049s) == 20210430152248-ensure-gateway-statistics-records (1.4.0): migrating ======= == 20210430152248-ensure-gateway-statistics-records: migrated (0.03s) == 20210506105130-remove-blog (1.4.0): migrating ======= == 20210506105130-remove-blog: migrated (0.072s) == 20210514182449-migrate-outage-stats-to-device-table (1.4.0): migrating ======= == 20210514182449-migrate-outage-stats-to-device-table: migrated (0.058s) == 20210517091457-create-blog-posts (1.4.0): migrating ======= == 20210517091457-create-blog-posts: migrated (0.085s) == 20210524150157-return-outage-score (1.4.0): migrating ======= == 20210524150157-return-outage-score: migrated (0.042s) == 20210526151201-extend-speed-report (1.4.0): migrating ======= == 20210526151201-extend-speed-report: migrated (0.075s) == 20210527102155-add-system-vendor-device (1.4.0): migrating ======= == 20210527102155-add-system-vendor-device: migrated (0.028s) == 20210531150157-add-autoedge-capability (1.4.0): migrating ======= == 20210531150157-add-autoedge-capability: migrated (0.018s) == 20210608110329-add-column-firmware-compatibility (1.4.0): migrating ======= == 20210608110329-add-column-firmware-compatibility: migrated (0.046s) == 20210608133002-device-capabilities-support_router (1.4.0): migrating ======= == 20210608133002-device-capabilities-support_router: migrated (0.025s) == 20210716165006-add-uknown-to-site-status-enum (1.4.0): migrating ======= == 20210716165006-add-uknown-to-site-status-enum: migrated (0.031s) == 20210716182402-remove-device-upgrade-preference (1.4.0): migrating ======= == 20210716182402-remove-device-upgrade-preference: migrated (0.039s) == 20210720133711-add-gw-internet-capacity (1.4.0): migrating ======= == 20210720133711-add-gw-internet-capacity: migrated (0.038s) == 20210826234659-stations-airtime (1.4.0): migrating ======= == 20210826234659-stations-airtime: migrated (0.033s) == 20210917103601-ideal-capacity (1.4.0): migrating ======= == 20210917103601-ideal-capacity: migrated (0.026s) == 20210924152801-update-expose-status-values (1.4.0): migrating ======= == 20210924152801-update-expose-status-values: migrated (0.023s) == 20211007184058-site-device-outage-count (1.4.0): migrating ======= == 20211007184058-site-device-outage-count: migrated (0.026s) == 20211022105009-theoretical-total-capacity (1.4.0): migrating ======= == 20211022105009-theoretical-total-capacity: migrated (0.05s) == 20211110150422-add_interface_mss_clamping (1.4.0): migrating ======= == 20211110150422-add_interface_mss_clamping: migrated (0.061s) == 20211117160422-extend-numeric-altitude (1.4.0): migrating ======= == 20211117160422-extend-numeric-altitude: migrated (0.023s) == 20211216114500-add_stp_state (1.4.0): migrating ======= == 20211216114500-add_stp_state: migrated (0.048s) Migrations finished in 5.22s {"name":"UNMS","hostname":"b1d5e1dea693","pid":4492,"level":30,"msg":"Database restored","time":"2022-02-08T16:34:16.956Z","v":0} {"name":"UNMS","hostname":"b1d5e1dea693","pid":4492,"level":30,"msg":"Restoring statistics","time":"2022-02-08T16:34:16.960Z","v":0} {"name":"UNMS","hostname":"b1d5e1dea693","pid":4492,"level":30,"msg":"Statistics restored","time":"2022-02-08T16:34:44.777Z","v":0} {"name":"UNMS","hostname":"b1d5e1dea693","pid":4492,"level":30,"msg":"Restoring directory /home/app/unms/public/site-images","time":"2022-02-08T16:34:44.779Z","v":0} {"name":"UNMS","hostname":"b1d5e1dea693","pid":4492,"level":50,"err":{"message":"EACCES: permission denied, mkdir '/home/app/unms/public/site-images/6d9b3a58-f60c-4c5f-9bfd-a4c58e519391'","name":"Error","stack":"Error: EACCES: permission denied, mkdir '/home/app/unms/public/site-images/6d9b3a58-f60c-4c5f-9bfd-a4c58e519391'","code":"EACCES"},"msg":"Failed to restore directory /home/app/unms/public/site-images from /home/app/unms/data/unms-backups/restore/unms/site-images.","time":"2022-02-08T16:34:44.804Z","v":0} {"name":"UNMS","hostname":"b1d5e1dea693","pid":4492,"level":50,"err":{"message":"EACCES: permission denied, mkdir '/home/app/unms/public/site-images/6d9b3a58-f60c-4c5f-9bfd-a4c58e519391'","name":"Error","stack":"Error: EACCES: permission denied, mkdir '/home/app/unms/public/site-images/6d9b3a58-f60c-4c5f-9bfd-a4c58e519391'","code":"EACCES"},"msg":"Backup restore failed, resetting database to empty state","time":"2022-02-08T16:34:44.805Z","v":0} {"name":"UNMS","hostname":"b1d5e1dea693","pid":4492,"level":30,"msg":"There is no UCRM backup found, resetting UCRM","time":"2022-02-08T16:34:45.859Z","v":0} [Error: EACCES: permission denied, mkdir '/home/app/unms/public/site-images/6d9b3a58-f60c-4c5f-9bfd-a4c58e519391'] { errno: -13, code: 'EACCES', syscall: 'mkdir', path: '/home/app/unms/public/site-images/6d9b3a58-f60c-4c5f-9bfd-a4c58e519391' } error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Nico640 commented 2 years ago

There's a permission issue with the images directory. Also, it actually isn't saved in the persistent directory, causing it to get wiped every time the container is recreated. I pushed a fix to the testing branch, please test it by using the testing tag instead of latest or 1.4.2 when starting / creating the container.

For example:

docker run -d --name unms -p 80:80 -p 443:443 -p 2055:2055/udp -v </path/to/config>:/config nico640/docker-unms:testing

bmg12249 commented 2 years ago

hi, This worked backup restored all running ok now .( there is an issue that it hangs about once a day both on 1.42 and 1.3.11 on bullseye but not on buster and brings network down but not a problem for me). thanks