Giter Site home page Giter Site logo

fortrabbit / craft-copy Goto Github PK

View Code? Open in Web Editor NEW
73.0 6.0 8.0 1.88 MB

Deployment tools for Craft on fortrabbit

Home Page: https://www.fortrabbit.com

License: MIT License

PHP 94.92% Dockerfile 0.66% Makefile 0.67% Shell 3.75%
fortrabbit craftcms craft craftcms-plugin

craft-copy's Introduction

Craft Copy Plugin

This little command line tool helps to speed up common tasks around Craft CMS deployment on fortrabbit. Craft Copy syncs your local development environment with your fortrabbit App — up and down. It conveniently deploys code changes and synchronizes latest images and database entries. This Craft CMS plugin will be installed locally and on the fortrabbit App.

Demos

demo

demo

Here is a video introdcution (1.5 minutes).

Requirements

  • A local development environment including: Craft 5 (since version 3), PHP 8 and Composer.
  • The following binaries should be executable: php, mysqldump, git and rsync
  • A SSH key installed should with your fortrabbit Account (no password auth so far)
  • You need to have an App with fortrabbit

Craft Copy works for Universal Apps and Professional Apps. Asset synchronisation is only available for Universal Apps with local asset volumes. It's known to work locally with Laravel Herd, Laravel Valet and DDEV.

Installation

Best install Craft Copy in the terminal on your local computer with Composer like so:

# Jump into your local Craft CMS folder
cd your/craft-project

# Require Craft Copy via Composer
composer config platform --unset
composer require fortrabbit/craft-copy -W

# With the latest version of composer (2.2 or higher) you may see this prompt: 
# Do you trust "fortrabbit/craft-auto-migrate" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [y,n,d,?] 
#
# Confirm with `y`

# Install and enable the plugin with Craft CMS
php craft plugin/install copy

You will be guided through a form to connect your local App with the App on fortrabbit. Craft Copy is available in the Craft CMS plugin store.

Usage

Craft Copy will always be executed on your local computer in your local development environment.

The optional {stage} parameter defines which fortrabbit App the command applies to. It is useful when working with multiple fortrabbit Apps as stages. The default parameter is the app name. See multi-staging section below for more.

Some commands are interactive, meaning that you will need to confirm certain potential dangerous operations. You can disable such manual interactions by adding the --interactive=0 flag in most cases. The short alias version is -i=0.

Setup

# Connect your development environment with your fortrabbit App
php craft copy/setup

Get help

# See a list of available commands
php craft help copy

Database

# Dump local DB (backup fortrabbit db) and import it to the fortrabbit App
php craft copy/db/up {stage}

# Dump local DB and import it to the fortrabbit App (useful if the fortrabbit db is broken)
php craft copy/db/up {stage}  --force

# Dump fortrabbit DB and import it locally
php craft copy/db/down {stage}

Code

While you can use git push as well to deploy code by Git to your fortrabbit App, the Craft Copy code commands offer some additional extras: It will check for uncommitted changes and initialize the Git repo if required.

# Push code changes to the fortrabbit App
php craft copy/code/up {stage}

# Pull code changes from your fortrabbit App
php craft copy/code/down {stage}

Options and arguments

  • To prevent a prompt, for instance when running the command in a CI pipeline, you can use php craft copy/code/up -i=0 -m="your commit message".

Asset Volumes

Assets in Craft CMS are media files that are uploaded by editors and managed by the CMS. Assets are getting stored in volumes and are not part of Git.

# Sync up a local volume to fortrabbit App
php craft copy/volumes/up {stage} {?volumeHandle}

# Sync down a vlume from the fortrabbit App to local
php craft copy/volumes/down {stage} {?volumeHandle}
  • The "File System Path" for the Volume setting within the Craft CMS control panel should not be a relative path. You can use the @webroot alias.
  • Remote volumes (S3, Object Storage …) are not supported so far

Options and arguments

  • {volumeHandle} is the handle name of your asset volume in Craft CMS
  • To sync all volumes, don't provide a volumeHandle (and add -i=0 to avoid questions)
  • To test what will actually be synced you can add the -n option to trigger a dry-run

Copy all

Often you want to get all the latest content from the App or maybe even push all local changes up to the App. You can use the all command for that:

# Sync database, volumes and git from local to your fortrabbit App
php craft copy/all/up

# Sync database, volumes and git from your fortrabbit App to local
php craft copy/all/down
  • This is not including the folder action by default.

DDEV support

Craft Copy supports DDEV. Once you got the container running:

  1. ddev auth ssh - Copy SSH keys from the host into the container
  2. ddev ssh - Login to the container
  3. From their proceed as required

See our slighlty old blog post on how to set it up together.

Craft Nitro support (deprecated)

This feature will be removed with the next major version since Craft Nitro is retired.

Advanced usage

Don't stop. Read on to fully understand Craft Copy!

Config file

The setup command creates a configuration file within the Craft /config folder. The file name pattern is fortrabbit.{stage}.yml, where {stage} is how you have defined the fortrabbit App environment in the setup. The default for {stage} is the App name, commonly this can also be production. The file is version controlled and can be shared with the team and includes all basic settings, plus some extras, like before/after commands. When using multi-staging a configuration file will be created for each fortrabbit App. Also see the example file.

Automatic migrations

Craft Copy incorporates another package called Craft auto migrate. It makes sure that database migrations will always run when deploying to the fortrabbit App. That means that every time you'll push code via Git, a database migration will be triggered and changes from project.yaml will be applied right away, without the need to click the apply changes button with the Control Panel.

The other way around, when pulling down changes, a database migration will also run. This is configured via a default after command in the config file.

Project Config

Craft Copy alters the behaviour of the ProjectConfig class to prevent Project Config actions in the CP. By default, we apply the potential changes during deployment after composer install.

Multi staging

At fortrabbit you can set up multiple Apps to create multiple environments for your project. See the multi-staging help article.

Multi staging config

Once your Apps are in place, you connect your local environment with each App.

# Run this command to setup a new deployment configuration for each stage
php craft copy/setup

The setup command creates a config file for each App.

Multi staging usage

# Copy code and db down from 'production'
php craft copy/code/down production
php craft copy/db/down production

# Make changes
# ...

# Copy code and db up to 'staging'
php craft copy/code/up staging
php craft copy/db/up staging

Before/after commands

You can run any script before or after you run common up/down commands with Craft Copy.

  • Place the before/after scripts in your Craft Copy config file.
  • The before/after commands will run on your local machine, not on the fortrabbit App. To run scripts while deploying, consider the Composer post-install-cmd.

Supported commands

  • code/up
  • code/down
  • db/up
  • db/down
  • volumes/up
  • volumes/down
  • folder/up
  • folder/down

Before/after example

Automate your deployment pipeline. Every time you push up new code with code/up also minify javascript and css and sync it up as well:

before:
  # Before deploying code by Git, please:
  code/up:
    # 1. Run your NPM production build
    - "npm run prod"
    # 2. Sync the results of the build up
    - "php craft copy/folder/up production web/build/prod -i=0"

Here is a full config file example: config/fortrabbit.example.yaml

Database to file

There is also a command to create a local copy of your database to a file. You can create an .sql file and also import back such file into the database. Here is the command:

# Export DB
php craft copy/db/to-file filename

# Import DB
php craft copy/db/from-file filename
# Filename is a required parameter

Note that there are also similar Craft CLI commands for this: php craft backup/db and php craft restore/db.

Synchronize folders

You can also synchronize folders which are not in Git or not an Asset Volume. A common use case is to sync up build artifacts such as minified JS or CSS to your fortrabbit App. This can be coupled with before/after commands.

# Sync up a folder from local to your fortrabbit App
php craft copy/folder/up {stage} {folder}

# Example usage
php craft copy/folder/up production web/build
  • The {folder} is your relative path seen from the craft executable (project root)

Using Craft Copy in Docker environments

You may want to run Craft Copy within any Docker container. You will need the following dependencies to be installed inside the container:

  • mysqldump
  • mysql (client)
  • ssh (client)
  • Access to the SSH keys you saved with your fortrabbit Account - for example like so

How Craft Copy works

With fortrabbit you can already use Git to deploy code without any extras or plugins. When deploying code by Git Composer also is getting triggered. Craft Copy enhances on that by adding support for files that are excluded from Git such as assets in volumes, folders and database contents.

Craft Copy can help to bring together the different data types required to run Craft CMS. Each data type is unique, so is the transport layer. Here are more details so you can better understand what's going on behind the scenes:

Template and dependencies code via Git

Craft Copy offers a light weight Git wrapper. The direction will be in most case up (push code), since you will develop locally first and then push changes up to the fortrabbit App. Since Git is transport layer and version history, those changes are non-destructive. You can always roll back.

The composer.json is also managed in Git and when you push a change to that file, Composer will run during deployment on fortrabbit. That's not Craft Copy but a fortrabbit feature. So you don't need to login by SSH and run Composer manually. Also you should not trigger any updates with the Craft CMS Control Panel on the fortrabbit App itself.

Asset Volumes

Any asset files and folders, including image transformations that can be synced up and down with the volumes command. Here rsync will be used. The transport flags are set to be non-destructive. No files will be deleted and you can safely run this operation in any direction without having to fear any data loss. You might need to keep your assets library clean from time to time.

Database

The MySQL database is getting copied over by using mysqldump. So it basically will export the current status of the database as an file.sql and will replace the other database with that file. In other words: This can be a destructive operation. You need to make sure that any content changes affecting the database, like new entries or editing entries are only done in one environment, either locally or on the fortrabbit App. It can not merge changes, like with assets or code. Good news is, that Craft Copy will always create a snapshot file which you can use to roll back.

my.conf file

Craft Copy creates a my.conf file. It sets some defaults to ensure maximal compability when working with different MySQL versions. See the annotated file here and read about SUPER priviliges here.

Troubleshooting Craft Copy

The setup is usually straight forward when the system requirements are fulfilled. However, depending on your local setup, you may run into errors. Many errors are MAMP related and easy to fix:

Local MySQL connection error

php craft install/plugin copy
  *** installing copy
  *** failed to install copy: Craft CMS can’t connect to the database with the credentials in config/db.php.

Fix: Ensure "Allow network access to MySQL" is ticked in MAMP.

The mysqldump command does not exist

The mysqldump client is a command line program to backup mysql databases. It is usually included with MySQL installations. Find out if you can access mysqldump:

which mysqldump
  mysqldump not found

Possible fix: Add the MAMP bin path to your Bash profile:

echo 'export PATH=/Applications/MAMP/Library/bin:$PATH' >>~/.bash_profile

PHP cli version is lower than 7.1

Find out the php version on the command line:

