Skip to content

ambrisolla/unison-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

unisonManager

unisonManager is a Python script to be used to manage Unison File Syncronizer process.

Contents

Unison

Unison is a file-syncronization tool. If you need a solution to keep your data up-to-date between two servers, Unison is a great choice.

Features

  • Run an automated installation of Unison
  • Manage Unison job process profiles

Test environment

unisonManager has been tested on the Operating System below:

  • Ubuntu 22.04
  • Debian 11
  • Rocky Linux 8
  • Oracle Linux 8

Prerequisites

To use unisonManager we need to solve some dependencies.

  • Python 3
  • PIP 3
  • PIP packages: paramiko, pyyaml, requests and tabulate
  • SSH communication between servers without password

Install Python/PIP 3

Install Python 3 on Debian-based Linux:

 $ apt update && apt install python3 python3-pip -y

Install Python 3 on RedHat-based Linux:

 $ yum install python39 python39-pip -y

Install PIP packages

$ pip3 install paramiko pyyaml requests tabulate

Configure SSH to communicate without password between servers.

The transfer process uses SSH for communication between servers. So we need to create an SSH key and copy it to remote server.

Create SSH key:

$ ssh-keygen -t rsa # do not put password

Copy the SSH key to the remote server:

ssh-copy-id -i ~/.ssh/id_rsa root@[REMOTE_SERVER_ADDRESS]

Install

The installation process is very simple. You just need to clone this repository and create a symbolic link.

PS: The Unison needs to be installed on all servers!

Clone repo:

$ git clone https://github.com/brisa-dev/unison-manager.git /opt/unisonManager

Create a symbolic link:

$ ln -s /opt/unisonManager/unisonManager.py /usr/local/bin/unisonManager

Options

--install-unison

Install Unison.

Example:

$ unisonManager --install-unison

--add-job

Add a new Unison job. This option needs to be used with --job-name, --remote-server, and --directory options.

Example:

$ unisonManager --add-job --job-name mysql_files --directory=/data/mysql_files \
  --remote-server [REMOTE_SERVER_ADDRESS]

By convention, use the same name to indentify --job-name and --directory.

When process has been finished, all structure necessary to syncronize the data will be created in local and remote server.

--job-name [JOB_NAME] (to be used with --add-job)

Specify a job name when creating a new Unison job.

--directory [DIRECTORY] (to be used with --add-job)

Specify a directory when creating a new Unison job.

--remote-server [REMOTE_SERVER] (to be used with --add-job)

Specify a remote server when creating a new Unison job.

--list

List status of created jobs.

Example:

$ unisonManager --list

--start [JOB_NAME]

Start a Unison job.

Example:

$ unisonManager --start [JOB_NAME]

--stop [JOB_NAME]

Stop a Unison job.

Example:

$ unisonManager --stop [JOB_NAME]

--remove

Remove a Unison job. PS: This action only removes the Unison profile, it does not remove any data where the data is synced.

Example:

$ unisonManager --remove [JOB_NAME]

--cleanup [JOB_NAME]

This action stops the job process, removes all .unison.tmp and starts job process.

Example:

$ unisonManager --cleanup [JOB_NAME]

--cleanup-all

This action executes the same of '--cleanup' option, but in all jobs.

Example:

$ unisonManager --cleanup-all

--exporter

Exports a web data vizualization.

Example:

$ unisonManager --exporter

Architecture

Simple example of a Unison Architecture:

About

A interface to manage Unison jobs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published