A command line program for automating the deployment of rsyncdirector instances.
-
Ensure that there is a compatible version of Python installed. See
pyproject.tomlfor details. -
Export the path to the Python interpreter and the path to the virtenv and create and source the virtenv.
export PYTHON_PATH=<path-to-your-interpreter> export VIRT_ENV_PATH=<path-to-virt-env-parent-dir> $PYTHON_PATH -mvenv $VIRT_ENV_PATH . $VIRT_ENV_PATH/bin/activate
pip install rsyncdirector_deploy
-
Build
pip install -r ./requirements_dev.txt && \ python -m build && \ twine check dist/* -
Install the wheel file
pip install ./dist/rsyncdirector_deploy-<version>-py3-none-any.whl -
Run
rsyncdirector_deploy -hto confirm installation and to see details on how to run it.
The rsyncdirector_deploy program uses the Python Fabric library which depends on the Python Paramiko library for the core SSH protocol implementation to run commands on the remote hosts over SSH. SSH connections are currently authenticated using passphrase-less SSH keys.
- Distribute public SSH keys for the user under which you will run the deployment program on your localhost to the
rootuser on the hosts on which you want to installrsyncdirector.
Following is an outline of the operations and commands required to run rynscdirector. The rsyncdirector_deployment tool automates all of the following operations except the distribution of keys.
-
Create an
rsyncdirector.yamlconfig file to define the data that you want torsync. See thersyncdirector.yamlfile for a complete example with explanation. -
Install Python on the target host:
rsyncdirector_deploy python -h -
Install
rsyncdirectorconfigs on the target host and optionally create anrsyncdirectoruser under which the application will run. The user under whichrsyncdirectorruns MUST have read access to all data to bersynced. In many cases, this can just be therootuser to avoid having to create an additional user and ensure that the user has read access to all of the source data.rsyncdirector_deploy rsyncdirector configs -h -
Install the
rsyncdirectorapplicationrsyncdirector_deploy rsyncdirector install -h -
Distribute SSH keys for the aforementioned user to the remote host(s) to which you will be syncing data Create ssh key pairs for the aforementioned user under which the
rsyncdirectorwill run and distribute the public keys to the users on the remote hosts to which you will be syncing data.Best practice is to create a non-root user on the remote host to which data will be synced and then have create an
rsyncdirectorconfiguration that connects using that user.For example: in order to be able to read any files on the source host, run the
rsyncdirectoras root. On the remote host to which data is to be synced create abackupuser and create a directory where thebackupusers hasr-w-xpermissions. Create an ssh key-pair for therootuser on the localhost and distribute the public key to the remote host adding it to thebackupuser'sauthorized_keysfile.
Do the following if you want to develop and debug the installation scripts using VSCode.
- Create a virtual environment as described in the Setup section above.
- Pip install the additional
requirements_dev.txtdependencies. - Add the
deploymentdirectory to VSCode. - Click on the Debug tab and select from one of the launch configuratons defined in the
launch.jsonfile. You must have themain.pyfile selected in the IDE before clicking on the Debug play button.