php -v
  PHP 7.0.8 (cli) (built: Jun 26 2016 12:30:44) ( NTS )
  Copyright (c) 1997-2016 The PHP Group
  Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
     with Zend OPcache v7.0.8, Copyright (c) 1999-2016, by Zend Technologies

Fix: Add MAMP php bin path to your Bash profile:

echo 'export PATH=/Applications/MAMP/bin/php/php7.2.1/bin:$PATH' >>~/.bash_profile

Composer version conflict

When installing the plugin via Composer you may see an error like this:

composer require fortrabbit/craft-copy:^1.0.0
  ./composer.json has been updated
  Loading composer repositories with package information
  Updating dependencies (including require-dev)
  Your requirements could not be resolved to an installable set of packages.
  
  Problem 1
  - Installation request for fortrabbit/craft-copy ^1.0.0 -> satisfiable by fortrabbit/craft-copy[1.0.0].
  - Conclusion: remove symfony/console v3.3.6
  - Conclusion: don't install symfony/console v3.3.6
  - fortrabbit/craft-copy 1.0.0 requires symfony/yaml ^4.1
  [...]
   Problem 99

Fix: Update all existing dependencies:

composer config platform --unset
composer update
php craft migrate/all

Composer allow plugin issue

You see a warning like this when trying to deploy:

In PluginManager.php line 762: fortrabbit/craft-auto-migrate contains a Composer plugin  which is blocked by your allow-plugins config. You may add  it to the list if you consider it safe. You can run "composer config --no-plugins allow-plugins.fortrabbit/craft-auto-migrate [true|false]" to enable it (true) or disable it explicitly and suppress this exception (false) See https://getcomposer.org/allow-plugins

That's a new Composer security policy in action and should only happen when you installed the plugin a while ago.

Fix: Configure Composer to allow plugins:

composer config --no-plugins allow-plugins.fortrabbit/craft-auto-migrate true

craft-copy's People

Contributors

erinbit avatar frank-laemmer avatar juhg avatar meredevelopment avatar nitech avatar pheeque1 avatar tomdavies avatar vholer avatar xhmikosr avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

craft-copy's Issues

Better error when no SSH key is installed

When a user does not have an SSH key installed, this error is shown:

Screenshot 2019-09-30 at 13 22 15

The error message "SSH is required" is not super helpful here. Could be "SSH key authentication is required here, username/password authentication is not working. Please add your SSH key to your fortrabbit Account first."

Add branch option for copy/code/up

Allow adding branches to php craft copy/code/up {localBranch} {remoteBranch} to avoid question interface, which currently throws an exception when used in a Composer script.

Copy Fail

Thanks for putting effort into writing this plugin! It's great to see a hosting company put this kind of effort into easing the deployment process.

After having successfully installed the plugin, I encountered this error after running ./craft copy/setup

fortrabbit\Copy\exceptions\RemoteException in /site/craft/vendor/fortrabbit/craft-copy/src/services/Ssh.php: 61                

Stack trace:                                                                                      
#0 /vendor/fortrabbit/craft-copy/src/commands/SetupAction.php(160): fortrabbit\Copy\services\Ssh->exec('php          
vendor/bin/...')                                                                                                     
#1 /vendor/fortrabbit/craft-copy/src/commands/SetupAction.php(80):                                                   
fortrabbit\Copy\commands\SetupAction->setupRemote()                                                                  
#2 [internal function]: fortrabbit\Copy\commands\SetupAction->run()                                                  
#3 /vendor/yiisoft/yii2/base/Action.php(94): call_user_func_array(Array, Array)                                      
#4 /vendor/yiisoft/yii2/base/Controller.php(157): yii\base\Action->runWithParams(Array)                              
#5 /vendor/yiisoft/yii2/console/Controller.php(148): yii\base\Controller->runAction('setup', Array)                  
#6 /vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('setup', Array)                      
#7 /vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('copy/setup', Array)                
#8 /vendor/yiisoft/yii2/console/Application.php(147): yii\console\Application->runAction('copy/setup', Array)        
#9 /vendor/yiisoft/yii2/base/Application.php(386):                                                                   
yii\console\Application->handleRequest(Object(craft\console\Request))                                                
#10 /craft(22): yii\base\Application->run()                                                                          
#11 {main}

Having never run this before I'm not sure which order the plugin runs the various dependencies. It appears all my files are on the server (minus the above exceptions), but the mysqldump hasn't occurred. Not sure where to go from here to get the site up other than scrapping the app and restarting. Suggestions?

cannot get ./craft copy/db/up to work

Trying to push db from local to remote with ./craft copy/db/up, the command is not giving any error but the remote db is not updated... I have to use a ./craft copy/db/to-file and then import on FR with sequelpro

Cannot run php craft copy/db/up

Hello there,

I am unable to run php craft copy/db/up

The output:

 [production craft3-****.****.io] Export local DB and import on remote.                                                 

 Are you sure? (yes/no) [no]:
 > yes

Creating local dump
Uploading dump to remote ./storage/craft-copy-transfer.sql
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░  50 %
time:  6 secs/12 secs

Enter passphrase for key '/Users/****/.ssh/id_rsa': 

                                                                                                                        
 [ERROR] Plugin is not installed on remote.                                                                             
                                                                                                                        
         fortrabbit\Copy\exceptions\PluginNotInstalledException                                                         
                                                                                                                        
         in /Users/****/Documents/CraftCMS/vrints-carrosserie/vendor/fortrabbit/craft-copy/src/services/Ssh.php:
         68                                                                                                             
                                                                                                                        

▓                                                                                                                       
▓  Stack trace:                                                                                                         
▓                                                                                                                       
▓  #0 /vendor/fortrabbit/craft-copy/src/commands/DbUpAction.php(94): fortrabbit\Copy\services\Ssh->exec('ssh            
▓  craft3-w48p...')                                                                                                     
▓  #1 [internal function]: fortrabbit\Copy\commands\DbUpAction->run(NULL)                                               
▓  #2 /vendor/yiisoft/yii2/base/Action.php(94): call_user_func_array(Array, Array)                                      
▓  #3 /vendor/yiisoft/yii2/base/Controller.php(157): yii\base\Action->runWithParams(Array)                              
▓  #4 /vendor/yiisoft/yii2/console/Controller.php(164): yii\base\Controller->runAction('db/up', Array)                  
▓  #5 /vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('db/up', Array)                      
▓  #6 /vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('copy/db/up', Array)                
▓  #7 /vendor/craftcms/cms/src/console/Application.php(93): yii\console\Application->runAction('copy/db/up', Array)     
▓  #8 /vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('copy/db/up', Array)      
▓  #9 /vendor/yiisoft/yii2/base/Application.php(386):                                                                   
▓  yii\console\Application->handleRequest(Object(craft\console\Request))                                                
▓  #10 /craft(30): yii\base\Application->run()                                                                          
▓  #11 {main}                                                                                                           
▓   

The error is clear Plugin is not installed on remote. so I sshed into the box and ran php craft install/plugin copy

craft3-w48p:~$ php craft install/plugin copy

Loaded php.ini: /etc/php5/php.ini*** installing copy
*** installed copy successfully (time: 0.000s)

This seemed to installed correctly but when I run php craft copy/info I get an error (Unknown command)

craft3-w48p:~$ php craft copy/info

Loaded php.ini: /etc/php5/php.ini
Unknown command: copy/info

Any idea how I can install the plugin remote so that the php craft copy/db/up command works?

Only Database commands fail, code & assets commands work fine.

Windows support

Hi, there.

I know you state in README.md no Windows support, but being I'm personally on Windows most of the time, I could really benefit from this.

Thanks!

[ERROR] SSH Remote error

Doing ./craft copy/db/down as I always do I'm getting now this error:

[ERROR] SSH Remote error: ssh: Could not resolve hostname deploy.eu2.frbit.com: nodename

Any idea?

Thanks a lot

PHP requirement incompatible on install

Trying to install plugin via composer:
composer.phar require fortrabbit/craft-copy:^1.0.0-RC11

My php version is 7.1.19 (cli).
Mamp pro is using 7.1.8

While trying to get plugin i get this error:

[InvalidArgumentException]                                                                                              
  Package fortrabbit/craft-copy at version ^1.0.0-RC11 has a PHP requirement incompatible with your PHP version (7.1.19)

Although stated in the readme that the php requirement is 7.1+

Feature request: multi-environment sync

Hi, and firstly — thanks for such a great tool as craft/copy. It really made developing with Craft a pleasure!

I have what I feel is a feature request. I hope it makes sense, I as this is a bit of a compilation of several thought. I'm happy to clarify if needed.

  • I use your craft-copy tool extensively to sync DBs between two environments: staging and production. Currently, via local machine. I.e. I do sync/down from staging to local, then sync/up from local to production.
  • My aim is to allow the client seamlessly write content/do changes on staging environment. After finishing, they would press a button either in the Control Panel, or the app console to push the changes from staging to production.
  • Since the project will be handed over to the client, and mostly used by non-technical people, I'm looking for a simple deploy workflow. And by deploy I mean syncing the DB from staging to production - as it'll be only entries and settings changes. The important point here, is that sync should be ran on the production box, pulling DB changes from staging. To clarify: this should not be a sync/down from staging to local machine, then sync/up from local to production.

The goal is to have CLI-free DB migration from staging to production. I’m essentially looking for creating that workflow available from Craft’s control panel.

To give a more concrete example, I’m looking to build a button for a non-technical editor. When they finish writing an article on Staging, they can test it all looks great and works. I want them to then have a button somewhere in CP that, when pressed, simply copies staging DB over to production. It feels like craft/copy tool could provide the functionality for that. Obviously, the button could be implemented as a plugin separately.

Does that use-case make sense, or am I overcomplicating it? Craft development is not my specialty, so I apologise in advance.

Setup for Pro stack app fails: Undefined index: us-east-1

Ubuntu 18.04; PHP 7.2
PHP 7.2.9-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Aug 19 2018 07:16:54) ( NTS )

App is located at deploy.us1.frbit.com.

./craft copy/setup

 What's the name of your App? []:
 > <my-app>



 [ERROR] Undefined index: us-east-1

         yii\base\ErrorException

         in /home/vagrant/sites/craft/vendor/fortrabbit/craft-copy/src/commands/SetupAction.php: 54


