Tutorial Office to Office Sync

rev 1.003, 19.10.24

How to read this tutorial


  • The tutorial does not cover all features of Accsyn, just a selected set.
  • Entries in Bold are made up data for this tutorial only, here you provide your own data as appropriate.
  • Labels in Italic correspond to the name of an input were you enter data.
  • Text in [ BRACKETS ] denotes a button within user interface, were LINK points out a link - for example a navigation link.


Summary

This tutorial is targeted:

  • Companies having multiple office around the globe.


Wishing to:

  • Replicate data from main premises, keeping folder structure, to these satellite offices.
  • Have traffic going over dedicated VPN trunk (Accsyn also of course supports encrypted transfers over Internet).
  • Have file transfers go at maximum speed, without corruption, that can be resumed if aborted.
  • Not need hire a programmer/IT tech person just to get the solution going.
  • Have a script run on server when transfer is done, to write status into production database.
  • Be able to back track transfers, using their mobile device.


This guide is a complete walkthrough covering:

  • Installing Accsyn from scratch.
  • Configure a Accsyn site.
  • Submit a Accsyn job syncing a folder and a file from main premises to remote office, both using the CLI job submit and the Python API.


Scenario


  • In this tutorial, we name your fictive company "MedTech" and admin username (E-mail) is "andrea@medtech.de".
  • You have a Linux server "alpha" (IP: 10.10.10.1/24) connected to disk "storage" at your main headquarters.
  • You have an office in London, with another Linux server "beta" (IP: 10.10.10.2/24) and a proxy storage.


Your task would be to make sure people in London have a subset of your files (i.e. a project folder) to work on, having the same paths as on main premises, for easy sync and pick up of work project files. Instead of having to manually copy files forth and back, we collect the files needed to copy and submit a transfer job to Accsyn using a custom made button in user application.

IMPORTANT NOTE: The terms mentioned/configuration steps outlined below are described in detail in our Accsyn Admin Manual, for instructions on how to use the Accsyn desktop app - have a look at the Accsyn User Manual. Always consult the manuals before your reach out to support@accsyn.com.


Installing Accsyn


The following guide is a short summary of the installation process described in detail here: Accsyn Admin Manual

  • Register your domain @ https://customer.accsyn.com
  • Follow the guide to initialise domain.
  • Install server; when the guide instructs you to install the Accsyn daemon, download and install it on your current file transfer server ("alpha").
  • Network; the guide will ask you to configure your firewall, add NAT port forwards 45190-45210 (tcp) to file transfer server "alpha". Note that Accsyn daemon DOES NOT listen to any ports 24/7, it will only start a listening process during file transfer init, software firewalled to accept incoming connections from remote client WAN IP only.
  • Root share; Browse to were the disk is mounted on server [/net/vol].
  • Finish installation.


By now you have a fully working file transfer solution that can be used by external user to receive and send back large file packages at high speed (i.e. an accelerated encrypted FTP server replacement). We are now going to continue and make file transfers submitted by Python scripts to enable an automised workflow.


Configuring site to site


Configuring remote site

  1. Go to ADMIN>SITES and click [ CREATE SITE ].
  2. Enter "london" as name and click [ CREATE ].


Installing daemon (server) at remote site

To be able to sync files at remote site, we need to add install a server on a computer that has access to local site storage. We assume the storage is mounted @ "/mnt/projects" here aswell, and the hostname of computer is "beta":

  1. Go to ADMIN>SERVERS and click [ INSTALL SERVER ].
  2. Click [ SERVING EXISTING ROOT SHARE(S) ON A REMOTE SITE].
  3. Download and install the server as told, enter PIN when asked, finalise and launch the server.
  4. Choose the site "london" and click [ FINISH ] to finalise server setup.


Setting up server IP overrides

Now we are almost done. Accsyn attempts to connect using Internet WAN IP addresses, but we want to direct the traffic over our dedicated VPN trunk. To achieve this, we need to configure Accsyn accordingly:

  1. Go to ADMIN>SERVERS and edit the "alpha" server.
  2. Check the box next to "Override IP:s".
  3. On Client, choose "beta".
  4. At Remote IP choose the local LAN IP address remote server "beta" has - in this case 10.10.10.2.
  5. At Local IP choose the local LAN IP address local server "alpha" has - in this case 10.10.10.1.
  6. Finish by clicking [ SAVE ].


Setting up hook

