juanluisbaptiste / docker-otrs

The unofficial Znuny/OTRS Ticketing System docker image
https://www.juanbaptiste.tech/category/otrs
GNU Lesser General Public License v3.0
173 stars 101 forks source link

How to restore #46

Closed houstek closed 5 years ago

houstek commented 5 years ago

Hi, I made a backup of my legacy OTRS install (v5.0.27) with : linux:/opt/otrs/scripts# ./backup.pl -d /backup/ I put the backup in the folder ./volumes/backup When trying to restore it, I run into the following error:


mysqladmin:

connect to server at 'mariadb' failed

error: 'Lost connection to MySQL server at 'reading initial communication packet', system error: 111'

[INFO] Database server is not available. Waiting 2 seconds...

[INFO] Database server is up !

[INFO] Restoring OTRS backup: "2018-11-08_09-34" for host

[INFO] Updating database password on configuration file...

sed: can't read /opt/otrs/Kernel/Config.pm: No such file or directory

[INFO] Updating databse server on configuration file...

sed: can't read /opt/otrs/Kernel/Config.pm: No such file or directory

[INFO] Updating SMTP server on configuration file...

grep: /opt/otrs/Kernel/Config.pm: No such file or directory

[INFO] Adding configuration option SendmailModule with value: Kernel::System::Email::SMTP

sed: can't read /opt/otrs/Kernel/Config.pm: No such file or directory

grep: /opt/otrs/Kernel/Config.pm: No such file or directory

[INFO] Adding configuration option SendmailModule::Host with value: postfix

sed: can't read /opt/otrs/Kernel/Config.pm: No such file or directory

grep: /opt/otrs/Kernel/Config.pm: No such file or directory

[INFO] Adding configuration option SendmailModule::Port with value: 25

sed: can't read /opt/otrs/Kernel/Config.pm: No such file or directory

ERROR 1049 (42000) at line 1: Unknown database 'otrs'

[INFO] Creating OTRS database...

sed: can't read /opt/otrs/Kernel/Config.pm: No such file or directory

tar (child): /var/otrs/backups/"2018-11-08_09-34": Cannot open: No such file or directory

tar (child): Error is not recoverable: exiting now

tar: Child returned status 2

tar: Error is not recoverable: exiting now

[ERROR] Couldn't uncompress main backup file !!

> 

My compose : 

version: '3'

services: otrs: image: juanluisbaptiste/otrs:5.0.27 build: otrs ports:

houstek commented 5 years ago

he seems not to find the backup folder. Yet he is present. 2018-11-09_15h03_54 2018-11-09_15h05_05

juanluisbaptiste commented 5 years ago

Hi,

Please try latest build (latest-5x tag).

houstek commented 5 years ago

Thx for your reply @juanluisbaptiste

Same problem with image: juanluisbaptiste/otrs:latest-5x

With OTRS_INSTALL=no , everything is OK

` ... mariadb_1 | Finished mysql_install_db otrs_1 | mysqladmin: connect to server at 'mariadb' failed otrs_1 | error: 'Lost connection to MySQL server at 'reading initial communication packet', system error: 111' otrs_1 | [INFO] Database server is not available. Waiting 2 seconds... mariadb_1 | 181110 08:38:08 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'. mariadb_1 | 181110 08:38:08 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql otrs_1 | [INFO] Database server is up ! otrs_1 | [INFO] Restoring OTRS backup: 2018-11-08_09-35 for host otrs_1 | [INFO] Updating database password on configuration file... otrs_1 | sed: can't read /opt/otrs/Kernel/Config.pm: No such file or directory otrs_1 | [INFO] Updating databse server on configuration file... otrs_1 | sed: can't read /opt/otrs/Kernel/Config.pm: No such file or directory otrs_1 | [INFO] Updating SMTP server on configuration file... otrs_1 | grep: /opt/otrs/Kernel/Config.pm: No such file or directory otrs_1 | [INFO] Adding configuration option SendmailModule with value: Kernel::System::Email::SMTP otrs_1 | sed: can't read /opt/otrs/Kernel/Config.pm: No such file or directory otrs_1 | grep: /opt/otrs/Kernel/Config.pm: No such file or directory otrs_1 | [INFO] Adding configuration option SendmailModule::Host with value: postfix otrs_1 | sed: can't read /opt/otrs/Kernel/Config.pm: No such file or directory otrs_1 | grep: /opt/otrs/Kernel/Config.pm: No such file or directory otrs_1 | [INFO] Adding configuration option SendmailModule::Port with value: 25 otrs_1 | sed: can't read /opt/otrs/Kernel/Config.pm: No such file or directory otrs_1 | ERROR 1049 (42000) at line 1: Unknown database 'otrs' otrs_1 | [INFO] Creating OTRS database... otrs_1 | sed: can't read /opt/otrs/Kernel/Config.pm: No such file or directory otrs_1 | Can't locate Encode/Locale.pm in @INC (@INC contains: /opt/otrs/Custom /opt/otrs/Kernel/cpan-lib /opt/otrs /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Kernel/System/Encode.pm line 15. otrs_1 | BEGIN failed--compilation aborted at Kernel/System/Encode.pm line 15. otrs_1 | Compilation failed in require at Kernel/System/ObjectManager.pm line 30. otrs_1 | BEGIN failed--compilation aborted at Kernel/System/ObjectManager.pm line 30. otrs_1 | Compilation failed in require at /opt/otrs/scripts/restore.pl line 30. otrs_1 | BEGIN failed--compilation aborted at /opt/otrs/scripts/restore.pl line 30. otrs_1 | [ERROR] Couldn't load OTRS backup !! docker-otrs_otrs_1 exited with code 1

`