▓
▓  Stack trace:
▓
▓  #0 /vendor/fortrabbit/craft-copy/src/commands/SetupAction.php(54): yii\base\ErrorHandler->handleError(8, 'Undefined
▓  index...', '/home/vagrant/s...', 54, Array)
▓  #1 [internal function]: fortrabbit\Copy\commands\SetupAction->run()
▓  #2 /vendor/yiisoft/yii2/base/Action.php(94): call_user_func_array(Array, Array)
▓  #3 /vendor/yiisoft/yii2/base/Controller.php(157): yii\base\Action->runWithParams(Array)
▓  #4 /vendor/yiisoft/yii2/console/Controller.php(148): yii\base\Controller->runAction('setup', Array)
▓  #5 /vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('setup', Array)
▓  #6 /vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('copy/setup', Array)
▓  #7 /vendor/yiisoft/yii2/console/Application.php(147): yii\console\Application->runAction('copy/setup', Array)
▓  #8 /vendor/yiisoft/yii2/base/Application.php(386):
▓  yii\console\Application->handleRequest(Object(craft\console\Request))
▓  #9 /craft(22): yii\base\Application->run()
▓  #10 {main}

Default answer to "Are you sure?" should not be "yes"

Lovely tool - I use it a lot and it's very reliable.

However the default answer to "Are you sure?" after being asked if a user wishes to import is dangerous.

It should be "no".

I almost lost my Craft DB on Fortrabbit after installing craft-copy on a local machine. It ran through the install script and at the end asked:

$ php craft copy/db/up

Export local DB - import on remote: sonniesedge
-----------------------------------------------

 Are you sure? (yes/no) [yes]:

If I had accidentally hit return here I would have lost my live site, having it replaced by an empty DB that was sitting on my machine.

Summary

Can we please make the default response to be "no" to avoid situations like this? Explicit confirmation should always be required for a data-destroying operation.

Explain before/after commands better

There is some mention of "before/after" commands here:
https://github.com/fortrabbit/craft-copy#run-scripts-beforeafter-commands
It also links to an example file.

I would like to see explained:

  • Give some examples for use cases and maybe but the examples right away in the README.
  • Is there a was to deploy assets generated by NPM build scripts, if so, how? npm run prod is part of the example.
  • How does this relate to fortrabbit.yml which also allows post deploy operations. What is run in which order?
  • What about auto-migrate? It's mentioned that auto-migrate is included and it is pre-populated for code/down. Why is not shown at code/up where it will also run (magically)?

mysqldump error 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock'

Me again. This is the first time trying copy since I got it to install correctly.

I am trying to run ./craft copy/db/down and it gets to about 50% when it dumps this error message:

 [ERROR] The shell command "mysqldump                                                                                   
         --defaults-extra-file="/Users/steven/Code/vetscripts/storage/runtime/temp/my.cnf" --add-drop-table --comments  
         --create-options --dump-date --no-autocommit --routines --set-charset --triggers --single-transaction --no-data
         --result-file="storage/craft-copy-recent.sql" vetscripts && mysqldump                                          
         --defaults-extra-file="/Users/steven/Code/vetscripts/storage/runtime/temp/my.cnf" --add-drop-table --comments  
         --create-options --dump-date --no-autocommit --routines --set-charset --triggers --no-create-info              
         --ignore-table=vetscripts.craft_assetindexdata --ignore-table=vetscripts.craft_assettransformindex             
         --ignore-table=vetscripts.craft_sessions --ignore-table=vetscripts.craft_templatecaches                        
         --ignore-table=vetscripts.craft_templatecachequeries --ignore-table=vetscripts.craft_templatecacheelements     
         --ignore-table=vetscripts.craft_cache --ignore-table=vetscripts.craft_templatecachecriteria vetscripts >>      
         "storage/craft-copy-recent.sql"" failed with exit code 2: mysqldump: Got error: 2002: Can't connect to local   
         MySQL server through socket '/tmp/mysql.sock' (2) when trying to connect                                       
                                                                                                                        
         craft\errors\ShellCommandException                                                                             
                                                                                                                        
         in /Users/steven/Code/vetscripts/vendor/craftcms/cms/src/db/Connection.php: 607                                
                                                                                                                        

▓                                                                                                                       
▓  Stack trace:                                                                                                         
▓                                                                                                                       
▓  #0 /vendor/craftcms/cms/src/db/Connection.php(288):                                                                  
▓  craft\db\Connection->_executeDatabaseShellCommand(Object(mikehaertl\shellcommand\Command))                           
▓  #1 /vendor/fortrabbit/craft-copy/src/services/Dump.php(40): craft\db\Connection->backupTo('storage/craft-c...')      
▓  #2 /vendor/fortrabbit/craft-copy/src/commands/DbDownAction.php(77):                                                  
▓  fortrabbit\Copy\services\Dump->export('storage/craft-c...')                                                          
▓  #3 [internal function]: fortrabbit\Copy\commands\DbDownAction->run(NULL)                                             
▓  #4 /vendor/yiisoft/yii2/base/Action.php(94): call_user_func_array(Array, Array)                                      
▓  #5 /vendor/yiisoft/yii2/base/Controller.php(157): yii\base\Action->runWithParams(Array)                              
▓  #6 /vendor/yiisoft/yii2/console/Controller.php(148): yii\base\Controller->runAction('db/down', Array)                
▓  #7 /vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('db/down', Array)                    
▓  #8 /vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('copy/db/down', Array)              
▓  #9 /vendor/craftcms/cms/src/console/Application.php(93): yii\console\Application->runAction('copy/db/down', Array)   
▓  #10 /vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('copy/db/down', Array)   
▓  #11 /vendor/yiisoft/yii2/base/Application.php(386):                                                                  
▓  yii\console\Application->handleRequest(Object(craft\console\Request))                                                
▓  #12 /craft(22): yii\base\Application->run()                                                                          
▓  #13 {main}   

I looked at the troubleshooting section of the readme but nothing seems relevant and I already had "allow network access" ticked in MAMP.

"Changes to project.yaml must be applied to the loaded project config"

Whenever I push new code, my site goes offline until I go to the CP, where I get:

Changes to project.yaml must be applied to the loaded project config
[Sync changes]

... followed by

The loaded project config has more recent changes than project.yaml.
[Use the loaded project config] [Use project.yaml]

I don't know if this is an issue with Craft or Craft Copy but have you encountered this before? And idea for a fix?

Thanks for this plugin – apart from this little glitch it's improved my deployment process massively!

Unable to update to 1.0.0-beta3

The CP tells me that there is an update to 1.0.0-beta3.
When I try to update using composer nothing changes:

$ composer config platform --unset
$ composer update  fortrabbit/craft-copy
// Output
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating optimized autoload files

The corresponding entry in compser.lock stays unchanged at

{
  "name": "fortrabbit/craft-copy",
  "version": "1.0.0-beta2",
}

And CP insists there is an update.
I even tried to uninstall and reinstall. But also no success.

This is probably because I'm missing some composer subtlety. Any help/hint is very much appreciated.

Problems install Craft Copy

I have a fresh Craft CMS 3.0.17.1 installed locally, macOS 10.14, homebrew, Valet, PHP 7.2.8. Following the install guide here with composer require fortrabbit/craft-copy:^1.0.0-beta gives the following output:

./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: don't install fortrabbit/craft-copy 1.0.0-beta2
    - Conclusion: remove symfony/process v3.3.6
    - Installation request for fortrabbit/craft-copy ^1.0.0-beta -> satisfiable by fortrabbit/craft-copy[1.0.0-beta1, 1.0.0-beta2].
    - Conclusion: don't install symfony/process v3.3.6
    - fortrabbit/craft-copy 1.0.0-beta1 requires cpliakas/git-wrapper ^2.0 -> satisfiable by cpliakas/git-wrapper[v2.0.0, v2.0.1].
    - cpliakas/git-wrapper v2.0.0 requires symfony/process ^4.0 -> satisfiable by symfony/process[v4.0.0, v4.0.1, v4.0.10, v4.0.11, v4.0.12, v4.0.13, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.1, v4.1.2].
    - cpliakas/git-wrapper v2.0.1 requires symfony/process ^4.0 -> satisfiable by symfony/process[v4.0.0, v4.0.1, v4.0.10, v4.0.11, v4.0.12, v4.0.13, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.1, v4.1.2].
    - Can only install one of: symfony/process[v4.0.0, v3.3.6].
    - Can only install one of: symfony/process[v4.0.1, v3.3.6].
    - Can only install one of: symfony/process[v4.0.10, v3.3.6].
    - Can only install one of: symfony/process[v4.0.11, v3.3.6].
    - Can only install one of: symfony/process[v4.0.12, v3.3.6].
    - Can only install one of: symfony/process[v4.0.13, v3.3.6].
    - Can only install one of: symfony/process[v4.0.2, v3.3.6].
    - Can only install one of: symfony/process[v4.0.3, v3.3.6].
    - Can only install one of: symfony/process[v4.0.4, v3.3.6].
    - Can only install one of: symfony/process[v4.0.5, v3.3.6].
    - Can only install one of: symfony/process[v4.0.6, v3.3.6].
    - Can only install one of: symfony/process[v4.0.7, v3.3.6].
    - Can only install one of: symfony/process[v4.0.8, v3.3.6].
    - Can only install one of: symfony/process[v4.0.9, v3.3.6].
    - Can only install one of: symfony/process[v4.1.0, v3.3.6].
    - Can only install one of: symfony/process[v4.1.1, v3.3.6].
    - Can only install one of: symfony/process[v4.1.2, v3.3.6].
    - Installation request for symfony/process (locked at v3.3.6) -> satisfiable by symfony/process[v3.3.6].


Installation failed, reverting ./composer.json to its original content.

Installation fails: phpdotenv conflict with your requirements or minimum-stability

Initial local installation of craft copy fails:

$ composer require fortrabbit/craft-copy:^1.0.0-RC5

./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for fortrabbit/craft-copy ^1.0.0-RC5 -> satisfiable by fortrabbit/craft-copy[1.0.0-RC5].
    - fortrabbit/craft-copy 1.0.0-RC5 requires vlucas/phpdotenv ^2.5.1 -> satisfiable by vlucas/phpdotenv[2.5.x-dev, 2.6.x-dev, v2.5.1, v2.5.2, v2.6.0, v2.6.1] but these conflict with your requirements or minimum-stability.

Installation failed, reverting ./composer.json to its original content.

Drop all tables before importing

When copying down from Fortrabbit, if a plugin was installed locally but not on the remote and that plugin created tables you run into issues.

Rough steps to replicate:

  1. Install Craft Commerce locally
  2. Sync remote database
  3. Install Craft Commerce

This leads to an install migration error as the commerce_addresses table already exists locally.

Is it possible to completely clear the database before reimporting the downloaded database dump?

Craft Copy Setup not working

I'm trying to set this up per the readme instructions, and it's not recognizing my password.

What's weird is that my understanding is that this is the same password as I would use for SSH access (my account pw). I tried logging in via ssh and it worked fine! So, I thought this might be a bug. Let me know if anything else would be helpful. Thanks!

screen shot 2018-09-30 at 9 26 51 pm

Conflict with Blitz plugin

