sandstorm / synco

Synco - an Database and File Dump Downloader for synchronizing production, staging, and local development. Batteries included, but removable.
https://sandstorm.github.io/synco
MIT License
26 stars 2 forks source link
downloader synchronization

synco

an intelligent Database and File Dump Downloader for synchronizing content between production, staging, and local development

Latest Release License: MIT


Installation | Documentation | Contributing


In many web projects, we at some point needed to synchronize content from production to local development, in order to reproduce and fix some bugs, test huge updates, or develop further features. We have implemented lots of different synchronization scripts - but they were often kind of half-baked, and had some uncovered edge cases.

Especially in bigger projects which f.e. have multiple gigabytes of persistent resources like images which must be downloaded sometimes, we need the flexibility to choose whether we only need a database dump, or whether we need all the files. And if possible, we only want to download changed files instead of all of them.

This problem is what Synco solves. Right now it is working only for Neos/Flow projects, though this will change really soon (and is already prepared).

Synco is not the right fit if you want to run it inside some batch jobs like backups - I recommend to use other solutions like Borgbackup there.

Features

┌─────────────────────────────┐                      ┌─────────────────────────────┐
│         synco serve         │                      │        synco receive        │
│                             │                      │                             │
│      detect framework       │─────────────────────▶│ downloads and decrypt dump  │
│   produce encrypted dump    │                      │  (planned) import to local  │
│                             │                      │          instance           │
└─────────────────────────────┘                      └─────────────────────────────┘
   on your production server                             on your local instance     

Features:

Installation

Run the following command on your developer machine, and this will download synco and place it on your PATH:

macOS

brew install sandstorm/tap/synco

Usage

On your production server, run the following command in the work directory of your application:

curl https://sandstorm.github.io/synco/serve | sh -s -

# for verbose mode, run with "--debug" at the end.
curl https://sandstorm.github.io/synco/serve | sh -s - --debug

# for downloading ALL files and ALL database tables (including things
# like thumbnails which can be regenerated on the client)
curl https://sandstorm.github.io/synco/serve | sh -s - --all

# For Neos/Flow: To use a specific Flow context, do the following:
export FLOW_CONTEXT=Production
curl https://sandstorm.github.io/synco/serve | sh -s -

This will (on the prod server):

To download the dump, on your local machine, you run the CLI call printed out; and follow the wizard:

What is the difference between synco and synco-lite?

synco-lite is a binary-size-optimized package of Synco which only contains the code to run synco serve. This makes Synco more quick to run on the server side, where the tool is downloaded at first use.

synco is the tool which contains all features, but comes with a bigger package size.

Configuration

Synco tries to detect as many settings as possible by inspecting the the environment in which it runs.

If this auto-detection does not properly work, you can set environment variables to control the synco serve behavior.

Supported environment variables:

Example:

export PHP=/your/path/to/php
curl https://sandstorm.github.io/synco/serve | sh -s -

Usage Server-to-Server

On the first host (where you want to download from), run the synco command as usual (see above).

On the second host, where you want to download to, you can run synco without installing it like this:

curl https://sandstorm.github.io/synco/synco | sh -s - <your-synco-arguments-as-shown-from-the-other-command-output>
# for example
curl https://sandstorm.github.io/synco/synco | sh -s - receive ts-...... ..........

Development

See CONTRIBUTING.md for details on the dev process.

License

This project is licensed under the MIT license.