juanluisbaptiste commented 5 years ago

That's not the same issue as shown in the screenshot which is that the backup file isn't being found. This same error you post it at first, then you modified something and send the screenshot that is of a functional install (with the restore bug).

What's the image hash ?

houstek commented 5 years ago

ok, let's go back to zero I made a backup of my legacy OTRS install (v5.0.27) with :

/opt/otrs/scripts# ./backup.pl -d /backup/

I put the backup in the folder ./volumes/backup

docker compose: https://pastebin.com/BYAF0e54 otrs-setup.env: https://pastebin.com/dfuYMVA3 image hash: juanluisbaptiste/otrs latest-5x sha256:a81ffb4159122c617b1242f766d0157091caf954b4df8b6710caf043cd29f56d with OTRS_INSTALL = no, I have no errors, OTRS launches and the backup directory is accessible from the container :

2018-11-11_07h38_21 2018-11-11_07h39_04

Now, I'm doing a docker-compose stop, change OTRS_INSTALL = restore and docker-compose up :

2018-11-11_07h43_25

if i try a fresh install with OTRS_INSTALL= restore : 2018-11-11_08h56_02

houstek commented 5 years ago

Restoring the backup in manual mode works well:

2018-11-12_09h18_10

juanluisbaptiste commented 5 years ago

Were you able to restore the backup ? I can restore without issues. I started a clean OTRS 5 install, created a backup, then stopped the container and set:

OTRS_INSTALL=restore
OTRS_BACKUP_DATE=2018-12-13_15-56
OTRS_DROP_DATABASE=yes

To restore it, this is the output:

