Skip to content

Latest commit

 

History

History
205 lines (155 loc) · 7.13 KB

backupNrestore.adoc

File metadata and controls

205 lines (155 loc) · 7.13 KB

GLPI Backup N Restore

Preparation

Define backup environment variables.

Set the root location of the backup folder.

$ BACKUP_ROOT_FOLDER=/z/_backup

Backup

Identify GLPI pod.

$ kubectl -n glpi get pods
NAME                                     READY   STATUS    RESTARTS   AGE
glpi-75f944445c-ncjss                    1/1     Running   0          18d
glpi-mariadb-0                           1/1     Running   0          18d
phpmyadmin-deployment-74fc9dd457-dljld   1/1     Running   0          20d

Define the pod for the GLPI application.

$ GLPI_POD=glpi-75f944445c-ncjss

Dump mysql database.

$ GLPI_MYSQL_DUMP_FILENAME_PREFIX=$(date +%Y-%m-%d-%H-%M-%S).glpi.backup
$ kubectl -n glpi exec -it glpi-mariadb-0 -- mysqldump -u root glpi > ${BACKUP_ROOT_FOLDER}/glpi/${GLPI_MYSQL_DUMP_FILENAME_PREFIX}.sql

Compress and copy the folders with physical files.

kubectl -n glpi exec -it ${GLPI_POD} -- tar --warning=no-file-changed -czvf /tmp/${GLPI_MYSQL_DUMP_FILENAME_PREFIX}.files.tgz /var/www/html/files
kubectl -n glpi exec -it ${GLPI_POD} -- tar --warning=no-file-changed -czvf /tmp/${GLPI_MYSQL_DUMP_FILENAME_PREFIX}.plugins.tgz /var/www/html/plugins
kubectl -n glpi cp ${GLPI_POD}:/tmp/${GLPI_MYSQL_DUMP_FILENAME_PREFIX}.files.tgz ${BACKUP_ROOT_FOLDER}/glpi/${GLPI_MYSQL_DUMP_FILENAME_PREFIX}.files.tgz
kubectl -n glpi cp ${GLPI_POD}:/tmp/${GLPI_MYSQL_DUMP_FILENAME_PREFIX}.plugins.tgz ${BACKUP_ROOT_FOLDER}/glpi/${GLPI_MYSQL_DUMP_FILENAME_PREFIX}.plugins.tgz

Restore

⚠️
TODO

Set database dump file to be restores.

$ GLPI_MYSQL_DUMP_FILENAME=2021-06-13-00-09-16.glpi.backup.sql

Import the database.

$ kubectl -n glpi exec -it glpi-mariadb-0 -- mysql -u root glpi < ${BACKUP_ROOT_FOLDER}/glpi/${GLPI_MYSQL_DUMP_FILENAME}

The result is the following:

Unable to use a TTY - input is not a terminal or the right kind of file

$
💡
Just ignore the Unable to use a TTY - input is not a terminal or the right kind of file message.

Troubleshooting

Access the GLPI console

Problem

How to access the GLPI console

Cause

N/A

Solution

Execute the the php bin/console command in the /var/www/html folder.

$ kubectl -n glpi exec -it glpi-5847c6b6b-scv8b --  /bin/bash
[root@glpi-5847c6b6b-scv8b html]# cd /var/www/html
[root@glpi-5847c6b6b-scv8b html]# php bin/console
GLPI CLI 9.5.3

Usage:
  command [options] [arguments]

Options:
  -h, --help                     Display this help message
  -q, --quiet                    Do not output any message
  -V, --version                  Display this application version
      --ansi                     Force ANSI output
      --no-ansi                  Disable ANSI output
  -n, --no-interaction           Do not ask any interactive question
      --config-dir[=CONFIG-DIR]  Configuration directory to use
      --no-plugins               Disable GLPI plugins (unless commands forces plugins loading)
      --lang[=LANG]              Output language (default value is existing GLPI "language" configuration or "en_GB")
  -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  help                                        Displays help for a command
  list                                        Lists commands
 glpi
  glpi:config:set                             [config:set] Set configuration value
  glpi:database:check                         [db:check] Check for schema differences between current database and installation file.
  glpi:database:configure                     [db:configure] Define database configuration
  glpi:database:install                       [db:install] Install database schema
  glpi:database:update                        [db:update] Update database schema to new version
  glpi:ldap:synchronize_users                 [ldap:sync] Synchronize users against LDAP server informations
  glpi:maintenance:disable                    [maintenance:disable] Disable maintenance mode
  glpi:maintenance:enable                     [maintenance:enable] Enable maintenance mode
  glpi:migration:appliances_plugin_to_core    Migrate Appliances plugin data into GLPI core tables
  glpi:migration:domains_plugin_to_core       Migrate Domains plugin data into GLPI core tables
  glpi:migration:myisam_to_innodb             Migrate MyISAM tables to InnoDB
  glpi:migration:racks_plugin_to_core         Migrate Racks plugin data into GLPI core tables
  glpi:migration:timestamps                   Convert "datetime" fields to "timestamp" to use timezones.
  glpi:plugin:activate                        [plugin:activate] Activate plugin(s)
  glpi:plugin:deactivate                      [plugin:deactivate] Deactivate plugin(s)
  glpi:plugin:install                         [plugin:install] Run plugin(s) installation script
  glpi:rules:process_software_category_rules  [rules:process_software_category_rules] Process software category rules
  glpi:rules:replay_dictionnary_rules         [rules:replay_dictionnary_rules] Replay dictionnary rules on existing items
  glpi:security:change_key                    Change password storage key and update values in database.
  glpi:system:check_requirements              [system:check_requirements] Check system requirements
  glpi:system:clear_cache                     [system:clear_cache] Clear GLPI cache.
  glpi:system:status                          [system:status] Check system status
  glpi:task:unlock                            [task:unlock] Unlock automatic tasks

Blank screen when adding/updating ticket

Problem

When making some changes to GLPI, e.g. create or update tickets, a blank screen is returned.

Cause

Problem with internal certificate

Solution

#tag::reset-security-key[] Execute the following kubectl command.

$ kubectl -n glpi exec -it glpi-5847c6b6b-scv8b --  /bin/bash
[root@glpi-5847c6b6b-scv8b html]# cd /var/www/html
[root@glpi-5847c6b6b-scv8b html]# php bin/console glpi:security:change_key
Found 2 field(s) and 3 configuration entries requiring migration.
Do you want to continue ? [Yes/no]Yes

New security key generated; database updated.
[root@glpi-5847c6b6b-scv8b html]# exit

#end::reset-security-key[]

Error sending email after system restore

Problem

After restoring GLPI emails cannot be sent.

Cause

The email password has been cleared.

Solution

Introduce the email password in the SMTP password (optional) field of the Setup > Notifications > Email followups configuration screen.