Git Product home page Git Product logo

craft-remote-sync's Introduction

Remote Sync Craft CMS Plugin

Header image for plugin

📓 Documentation | 💳 Purchase | 🤷🏻‍♂️ Get help

Remote Sync is a plugin for Craft CMS that helps you sync your database and assets across multiple Craft environments via cloud destinations like AWS, Digital Ocean & Backblaze.

This makes it easier to move from local development to staging and onto production and avoids the need to regularly SSH into servers to perform database dumps and restores.

Remote Sync provides a useful interface for manually syncing your data via the Craft CMS Control Panel utilites section:

Craft Remote Sync Overview

Remote Sync also lets you automate the process via CLI commands:

./craft remote-sync/database/push
./craft remote-sync/database/pull
./craft remote-sync/database/list
./craft remote-sync/database/delete ...

Features

  • Database sync: move the entire database from one environment to another without touching the CLI.
  • Asset sync: copy all your asset folders without needing to FTP a file yourself.
  • Multiple cloud providers: remote sync supports numerous cloud providers including AWS and Backblaze.
  • Background queue: use the Craft queue to avoid hanging around for files to complete syncing.
  • Supports large files: sync large multi-GB volumes and databases to remote destinations.
  • CLI commands: automate syncing using the CLI commands and cron.
  • Prunes old files and folders: automatically prune old files so you never run out of space.
  • Remote volumes: sync remote volumes to other remote locations (i.e. S3 to Backblaze)

Documentation

See the full documentation website for details on how to get started with the plugin.

craft-remote-sync's People

Contributors

timmyomahony avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

craft-remote-sync's Issues

Error with 1.3.4 update

I attempted to update Remote Sync when it appeared in my Craft CP. I got the following error message:


Your requirements could not be resolved to an installable set of packages.

Problem 1

  • Installation request for weareferal/remote-sync 1.3.4 -> satisfiable by weareferal/remote-sync[1.3.4].
  • weareferal/remote-sync 1.3.4 requires weareferal/remote-core ^1.1.5 -> no matching package found.

Potential causes:

  • A typo in the package name
  • The package is not available in a stable-enough version according to your minimum-stability setting
    see for more details.
  • It's a private package and you forgot to add a custom repository to find it

Read for further common problems.
Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.

Plugin breaking the users section in the admin

Really glad this has now been moved into craft 4! Thank you!

Quite a major issue at the minute which is making the plugin unusable.

When you go to edit user permissions in the admin, either through settings->users -> groups or through an individual's user settings, if not in devMode you get a server error and when in devMode you get:

Key "heading" for array with keys "remotesync" does not exist.

This is also a problem for for remote backups plugin.

Most probably just a template issue with Craft 4.

Error Fetching Databases - Undefined Offset

When trying to view the utility from the control panel I see "Error Fetching Databases". However, while pushing the database doesn't remove the error I can see the files show up in the S3 control panel. Running the command line remote-sync/database/push successfully runs, but remote-sync/database/list returns Error: Undefined offset: 1.

I can provide more of my log if need be, but the error there is
yii\base\ErrorException: Undefined offset: 1 in /Users/steve/documents/git/mvcu/vendor/weareferal/remote-sync/src/services/RemoteSyncService.php:43

It is otherwise a new empty bucket and I have not touched any file in the bucket outside of running this plugin.

Error Fetching Databases

We use Digital Ocean Space and Remote Sync at a production environment and anything works fine. If I install Craft CMS with Nitro + Docker as local environment with the same Digital Ocean Space setting Remote Sync gives me an error "Error Fetching Databases".

Can't see my teammates databases and/or assets

Hi there,

I want to use your remote sync plug-in when collaborating on a project with my colleague.

In my Digital Ocean Space I see all of the back-ups that we create, but in Craft we can't see each other's back-ups.

Any pointers as to why this is happening?

Love the plugin btw!

Cheers,

Daaf

Error on database restore via queue

This is expected as the restore happend via an AJAX call, which logs you out of the site. What should happen is that you are automatically redirected to the login page.

Does Craft properly return a 401 or 301? If so, should check for that then just assume and redirect

Note this is only an issue when using the queue

FR: Setting to only allow pull/restore of most recent database sync