The shared dependency cpliakas/git-wrapper causes a conflict when requiring Copy after installing the Blitz plugin.

Problem 1
  - Installation request for fortrabbit/craft-copy ^1.0.0-RC10 -> satisfiable by fortrabbit/craft-copy[1.0.0-RC10].
  - Conclusion: remove cpliakas/git-wrapper v3.0.2
  - Conclusion: don't install cpliakas/git-wrapper v3.0.2
  - fortrabbit/craft-copy 1.0.0-RC10 requires cpliakas/git-wrapper ^2.0 -> satisfiable by cpliakas/git-wrapper[v2.0.0, v2.0.1, v2.1.0, v2.2.0].
  - Can only install one of: cpliakas/git-wrapper[v2.2.0, v3.0.2].
  - Can only install one of: cpliakas/git-wrapper[v2.0.0, v3.0.2].
  - Can only install one of: cpliakas/git-wrapper[v2.0.1, v3.0.2].
  - Can only install one of: cpliakas/git-wrapper[v2.1.0, v3.0.2].
  - Installation request for cpliakas/git-wrapper (locked at v3.0.2) -> satisfiable by cpliakas/git-wrapper[v3.0.2].

As Blitz accepts cpliakas/git-wrapper v2 and v3 it’s as easy as composer require cpliakas/git-wrapper:^2.2.0, but I wondered if it were possible for Copy to use the version standard API too (i.e. be agnostic to the version that’s installed).

Install errors ("The plugin is not installed with your App!", "Uncommitted changes")

Hi

I'm getting a couple of issues when trying to install.

After running php craft copy/setup I get:

Testing DNS - US (AWS US-EAST-1 / Virginia) OK
Testing rsync OK
Testing mysqldump OK
Testing SSH access OK
 The plugin is not installed with your App! Do you want to deploy now? (yes/no)

... which is odd as the Copy plugin shows as installed both locally and on the staging server. If I choose "yes" I get the following:

 ░ [NOTE] Uncommitted changes:
 ░        ?? .env.example
 ░        ?? .gitignore
 ░        ?? composer.json
 ░        ?? composer.lock
 ░        ?? config/
 ░        ?? craft
 ░        ?? craft.bat
 ░        ?? modules/
 ░        ?? storage/
 ░        ?? templates/
 ░        ?? web/

... which is also odd as all of those files are committed in my repo and exist locally and on the staging site. I'm wary of entering a commit message at this point in case it does something bad to the files on the staging server.

Is something wrong in my config/setup? I don't know if it's relevant but Craft is installed in a dist subdirectory. So GIT is tracking a directory containing:

fortrabbit.yml
dist
  composer.json
  composer.lock
  config
  craft
  craft.bat
  modules
  storage
  templates
  vendor
  web
gulpfile.js
node_modules
package-lock.json
package.json
README.md
src

Do I need to do something special since Craft isn't in the root?

I'm on Craft CMS 3.1.28, Copy 1.0.0-RC5. Thanks loads for any help.

60 seconds timeout

[ERROR] The process "ssh [email protected] "php 
craft copy/db/from-file ./storage/craft-copy-transfer.sql --interactive=0"" exceeded the 
timeout of 60 seconds.

larger datasets need a bit more time for import/export.

"failed to install copy" error

Hi

I'm trying to install this for the first time. I've got as far as php craft install/plugin copy but I then get the output you mention in the Troubleshooting section:

*** installing copy
*** failed to install copy: Craft CMS can’t connect to the database with the credentials in config/db.php.

So I did the suggested fix of Ensure "Allow network access to MySQL" is ticked in MAMP... but I'm still getting the same error. I've tried restarting the server but that doesn't seem to help.

Any ideas what I should try next?

Thanks, and looking forward to using this – looks super helpful!

Copy Code Down Error

When running ./craft copy/code/down I get the following error:

 [ERROR] Argument 1 passed to fortrabbit\Copy\services\Git::pull() must be of the type                                  
         string, null given, called in                                                                                  
         /site/craft/vendor/fortrabbit/craft-copy/src/commands/CodeDownAction.php on line    
         40                                                                                                             
                                                                                                                        
         TypeError                                                                                                      
                                                                                                                        
         in /site/craft/vendor/fortrabbit/craft-copy/src/services/Git.php: 87                
                                                                                                                        

                                                                                                                     
Stack trace:                                                                                                         
                                                                                                                     
#0 /vendor/fortrabbit/craft-copy/src/commands/CodeDownAction.php(40): fortrabbit\Copy\services\Git->pull(NULL,       
'master')                                                                                                            
#1 [internal function]: fortrabbit\Copy\commands\CodeDownAction->run(NULL, 'master')                                 
#2 /vendor/yiisoft/yii2/base/Action.php(94): call_user_func_array(Array, Array)                                      
#3 /vendor/yiisoft/yii2/base/Controller.php(157): yii\base\Action->runWithParams(Array)                              
#4 /vendor/yiisoft/yii2/console/Controller.php(148): yii\base\Controller->runAction('code/down', Array)              
#5 /vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('code/down', Array)                  
#6 /vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('copy/code/down', Array)            
#7 /vendor/yiisoft/yii2/console/Application.php(147): yii\console\Application->runAction('copy/code/down', Array)    
#8 /vendor/yiisoft/yii2/base/Application.php(386):                                                                   
yii\console\Application->handleRequest(Object(craft\console\Request))                                                
#9 /craft(22): yii\base\Application->run()                                                                           
#10 {main}     

Make Craft Automigrate a setup setting

Craft Copy uses Craft Automigrate. This may come as a surprise for some users. So it would be nice to give it some visibility when using the tool. Therefore I can imagine that there is a question on craft copy/setup.

Enable Craft Automigrate? [Yes]
Will run database migrations each time you'll deploy.

Add general up/down commands

It's great to have individual commands to sync database, git and assets up and down, but in (at least my) reality, most of the time, what you likely want to do, is to make sure you have the threefold of things updated. Therefore - feature request - enable something like:

# Sync database,assets and git up:
$ php craft copy/up

# Sync database,assets and git down:
$ php craft copy/down

Which makes sure that everything get's updated in the right order.

Unknown system variable 'GTID_PURGED' error using copy/db/down

Since a week or two I get the following error when importing the remote DB using craft copy/db/down:

 [ERROR] The shell command "mysql                                                                                       
         --defaults-extra-file="/XXX/storage/runtime/temp/my.cnf"        
         XXX < "storage/craft-copy-transfer.sql"" failed with exit code 1: ERROR 1193 (HY000) at line 24: 
         Unknown system variable 'GTID_PURGED'                                                                          
                                                                                                                        
         craft\errors\ShellCommandException                                                                             
                                                                                                                        
         in /XXX/vendor/craftcms/cms/src/db/Connection.php: 607          
                                                                                                                        

▓                                                                                                                       
▓  Stack trace:                                                                                                         
▓                                                                                                                       
▓  #0 /vendor/craftcms/cms/src/db/Connection.php(330):                                                                  
▓  craft\db\Connection->_executeDatabaseShellCommand(Object(mikehaertl\shellcommand\Command))                           
▓  #1 /vendor/fortrabbit/craft-copy/src/services/Dump.php(59): craft\db\Connection->restore('storage/craft-c...')       
▓  #2 /vendor/fortrabbit/craft-copy/src/commands/DbDownAction.php(83):                                                  
▓  fortrabbit\Copy\services\Dump->import('storage/craft-c...')                                                          
▓  #3 [internal function]: fortrabbit\Copy\commands\DbDownAction->run(NULL)                                             
▓  #4 /vendor/yiisoft/yii2/base/Action.php(94): call_user_func_array(Array, Array)                                      
▓  #5 /vendor/yiisoft/yii2/base/Controller.php(157): yii\base\Action->runWithParams(Array)                              
▓  #6 /vendor/yiisoft/yii2/console/Controller.php(148): yii\base\Controller->runAction('db/down', Array)                
▓  #7 /vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('db/down', Array)                    
▓  #8 /vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('copy/db/down', Array)              
▓  #9 /vendor/craftcms/cms/src/console/Application.php(93): yii\console\Application->runAction('copy/db/down', Array)   
▓  #10 /vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('copy/db/down', Array)   
▓  #11 /vendor/yiisoft/yii2/base/Application.php(386):                                                                  
▓  yii\console\Application->handleRequest(Object(craft\console\Request))                                                
▓  #12 /craft(43): yii\base\Application->run()                                                                          
▓  #13 {main}                                                                                                           
▓                       

I'm running MariaDB locally, which seems to have different GTID implementations. However, when I import the DB using Sequel Pro, I'm able to ignore these errors and just import.

Is there an option to ignore this with the craft copy/db/down command as well?

Put config files in a dedicated craft-copy folder in config

Currently config files from Craft Copy are stored on top level in the config folder. I think with Craft CMS 3.5 the "project" folder was introduced storing configs within that folder. I also noticed that other plugins have a folder in config with additional files in it.

I believe to know that there can be multiple configs for Craft Copy for multiple environments.

can't install craft copy

Hi I am getting the following error.

craft:$ ./craft install/plugin copy
*** installing copy
*** failed to install copy: Craft CMS can’t connect to the database with the credentials in config/db.php.

The site is working fine with the .env file I have. Copy is appearing as an installed pluging in my Craft dashboard.

SSH Remote error: Error: Unsupported DB driver value

Issue: Update of remote DB is failing.

copy/db/up fails with

fortrabbit\Copy\exceptions\RemoteException

 in [craft-path]/vendor/fortrabbit/craft-copy/src/services/Ssh.php: 70

copy/db/up --force fails with

SSH Remote error: Error: Unsupported DB driver value:

I can connect to server instance with ssh [project]@deploy.eu2.frbit.com but cannot SSH tunnel to the mySQL server with ssh -N -L 13306:[project].mysql.eu2.frbit.com:3306 [project]@tunnel.eu2.frbit.com. Which makes manually updating remote db an issue.

If I attempt to connect to the mySQL server via an SSH tunnel. Using..
ssh -N -L 13306:[project].mysql.eu2.frbit.com:3306 [project]@tunnel.eu2.frbit.com
Terminal stalls with no response. Adding verbose flag shows.

OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to tunnel.eu2.frbit.com port 22.
debug1: Connection established.
debug1: identity file [local-path]/.ssh/id_rsa type 0
debug1: identity file [local-path]/.ssh/id_rsa-cert type -1
debug1: identity file [local-path]/.ssh/id_dsa type -1
debug1: identity file [local-path]/.ssh/id_dsa-cert type -1
debug1: identity file [local-path]/.ssh/id_ecdsa type -1
debug1: identity file [local-path]/.ssh/id_ecdsa-cert type -1
debug1: identity file [local-path]/.ssh/id_ed25519 type 3
debug1: identity file [local-path]/.ssh/id_ed25519-cert type -1
debug1: identity file [local-path]/.ssh/id_xmss type -1
debug1: identity file [local-path]/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p2 Ubuntu-2ubuntu2
debug1: match: OpenSSH_6.6.1p2 Ubuntu-2ubuntu2 pat OpenSSH_6.6.1* compat 0x04000002
debug1: Authenticating to tunnel.eu2.frbit.com:22 as '[project-name]'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa [redacted]
debug1: Host 'tunnel.eu2.frbit.com' is known and matches the RSA host key.
debug1: Found key in [local-path]/.ssh/known_hosts:10
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 4294967296 blocks
debug1: Will attempt key: [local-path]/.ssh/id_rsa RSA [redacted]
debug1: Will attempt key: [local-path]/.ssh/id_dsa
debug1: Will attempt key: [local-path]/.ssh/id_ecdsa
debug1: Will attempt key: [local-path]/.ssh/id_ed25519 ED25519 [redacted]
debug1: Will attempt key: [local-path]/.ssh/id_xmss
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: password,publickey
debug1: Next authentication method: publickey
debug1: Offering public key: [local-path]/.ssh/id_rsa RSA [redacted]
debug1: Server accepts key: [local-path]/.ssh/id_rsa RSA [redacted]
debug1: Authentication succeeded (publickey).
Authenticated to tunnel.eu2.frbit.com ([52.212.159.57]:22).
debug1: Local connections to LOCALHOST:13306 forwarded to remote address [project-name].mysql.eu2.frbit.com:3306
debug1: Local forwarding listening on ::1 port 13306.
debug1: channel 0: new [port listener]
debug1: Local forwarding listening on 127.0.0.1 port 13306.
debug1: channel 1: new [port listener]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: network

Proceeding with mysql -u[user] -h127.0.0.1 -P13306 -p [project] results in

ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0

Composer conflicts when trying to install on Craft

Here's what I get when trying to install via the terminal:

user:sportscholarships andrei$ composer config platform --unset
user:sportscholarships andrei$ composer require fortrabbit/craft-copy:^1.0.0-beta
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages. (in red)

  Problem 1
    - Conclusion: don't install fortrabbit/craft-copy 1.0.0-beta5
    - Conclusion: don't install fortrabbit/craft-copy 1.0.0-beta4
    - Conclusion: don't install fortrabbit/craft-copy 1.0.0-beta3
    - Conclusion: don't install fortrabbit/craft-copy 1.0.0-beta2
    - Conclusion: remove symfony/process v3.3.6
    - Installation request for fortrabbit/craft-copy ^1.0.0-beta -> satisfiable by fortrabbit/craft-copy[1.0.0-beta1, 1.0.0-beta2, 1.0.0-beta3, 1.0.0-beta4, 1.0.0-beta5].
    - Conclusion: don't install symfony/process v3.3.6
    - fortrabbit/craft-copy 1.0.0-beta1 requires cpliakas/git-wrapper ^2.0 -> satisfiable by cpliakas/git-wrapper[v2.0.0, v2.0.1].
    - cpliakas/git-wrapper v2.0.0 requires symfony/process ^4.0 -> satisfiable by symfony/process[v4.0.0, v4.0.1, v4.0.10, v4.0.11, v4.0.12, v4.0.13, v4.0.14, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.1, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7].
    - cpliakas/git-wrapper v2.0.1 requires symfony/process ^4.0 -> satisfiable by symfony/process[v4.0.0, v4.0.1, v4.0.10, v4.0.11, v4.0.12, v4.0.13, v4.0.14, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.1, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7].
    - Can only install one of: symfony/process[v4.0.0, v3.3.6].
    - Can only install one of: symfony/process[v4.0.1, v3.3.6].
    - Can only install one of: symfony/process[v4.0.10, v3.3.6].
    - Can only install one of: symfony/process[v4.0.11, v3.3.6].
    - Can only install one of: symfony/process[v4.0.12, v3.3.6].
    - Can only install one of: symfony/process[v4.0.13, v3.3.6].
    - Can only install one of: symfony/process[v4.0.14, v3.3.6].
    - Can only install one of: symfony/process[v4.0.2, v3.3.6].
    - Can only install one of: symfony/process[v4.0.3, v3.3.6].
    - Can only install one of: symfony/process[v4.0.4, v3.3.6].
    - Can only install one of: symfony/process[v4.0.5, v3.3.6].
    - Can only install one of: symfony/process[v4.0.6, v3.3.6].
    - Can only install one of: symfony/process[v4.0.7, v3.3.6].
    - Can only install one of: symfony/process[v4.0.8, v3.3.6].
    - Can only install one of: symfony/process[v4.0.9, v3.3.6].
    - Can only install one of: symfony/process[v4.1.0, v3.3.6].
    - Can only install one of: symfony/process[v4.1.1, v3.3.6].
    - Can only install one of: symfony/process[v4.1.2, v3.3.6].
    - Can only install one of: symfony/process[v4.1.3, v3.3.6].
    - Can only install one of: symfony/process[v4.1.4, v3.3.6].
    - Can only install one of: symfony/process[v4.1.5, v3.3.6].
    - Can only install one of: symfony/process[v4.1.6, v3.3.6].
    - Can only install one of: symfony/process[v4.1.7, v3.3.6].
    - Installation request for symfony/process (locked at v3.3.6) -> satisfiable by symfony/process[v3.3.6].


Installation failed, reverting ./composer.json to its original content.

Here are the messages I get when I try to installthrough CraftCMS locally. Can you suggest a resolution?

Composer output: Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1

  • Installation request for fortrabbit/craft-copy 1.0.0-beta5 -> satisfiable by fortrabbit/craft-copy[1.0.0-beta5].
  • fortrabbit/craft-copy 1.0.0-beta5 requires php ^7.1.3 -> your PHP version (7.2.11) overridden by "config.platform.php" version (7.0) does not satisfy that requirement.
    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.

Craft System Report:

PHP version | 7.2.11
MySQL 5.7.24
GD 7.2.11
Craft Solo 3.0.30.1
2.0.15.1
2.5.0
6.3.3
0.7-dev

Installation failed, symfony/yaml conflicts with symfony/console for craftcms/cms 3.2.8

$ composer require fortrabbit/craft-copy:^1.0.0-RC5
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: don't install fortrabbit/craft-copy 1.0.0-RC5
    - Conclusion: don't install fortrabbit/craft-copy 1.0.0-RC4
    - Conclusion: don't install fortrabbit/craft-copy 1.0.0-RC3
    - Conclusion: don't install fortrabbit/craft-copy 1.0.0-RC2
    - Conclusion: don't install fortrabbit/craft-copy 1.0.0-RC1
    - Conclusion: don't install fortrabbit/craft-copy 1.0.0-beta5
    - Conclusion: don't install fortrabbit/craft-copy 1.0.0-beta4
    - Conclusion: don't install fortrabbit/craft-copy 1.0.0-beta3
    - Conclusion: don't install fortrabbit/craft-copy 1.0.0-beta2
    - Conclusion: remove symfony/process v3.3.6
    - Installation request for symfony/console (locked at v3.3.6) -> satisfiable by symfony/console[v3.3.6].
    - Installation request for fortrabbit/craft-copy ^1.0.0-beta -> satisfiable by fortrabbit/craft-copy[1.0.0-RC1, 1.0.0-RC2, 1.0.0-RC3, 1.0.0-RC4, 1.0.0-RC5, 1.0.0-beta1, 1.0.0-beta2, 1.0.0-beta3, 1.0.0-beta4, 1.0.0-beta5].
    - Conclusion: don't install symfony/process v3.3.6
    - fortrabbit/craft-copy 1.0.0-beta1 requires cpliakas/git-wrapper ^2.0 -> satisfiable by cpliakas/git-wrapper[v2.0.0, v2.0.1, v2.1.0, v2.2.0].
    - cpliakas/git-wrapper v2.0.0 requires symfony/process ^4.0 -> satisfiable by symfony/process[v4.0.0, v4.0.1, v4.0.10, v4.0.11, v4.0.12, v4.0.13, v4.0.14, v4.0.15, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8, v4.1.9, v4.2.0, v4.2.1, v4.2.10, v4.2.11, v4.2.2, v4.2.3, v4.2.4, v4.2.5, v4.2.6, v4.2.7, v4.2.8, v4.2.9, v4.3.0, v4.3.1, v4.3.2, v4.3.3].
    - cpliakas/git-wrapper v2.0.1 requires symfony/process ^4.0 -> satisfiable by symfony/process[v4.0.0, v4.0.1, v4.0.10, v4.0.11, v4.0.12, v4.0.13, v4.0.14, v4.0.15, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8, v4.1.9, v4.2.0, v4.2.1, v4.2.10, v4.2.11, v4.2.2, v4.2.3, v4.2.4, v4.2.5, v4.2.6, v4.2.7, v4.2.8, v4.2.9, v4.3.0, v4.3.1, v4.3.2, v4.3.3].
    - cpliakas/git-wrapper v2.1.0 requires symfony/process ^4.1 -> satisfiable by symfony/process[v4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8, v4.1.9, v4.2.0, v4.2.1, v4.2.10, v4.2.11, v4.2.2, v4.2.3, v4.2.4, v4.2.5, v4.2.6, v4.2.7, v4.2.8, v4.2.9, v4.3.0, v4.3.1, v4.3.2, v4.3.3].
    - cpliakas/git-wrapper v2.2.0 requires symfony/process ^4.1 -> satisfiable by symfony/process[v4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8, v4.1.9, v4.2.0, v4.2.1, v4.2.10, v4.2.11, v4.2.2, v4.2.3, v4.2.4, v4.2.5, v4.2.6, v4.2.7, v4.2.8, v4.2.9, v4.3.0, v4.3.1, v4.3.2, v4.3.3].
    - Can only install one of: symfony/process[v4.0.0, v3.3.6].
    - Can only install one of: symfony/process[v4.0.1, v3.3.6].
    - Can only install one of: symfony/process[v4.0.10, v3.3.6].
    - Can only install one of: symfony/process[v4.0.11, v3.3.6].
    - Can only install one of: symfony/process[v4.0.12, v3.3.6].
    - Can only install one of: symfony/process[v4.0.13, v3.3.6].
    - Can only install one of: symfony/process[v4.0.14, v3.3.6].
    - Can only install one of: symfony/process[v4.0.15, v3.3.6].
    - Can only install one of: symfony/process[v4.0.2, v3.3.6].
    - Can only install one of: symfony/process[v4.0.3, v3.3.6].
    - Can only install one of: symfony/process[v4.0.4, v3.3.6].
    - Can only install one of: symfony/process[v4.0.5, v3.3.6].
    - Can only install one of: symfony/process[v4.0.6, v3.3.6].
    - Can only install one of: symfony/process[v4.0.7, v3.3.6].
    - Can only install one of: symfony/process[v4.0.8, v3.3.6].
    - Can only install one of: symfony/process[v4.0.9, v3.3.6].
    - Can only install one of: symfony/process[v4.1.0, v3.3.6].
    - Can only install one of: symfony/process[v4.1.1, v3.3.6].
    - Can only install one of: symfony/process[v4.1.10, v3.3.6].
    - Can only install one of: symfony/process[v4.1.11, v3.3.6].
    - Can only install one of: symfony/process[v4.1.12, v3.3.6].
    - Can only install one of: symfony/process[v4.1.2, v3.3.6].
    - Can only install one of: symfony/process[v4.1.3, v3.3.6].
    - Can only install one of: symfony/process[v4.1.4, v3.3.6].
    - Can only install one of: symfony/process[v4.1.5, v3.3.6].
    - Can only install one of: symfony/process[v4.1.6, v3.3.6].
    - Can only install one of: symfony/process[v4.1.7, v3.3.6].
    - Can only install one of: symfony/process[v4.1.8, v3.3.6].
    - Can only install one of: symfony/process[v4.1.9, v3.3.6].
    - Can only install one of: symfony/process[v4.2.0, v3.3.6].
    - Can only install one of: symfony/process[v4.2.1, v3.3.6].
    - Can only install one of: symfony/process[v4.2.10, v3.3.6].
    - Can only install one of: symfony/process[v4.2.11, v3.3.6].
    - Can only install one of: symfony/process[v4.2.2, v3.3.6].
    - Can only install one of: symfony/process[v4.2.3, v3.3.6].
    - Can only install one of: symfony/process[v4.2.4, v3.3.6].
    - Can only install one of: symfony/process[v4.2.5, v3.3.6].
    - Can only install one of: symfony/process[v4.2.6, v3.3.6].
    - Can only install one of: symfony/process[v4.2.7, v3.3.6].
    - Can only install one of: symfony/process[v4.2.8, v3.3.6].
    - Can only install one of: symfony/process[v4.2.9, v3.3.6].
    - Can only install one of: symfony/process[v4.3.0, v3.3.6].
    - Can only install one of: symfony/process[v4.3.1, v3.3.6].
    - Can only install one of: symfony/process[v4.3.2, v3.3.6].
    - Can only install one of: symfony/process[v4.3.3, v3.3.6].
    - Installation request for symfony/process (locked at v3.3.6) -> satisfiable by symfony/process[v3.3.6].