docker-otrs-5x $ docker-compose up
WARNING: Dependency conflict: an older version of the 'docker-py' package may be polluting the namespace. If you're experiencing crashes, run the following command to remedy the issue:
pip uninstall docker-py; pip uninstall docker; pip install docker
Starting dockerotrs5x_mariadb_1 ... done
Recreating dockerotrs5x_otrs_1 ... done
Attaching to dockerotrs5x_mariadb_1, dockerotrs5x_otrs_1
mariadb_1  | 181213 16:29:43 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
otrs_1     | mysqladmin: connect to server at 'mariadb' failed
otrs_1     | error: 'Lost connection to MySQL server at 'reading initial communication packet', system error: 111'
mariadb_1  | 181213 16:29:43 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
otrs_1     | [INFO] Database server is not available. Waiting 2 seconds...
otrs_1     | [INFO] Database server is up !
otrs_1     | [INFO] Restoring OTRS backup: 2018-12-13_15-56 for host support.xxxxxx.com
otrs_1     | [INFO] Updating database password on configuration file...
otrs_1     | [INFO] Updating databse server on configuration file...
otrs_1     | [INFO] Updating SMTP server on configuration file...
otrs_1     | [INFO] Updating configuration option SendmailModule with value: Kernel::System::Email::SMTP
otrs_1     | [INFO] Updating configuration option SendmailModule::Host with value: postfix
otrs_1     | [INFO] Updating configuration option SendmailModule::Port with value: 25
otrs_1     | [INFO] OTRS_DROP_DATABASE=yes, Dropping existing database
otrs_1     | 
otrs_1     | [INFO] Creating OTRS database...
otrs_1     | Restore /var/otrs/backups/2018-12-13_15-56//Config.tar.gz ...
otrs_1     | Restore /var/otrs/backups/2018-12-13_15-56//Application.tar.gz ...
otrs_1     | create MySQL
otrs_1     | decompresses SQL-file ...
otrs_1     | cat SQL-file into MySQL database
otrs_1     | compress SQL-file...
otrs_1     | [WARNING] OTRS version of backup being restored: 5.0.30
otrs_1     | [WARNING] OTRS version of this container: 5.0.32
otrs_1     | [WARNING] Backup version older than current OTRS version, fixing...
otrs_1     | [INFO] Done.
otrs_1     | [INFO] Updating default skin for users in backup...
otrs_1     | [INFO] Reinstalling OTRS modules...
otrs_1     | [INFO] Done.
otrs_1     | Setting permissions on /opt/otrs
otrs_1     | /
otrs_1     | Cron.sh - start/stop OTRS cronjobs
otrs_1     | Copyright (C) 2001-2018 OTRS AG, https://otrs.com/
otrs_1     | (using /opt/otrs) done
otrs_1     | otrs.Daemon.pl - the OTRS daemon
otrs_1     | Copyright (C) 2001-2018 OTRS AG, https://otrs.com/
otrs_1     | 
otrs_1     | Daemon started
otrs_1     | Processing ticket escalation events ...
otrs_1     | Done.
otrs_1     | Checking availability of OTRS Business Solution™...
otrs_1     | No need to execute the availability check at this moment, skipping...
otrs_1     | Done.
otrs_1     | Checking the OTRS Business Solution™ entitlement status...
otrs_1     | OTRS Business Solution™ is not installed in this system, skipping...
otrs_1     | Done.
otrs_1     | 
otrs_1     | No configured mail accounts found!
otrs_1     | 
otrs_1     | Collecting asynchronous support data...
otrs_1     | Done.
otrs_1     | Generating dashboard widgets statistics...
otrs_1     | Done.
otrs_1     | Rebuilding the system configuration...
otrs_1     | Done.
otrs_1     | Deleting cache...
otrs_1     | Done.
otrs_1     | [INFO] Starting supervisord...
otrs_1     | [INFO] Restarting OTRS daemon...
otrs_1     | 2018-12-13 16:29:54,474 CRIT Supervisor running as root (no user in config file)
otrs_1     | 2018-12-13 16:29:54,481 INFO /var/tmp/supervisor.sock:Medusa (V1.1.1.1) started at Thu Dec 13 16:29:54 2018
otrs_1     |    Hostname: <unix domain socket>
otrs_1     |    Port:/var/tmp/supervisor.sock
otrs_1     | 2018-12-13 16:29:54,513 CRIT Running without any HTTP authentication checking
otrs_1     | 2018-12-13 16:29:54,514 INFO supervisord started with pid 87
otrs_1     | 2018-12-13 16:29:54,515 INFO spawned: 'httpd' with pid 90
otrs_1     | 2018-12-13 16:29:54,516 INFO spawned: 'crond' with pid 91
otrs_1     | 2018-12-13 16:29:54,520 INFO spawned: 'rsyslog' with pid 92
otrs_1     | otrs.Daemon.pl - the OTRS daemon
otrs_1     | Copyright (C) 2001-2018 OTRS AG, https://otrs.com/
otrs_1     | 
otrs_1     | Daemon stopped
otrs_1     | 2018-12-13 16:29:55,557 INFO success: httpd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
otrs_1     | 2018-12-13 16:29:55,557 INFO success: crond entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
otrs_1     | 2018-12-13 16:29:55,558 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
otrs_1     | otrs.Daemon.pl - the OTRS daemon
otrs_1     | Copyright (C) 2001-2018 OTRS AG, https://otrs.com/
otrs_1     | 
otrs_1     | Daemon started
otrs_1     | [INFO] OTRS Ready !

I can only tell you to make sure you have the latest image (sudo docker pull juanluisbaptiste/otrs:latest-5x) and set OTRS_DEBUG=yes and see if there's more info that can help you debug the problem.

juanluisbaptiste commented 5 years ago

No answer so closing as fixed.