In this tutorial we also describe the optional step of enabling atomisations, this is done by defining a "hook" within Accsyn that is run whenever a transfer job is finished.

  1. Go to ADMIN>SETTINGS>Hooks.
  2. Locate and enable "hook-job-post-done-server" hook at bottom of page.
  3. We assume you have Python installed on server and a python script "/mnt/workflow/accsyn.py" that you wish to run. Enter this to to the Linux entry: "/mnt/workflow/accsyn.py ${PATH_JSON_INPUT} ${PATH_JSON_OUTPUT}".
  4. Click [ SAVE ] in bottom right corner.


Each time a job finishes from now on, your script will be called with a path to a job description JSON as argument #1. You can open this job description JSON to find out information about the job, enabling you to for example submit a chained job to Accsyn or perform other workflow atomisations.

Note: Jobs will fail if the hook fails to execute. If you have standard transfers that should not be processed by the hook, create a separate queue and configure hooks for that queue instead. Then submit jobs to that queue, this will have standard transfer jobs go outside your workflow and ignore hook.


Copying files from main site to remote site


We assume you have decided to copy the following files to remote site for users to start working on:

/mnt/projects/_LIBRARY/statistics.zip (file)

/mnt/projects/XFC001/London (directory)

Sending an E-mail to admins plus additional recipient "john@medtech.co.uk" when transfer is done.


Submitting the job to Accsyn using desktop app


  • Download and install the Accsyn desktop app - retrieve it by logging in to https://medtech.accsyn.com and follow GET APP link.
  • Click [ DOWNLOAD ] in lower right corner (upload/download is relative HQ/main site, in this case we are downloading from hq > london site).
  • Choose [ PUSH ] option.
  • Browse and and add the files from projects root share.
  • Click on the right green label saying "To site: London", enter E-mail "john@medtech.co.uk" to have notifications sent to him.
  • Click [ Submit ]. You should see the transfer job progress in medium (default) queue.


Submitting the job to Accsyn using CLI or Python API


Besides using the Accsyn desktop app to send files, jobs can be submitted using the CLI and the Python API.


Submitting using CLI

The simplest approach is to open a shell and submit using our CLI with RSYNC notation:

accsyn --mail john@medtech.co.uk  medtech:/mnt/projects/_LIBRARY/statistics.zip medtech:/mnt/projects/XFC001/London  site=london

Note: Assuming "accsyn" is in your path, default full path would be "/usr/local/accsyn/accsyn" otherwise.


Submitting JSON using CLI

JSON format for submit through CLI and Python API. Save this to temporary file, for example /tmp/accsyn/jobsubmit/A5F1D.json :

{
        "code":"XFC001 data sync to London", 
        "mail":"john@medtech.co.uk",
        "tasks":{
                "0":{
                      "source":"medtech:/mnt/projects/_LIBRARY/statistics.zip",
                      "destination":"site=london"
                },
                "1":{
                       "source":"medtech:share=projects/XFC001/London",
                       "destination":"site=london"
                }
        }
}

Note: The syntax of second file shows how a named share can be given instead of absolute path.

accsyn /tmp/accsyn/jobsubmit/A5F1D.json


You should get an E-mail notification that job has been submitted. The transfer job will appear in desktop app and be listable in CLI.

accsyn job find


To look for clues why job is not starting or possible errors during transfer, double-click job in desktop app and sift through the logs that opens when clicking the magnifier glass icon on a file/task. Or using the CLI:

accsyn job report <ID>



Using Python API

For instructions on how to use our Python API, please head over to: Accsyn Python API Documentation.


import accsyn_api
session = accsyn_api.Session(domain="medtech",username="andrea@medtech.de",api_key="****")
job = session.create("job","/tmp/accsyn/jobsubmit/A5F1D.json")

Print job status:

print session.str(session.find_one("job where id=%s"%job["id"]))


To add file to an existing job:

session.create("task", {"tasks":["share=projects/_REF/simulations.mov"]}, job["id"])

Or if renaming needed:

session.create("task", {"tasks":[{"source":"share=projects/_REF/simulations.mov","destination":"share=projects/TMP/simulations_tmp.mov"}]}, job["id"])


Note: If you tend to submit many jobs, attempt to re-use a job and add files as described above. In that case, we do not want an E-mail sent everytime job finished - submit job with ..,"email":"none",... supplied.


Syncing files back

To sync back files from remote office simply reverse the source and destination parties:

{
        "code":"XFC001 data sync from London to HQ", 
        "tasks":{
                "0":{
                      "source":"site=london:/mnt/projects/XFC001/London/Output_2608-2019",
                      "destination":"medtech" 
                }
        }
}



Voila, you should be all setup with Accsyn!