Installation failed, reverting ./composer.json to its original content.


$ composer why composer/composer
craftcms/cms  3.2.8  requires  composer/composer (1.6.3)  
$ composer why symfony/console
composer/composer  1.6.3  requires  symfony/console (^2.7 || ^3.0 || ^4.0)  


copy/setup fails

I'm seeing the error below using RC5. I can ssh into my app without a problem. Are there perhaps some fortrabbit settings that I'm missing beyond creating the ssh key?

Not sure if it's relevant, but I'm working from Homestead.

Testing DNS - US (AWS US-EAST-1 / Virginia) OK
Testing rsync OK
Testing mysqldump OK
Testing SSH access ⚠ Error

[ERROR] SSH is required.

copy fails to install on fortrabbit server

Here are the errors I am getting

copy plugin cannot be installed on remote

Any way you could help resolve this?

Thank you!

Select a remote [***]:
  [origin    ] ***
  [production] ***@deploy.us1.frbit.com:appname.git
 > production

 ░
 ░ [NOTE] Uncommitted changes:
 ░         M composer.json
 ░         M composer.lock
 ░
 ░

 Enter a commit message, or leave it empty to abort the commit:
 > added fortrabbit copy plugin

git push (added fortrabbit copy plugin)
---------------------------------------


Commit received, starting build of branch master

–––––––––––––––––––––––  ∙ƒ  –––––––––––––––––––––––

B U I L D


Checksum:
  d5a819ce2f84836b8ea24969d81b88eb225ae892

Deployment file:
  not found

Pre-script:
  not found
  0ms

Composer:
  - - -
  Loading composer repositories with package information
  Installing dependencies (including require-dev) from lock file
  Package operations: 5 installs, 1 update, 0 removals
    - Updating symfony/process (v3.3.6 => v4.1.7): Downloading (100%)
    - Installing ostark/yii2-artisan-bridge (1.2.0): Downloading (100%)
    - Installing symfony/event-dispatcher (v4.1.7): Downloading (100%)
    - Installing cpliakas/git-wrapper (v2.0.1): Downloading (100%)
    - Installing albertofem/rsync-lib (1.0.0): Downloading (100%)
    - Installing fortrabbit/craft-copy (1.0.0-beta5): Downloading (100%)
  symfony/event-dispatcher suggests installing symfony/dependency-injection
  symfony/event-dispatcher suggests installing symfony/http-kernel
  Generating optimized autoload files
  > php craft migrate/all

  Yii Migration Tool (based on Yii v2.0.15.1)

  Migrated up successfully.

  - - -
  3s 206ms

Post-script:
  not found
  0ms



R E L E A S E


Packaging:
  2s 217ms

Revision:
  1541724681648920220.d5a819ce2f84836b8ea24969d81b88eb225ae892

Size:
  30 MB

Uploading:
  920ms

Build & release done in 6s 358ms, now queued for final distribution.

–––––––––––––––––––––––  ∙ƒ  –––––––––––––––––––––––

To deploy.us1.frbit.com:appname.git
   d47d61b..d5a819c  master -> master


 [OK] Code deployed successfully.





         –––––––––––––––––––––––  ∙ƒ









         fortrabbit\Copy\exceptions\RemoteException

         in /Users/andrei/Desktop/work/sites/appnames/vendor/fortrabbit/craft-copy/src/services/Ssh.php: 69


▓
▓  Stack trace:
▓
▓  #0 /vendor/fortrabbit/craft-copy/src/commands/SetupAction.php(160): fortrabbit\Copy\services\Ssh->exec('ssh
▓  sportschola...')
▓  #1 /vendor/fortrabbit/craft-copy/src/commands/SetupAction.php(83):
▓  fortrabbit\Copy\commands\SetupAction->setupRemote()
▓  #2 [internal function]: fortrabbit\Copy\commands\SetupAction->run()
▓  #3 /vendor/yiisoft/yii2/base/Action.php(94): call_user_func_array(Array, Array)
▓  #4 /vendor/yiisoft/yii2/base/Controller.php(157): yii\base\Action->runWithParams(Array)
▓  #5 /vendor/yiisoft/yii2/console/Controller.php(148): yii\base\Controller->runAction('setup', Array)
▓  #6 /vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('setup', Array)
▓  #7 /vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('copy/setup', Array)
▓  #8 /vendor/yiisoft/yii2/console/Application.php(147): yii\console\Application->runAction('copy/setup', Array)
▓  #9 /vendor/yiisoft/yii2/base/Application.php(386):
▓  yii\console\Application->handleRequest(Object(craft\console\Request))
▓  #10 /craft(22): yii\base\Application->run()
▓  #11 {main}
▓

user:appnames andrei$ ./craft copy

Environment check
-----------------

+-----------------+--------------+--------------------------------------+----+
| Key             | Local        | Remote (App:appname)        |    |
+-----------------+--------------+--------------------------------------+----+
| ENVIRONMENT     | dev          | production                           | 👌  |
+-----------------+--------------+--------------------------------------+----+
| SECURITY_KEY    | q57O3******* | q57O3*******                         | 👌  |
+-----------------+--------------+--------------------------------------+----+
| DB_TABLE_PREFIX |              |                                      | 👌  |
| DB_SERVER       | localhost    | appname.mysql.us1.frbit.com | 👌  |
+-----------------+--------------+--------------------------------------+----+
user:appnames andrei$ ./craft copy/info

Environment check
-----------------

+-----------------+--------------+--------------------------------------+----+
| Key             | Local        | Remote (App:appname)        |    |
+-----------------+--------------+--------------------------------------+----+
| ENVIRONMENT     | dev          | production                           | 👌  |
+-----------------+--------------+--------------------------------------+----+
| SECURITY_KEY    | q57O3******* | q57O3*******                         | 👌  |
+-----------------+--------------+--------------------------------------+----+
| DB_TABLE_PREFIX |              |                                      | 👌  |
| DB_SERVER       | localhost    | appname.mysql.us1.frbit.com | 👌  |
+-----------------+--------------+--------------------------------------+----+
user:appnames andrei$ ./craft/copy/db/up
-bash: ./craft/copy/db/up: Not a directory
user:appnames andrei$ ./craft copy/db/up

Export local DB - import on remote: appname
----------------------------------------------------

 Are you sure? (yes/no) [yes]:
 >

Uploading dump to remote ./storage/craft-copy-transfer.sql
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░  50 %
time:  2 secs/4 secs



 [ERROR] Plugin is not installed on remote.

         fortrabbit\Copy\exceptions\PluginNotInstalledException

         in /Users/andrei/Desktop/work/sites/appnames/vendor/fortrabbit/craft-copy/src/services/Ssh.php: 66


▓
▓  Stack trace:
▓
▓  #0 /vendor/fortrabbit/craft-copy/src/commands/DbUpAction.php(65): fortrabbit\Copy\services\Ssh->exec('ssh
▓  sportschola...')
▓  #1 [internal function]: fortrabbit\Copy\commands\DbUpAction->run()
▓  #2 /vendor/yiisoft/yii2/base/Action.php(94): call_user_func_array(Array, Array)
▓  #3 /vendor/yiisoft/yii2/base/Controller.php(157): yii\base\Action->runWithParams(Array)
▓  #4 /vendor/yiisoft/yii2/console/Controller.php(148): yii\base\Controller->runAction('db/up', Array)
▓  #5 /vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('db/up', Array)
▓  #6 /vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('copy/db/up', Array)
▓  #7 /vendor/yiisoft/yii2/console/Application.php(147): yii\console\Application->runAction('copy/db/up', Array)
▓  #8 /vendor/yiisoft/yii2/base/Application.php(386):
▓  yii\console\Application->handleRequest(Object(craft\console\Request))
▓  #9 /craft(22): yii\base\Application->run()
▓  #10 {main}
▓

user:appnames andrei$

Migration not running correctly with project.yml enabled

Case: I have enabled the new projectConfig in order to separate config and content. So I can make local content changes, while the editor is busy updating the live website. My use case: I want to add some new image transformations.

I expect Craft Copy to magically handle migrations (that part also could benefit from some documentation?) for me during the deployment. While deploying via Git I see this:

  ▶ Craft auto migrate [START]
  Yii Migration Tool (based on Yii v2.0.21)

  Migrated up successfully.
  Applying changes from project.yaml ...
  > php craft project-config/sync --force

  done
  ▶ Craft auto migrate [END]