Not sure if this would work for anyone else, but in my situation, I'd be interested in only being able to see, pull, or restore the most recently pushed database, in order to avoid pulling and restoring the wrong one. Maybe there could be a setting to "show X most recent pushes" or something.

Also, is there any pruning with this plugin?

Fix Composer 2 compatibility

When installing this plugin with Composer 1, the following deprecation notice is output:

Deprecation Notice: Class weareferal\remotesync\assets\RemoteSyncUtility\RemoteSyncUtilityAsset located in ./vendor/weareferal/remote-sync/src/assets/remotesyncutility/RemoteSyncUtilityAsset.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0.

Composer 2 was released on October 24, and is now the default version that will be installed, so it’s critical that this gets resolved ASAP, or people will start getting Class not found errors.

To fix, run the following command:

> git mv src/assets/remotesyncutility src/assets/RemoteSyncUtility

Then commit your change and tag a new release.

(Note that you must use the git mv command, as Git tends to not notice case-sensitive file renames otherwise.)

Option for path style bucket requests for generic S3 endpoint

Hey, it would be nice if an option could be added to switch from subdomain based bucket requests (bucket.mys3.com) to path-style bucket requests (mys3.com/bucket).

In my particular use-case, I'm using self-hosted Minio, which can also use subdomain based buckets, but the default is path-based.
It actually gets difficult during certificate generation, because you cant generate Let's Encrypt certificates for wildcard subdomains when using TLS challenge, but you would have to use DNS challenge, which I would like to avoid.

Thanks for implementing the generic S3 Endpoint :)

Issue instantiating component on remote core

A user report an issue with the latest plugin version. They are noticing the error:

Failed to instantiate component or class "weareferal\remotecore\assets\remotecoresettings\remotecoresettingsasset.

When trying to sync volumes. Further info:

Please note this works locally but not on the server that I've deployed it to - let me know what I can do to fix it.

Craft 4

Have found your plugin extremely useful over the last year for syncing between local, staging & prod.

Do you have any idea of when you guys might support Craft 4?

Cannot push database (Craft 3.7)

In Craft 3.7.0, I get an error when pushing the database to Backblaze. Here’s what I saw in the log:

`2021-07-19 11:58:53 [-][1][-][error][Aws\S3\Exception\S3MultipartUploadException] Aws\S3\Exception\S3MultipartUploadException: An exception occurred while uploading parts to a multipart upload. The following parts had errors:

  • Part 4: Error executing "UploadPart" on “URL REMOVED"; AWS HTTP error: cURL error 7: Failed to connect to s3.us-west-002.backblazeb2.com port 443: Connection timed out (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for URL REMOVED
    in /home/site/vendor/aws/aws-sdk-php/src/Multipart/AbstractUploadManager.php:134
    `

This worked fine on the version of Craft just prior to 3.7.0

How to debug access issues

Hi there!

Problem:

./craft.bat remote-sync/database/list
Error: AWS Error (Check credentials)

However, when attempting to connect to AWS using the exact same credentials via AWS CLI, I can connect and for example, list objects in the specified bucket.

How can I debug this issue?

S3 bucket endpoint configuration

Hi,

Could you look into adding a configuration option for what endpoint to use for S3? We use DigitalOcean Spaces which is 100% S3 API compatible and it would work out of the box if we could specify a custom endpoint :)

Configuration To Disable "Pull & Restore"

I'm on Craft 3 and this plugin v1.4.0. I'm looking to prevent the ability to restore on an environment basis.

For example I'd like to be able to Push the DB from production and ensure we never "Pull & Restore" from production. It would prevent accidentally restoring on the wrong ENV.

I'm imagining a new Lightswitch setting that is named something like "Prevent Pull & Restore" and it's defaulted to false and configurable with a ENV variable. Thanks!

I could see this expanding to disabling Push and Delete Databases and similar for the Volumes feature but I don't need any of those for now 😄

Incorrect reference in docs to config file

Alternatively, if you want to configure the plugin on a per-environment basis, you can copy the config/remote-backup.example.php to your project's config/remote-backup.php file. These settings will override the Control Panel settings.

