You are here:
< Back

Server Backup-Restore Guide

 

We recommend mounting a separate storage volume of at least 2 times the Wallboard-storage size to your server.

The Wallboard system backup consists of three parts. If you would like to do backups by yourself and we have installed your system, contact us for the necessary credentials and paths.

  1. Backup wallboard-storage
  2. Backup necessary data from the database
  3. Full database backup also includes negligible data (we run this less frequently)

If you installed the server yourself:

  • You will find the wallboard-storage in your compose file at master container volumes:
    • ${VOLUMES_PATH}/master/wallboard-storage:/home/wallboard-storage -> you will need the part before the colon as an absolute path
      • from that folder should you make a backup
  • You will find the credentials for the database in your compose file at database container environment variables:
    • We are ignoring the following tables from this database backup because we think these tables didn’t store any necessary data.
      If any of the following tables are important for you, do not ignore them.

        • Cache tables:
          • weather
      • Audience statistics tables:
        • asset_spectator
        • content_spectator
        • device_spectator
        • face
      • Other statistical data:
        • display_time_stat
        • page_click_stat
        • form_data
        • device_metric
        • server_stat
      • Log tables:
        • log
        • slave_history
    • We occasionally perform a full backup of the database, not ignoring any of the above tables.

We do not install this by default for our partners. If you would like a backup on your own server, please contact us.

 

Backup

We are using a rsnapshot tool to do the backups on our servers.

You can install the backup tool with the attached docker-compose-backup.yml file.

Configuration:

Volumes:

  • ${BACKUP_FROM}: Set it to the /folder/you/want/to/backup. In this case it is the wallboard-storage,  usually /srv/docker/master/wallboard-storage.
  • ${SNAPSHOTS_TO}: Set it to the /folder/where/you/want/to/store/the/backup. We suggest using another storage volume!

Environments:

  • DATABASE_NAME: Set it to the same value as the MYSQL_DATABASE field at the database compose.
  • DATABASE_USER: Set it to the same value as the MYSQL_USER field at the database compose
  • DATABASE_PASSWORD: Set it to the same value as MYSQL_PASSWORD and MYSQL_ROOT_PASSWORD (these two fields must have the same value) fields at the database container.
  • DATABASE_CONTAINER_NAME: database, change only if you renamed the database container!
  • TZ: Set it to your TimeZone.
  • The following environments are not required to set, only if you want to change the defaults.
  • Subsequent backup levels (e.g., daily, weekly, etc.) simply rotate, with each higher backup level drawing on the one below it for its backup.
    • BACKUP_EVERY_MINUTE: The number of stored per minute backups. We suggest to not use this period! Default is 0 (zero). 0 (zero) means it is turned off!
    • BACKUP_HOURLY: The number of stored hourly backups.  Default is 0 (zero).
    • BACKUP_DAILY: The number of stored daily backups. Default is 7 days.
    • BACKUP_WEEKLY: The number of stored weekly backups. Default is 4 weeks.
    • BACKUP_MONTHLY: The number of stored monthly backups. Default is 3 months.
    • BACKUP_YEARLY: The number of stored yearly backups. Default is 0 (zero).
    • FULL_DB_BACKUP_EVERY_MINUTE: The number of stored per minute full database backups. Default is 0 (zero).
    • FULL_DB_BACKUP_HOURLY: The number of stored hourly minute full database backups. Default is 0 (zero).
    • FULL_DB_BACKUP_DAILY: The number of stored daily full database backups. Default is 0 (zero).
    • FULL_DB_BACKUP_WEEKLY: The number of stored weekly full database backups. Default is 4 weeks.
    • FULL_DB_BACKUP_MONTHLY: The number of stored monthly full database backups. Default is  3 months.
    • FULL_DB_BACKUP_YEARLY: The number of stored yearly full database backups. Default is 0 (zero).
    • CRON_EVERY_MINUTE: Cron of every minute running. Default is “* * * * *” (Every minute). If you want to change any of these, set it without quotes!
    • CRON_BACKUP_HOURLY: Cron of database and storage hourly backup. Default is “15 * * * *” (Every hour at minute 15).
    • CRON_BACKUP_DAILY: Cron of database and storage daily backup. Default is “30 0 * * *” (Every day at 0:30 AM).
    • CRON_BACKUP_WEEKLY: Cron of database and storage weekly backup. Default is “0 1 * * 1” (Every Monday at 01:00 AM).
    • CRON_BACKUP_MONTHLY: Cron of database and storage monthly backup. Default is “30 1 1 * *” (Every 1st day of the month at 01:30 AM).
    • CRON_BACKUP_YEARLY: Cron of database and storage yearly backup. Default is “0 2 1 1 *” (Every year on 1th of January at 02:00 AM).
    • CRON_FULL_DB_BACKUP_HOURLY: Cron of full database hourly backup. Default is “45 * * * *” (Every hour at minute 45).
    • CRON_FULL_DB_BACKUP_DAILY: Cron of full database daily backup. Default is “30 2 * * *” (Every day at 02:30 AM)
    • CRON_FULL_DB_BACKUP_WEEKLY: Cron of full database weekly backup. Default is “0 3 * * 1” (Every Monday at 03:00 AM)
    • CRON_FULL_DB_BACKUP_MONTHLY: Cron of full database monthly backup. Default is “30 3 1 * *” (Every 1st day of the month at 03:30 AM)
    • CRON_FULL_DB_BACKUP_YEARLY: Cron of full database yearly backup. Default is “0 4 1 1 *” (Every year on 1th of January at 04:00 AM)

 