Expected: So I assume that this will "sync" the changes from the newly committed and deployed project.yml into the database of the fortrabbit App.

But when I visit the App URL after deploying, I see an 503 error, service unavailable. When I visit the Dashboard URL, there is a screen to sync changes:

Screenshot_2019-09-18_at_11 31 04

After applying the changes, everything works. But I would rather like not to have to visit that URL and click the button every time project.yml has changed with deployment.

  • Craft Copy version is RC6
  • Craft CMS version is 3.3.4.1

Remote Exception error

Hello, I'm getting the following error when using both php craft copy/db/up and php craft copy/db/down. It may be related to the errors present on #1 and #26 but the plugin install has been successful on both remote and local.
php craft copy/db/up --force manages to work, but that won't work for copying the database from remote.

Below is the full error. Please let me know if I can provide any more information.
Thanks!

                                                                                           
         –––––––––––––––––––––––  ∙ƒ                                                                                   
                                                                                      
                                                                                                             
                                                                                                             
                                                                                                
                                                                                                             
                                                                    
                                                                                                             
                                                                                                                       
                                                                                                                       
         fortrabbit\Copy\exceptions\RemoteException                                                                    
                                                                                                                       
         in /Users/motsuka/Sites/risd-global/vendor/fortrabbit/craft-copy/src/services/Ssh.php: 70                     
                                                                                                                       

▓                                                                                                                      
▓  Stack trace:                                                                                                        
▓                                                                                                                      
▓  #0 /vendor/fortrabbit/craft-copy/src/commands/DbDownAction.php(64): fortrabbit\Copy\services\Ssh->exec('ssh         
▓  craft3-xs3f...')                                                                                                    
▓  #1 [internal function]: fortrabbit\Copy\commands\DbDownAction->run(NULL)                                            
▓  #2 /vendor/yiisoft/yii2/base/Action.php(94): call_user_func_array(Array, Array)                                     
▓  #3 /vendor/yiisoft/yii2/base/Controller.php(157): yii\base\Action->runWithParams(Array)                             
▓  #4 /vendor/yiisoft/yii2/console/Controller.php(148): yii\base\Controller->runAction('db/down', Array)               
▓  #5 /vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('db/down', Array)                   
▓  #6 /vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('copy/db/down', Array)             
▓  #7 /vendor/craftcms/cms/src/console/Application.php(93): yii\console\Application->runAction('copy/db/down', Array)  
▓  #8 /vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('copy/db/down', Array)   
▓  #9 /vendor/yiisoft/yii2/base/Application.php(386):                                                                  
▓  yii\console\Application->handleRequest(Object(craft\console\Request))                                               
▓  #10 /craft(22): yii\base\Application->run()                                                                         
▓  #11 {main}

Installation fails with "PHP requirement incompatible with your PHP version"

I'm installing craft-copy on OS X Mojave with what I think is php 7.1, and get an error about the PHP version being 7.0. Here's what I'm doing:

➜  git:(master) ✗ php -v
PHP 7.1.19 (cli) (built: Aug 17 2018 20:10:18) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
➜  git:(master) ✗ composer -v require fortrabbit/craft-copy:^1.0.0-RC4


  [InvalidArgumentException]
  Package fortrabbit/craft-copy at version ^1.0.0-RC4 has a PHP requirement incompatible with your PHP version (7.0)


Exception trace:
 () at phar:///usr/local/Cellar/composer/1.8.0/bin/composer/src/Composer/Command/InitCommand.php:703
 Composer\Command\InitCommand->findBestVersionAndNameForPackage() at phar:///usr/local/Cellar/composer/1.8.0/bin/composer/src/Composer/Command/InitCommand.php:413
 Composer\Command\InitCommand->determineRequirements() at phar:///usr/local/Cellar/composer/1.8.0/bin/composer/src/Composer/Command/RequireCommand.php:134
 Composer\Command\RequireCommand->execute() at phar:///usr/local/Cellar/composer/1.8.0/bin/composer/vendor/symfony/console/Command/Command.php:245
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/Cellar/composer/1.8.0/bin/composer/vendor/symfony/console/Application.php:835
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/Cellar/composer/1.8.0/bin/composer/vendor/symfony/console/Application.php:185
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/Cellar/composer/1.8.0/bin/composer/src/Composer/Console/Application.php:258
 Composer\Console\Application->doRun() at phar:///usr/local/Cellar/composer/1.8.0/bin/composer/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at phar:///usr/local/Cellar/composer/1.8.0/bin/composer/src/Composer/Console/Application.php:104
 Composer\Console\Application->run() at phar:///usr/local/Cellar/composer/1.8.0/bin/composer/bin/composer:56
 require() at /usr/local/Cellar/composer/1.8.0/bin/composer:24

Note php -v returns 7.1 while the error references 7.0.

[ERROR] Call to undefined method Stringy\Stringy::snakeize() during setup

Versions
Craft: 3.3.0.1
PHP: 7.3.7

What I tried to do
Setup the plugin via command-line after install

What happened...
Error, call to an undefined method Stringy/Stringy::snakeize()

After requiring craft-copy in the terminal I was greeted with this message:

Warning: Ambiguous class resolution, "Stringy\Stringy" was found in both "/Users/steven/Code/vetscripts/vendor/danielstjules/stringy/src/Stringy.php" and "/Users/steven/Code/vetscripts/vendor/voku/stringy/src/Stringy.php", the first will be used.

Warning: Ambiguous class resolution, "Stringy\StaticStringy" was found in both "/Users/steven/Code/vetscripts/vendor/danielstjules/stringy/src/StaticStringy.php" and "/Users/steven/Code/vetscripts/vendor/voku/stringy/src/StaticStringy.php", the first will be used.

Since this was just a warning and it seemed to suggest it would take care of it on its own (just using the first one), I figured it would be safe to proceed. After installing the plugin I ran $ php craft copy/setup, gave it the name of the fortrabbit app, and then after giving it the name of production I got this error message:

                                                                                                                        
 [ERROR] Call to undefined method Stringy\Stringy::snakeize()                                                           
         Error                                                                                                          
         in /Users/steven/Code/vetscripts/vendor/craftcms/cms/src/helpers/StringHelper.php: 1645                        

▓                                                                                                                       
▓  Stack trace:                                                                                                         
▓                                                                                                                       
▓  #0 /vendor/fortrabbit/craft-copy/src/models/DeployConfig.php(62): craft\helpers\StringHelper::toSnakeCase('app')     
▓  #1 /vendor/fortrabbit/craft-copy/src/services/DeployConfig.php(88): fortrabbit\Copy\models\DeployConfig->toArray()   
▓  #2 /vendor/fortrabbit/craft-copy/src/commands/SetupAction.php(153):                                                  
▓  fortrabbit\Copy\services\DeployConfig->persist(Object(fortrabbit\Copy\models\DeployConfig))                          
▓  #3 /vendor/fortrabbit/craft-copy/src/commands/SetupAction.php(67):                                                   
▓  fortrabbit\Copy\commands\SetupAction->writeDeployConfig('vetscripts', 'us1', 'production')                           
▓  #4 [internal function]: fortrabbit\Copy\commands\SetupAction->run()                                                  
▓  #5 /vendor/yiisoft/yii2/base/Action.php(94): call_user_func_array(Array, Array)                                      
▓  #6 /vendor/yiisoft/yii2/base/Controller.php(157): yii\base\Action->runWithParams(Array)                              
▓  #7 /vendor/yiisoft/yii2/console/Controller.php(148): yii\base\Controller->runAction('setup', Array)                  
▓  #8 /vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('setup', Array)                      
▓  #9 /vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('copy/setup', Array)                
▓  #10 /vendor/craftcms/cms/src/console/Application.php(93): yii\console\Application->runAction('copy/setup', Array)    
▓  #11 /vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('copy/setup', Array)     
▓  #12 /vendor/yiisoft/yii2/base/Application.php(386):                                                                  
▓  yii\console\Application->handleRequest(Object(craft\console\Request))                                                
▓  #13 /craft(22): yii\base\Application->run()                                                                          
▓  #14 {main}                                                                                                           
▓ 

ProcessSignaledException on deployment

When I try to initiate a deployment (running copy/code/up) everything starts fine. It asks me to choose a local branch, then it asks me to select a remote, but as soon as I try to run the deployment I receive the following error:

[ERROR] The process has been signaled with signal "6".                                                                 
                                                                                                                        
         Symfony\Component\Process\Exception\ProcessSignaledException                                                   
                                                                                                                        
         in /Users/userFolder/projects/projectName/vendor/symfony/process/Process.php: 428

Add storage path config item

If you have a different install path (e.g. /api) the plugin fails to upload the craft-copy-transfer.sql file.

Please can we add a remote_storage_path config variable, or similar, to fix this.

Example

➜ php craft copy/db/up


▶ [production *******] Export local DB and import on remote.

 Are you sure? (yes/no) [no]:
 > yes

Creating local dump
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░  25 %
time:   1 sec/4 secs



 [ERROR] cat ./storage/craft-copy-transfer.sql | gzip | ssh
         *******@deploy.eu2.frbit.com "zcat > ./storage/craft-copy-transfer.sql"
         bash: ./storage/craft-copy-transfer.sql: No such file or directory

         –––––––––––––––––––––––  ∙ƒ









         fortrabbit\Copy\Exceptions\RemoteException

         in /*******/api/vendor/fortrabbit/craft-copy/src/Services/Ssh.php:
         58


▓
▓  Stack trace:
▓
▓  #0 /vendor/fortrabbit/craft-copy/src/Actions/DbUpAction.php(80):
▓  fortrabbit\Copy\Services\Ssh->upload('./storage/craft...', './storage/craft...')
▓  #1 [internal function]: fortrabbit\Copy\Actions\DbUpAction->run(NULL)
▓  #2 /vendor/yiisoft/yii2/base/Action.php(94): call_user_func_array(Array, Array)
▓  #3 /vendor/yiisoft/yii2/base/Controller.php(157): yii\base\Action->runWithParams(Array)
▓  #4 /vendor/yiisoft/yii2/console/Controller.php(164): yii\base\Controller->runAction('db/up', Array)
▓  #5 /vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('db/up', Array)
▓  #6 /vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('copy/db/up', Array)
▓  #7 /vendor/craftcms/cms/src/console/Application.php(87): yii\console\Application->runAction('copy/db/up', Array)
▓  #8 /vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('copy/db/up', Array)
▓  #9 /vendor/yiisoft/yii2/base/Application.php(386):
▓  yii\console\Application->handleRequest(Object(craft\console\Request))
▓  #10 /craft(23): yii\base\Application->run()
▓  #11 {main}
▓