This repo is the Remote Sync repo, the text above references a file for remote-backup.php. Also, the example config file in the repo is named remote-backup.example.php, I think it should be remote-sync.example.php.

Asset restore doesn’t pull images

On the staging server, I did a push of my assets. On my local environment, I did a pull. This took a couple minutes (about 300MB), and when it was done it said “volumes pulled." I looked in my local assets folder and no files had been downloaded there. I searched my hard drive and they weren’t anywhere. There are entries in the assets section for the images, but they are broken links and the file cannot be found. I moved all files out of my local assets folder and cleared caches and tried again... it once again said “volumes pulled” but there was just an empty assets folder at the end of the process.

The database sync seems to be working fine though.

Failed to instantiate component or class on Settings

When I install this plugin I cannot access the settings page to configure the plugin. It returns the following error:

ReflectionException: Class "weareferal\remotecore\assets\remotecoresettings\RemoteCoreSettingsAsset" does not exist in /var/www/html/vendor/yiisoft/yii2/di/Container.php:507
Stack trace:
#0 /var/www/html/vendor/yiisoft/yii2/di/Container.php(507): ReflectionClass->__construct('weareferal\\remo...')
#1 /var/www/html/vendor/yiisoft/yii2/di/Container.php(385): yii\di\Container->getDependencies('weareferal\\remo...')
#2 /var/www/html/vendor/yiisoft/yii2/di/Container.php(170): yii\di\Container->build('weareferal\\remo...', Array, Array)
#3 /var/www/html/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('weareferal\\remo...', Array, Array)
#4 /var/www/html/vendor/yiisoft/yii2/web/AssetManager.php(292): yii\BaseYii::createObject(Array)
#5 /var/www/html/vendor/yiisoft/yii2/web/AssetManager.php(265): yii\web\AssetManager->loadBundle('weareferal\\remo...', Array, true)
#6 /var/www/html/vendor/yiisoft/yii2/web/View.php(294): yii\web\AssetManager->getBundle('weareferal\\remo...')
#7 /var/www/html/vendor/weareferal/remote-sync/src/RemoteSync.php(141): yii\web\View->registerAssetBundle('weareferal\\remo...')
#8 /var/www/html/vendor/craftcms/cms/src/base/Plugin.php(203): weareferal\remotesync\RemoteSync->settingsHtml()
#9 /var/www/html/vendor/craftcms/cms/src/web/View.php(1610): craft\base\Plugin->craft\base\{closure}()
#10 /var/www/html/vendor/craftcms/cms/src/base/Plugin.php(204): craft\web\View->namespaceInputs(Object(Closure), 'settings')
#11 /var/www/html/vendor/craftcms/cms/src/controllers/PluginsController.php(103): craft\base\Plugin->getSettingsResponse()
#12 [internal function]: craft\controllers\PluginsController->actionEditPluginSettings('remote-sync', Object(weareferal\remotesync\RemoteSync))
#13 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#14 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#15 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('edit-plugin-set...', Array)
#16 /var/www/html/vendor/craftcms/cms/src/web/Application.php(301): yii\base\Module->runAction('plugins/edit-pl...', Array)
#17 /var/www/html/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('plugins/edit-pl...', Array)
#18 /var/www/html/vendor/craftcms/cms/src/web/Application.php(286): yii\web\Application->handleRequest(Object(craft\web\Request))
#19 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#20 /var/www/html/web/index.php(16): yii\base\Application->run()
#21 {main}

