Aspera

Aspera

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only

Four Kingdoms, One Folder: Syncing Anywhere with ascli

By Laurent Martin posted 10/09/26 08:06 AM

  

Four kingdoms, one folder

You have a folder. It must stay identical somewhere else. The somewhere else keeps changing.

On Monday it is a High-Speed Transfer Server (HSTS) reached over SSH. On Tuesday the same files must land on a Node API endpoint. On Wednesday the project moves to Aspera on Cloud (AoC), and on Thursday a partner asks for it in their Aspera Shares. Each of these speaks its own authentication dialect: SSH passwords and keys, Node API credentials, OAuth bearer tokens, Shares accounts with Node tokens.

The sync engine underneath, IBM Aspera Sync (async), only speaks one language. Hand-writing its command line for each kingdom means juggling hosts, ports, tokens and SSH keys you never wanted to know about.

This post shows how ascli, the IBM Aspera command-line interface, plays interpreter. You learn one sync syntax and one set of parameters, and you reuse them, word for word, on all four platforms. Hootput, the ascli owl mascot, has already memorized it. Your turn.

The one syntax to learn

Aspera Sync (async) replicates a folder over FASP. It scans both sides, records what it saw in a snapshot database (a .private-asp folder at the root of the local folder), and transfers only what changed. Run it again and it picks up where it left off.

ascli wraps it with a sync command that looks the same in every plugin:

ascli <plugin> [...] sync <direction> <path> [--to-folder=<path>] [<sync_info>]

Three words and an optional bag of settings:

Direction Positional <path> --to-folder What happens
push Local Remote Local changes go to the remote
pull Remote Local Remote changes come to you
bidi Local Remote Changes flow both ways

The optional <sync_info> is a Hash in conf format: the same payload as the async --conf option and the Node API /asyncs endpoint. That is where you put the session name, filters, checksum policy, mirror mode, continuous mode, bandwidth and the like. ascli fills in direction, local.path and remote.path from the command line, so you never repeat them.

The plugin does the rest. It authenticates to its application, obtains a transfer spec (host, user, port, token, SSH key, target path), and merges it into <sync_info> before launching async. That merge is the whole trick: your sync parameters never mention credentials, so they move unchanged from one platform to the next.

Diagram: your sync settings go through one of four plugins (ascli server, ascli node, ascli aoc files, ascli shares files); each adds its credentials, and async receives one conf payload.

image

Each plugin authenticates in its own way, then merges the result into your settings. async always receives one conf payload.

Packing for the trip

Two commands install ascli and the FASP engine. You need Ruby 3.1 or later (or use the portable versions in "Releases").

gem install aspera-cli
ascli config transferd install

The second command installs the IBM Aspera Transfer Daemon, which ships ascp. Version 1.3 and later also ship async and asyncadmin. Sync also needs an async-enabled license, so check with your administrator before blaming the owl.

Next, give each kingdom an option preset: a named set of options stored in the ascli configuration file. You type the URL and credentials once, then refer to them with -P<name>.

# HSTS over SSH
ascli config preset update hsts --url=ssh://hsts.example.com:33001 --username=john --password=<password>

# HSTS Node API
ascli config preset update node --url=https://hsts.example.com:9092 --username=node_john --password=<password>

# Aspera Shares
ascli config preset update shares --url=https://shares.example.com --username=john --password=<password>

# Aspera on Cloud: the wizard sets up OAuth and saves preset "aoc"
ascli config wizard https://myorg.ibmaspera.com aoc aoc

Just want to try? ascli config initdemo creates a demoserver preset that points to a public IBM demo server.

Round 1: HSTS over SSH

The classic. The server plugin talks SSH to a High-Speed Transfer Server, and async rides the same SSH credentials.

Push a local folder of photos to the server:

ascli server -Phsts sync push ~/photos --to-folder=/backup/photos

That is the minimal form. ascli generates a session name from the direction and folder names, and shows progress when run in a terminal. Now let's add some personality with a <sync_info>, written in dot-path notation (@: followed by key=value pairs):

ascli server -Phsts sync push ~/photos --to-folder=/backup/photos \
  @: name=photos reset=true checksum=sha1 \
     filters.0.rule=exclude filters.0.value='*.tmp' \
     transport.target_rate=100000000

This names the session photos, starts from a fresh snapshot, compares files with SHA-1, ignores temporary files, and caps the rate at 100 Mbps. Prefer JSON? The same Hash works as @json:'{"name":"photos","reset":true,...}'.

On the next runs, drop reset=true. The snapshot database remembers what was already synchronized, and only changes travel.

Already have an async command line in a script? ascli config sync translate converts it to the conf format, ready to paste:

ascli config sync translate -- -N photos -d ~/photos -r john@hsts.example.com:/backup/photos -K push -k sha1

Round 2: the Node API

Same server, different door. The node plugin talks HTTPS to the Node API. There is no SSH password here: ascli asks the node for a transfer token, then hands that token to async.

This time, let's pull the photos back down. Watch the <sync_info>: apart from the session name, it is the one from Round 1.

ascli node -Pnode sync pull /backup/photos --to-folder=~/photos_copy \
  @: name=photos_back reset=true checksum=sha1 \
     filters.0.rule=exclude filters.0.value='*.tmp' \
     transport.target_rate=100000000

