Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

resin-sync

resin-io-modules244Apache-2.0deprecated9.3.8

resin-sync is deprecated, please use balena-sync instead

Watch a local project directory and sync it on the fly

resin, watch, sync

readme

resin-sync

Update your application from a local source directory to a device on-the-fly.

npm version dependencies Build Status ![Gitter](https://badges.gitter.im/Join Chat.svg)

Role

The intention of this module is to provide a way to sync changes from a local source directory to a device.

THIS MODULE IS LOW LEVEL AND IS NOT MEANT TO BE USED BY END USERS DIRECTLY.

API

This module exports two methods:

capitano(cliTool)

This returns capitano command that can be registered by a cli tool. It is a convenience method that allows adding/modifying resin sync capitano commands/options without requiring changes in both the cli tool and the resin-sync module. The list of supported cli tools currently only includes 'resin-cli'

Example usage in resin-cli:

resinCliSyncCmd = require('resin-sync').capitano('resin-cli')
capitano.command(resinCliSyncCmd)

sync(target)

This method returns the proper sync() method for the specified target. Specifying different targets is necessary because the application sync process needs to adapt to the particular destination environment.

The list of currently support targets is

  • remote-resin-io-device
  • local-resin-os-device

and more will be added incrementally (e.g. remote-resin-os-device, virtual-resin-os-device etc.)

The sync() method can be used directly by modules that don't use capitano.

Support

If you're having any problem, please raise an issue on GitHub and the Resin.io team will be happy to help.

Tests

Run the test suite by doing:

$ gulp test

Contribute

Before submitting a PR, please make sure that you include tests, and that coffeelint runs without any warning:

$ gulp lint

License

The project is licensed under the Apache 2.0 license.

changelog

Change Log

All notable changes to this project will be documented in this file automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY! This project adheres to Semantic Versioning.

v9.3.8 - 2018-10-24

  • Update resin-semver to support balenaOS version strings [Paulo Castro]

v9.3.7 - 2018-10-18

  • Clarify Dockerfile.template warning message [Scott Lowe]

v9.3.6 - 2018-09-18

  • Dependencies: Update resin-semver version to support Balena OS [Lucian Buzzo]

v9.3.5 - 2018-05-28

  • Update SDK to add support for API keys #150 [Tim Perry]

v9.3.4 - 2018-04-03

  • Remove every last mention of rdt #149 [Tim Perry]

v9.3.3 - 2018-03-26

v9.3.2 - 2018-02-06

  • Log when local build really starts, to better explain the build process #147 [Tim Perry]

v9.3.1 - 2018-01-18

  • Provide a helpful warning when local pushing a template file. #146 [Tim Perry]

v9.3.0 - 2017-12-11

  • Add support for Balena by detecting the engine in local sync and using the correct pid file #145 [Pablo Carranza Velez]

v9.2.4 - 2017-11-20

  • Use 'local-app' as a default local push app name, rather than prompting for one #143 [Tim Perry]

v9.2.3 - 2017-09-22

  • Fix resin local push on Windows #142 [Tim Perry]

v9.2.2 - 2017-09-22

  • Autodeploy tagged changes to npm #141 [Tim Perry]

v9.2.1 - 2017-09-20

  • Use resin-semver for safe standardized handling of OS versions #137 [Lucian Buzzo]

v9.2.0 - 2017-09-15

  • Use all existing images on the device for caching during push builds #140 [Tim Perry]

v9.1.0 - 2017-08-11

  • Make Docker version comparison accept Docker's new non-semver versioning (e.g 17.03.0)
  • Add support for overlay2 in local push

9.0.0

  • Breaking! Drop support for node < 6
  • Fixed compatibility with docker >= 1.12: container start no longer accepts the HostConfig options that should instead be passed in the container create request

8.0.1

  • Fix "'cwd' must be a string" error in Node 8

8.0.0

  • Do not explicitly disable ControlMaster SSH option
  • Permit resin sync to collaborators

7.0.3

  • Upgrade resin-sdk

7.0.2

  • Fix short uuid bug in resin sync

7.0.1

  • Fix logs when enabling initsystem

7.0.0

  • Use experimental resin-discoverable-services with support for multiple interfaces listening.

6.2.3

  • Get correct docker pid during local push/sync

6.2.2

  • Revert experimental resin-discoverable-services

6.2.1

  • Use experimental resin-discoverable-services with support for multiple interfaces listening.
  • Filter out devices with unavailable docker socket.

6.2.0

  • Export docker utils

6.1.4

  • rdt: revert add '/run/dbus:/host_run/dbus' as a default bind-mount

6.1.3

  • rdt: add '/run/dbus:/host_run/dbus' as a default bind-mount

6.1.2

  • rdt: fix documentation

6.1.1

  • resin sync: fix container status typo on resin sync error

6.1.0

  • Support resin sync on AUFS devices
  • Add a --skip-restart flag to prevent container restart after sync

6.0.1

  • Export 'discover' utils

6.0.0

  • Chore: code refactor
  • rdt: push: support enviornment variable setting

5.3.3

  • rdt: push: improve log streaming

5.3.2

  • rdt: push: improve build log output
  • rdt: fix container create/start configuration
  • rdt: rename ResinOS -> resinOS
  • rdt: use 'SpinnerPromise' from resin-cli-visuals module
  • rdt: refactor: improve avahi service enumeration method

5.3.1

  • rdt: create containers with 'host' network configuration

5.3.0

  • rdt: use "rdt" CLI name in help and other messages
  • rdt: validate app name
  • rdt: add log streaming option flag and info message when enabled

5.2.1

  • rdt: fix log streaming after sync

5.2.0

  • rdt: remove connman bind mount
  • rdt: implement inspectImage()
  • rdt: preserve docker cache by removing previous image after build
  • rdt: rename --force to --force-build
  • rdt: support rsync update for local ResinOS AUFS devices
  • rdt: stream stdout/stderr after rtd push

5.1.1

  • rdt: Fix previous container removal during push

5.1.0

  • rdt: Support avahi autodiscovery and export device select form for use from other modules
  • rdt: Remove /etc/resolv.conf from bind mount list

5.0.0

  • rdt: Save 'local-resinos' field in .resin-sync.yml
  • rdt: Run containers with options similar to Resin.io devices
  • rdt: Sync a folder between the dev machine and a running container on a remote device
  • rdt: Do docker builds on remote device

4.1.0

  • Add resin-toolbox sync structure
  • Major refactorins to share as much functionality as possible between sync frontends

4.0.0

  • [Breaking] - changed external API - .capitano() and .sync() are now the exported methods of the resin sync module. resin-cli capitano command is also integrated in the module.

v3.1.7

  • Unpublished resin-sync@3.1.6 from npm due to error during publishing module and republished as v3.1.7

v3.1.6

Changes

  • Convert older, compatible versions of resin-sync.yml to .resin-sync.yml if the latter is not found in the project directory

v3.1.5

Changes

  • Permit resin sync to device owners only and fail with descriptive message otherwise

v3.1.4

Fixes

  • Install missing resin-cli-form dependency
  • Lock node-rsync version to 0.4.0
  • Fix space escape bug in .gitignore
  • Add more thorough special character escaping tests

v3.1.3

Changes

  • Pick (instead of omitting) sync options that will be saved in .resin-syc.yml

v3.1.2

Fixes

  • Save full uuids in .resin-sync.yml to avoid conflicts when selecting default device in interactive choose dialog

v3.1.1

Fixes

  • Fix order of app container start status messages

v3.1.0

New features

  • Add '--after' option to run commands on local machine after resin sync

v3.0.1

  • Fix interactive destination choose dialog

v3.0.0

New features

  • Parse .gitignore for file inclusions/exclusions from resin sync by default (don't parse with --skip-gitignore)
  • Automatically save options to ${source}/.resin-sync.yml after every run
  • Support user-specified destination directories with --destination/-d option

Changes

  • resin sync --source/-s option is mandatory if a .resin-sync.yml file is not found in the current directory
  • resin sync now only accepts uuid as a destination (appName has been deprecated)

Improvements

  • Major code refactoring - improved readability/maintainability
  • Improve error reporting

Fixes

  • Disable ControlMaster ssh option (as reported in support)

v2.2.0

  • Code refactor, clean up unsused variables
  • Support verbose flag for rsync and its ssh remote shell command

v2.1.1

  • HostOS version check before attempting rsync

v2.1.0

  • Support windows

v2.0.0

  • Support 'rsync' using the ssh gateway