Meza/Importing data

Importing data from another wiki can be done in several ways.

secret.yml
The following lines are required in secret.yml. See Meza/Secret config for more info.

backups_server_alt_source: addr: example.com remote_user: src-meza-ansible uploads_dir_path: /opt/data-meza/uploads/

backups_server_db_dump: addr: example.com remote_user: src-meza-ansible mysql_user: backupuser mysql_pass: "some123long456password7890"

hosts file
The following lines are required in your hosts file. See Meza/Secret config for more info.

[db-src] example.com alt_remote_user=src-meza-ansible

[backup-src] example.com alt_remote_user=src-meza-ansible

[exclude-all] example.com

Setup backup server

 * 1) Create user   on backup server. Unfortunately, with current Meza, this user has to be a passwordless sudoer.
 * 2) Create MySQL/MariaDB user   with rights SELECT, INSERT, UPDATE, LOCK TABLES, SHOW DATABASES, SHOW VIEW. If the backup server is a Meza server, this can be achieved by adding the following to the   section of  :

mysql_users: - name: "backupuser" host: "%" password: "some123long456password7890" priv: "*.*:SELECT,INSERT,UPDATE,LOCK TABLES,SHOW DATABASES,SHOW VIEW"

Run with
Running  will overwrite all wikis with their corresponding backups. This is highly destructive!

Manually position files for import
When running  Meza will try to pull data from a backup source. The simplest backup source is the one that is generated when you do. This generates the required backup directories for your existing wikis. Navigate to  to see the structure. It looks something like:

/opt/data-meza/backups/ demo 20180414122334_wiki.sql 20180413122334_wiki.sql 20180412122334_wiki.sql uploads/ anotherwiki ...   anotherwiki2 ...

If you run  then delete these SQL files, upload your own SQL file, and replace the   directory with your desired uploads, running   will import that data into the wiki. Note that all wikis will be overwritten with whatever they have as backups, so be careful how you use this!

Pushing database and uploads rather than pulling
Available since Meza 31.5.0

If you have a production server, and you want development servers to periodically synchronize with data from production, the "pull" method above works. However, if your security policy does not allow for development servers to SSH into production, then instead you can setup a push-from-production as outlined below. This (a) doesn't require any servers to log into production, (b) requires production to log into other servers with non-sudo access, and (c) this allows for pushing upload files directly to the  directory of the destination server rather than into the backups directory (removing duplicated directories which could be very large). For the purposes of this manual we'll assume you want to push from Prod to Dev, but any server could be setup to push to another server.

On Prod, configure secret config as follows: Here you define what servers to push data to, what user to push data with, and the exact location in the file system to push it to. In the paths listed,  will be replaced with each wiki's ID. While you're on Prod, copy the meza-ansible user's public SSH key for later user (i.e. copy the output of ).

Then on Dev do the following to create : If you now run   on Prod it will push data from Prod to Dev. In a later version of Meza a  field will be added allowing configuration of   on regular intervals.