Setup error SSH issue?

Getting this error when running php craft copy/setup

The config file exist at [project]/config/fortrabbit.production.yaml so not sure why the error is being thrown?

What's the name of your fortrabbit App?:
 > intrpk

 What's a good name for the environment of the fortrabbit App? (use arrow keys or type) [production]:
 > stage


Testing DNS - US (AWS US-EAST-1 / Virginia) OK
Testing rsync OK
Testing mysqldump OK
Testing SSH access OK

 [ERROR]

         fortrabbit\Copy\exceptions\DeployConfigNotFoundException

         in /Users/bjh/Code/interpack/api/vendor/fortrabbit/craft-copy/src/services/DeployConfig.php: 128


▓
▓  Stack trace:
▓
▓  #0 /vendor/fortrabbit/craft-copy/src/services/DeployConfig.php(53):
▓  fortrabbit\Copy\services\DeployConfig->getConfigDataFromFile()
▓  #1 /vendor/fortrabbit/craft-copy/src/commands/SetupAction.php(174): fortrabbit\Copy\services\DeployConfig->get()
▓  #2 /vendor/fortrabbit/craft-copy/src/commands/SetupAction.php(92):
▓  fortrabbit\Copy\commands\SetupAction->setupRemote(Object(fortrabbit\Copy\models\DeployConfig))
▓  #3 [internal function]: fortrabbit\Copy\commands\SetupAction->run()
▓  #4 /vendor/yiisoft/yii2/base/Action.php(94): call_user_func_array(Array, Array)
▓  #5 /vendor/yiisoft/yii2/base/Controller.php(157): yii\base\Action->runWithParams(Array)
▓  #6 /vendor/yiisoft/yii2/console/Controller.php(148): yii\base\Controller->runAction('setup', Array)
▓  #7 /vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('setup', Array)
▓  #8 /vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('copy/setup', Array)
▓  #9 /vendor/craftcms/cms/src/console/Application.php(93): yii\console\Application->runAction('copy/setup', Array)
▓  #10 /vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('copy/setup', Array)
▓  #11 /vendor/yiisoft/yii2/base/Application.php(386):
▓  yii\console\Application->handleRequest(Object(craft\console\Request))
▓  #12 /craft(22): yii\base\Application->run()
▓  #13 {main}

Before/after scripts fail, when there's a question in the process

I've tried to use before/after scripts similar to your example config but assets/up failed with a simple 'ERROR'.

I went after the issue and it looks like the question 'Are you sure?' causes the problem. Automatically answering it or giving an option to the user to predefine it in the config file might be a solution. The process class already has the option to do that. (That would require to change the yaml file structure slightly.)

Can you confirm that this is the problem?

(Awesome plugin btw!)

craft-copy won't install with composer on craft3 v3.028

CRL-MacBook:robtest claudio$ composer config platform --unset
CRL-MacBook:robtest claudio$ composer require fortrabbit/craft-copy:^1.0.0-beta
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Conclusion: don't install fortrabbit/craft-copy 1.0.0-beta5
- Conclusion: don't install fortrabbit/craft-copy 1.0.0-beta4
- Conclusion: don't install fortrabbit/craft-copy 1.0.0-beta3
- Conclusion: don't install fortrabbit/craft-copy 1.0.0-beta2
- Conclusion: remove symfony/process v3.3.6
- Installation request for fortrabbit/craft-copy ^1.0.0-beta -> satisfiable by fortrabbit/craft-copy[1.0.0-beta1, 1.0.0-beta2, 1.0.0-beta3, 1.0.0-beta4, 1.0.0-beta5].
- Conclusion: don't install symfony/process v3.3.6
- fortrabbit/craft-copy 1.0.0-beta1 requires cpliakas/git-wrapper ^2.0 -> satisfiable by cpliakas/git-wrapper[v2.0.0, v2.0.1].
- cpliakas/git-wrapper v2.0.0 requires symfony/process ^4.0 -> satisfiable by symfony/process[v4.0.0, v4.0.1, v4.0.10, v4.0.11, v4.0.12, v4.0.13, v4.0.14, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.1, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6].
- cpliakas/git-wrapper v2.0.1 requires symfony/process ^4.0 -> satisfiable by symfony/process[v4.0.0, v4.0.1, v4.0.10, v4.0.11, v4.0.12, v4.0.13, v4.0.14, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.1, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6].
- Can only install one of: symfony/process[v4.0.0, v3.3.6].
- Can only install one of: symfony/process[v4.0.1, v3.3.6].
- Can only install one of: symfony/process[v4.0.10, v3.3.6].
- Can only install one of: symfony/process[v4.0.11, v3.3.6].
- Can only install one of: symfony/process[v4.0.12, v3.3.6].
- Can only install one of: symfony/process[v4.0.13, v3.3.6].
- Can only install one of: symfony/process[v4.0.14, v3.3.6].
- Can only install one of: symfony/process[v4.0.2, v3.3.6].
- Can only install one of: symfony/process[v4.0.3, v3.3.6].
- Can only install one of: symfony/process[v4.0.4, v3.3.6].
- Can only install one of: symfony/process[v4.0.5, v3.3.6].
- Can only install one of: symfony/process[v4.0.6, v3.3.6].
- Can only install one of: symfony/process[v4.0.7, v3.3.6].
- Can only install one of: symfony/process[v4.0.8, v3.3.6].
- Can only install one of: symfony/process[v4.0.9, v3.3.6].
- Can only install one of: symfony/process[v4.1.0, v3.3.6].
- Can only install one of: symfony/process[v4.1.1, v3.3.6].
- Can only install one of: symfony/process[v4.1.2, v3.3.6].
- Can only install one of: symfony/process[v4.1.3, v3.3.6].
- Can only install one of: symfony/process[v4.1.4, v3.3.6].
- Can only install one of: symfony/process[v4.1.5, v3.3.6].
- Can only install one of: symfony/process[v4.1.6, v3.3.6].
- Installation request for symfony/process (locked at v3.3.6) -> satisfiable by symfony/process[v3.3.6].

Installation failed, reverting ./composer.json to its original content.

Composer version conflicts (fix didn’t work)

I note in the readme that there’s a section about version conflicts, however, following the fix instructions didn’t help.

➜ composer config platform --unset
composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating optimized autoload files


➜ composer require fortrabbit/craft-copy:^1.0.0-RC11
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - fortrabbit/craft-copy 1.0.0-RC11 requires ostark/yii2-artisan-bridge ^1.2.0 -> satisfiable by ostark/yii2-artisan-bridge[1.2.0].
    - Installation request for fortrabbit/craft-copy ^1.0.0-RC11 -> satisfiable by fortrabbit/craft-copy[1.0.0-RC11].
    - Conclusion: remove symfony/console v5.1.2
    - Conclusion: don't install symfony/console v5.1.2
    - ostark/yii2-artisan-bridge 1.2.0 requires symfony/console ^3.0 || ^4.0 -> satisfiable by symfony/console[v3.0.0, v3.0.1, v3.0.2, v3.0.3, v3.0.4, v3.0.5, v3.0.6, v3.0.7, v3.0.8, v3.0.9, v3.1.0, v3.1.1, v3.1.10, v3.1.2, v3.1.3, v3.1.4, v3.1.5, v3.1.6, v3.1.7, v3.1.8, v3.1.9, v3.2.0, v3.2.1, v3.2.10, v3.2.11, v3.2.12, v3.2.13, v3.2.14, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6, v3.2.7, v3.2.8, v3.2.9, v3.3.0, v3.3.1, v3.3.10, v3.3.11, v3.3.12, v3.3.13, v3.3.14, v3.3.15, v3.3.16, v3.3.17, v3.3.18, v3.3.2, v3.3.3, v3.3.4, v3.3.5, v3.3.6, v3.3.7, v3.3.8, v3.3.9, v3.4.0, v3.4.1, v3.4.10, v3.4.11, v3.4.12, v3.4.13, v3.4.14, v3.4.15, v3.4.16, v3.4.17, v3.4.18, v3.4.19, v3.4.2, v3.4.20, v3.4.21, v3.4.22, v3.4.23, v3.4.24, v3.4.25, v3.4.26, v3.4.27, v3.4.28, v3.4.29, v3.4.3, v3.4.30, v3.4.31, v3.4.32, v3.4.33, v3.4.34, v3.4.35, v3.4.36, v3.4.37, v3.4.38, v3.4.39, v3.4.4, v3.4.40, v3.4.41, v3.4.42, v3.4.5, v3.4.6, v3.4.7, v3.4.8, v3.4.9, v4.0.0, v4.0.1, v4.0.10, v4.0.11, v4.0.12, v4.0.13, v4.0.14, v4.0.15, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8, v4.1.9, v4.2.0, v4.2.1, v4.2.10, v4.2.11, v4.2.12, v4.2.2, v4.2.3, v4.2.4, v4.2.5, v4.2.6, v4.2.7, v4.2.8, v4.2.9, v4.3.0, v4.3.1, v4.3.10, v4.3.11, v4.3.2, v4.3.3, v4.3.4, v4.3.5, v4.3.6, v4.3.7, v4.3.8, v4.3.9, v4.4.0, v4.4.1, v4.4.10, v4.4.2, v4.4.3, v4.4.4, v4.4.5, v4.4.6, v4.4.7, v4.4.8, v4.4.9].
    - Can only install one of: symfony/console[v3.0.0, v5.1.2].
    - Can only install one of: symfony/console[v3.0.1, v5.1.2].
    - Can only install one of: symfony/console[v3.0.2, v5.1.2].
    - Can only install one of: symfony/console[v3.0.3, v5.1.2].
    - Can only install one of: symfony/console[v3.0.4, v5.1.2].
    …
    - Can only install one of: symfony/console[v4.4.8, v5.1.2].
    - Can only install one of: symfony/console[v4.4.9, v5.1.2].
    - Installation request for symfony/console (locked at v5.1.2) -> satisfiable by symfony/console[v5.1.2].

Error when running `copy/db/up`

When running ./craft copy/db/up I get the following error:

 [ERROR] Argument 1 passed to Symfony\Component\Console\Helper\ProgressBar::setMessage()                                
         must be of the type string, array given, called in                                                             
         /var/www/html/vendor/fortrabbit/craft-copy/src/commands/DbUpAction.php on line 66                              
                                                                                                                        
         TypeError                                                                                                      
                                                                                                                        
         in /var/www/html/vendor/symfony/console/Helper/ProgressBar.php: 151                                            

Was able to resolve it by changing every instance of:

$bar->setMessage($messages = "Some message");

To:

$messages[] = "Some message";
$bar->setMessage(end($messages));

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.