What changed: the plugin name, the direction and the paths. For pull, the positional path is the remote folder and --to-folder is local, exactly as in the table above.

If your credentials are an access key rather than a Node API user (for example, on IBM Aspera Transfer Service), use the access key API. The sync command is the same, one level deeper:

ascli node -Pnode_ak access_keys do self sync push ~/photos --to-folder=/backup/photos @: name=photos

Round 3: Aspera on Cloud

Now the cloud. AoC has no SSH account to speak of: you log in with OAuth, and files live in a workspace on a transfer node you never see. Under the hood, aoc files reuses the node plugin with an OAuth bearer token, and ascli passes that token to async.

You don't need to know any of that. Here is the same push, to a folder in your AoC Files:

ascli aoc -Paoc files sync push ~/photos --to-folder=/photos \
  @: name=photos_aoc reset=true checksum=sha1 \
     filters.0.rule=exclude filters.0.value='*.tmp' \
     transport.target_rate=100000000

And the reverse, to bring a shared folder home:

ascli aoc -Paoc files sync pull /project/photos --to-folder=~/photos_from_aoc @: name=photos_aoc_back

Paths are the ones you see in the AoC Files app. The local snapshot database works exactly as before, so the second run only moves what changed.

Round 4: Aspera Shares

Last stop: your partner's Aspera Shares. Shares authenticates its own users, then asks the underlying node for a transfer token on their behalf. ascli plays along: shares files goes through the node plugin with that token.

In Shares, the first element of a path is the share name. Everything else is, by now, muscle memory:

ascli shares -Pshares files sync push ~/photos --to-folder=/partner_share/photos \
  @: name=photos_shares reset=true checksum=sha1 \
     filters.0.rule=exclude filters.0.value='*.tmp' \
     transport.target_rate=100000000

Four platforms, four authentication schemes, one block of sync settings. Hootput is visibly smug.

Spot the difference

Only the front of the command changes. Everything after sync is the same on every platform.

Platform Command prefix You put in the preset ascli hands to async
HSTS over SSH ascli server SSH user, password or key Host, SSH port, user, credentials
Node API (node user) ascli node Node API user and password Transfer token from the node
Node API (access key) ascli node access_keys do self Access key and secret Access key token
Aspera on Cloud ascli aoc files OAuth setup from the wizard OAuth bearer token
Aspera Shares ascli shares files Shares user and password Transfer token obtained through Shares

Since the settings never change, stop retyping them. Put them in a file, say photos_sync.json, without a name so that ascli generates one per destination:

{
  "checksum": "sha1",
  "filters": [{"rule": "exclude", "value": "*.tmp"}],
  "transport": {"target_rate": 100000000}
}

You prefer YAML? Same settings, fewer braces, in photos_sync.yaml:

checksum: sha1
filters:
  - rule: exclude
    value: "*.tmp"
transport:
  target_rate: 100000000

In the commands below, replace @json:@file:photos_sync.json with @yaml:@file:photos_sync.yaml. ascli decodes either one into the same Hash.

Then point every platform at it with @json:@file::

ascli server -Phsts         sync push ~/photos --to-folder=/backup/photos    @json:@file:photos_sync.json
ascli node   -Pnode         sync push ~/photos --to-folder=/backup/photos    @json:@file:photos_sync.json
ascli aoc    -Paoc    files sync push ~/photos --to-folder=/photos           @json:@file:photos_sync.json
ascli shares -Pshares files sync push ~/photos --to-folder=/partner_share/photos @json:@file:photos_sync.json

Four destinations, one source of truth. Change the rate cap in one place and every sync obeys.

Owl-approved tips

Discover every knob. All conf parameters, with their defaults and the matching async option, are one command away:

ascli config sync spec

Never stop syncing. By default a session runs once and exits. Add mode=continuous and async keeps watching for changes (the source must be Linux or Windows):

ascli server -Phsts sync push ~/photos --to-folder=/backup/photos @: name=photos mode=continuous

Make the destination an exact copy. mirror=true removes files on the destination that are not on the source. It works with push and pull, not bidi. Its gentler cousins: ignore_delete=true keeps deleted files on the peer, and delete_delay=true waits until the end of the sync to delete.

Schedule it. For a periodic one-time sync, run the command from cron or the Windows Task Scheduler. Add --lock-port=12345 so that a slow run is never joined by a second one.

Check on it. The admin subcommands read the local snapshot database, so most of them need no network at all (install the sqlite3 gem first). They work from any of the four plugins, or from ascli config sync admin:

ascli config sync admin find ~/photos                      # sessions stored in this folder
ascli config sync admin counters ~/photos @: name=photos   # files synced, pending, in error
ascli config sync admin file_info ~/photos @: name=photos --sql="WHERE state=20"  # files in error
ascli server -Phsts sync admin status ~/photos @: name=photos   # live status from asyncadmin

Start over. If the two sides drifted (someone "tidied up" the server by hand), add reset=true once. async drops the snapshot and rescans both sides.

One syntax, four kingdoms

You now speak fluent sync in four dialects without learning a single one of them. Credentials stay in presets, settings stay in one conf block, and ascli translates between them and async. Next time someone asks for "the same folder, but over there", the answer is one changed word at the start of a command.

Go further:

Found a kingdom where it does not work? Open an issue on GitHub. Hootput reads every one.


#community-stories3
0 comments
8 views

Permalink