Restore

  1. Navigate to the folder where you configured to store the backup (${SNAPSHOTS_TO}, e.g: /mnt/backup_volume/wallboard-backup). To check which one is the latest backup, you can do that by running the following command:
    • CMD: ls -l
    • The latest backup is usually daily.0.
  2. In these backup folders, there are another two folders
    • mysql: Stores the database backup (MySQL dump).
    • storage: Stores the wallboard essential files, basically everything that we have in the wallboard-storage (${BACKUP_FROM}, usually /srv/docker/master/wallboard-storage)
  3. Stop all containers outside the database!
  4. Create a manual backup from the database and the wallboard-storage, just to be safe (e.g: in /home/manual-backup).
    • Database (e.g: in mysql, full path will /home/manual-backup/mysql):
      • Method 1:
        • CMD: mysqldump -u $DATABASE_USER -h 127.0.0.1 -P $DATABASE_PORT –password=$DATABASE_PASSWORD –single-transaction $DATABASE_NAME > $MYSQL_BACKUP_FILENAME  
          • $DATABASE_USER: replace it with that username that you configured for the backup container
          • $DATABASE_PORT: replace it with the port where the database is accessible, usually 3307
          • $DATABASE_PASSWORD: replace it with that password that you configured for the backup container
            • More secure way, if you remove the “=$DATABASE_PASSWORD” part, in this case, the password will be prompted.
              • This way cannot be used for method 2!
          • $DATABASE_NAME: replace it with the database’s name you want to dump, e.g: wallboard
          • $MYSQL_BACKUP_FILENAME: replace it with the absolute path of the backup, e.g: /home/manual-backup/mysql/wallboard-manual-dump.sql
      • Method 2:
        • CMD: docker exec $DATABASE_CONTAINER_NAME mysqldump -u $DATABASE_USER –password=$DATABASE_PASSWORD –single-transaction $DATABASE_NAME > $MYSQL_BACKUP_FILENAME
          • $DATABASE_CONTAINER_NAME: replace it with that container name that you configured for the backup container
          • $DATABASE_USER: replace it with that username that you configured for the backup container
          • $DATABASE_PASSWORD: replace it with that password that you configured for the backup container
          • $DATABASE_NAME: replace it with that database name that you configured for the backup container
          • $MYSQL_BACKUP_FILENAME: replaceit  with the absolute path of the backup, e.g: /home/manual-backup/mysql/wallboard-manual-dump.sql
      • Examples:
        • $DATABASE_USER=root, $DATABASE_PORT=3307, $DATABASE_PASSWORD=ExamplePassword, $DATABASE_NAME=wallboard, $MYSQL_BACKUP_FILENAME=/home/manual-backup/mysql/wallboard-manual-dump.sql, $DATABASE_CONTAINER_NAME=database
        • Method 1:
          • mysqldump -u root -h 127.0.0.1 -P 3307 –password=ExamplePassword –single-transaction wallboard > /home/manual-backup/mysql/wallboard-manual-dump.sql
        • Method 2:
          • docker exec database mysqldump -u root–password=ExamplePassword –single-transaction wallboard > /home/manual-backup/mysql/wallboard-manual-dump.sql
      • Check if the database backup dump file created successfully.
        • CMD: vi /home/manual-backup/mysql/wallboard-manual-dump.sql
    • Storage (e.g: in storage, full path will /home/manual-backup/storage):
      • CMD: mkdir /home/manual-backup/storage/; mv ${BACKUP_FROM}/* /home/manual-backup/storage/
        • example: mkdir/home/manual-backup/storage/; mv /srv/docker/master/wallboard-storage/* /home/manual-backup/storage/
        • This command will move your entire content of the wallboard-storage to the manual backup folder!
      • Check if the storage backup was successful.
        • CMD: ls -hal /home/manual-backup/storage/
  5. In the next step, we are going to restore the “wallboard-storage” folder from the backup.
    • CMD: rsync -av ${SNAPSHOTS_TO}/daily.X/storage/var/host/backup/ ${BACKUP_FROM}
      • ${SNAPSHOTS_TO}: replace it with that path you configured for “/snapshots”  for the backup container
      • X: replace it with the latest backup number, usually 0 (zero)
      • ${BACKUP_FROM}: replace it with that path you configured for “/var/host/backup:ro”  for the backup container
    • Example:
      • ${SNAPSHOTS_TO}=/mnt/backup_volume/wallboard-backup, X=0, ${BACKUP_FROM}=/srv/docker/master/wallboard-storage/
      • rsync -av /mnt/backup_volume/wallboard-backup/daily.0/storage/var/host/backup/ /srv/docker/master/wallboard-storage/
    • Check if the storage restore was successful.
      • CMD: ls -hal /srv/docker/master/wallboard-storage/
  6. In the next step, we are going to restore the database.
    • You have to unzip the .gz file in the database backup folder. Example path “/mnt/backup_volume/wallboard-backup/daily.0/mysql/backup.gz
    • CMD: unzip /mnt/backup_volume/wallboard-backup/daily.0/mysql/backup.gz -d /home/mysql-dump/
    •  There are two options for restoring the database:
      1. Performing the database restore on the current “wallboard” database.
      2. Performing the database restore on a new database. In this case, we have to create a new database.
        • The new database must have the same character set and collation as the old one!
        • You should configure the content editor to use this new database.
    • We are going to use the first option:
      • CMD: mysql -u $DATABASE_USER -h 127.0.0.1 -P $DATABASE_PORT –password=$DATABASE_PASSWORD $DATABASE_NAME < $MYSQL_DUMP_FILENAME
        • $DATABASE_USER: replace it with that username that you configured for the backup container
        • $DATABASE_PORT: replace it with the port where the database is accessible, usually 3307
        • $DATABASE_PASSWORD: replace it with that password that you configured for the backup container
          • More secure way, if you remove the “=$DATABASE_PASSWORD” part, in this case, the password will be prompted.
        • $DATABASE_NAME – replace it with the database’s name you want to dump, e.g: wallboard
        • $MYSQL_DUMP_FILENAME: replace it with the absolute path of the unzipped dump file, e.g: /home/mysql-dump/wallboard-dump.sql
      • Example: $DATABASE_USER=root, $DATABASE_PORT=3307, $DATABASE_PASSWORD=ExamplePassword, $DATABASE_NAME=wallboard, $MYSQL_DUMP_FILENAME=/home/mysql-dump/wallboard-dump.sql
        • mysql -u root -h 127.0.0.1 -P 3307 –password=ExamplePassword wallboard < /home/mysql-dump/wallboard-dump.sql
  7. Start the stopped containers and Login into the content editor to validate that you restored the wallboard system successfully.