Next yii\di\NotInstantiableException: Failed to instantiate component or class "weareferal\remotecore\assets\remotecoresettings\RemoteCoreSettingsAsset". in /var/www/html/vendor/yiisoft/yii2/di/Container.php:509
Stack trace:
#0 /var/www/html/vendor/yiisoft/yii2/di/Container.php(385): yii\di\Container->getDependencies('weareferal\\remo...')
#1 /var/www/html/vendor/yiisoft/yii2/di/Container.php(170): yii\di\Container->build('weareferal\\remo...', Array, Array)
#2 /var/www/html/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('weareferal\\remo...', Array, Array)
#3 /var/www/html/vendor/yiisoft/yii2/web/AssetManager.php(292): yii\BaseYii::createObject(Array)
#4 /var/www/html/vendor/yiisoft/yii2/web/AssetManager.php(265): yii\web\AssetManager->loadBundle('weareferal\\remo...', Array, true)
#5 /var/www/html/vendor/yiisoft/yii2/web/View.php(294): yii\web\AssetManager->getBundle('weareferal\\remo...')
#6 /var/www/html/vendor/weareferal/remote-sync/src/RemoteSync.php(141): yii\web\View->registerAssetBundle('weareferal\\remo...')
#7 /var/www/html/vendor/craftcms/cms/src/base/Plugin.php(203): weareferal\remotesync\RemoteSync->settingsHtml()
#8 /var/www/html/vendor/craftcms/cms/src/web/View.php(1610): craft\base\Plugin->craft\base\{closure}()
#9 /var/www/html/vendor/craftcms/cms/src/base/Plugin.php(204): craft\web\View->namespaceInputs(Object(Closure), 'settings')
#10 /var/www/html/vendor/craftcms/cms/src/controllers/PluginsController.php(103): craft\base\Plugin->getSettingsResponse()
#11 [internal function]: craft\controllers\PluginsController->actionEditPluginSettings('remote-sync', Object(weareferal\remotesync\RemoteSync))
#12 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#13 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#14 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('edit-plugin-set...', Array)
#15 /var/www/html/vendor/craftcms/cms/src/web/Application.php(301): yii\base\Module->runAction('plugins/edit-pl...', Array)
#16 /var/www/html/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('plugins/edit-pl...', Array)
#17 /var/www/html/vendor/craftcms/cms/src/web/Application.php(286): yii\web\Application->handleRequest(Object(craft\web\Request))
#18 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#19 /var/www/html/web/index.php(16): yii\base\Application->run()
#20 {main}

I am running on craft 4.3.0 and can see the remote-core composer package installed.

Timeout setting 300?

On my local, I have php's script timeout set to 600. However, when pulling/restoring a db with Remote Sync, it times out showing that it has surpassed 300. Is there some setting within the plugin that sets the timeout at 300? If so, could you make that a config setting so I can increase it in environments that need it?

https://d.pr/i/dxBj9K
https://d.pr/i/Rz5ZUp

Draft/Revision issue when restoring database

I've noticed that when I restore a database via sync, draft entries can appear as duplicated entries in the Craft admin:

Screenshot 2020-09-29 at 13 36 57

This doesn't seem to happen if you download a database backup and manually restore it via:

 psql -U feral feral < ~/Downloads/feral--2020-09-29-123002--v3.5.11.1.sql

Connection fails when folder object exists in S3

If your S3 bucket contains a folder "object", this causes Remote Sync to fail. To reproduce:

  1. Create a bucket.
  2. Use AWS console to create a folder called "backup" in this bucket.
  3. Configure Remote Sync to use this bucket.
  4. Test connection - will fail.

If would be great if Remote Sync could ignore this object or report a better error message at least.

No (*env*) shown in title

hey :)
i'm not sure if it is a bug or i am missing something, but at the moment i can't see the env the database is comming from in the craft backend.
in the screenshots there is a (dev) behind the date.

Would be helpfull to get that information back.

Thanks, and have a good day

Missing fields when restoring/changing environment

I've experienced this issue when pushing/pulling databases with remote-sync. You update a field or section/global on local then push to staging (or another dev machine). After pulling latest changes and restoring the database via the interface (which uses ./craft restore/db under the hood) the new fields aren't reflected.

I think this is an issue with how Craft is handling project.yaml as well as the restore function. The issue has been logged here:

craftcms/cms#5952

Support for MinIO (or custom s3 compatible endpoints)

Hi,

I'm looking to use this with a self-hosted instance of MinIO (which is 100% compatible with Amazon S3), which in result has a custom endpoint URL (Like it was initially requested by #19 ).

Would be nice if either custom endpoint support or an additional provider could be added. However, I think a custom endpoint would be the best option for general applicability.

From MinIO webpage

Amazon’s S3 API is the defacto standard in the object storage world. MinIO is the defacto standard for S3 compatibility and was one of the first to adopt the API and the first to add support for S3 Select. More than 750 organizations, including Microsoft Azure, use MinIO’s S3 Gateway - more than the rest of the industry combined.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.