Coder Social home page Coder Social logo

welaika / wordmove Goto Github PK

View Code? Open in Web Editor NEW
1.9K 52.0 165.0 958 KB

Multi-stage command line deploy/mirroring and task runner for Wordpress

Home Page: https://wptools.it/wordmove

License: MIT License

Ruby 70.79% HTML 29.08% Shell 0.13%
wordpress gem deploy automation multistage ruby ssh ftp wpcli task-runner

wordmove's Introduction

Wordmove

logo

Wordmove is a command line tool that lets you automatically mirror local WordPress installations and DB data back and forth from your local development machine to one or more remote servers.

Wordmove has also a neat hook system which enables you to run arbitrary commands before and after push/pull actions. Local and remote commands are both supported (remote ones only on SSH protocol).

FTP support development has been discontinued, thus not all features are granted when using this protocol.

Tests Slack channel Gem Version Docker Build Status

Installation

Wordmove is developed in ruby and packaged and distributed as a gem.

To install:

gem install wordmove

And to update:

gem update wordmove

You can read more about ruby gems ecosystem on the official site https://rubygems.org/.

Peer dependencies

Wordmove acts as automation glue between tools you already have and love. These are its peer dependencies which you need to have installed and executable through your system $PATH:

Program Mandatory?
rsync Yes for SSH protocol
mysql Yes
mysqldump Yes
wp-cli Yes by default, but configurable
lftp Yes, for FTP protocol

Wordmove also expect that the remote server will have the following commands: gzip, nice, mysql, rsync. All of these should be always present by default on any WordPress hosting.

Usage

> wordmove help
Commands:
  wordmove --version, -v    # Print the version
  wordmove doctor           # Do some local configuration and environment checks
  wordmove help [TASK]      # Describe available tasks or one specific task
  wordmove init             # Generates a brand new movefile.yml
  wordmove list             # List all environments and vhosts
  wordmove pull             # Pulls WP data from remote host to the local machine
  wordmove push             # Pushes WP data from local machine to remote host

Move inside the WordPress folder and use wordmove init to generate a new movefile.yml and edit it with your settings. Read the next paragraph for more info.

See the wiki article: Usage and flags explained for more info.

Multistage

You can define multiple remote environments in your movefile.yml, such as production, staging, etc. Every first level key in the YAML other than the defaults and mandatory global and local will be interpreted as a remote environment.

Use -e with pull or push to run the command on the specified environment.

For example: wordmove push -e staging -d will push your local database to the staging environment.

We warmly recommend to read the wiki article: Multiple environments explained

movefile.yml

You can configure Wordmove creating a movefile.yml. That's a YAML file with local and remote host(s) infos:

global:
  sql_adapter: wpcli

local:
  vhost: http://vhost.local
  wordpress_path: /home/john/sites/your_site # use an absolute path here

  database:
    name: database_name
    user: user
    password: password
    host: localhost

  # paths: # you can customize wordpress internal paths
  #   wp_content: wp-content
  #   uploads: wp-content/uploads
  #   plugins: wp-content/plugins
  #   themes: wp-content/themes
  #   languages: wp-content/languages

production:
  vhost: http://example.com
  wordpress_path: /var/www/your_site # use an absolute path here

  database:
    name: database_name
    user: user
    password: password
    host: host
    # port: 3308 # Use just in case you have exotic server config
    # mysqldump_options: --max_allowed_packet=50MB # Only available if using SSH
    # mysql_options: --protocol=TCP # Only available if using SSH

  exclude:
    - '.git/'
    - '.gitignore'
    - 'node_modules/'
    - 'bin/'
    - 'tmp/*'
    - 'Gemfile*'
    - 'Movefile'
    - 'movefile'
    - 'movefile.yml'
    - 'movefile.yaml'
    - 'wp-config.php'
    - 'wp-content/*.sql.gz'
    - '*.orig'

  ssh:
    host: host
    user: user

#  hooks: # Remote hooks won't work with FTP
#    push:
#      before:
#        - command: 'echo "do something"'
#          where: local
#          raise: false # raise is true by default
#      after:
#        - command: 'echo "do something"'
#          where: remote
#    pull:
#      before:
#        - command: 'echo "do something"'
#          where: local
#          raise: false
#      after:
#        - command: 'echo "do something"'
#          where: remote

We warmly recommend to read the wiki articles

to understand more about supported configurations.

Environment Variables

Wordmove allows the use of environment variables in your movefiles. This is useful in order to protect sensitive variables and credentials, as well as make it easy to share movefiles between your team.

Environment variables are written using the ERB tags syntax:

"<%= ENV['YOUR_SECRET_NAME'] %>"

Variables set up

Environment variables can be set up using two methods:

Using the shell:

# bash
export PROD_DB_USER="username" PROD_DB_PASS="password"

# fish
set --export --global PROD_DB_USER "username"; set --export --global PROD_DB_PASS "password"

Using a .env file:

Wordmove supports the dotenv module.

Simply create a .env file next to your movefile structured as follows:

PROD_DB_USER="username"
PROD_DB_PASS="password"

Wordmove will take care of loading the file and making the environment variables ready to be used in your configuration file.

You may also use .env.{environmentname}, but this is discouraged.

Use them in your movefile.yml

Using the ERB syntax described above, write your movefile as follows:

production:
  database:
    user: "<%= ENV['PROD_DB_USER'] %>"
    password: "<%= ENV['PROD_DB_PASS'] %>"

System variables

You can use system variables to configure your movefile.

For example:

local:
  vhost: "http://wordpress-site.localhost"
  wordpress_path: "<%= ENV['HOME'] %>/[wordpress directory path]/"
  # wordpress_path will be substituted with /home/user_name/[wordpress directory path]

Supports

OS

OS X and Linux are fully supported.

See the Windows (un)support disclaimer

Docker

We have a docker image bringing the latest Wordmove's version with autobuild on new releases.

Docker Build Status

SSH

  • You need rsync on your machine; as far as we know it's already installed on OS X and Linux.
  • To use your SSH public key for authentication, just delete the production.ssh.password field in your movefile.yml. Easy peasy.
  • writing the password inside movefile.yml was and is somewhat supported, but we discourage this practice in favor of password-less authentication with pub key. Read here for old informations.

FTP and SFTP

  • You need to install lftp on your machine. See community wiki article: Install lftp on OSX yosemite).
  • Use the relative FTP path as production.wordpress_path
  • Use the absolute FTP path as production.wordpress_absolute_path (you may need to recover this from the __FILE__ magic constant
  • if you want to specify a passive FTP connection add to the YAML config a production.ftp.passive flag and set it to true.

FTP support development is discontinued, but it's always there.

Sice version 3.2.0 SFTP is fully supported, with same functionalities as FTP, through production.ftp.scheme configuration. More information found in the wiki.

Notes

Mirroring

Push and pull actions on files will perform a mirror operation. Please, keep in mind that to mirror means to transfer new/updated files and remove files from destination if not present in source.

This means that if you have files/directories on your remotes which you must preserve, you must exclude those in your movefile.yml, or they will be deleted.

How the heck you are able to sync the DB via FTP?

We're glad you asked! We basically upload via FTP a PHP script that performs the various import/export operations. This script then gets executed via HTTP. Don't worry too much about security though: the script is deleted just after the usage, and can only be executed by wordmove, as each time it requires a pre-shared one-time-password to be run.

Yanked versions

Wordmove 1.3.1 has been removed from rubygems due to a bug with FTP deploying system. If you are using this version, please update soon (gem update wordmove).

Need more tools?

Visit Wordpress Tools.

Credits

Contribute

Please, read the contributor guide.

Feel free to open a discussion issue about contribution if you need more info.

Author

made with ❤️ and ☕️ by weLaika

wordmove's People

Contributors

akiko-pusu avatar aleonrails avatar alessandro-fazzi avatar alexsancho avatar amchoukir avatar burhandodhy avatar chuckmac avatar connormckelvey avatar cu39 avatar danieleperot avatar delphaber avatar elebumm avatar endorama avatar esad avatar ixkaito avatar jaymanpandya avatar jimmy2k avatar jtomaszewski avatar kenchan0130 avatar korkey128k avatar luciaisacomputer avatar maiorano84 avatar matjack1 avatar mte90 avatar nlemoine avatar rbndelrio avatar stefanoordine avatar stefanoverna avatar stephenwspann avatar xrmx 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  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  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

wordmove's Issues

Use a socket DB connection

Is there any way to use a socket DB connection locally by specifying a socket file? I know mysql dump supports it...

Choose the template or plugin

When i do it the wordmove push -t it's not possible choose the template to push.
When i do it this command i see that wordmove check every time in the installation but i don't need in the most of the times.
it's possible add a parameter for set the template or the plugin to sync?

Stage / Production support

What about implementing a double remote Movefile configuration, one for staging and one for production?
Would be nice if the command will defaults to production if not specified other with a cli option. And the Movefile should be

local:
    ...
remote_stage:
    ...
remote_production:

rsync failed to exec sshpass

I'm getting the following error after a word move push:
rsync: Failed to exec sshpass: No such file or directory (2) rsync error: error in IPC code (code 14) at /SourceCache/rsync/rsync-42/rsync/pipe.c(86) [sender=2.6.9] rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: error in IPC code (code 14) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9] Error executing "rsync -azLK -e 'sshpass -p [...] ssh' --exclude-from

I have my local SSH public key already installed on the remote machine. So what's wrong?

Expected Key Error

First of all..this is amazing, thanks for woking on this.

I created a move file and tried both SSH and FTP, both times I had the following error

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:205:in `parse': (<unknown>): did not find expected key while parsing a block mapping at line 12 column 3 (Psych::SyntaxError)
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:205:in `parse_stream'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:153:in `parse'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:129:in `load'
    from /Library/Ruby/Gems/2.0.0/gems/wordmove-1.1.0/lib/wordmove/deployer/base.rb:56:in `fetch_movefile'
    from /Library/Ruby/Gems/2.0.0/gems/wordmove-1.1.0/lib/wordmove/deployer/base.rb:18:in `deployer_for'
    from /Library/Ruby/Gems/2.0.0/gems/wordmove-1.1.0/lib/wordmove/cli.rb:56:in `push'
    from /Library/Ruby/Gems/2.0.0/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
    from /Library/Ruby/Gems/2.0.0/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
    from /Library/Ruby/Gems/2.0.0/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
    from /Library/Ruby/Gems/2.0.0/gems/wordmove-1.1.0/bin/wordmove:6:in `<top (required)>'
    from /usr/bin/wordmove:23:in `load'
    from /usr/bin/wordmove:23:in `<main>'

sql dump naming

When a push is done against remote database the saved dump is named local-xxx regardless of the stage's name in the Movefile.

This way is a problem recognizing from wich environment a dump is coming if we have a configuration with multiple remotes

Permission denied

I'm getting a permission denied when trying to run wordmove pull. Here's the relevant stacktrace:

/Users/jch/.rvm/gems/ruby-1.9.2-p290/gems/net-scp-1.0.4/lib/net/scp/download.rb:103:in `parse_directive': unknown directive: "\x01scp: /var/www/rockyroadblog.com/wp-content/database_dump.sql: Permission denied\n" (ArgumentError)
from /Users/jch/.rvm/gems/ruby-1.9.2-p290/gems/net-scp-1.0.4/lib/net/scp/download.rb:38:in `read_directive_state'

I haven't looked into it very deeply, but my guess is that the directory it's trying to download into is owned by root and can't be written into by my user. Is it possible to run remote commands with sudo?

Push database and error 500

I get this error when i try to push the database:

mte90@siduction:/var/www/domain.dev$ wordmove push -d

▬▬ ✓ Using Movefile: ./Movefile ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

▬▬ ✓ Pushing Database ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
   remote | write /wp-content/dump.php
    local | download http://domain.tld/wp-content/dump.php?shared_key=7d73eb11d521b9573b86cd5d0313dbd272f059a0d63285a62678ca872f2bf6e3ce0e1b7d71b61104 > /home/www/domain.dev/wp-content/remote-backup-1380724152.sql
/usr/lib/ruby/1.9.1/open-uri.rb:346:in `open_http': 500 Internal Server Error (OpenURI::HTTPError)
        from /usr/lib/ruby/1.9.1/open-uri.rb:775:in `buffer_open'
        from /usr/lib/ruby/1.9.1/open-uri.rb:203:in `block in open_loop'
        from /usr/lib/ruby/1.9.1/open-uri.rb:201:in `catch'
        from /usr/lib/ruby/1.9.1/open-uri.rb:201:in `open_loop'
        from /usr/lib/ruby/1.9.1/open-uri.rb:146:in `open_uri'
        from /usr/lib/ruby/1.9.1/open-uri.rb:677:in `open'
        from /usr/lib/ruby/1.9.1/open-uri.rb:33:in `open'
        from /var/lib/gems/1.9.1/gems/wordmove-1.1.0/lib/wordmove/deployer/base.rb:153:in `block in download'
        from /usr/lib/ruby/1.9.1/open-uri.rb:35:in `open'
        from /usr/lib/ruby/1.9.1/open-uri.rb:35:in `open'
        from /var/lib/gems/1.9.1/gems/wordmove-1.1.0/lib/wordmove/deployer/base.rb:152:in `download'
        from /var/lib/gems/1.9.1/gems/wordmove-1.1.0/lib/wordmove/deployer/ftp.rb:104:in `download_remote_db'
        from /var/lib/gems/1.9.1/gems/wordmove-1.1.0/lib/wordmove/deployer/ftp.rb:23:in `push_db'
        from /var/lib/gems/1.9.1/gems/wordmove-1.1.0/lib/wordmove/cli.rb:58:in `block in push'
        from /var/lib/gems/1.9.1/gems/wordmove-1.1.0/lib/wordmove/cli.rb:34:in `block in handle_options'
        from /var/lib/gems/1.9.1/gems/wordmove-1.1.0/lib/wordmove/cli.rb:32:in `each'
        from /var/lib/gems/1.9.1/gems/wordmove-1.1.0/lib/wordmove/cli.rb:32:in `handle_options'
        from /var/lib/gems/1.9.1/gems/wordmove-1.1.0/lib/wordmove/cli.rb:57:in `push'
        from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
        from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
        from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
        from /var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
        from /var/lib/gems/1.9.1/gems/wordmove-1.1.0/bin/wordmove:6:in `<top (required)>'
        from /usr/local/bin/wordmove:23:in `load'
        from /usr/local/bin/wordmove:23:in `<main>'

The remote database is empty, i have no idea for the problem because wordmove have pushed all the files of wordpress. The not output an error 500 but it's working with a empty database (wordpress ask me to generate the wp-config.php, wordmove don't have created it...)

FTP: certificate verify failed

When doing a

wordmove push -d -e production

to a server with no proper certificate I keep getting
remote | write /public_html/wordpress/wp-content/dump.php
local | download https://www.example.com/wordpress/wp-content/dump.php?shared_key=xxx > /Users/xxx/Sites/linke-thueringen/wp-content/remote-backup-xxx.sql
/Users/xxx/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:918:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)

Since this is not lftp-based (it happens in deployer/base.rb:153)

file << open(url).read

it cannot be remedied by changing ~/.lftprc
This keeps me from pushing my database to the production server via FTP.

Does this work with Multisite?

hey there,
I'm looking for a scripted method to sync Multisites from one environment to the other. This looks promising. Off the top of your head could this work with a sub-folder multisite setup?

OpenURI::HTTPError over FTP

Hi there I have been using Wordmove with no problems over SSH and FTP, but I have recently had some issues with the OpenURI returning a 404 when trying to download the dump.php/dump.sql

If I look on the server, the dump.php is there... but dump.sql is not created. Are the permissions not being set properly? I may have updated my gemset.... Here is the error.

   remote | write bv2013/wp-content/dump.php
    local | download http://bonfirevanities.com/bv2013/wp-content/dump.php?shared_key=secretkey > /Volumes/MIND/Users/Me/sites/bonfire-vanities/bv2013/wp-content/dump.sql
/Volumes/MIND/Users/Me/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/open-uri.rb:353:in `open_http': 404 Not Found (OpenURI::HTTPError)

Edit: when passive: true the above occurs, when passive is commented out dump.php is 0bytes on server and the wordmove hangs/timeout.

Why shall I download a "download" file?!?

Hi there,

I am writing just to let you know about a strange problema I am having with WordMove. My server configuration is not the best one anyone can get and maybe my problem derive from it but let me explain a bit better.

The structure of my server is something like this:

/
wp-config.php
  wp-admin/
  wp-include/
  wp-content/
  file1.php
  file2.php
  wpsite_1/
  wpsite_2/
  wpsite_3/

I other words my public_html/ folder has my main website and then you'll fine the wpsite_1/, wpsite_2/ and wpsite_3/ that contains other wp installations. Also, for security reasons, the file wp-config.php has been moved in the folder above.

Now I've used the Movefile to exclude the folders that I do not need but, any time I am trying to access to the site via browser, I receive a message that is asking me to download the... download file! Well, the code inside this file looks like the code in index.php but, instead to ask me to create a config file, is asking me to download a file...

schermata 2013-12-03 alle 22 49 29

I don't understand the problem but I would like to let you know that I can follow a different path to create this "clone" but I would like to know if anyone has met something like this before...

Net::SSH::AuthenticationFailed

Hi there. Thanks for this marvelous script. You're about to change my whole workflow for the better.

I'm having some trouble at the pull stage. After initializing & configuring a yaml config file, I do a pull and here's what happens:

$ wordmove pull
Pushing the DB...
/Library/Ruby/Gems/1.8/gems/net-ssh-2.2.1/lib/net/ssh.rb:200:in start': root (Net::SSH::AuthenticationFailed) from /Library/Ruby/Gems/1.8/gems/net-scp-1.0.4/lib/net/scp.rb:197:instart'
from /Library/Ruby/Gems/1.8/gems/net-scp-1.0.4/lib/net/scp.rb:235:in download!' from /Library/Ruby/Gems/1.8/gems/wordmove-0.0.1/lib/wordmove/hosts/remote_host.rb:26:inupload_file'
from /Library/Ruby/Gems/1.8/gems/wordmove-0.0.1/lib/wordmove/deployer.rb:83:in pull_db' from /Library/Ruby/Gems/1.8/gems/wordmove-0.0.1/lib/wordmove/deployer.rb:127:inremotely'
from /Library/Ruby/Gems/1.8/gems/wordmove-0.0.1/lib/wordmove/deployer.rb:81:in pull_db' from /Library/Ruby/Gems/1.8/gems/wordmove-0.0.1/lib/wordmove/deployer.rb:39:inpull'
from /Library/Ruby/Gems/1.8/gems/wordmove-0.0.1/lib/wordmove/cli.rb:23:in pull' from /Library/Ruby/Gems/1.8/gems/thor-0.14.6/lib/thor/task.rb:22:insend'
from /Library/Ruby/Gems/1.8/gems/thor-0.14.6/lib/thor/task.rb:22:in run' from /Library/Ruby/Gems/1.8/gems/thor-0.14.6/lib/thor/invocation.rb:118:ininvoke_task'
from /Library/Ruby/Gems/1.8/gems/thor-0.14.6/lib/thor.rb:263:in dispatch' from /Library/Ruby/Gems/1.8/gems/thor-0.14.6/lib/thor/base.rb:389:instart'
from /Library/Ruby/Gems/1.8/gems/wordmove-0.0.1/bin/wordmove:4
from /usr/bin/wordmove:19:in `load'
from /usr/bin/wordmove:19

I'm relatively new to Ruby.

Any help is greatly appreciated! Thank you.

Refresh wordmove options

It seems a bit counter-intuitive to tell wordmove what to ignore instead of what to push/pull: instead I would prefer to tell wordmove exactly what I need to be updated.

Moreover, I guess a sensible default would be nice, such as for example pushing only the theme when wordmove is called without options

Infinite loop download if remote wordpress_path is wrong

Hi,

I've installed wordmove (it is very hard if you don't have LFTP installed on MAC!)

I've configured movefile in my localhost path
using
wordmove pull --all

there is a message "cd: fatal error xxxxx not found in server" (or similar : I no longer have the displayed message), but download continue, in loop (every local subdir contains all server's files and subdirs from / !)

Problem local database when pull

Hi, I get the error:
/.rvm/gems/ruby-2.0.0-p451@global/gems/wordmove-1.1.0/lib/wordmove/sql_adapter.rb:44:in gsub!': invalid byte sequence in US-ASCII (ArgumentError)`

Problem with permalinks

Hi weilaka team,

congrats for your amazing work! I've been usign your gem in the last few days and I've been impressed with its easy of use.

Unfortunatly there is a little problem that I can't understand properly, but I'm sure its my fault ;) Every time I pull or push my work the platform that has been updated it will loose the permalink settings and I have to enter in the admin panel and save again the permalink structure (just to flush the rewriting rules).

There is something wrong with my Movefile? Should I add the .htaccess file in the exclude section?

Thanks in advance for your help!

A little bug if args inverted

In v1.0.6

$ wordmove -e production pull -vdt
wordmove help requires at least 0 argument: "wordmove help [TASK]".

Not a real usage problem, but probably something weak in args parsing?

no such file to load - net/ssh/gateway

Trying wordmove on Ubuntu 12.04 lead to this error:

$HOME/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
`gem_original_require': no such file to load -- net/ssh/gateway (LoadError)

You can fix it by doing:

gem install net-ssh-gateway

Unable to connect

Thanks for adding more details to the output. That was helpful.

I'm still getting errors, though. The first error is:

$ wordmove pull
Pulling the DB...
SSH authentification failure, please double check the SSH credentials on your Movefile!

SSH info is correct. See here:

$ ssh [email protected]
[email protected]'s password:
Last login: Thu Dec 8 13:15:31 2011 from xx.xx.xx.xx

I can SSH in, run the same mysql method you've used, and it works. Not sure why this isn't working though. I added skip-grant-tables to my.cnf file, opened up 3306 in the firewall, etc. It just won't work. Running it myself gives this:

mysqldump --host=localhost --user=xxxxxx --password=xxxxxx abc123DBname

MySQL dump 10.13 Distrib 5.1.58, for redhat-linux-gnu (x86_64)
. . .
Dump completed on 2011-12-09 1:08:10

So, I used the skip_db option instead to see where I could get next. This is where the second error occurs. Using a tilde in the wordpress_path variable returns this:

rsync: push_dir#3 "/Users/me/dev/website/~/dev/website/wp-content" failed: No such file or directory (2)

To get around this, I've used the absolute path without the tilde and it works:

$ wordmove pull --skip_db
Pulling wp-content/uploads...
[email protected]'s password:
Pulling wp-content/themes...

Do you know what's causing the database issue? This is the biggest advantage of this script and I desperately want to get it working.

Would you be able to set up this script for an atypical WordPress install – one which stores uploads into /assets instead of wp-content/uploads? Or just a way for it to skip a directory if it's not found and keep on moving?

rsync and special chars

Hi,

when wordmove runs rsync to sync uploads, rsync has a problem with special characters (like umlauts) in filenames. Those files are deleted and redownloaded every time I run wordmove pull. This rsync option fixes it for me:

--iconv=UTF8-MAC,UTF-8

Source: https://discussions.apple.com/thread/2707887

Is there a chance that this parameter could be included in wordmove?

Cheers
Felix

Issue with Pulling the DB

I cannot seem to diagnose this error:

jwaldrip$ wordmove pull
Pulling the DB...
/Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/net-scp-1.0.4/lib/net/scp/download.rb:103:in `parse_directive': unknown directive: "\x01scp: ~/domains/jasonwaldrip.com/html/wp-content/database_dump.sql: No such file or directory\n" (ArgumentError)
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/net-scp-1.0.4/lib/net/scp/download.rb:38:in `read_directive_state'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/net-scp-1.0.4/lib/net/scp.rb:356:in `block (3 levels) in start_command'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/net-ssh-2.3.0/lib/net/ssh/connection/channel.rb:311:in `call'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/net-ssh-2.3.0/lib/net/ssh/connection/channel.rb:311:in `process'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/net-ssh-2.3.0/lib/net/ssh/connection/session.rb:214:in `block in preprocess'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/net-ssh-2.3.0/lib/net/ssh/connection/session.rb:214:in `each'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/net-ssh-2.3.0/lib/net/ssh/connection/session.rb:214:in `preprocess'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/net-ssh-2.3.0/lib/net/ssh/connection/session.rb:197:in `process'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/net-ssh-2.3.0/lib/net/ssh/connection/session.rb:161:in `block in loop'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/net-ssh-2.3.0/lib/net/ssh/connection/session.rb:161:in `loop'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/net-ssh-2.3.0/lib/net/ssh/connection/session.rb:161:in `loop'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/net-ssh-2.3.0/lib/net/ssh/connection/channel.rb:269:in `wait'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/net-scp-1.0.4/lib/net/scp.rb:316:in `download!'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/wordmove-0.0.7/lib/wordmove/hosts/remote_host.rb:27:in `block in upload_file'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/net-ssh-2.3.0/lib/net/ssh.rb:193:in `start'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/wordmove-0.0.7/lib/wordmove/hosts/remote_host.rb:26:in `upload_file'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/wordmove-0.0.7/lib/wordmove/deployer.rb:87:in `block in pull_db'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/wordmove-0.0.7/lib/wordmove/deployer.rb:131:in `remotely'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/wordmove-0.0.7/lib/wordmove/deployer.rb:85:in `pull_db'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/wordmove-0.0.7/lib/wordmove/deployer.rb:42:in `block in pull'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/wordmove-0.0.7/lib/wordmove/deployer.rb:136:in `informative_errors'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/wordmove-0.0.7/lib/wordmove/deployer.rb:39:in `pull'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/wordmove-0.0.7/lib/wordmove/cli.rb:23:in `pull'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/wordmove-0.0.7/bin/wordmove:4:in `<top (required)>'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/bin/wordmove:19:in `load'
    from /Volumes/Terra-Nova/jwaldrip/.rbenv/versions/1.9.3-p0/bin/wordmove:19:in `<main>'

Password autentication error

there's an error on rsync command:
rsync --progress -e 'ssh user@domain' --archive --compress --omit-dir-times --delete /local/path/ :/remote/path
when I launch wordmove command they required always the password... you must to use sshpass?

Rollback feature

Hello and thanks for sharing this gem.

Is it possible to rollback in case something goes wrong?

Thank you!

Override classic wp folders path

Add a "directories" key to Movefile to override common wp folders path like wp-content, uploads.

Wordmove should upload files in those directories accordingly

Push also copies excluded directories through ftp

When i use lftp as deploy method (cheap hosting usually) the parameter --exclude-glob invocated by the lftp command gets ignored. So I get all excluded files pushed into the remote host when I launch wordmove push -w -e=production.
It works if I copy-paste the invocated lftp command changing --exclude-glob to --exclude.

WordPress in a subdirectory

Hi,

I'm using WordPress in a subdirectory and I'm setting my own content, plugins, plugins-mu directories. Here's my folder structure:

|-www
 |---content
 |---plugins
 |---plugins-mu
 |---wp

Although Wordmove plays nicely with custom directories (with paths), it doesn't deal with WordPress in a subdirectory. From what I observed, it takes the WordPress path and adds the custom paths behind. I'm for example ending up with something like:

/my/path/to/project/www/wp/content/

instead of:

/my/path/to/project/www/content/

As I'm mostly using Wordmove for database migration, it's fine and I can deal with this "issue" by setting paths like:

content: "../content"

But it would be nice that Wordmove considers content, plugins, uploads, etc. folders as not necessarily contained by wordpress directory (e.g. sometimes absolute content path isn't wordpress absolute path + content relative path). Maybe by detecting absolute path in paths?

Invalid byte sequence in UTF-8 on db synchronize

Hi,
i have take old wordpress site, and i want sync it on my localhost.

Files are correctly synchronized, but when push (or pull) db, terminal write
"adapt dump
/Users/luca/.rvm/gems/ruby-2.0.0-p247/gems/wordmove-1.1.0/lib/wordmove/sql_adapter.rb:44:in `gsub!': invalid byte sequence in UTF-8 (ArgumentError)"
and view a lot of error.

with other site from this remote server and on this localhost, wordmove work properly

an you help me?

YAML (NameError) and mysqldump command not found

Hi,
I'm using wordmove.

/usr/local/lib/ruby/gems/2.0.0/gems/wordmove-1.1.0/lib/wordmove/deployer/base.rb:56:in `fetch_movefile': uninitialized constant Class::YAML (NameError)

To solve the problems, I added code in base.rb.

require 'yaml'

mysqldump command not found.
FTP is OK,but can not be successful with SSH...

Case successful.

local
/usr/bin/mysqldump

host
/usr/bin/mysqldump

Case that does not succeed.

local

/usr/bin/mysqldump

host

/usr/local/mysql/bin/mysqldump


I'm on the way of learning English...
I hope you will be able to provide the information.

siteurl and Home issue

Hi,
I'm facing a strange problem pushing changes to remote host, siteurl and Home DB fields are updated with the local values. Everything else, including post, are ok.
Any suggestion?

This my Movefile content:

local:
  vhost: "http://xxx.dev"
  wordpress_path: "/Users/xxx/Sites/xxx"
  database:
    name: "retyper"
    username: "retyper"
    password: "retyper"
    host: "localhost"
remote:
  vhost: "http://xxx.com"
  wordpress_path: "/var/www/vhosts/xxx.com/httpdocs"
  exclude:
    - .git
    - .DS_Store
    - .sass-cache
    - Movefile
  database:
    name: "xxx"
    username: "xxx"
    password: "xxx"
    host: "localhost"
  ssh:
    username: "xxx"
    host: "xxx.xx.xxx.xxx"
    # port: 22 # Port is optional

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

Wordmove & MAMP

I've just found that MAMP mysqldump is located under /Applications/MAMP/Library/bin/mysqldump
I'm wondering if there's a way to point Wordmove to this new path.

HEAD code pull db over ftp broken

/home/pioneerskies/.rvm/gems/ruby-2.0.0-p247@wordless/gems/wordmove-1.1.0/lib/wordmove/deployer/ftp.rb:81:in `escape_php': undefined method `gsub' for nil:NilClass (NoMethodError)
    from (erb):170:in `generate_dump_script'
    from /home/pioneerskies/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/erb.rb:849:in `eval'
    from /home/pioneerskies/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/erb.rb:849:in `result'
    from /home/pioneerskies/.rvm/gems/ruby-2.0.0-p247@wordless/gems/wordmove-1.1.0/lib/wordmove/deployer/ftp.rb:86:in `generate_dump_script'
    from /home/pioneerskies/.rvm/gems/ruby-2.0.0-p247@wordless/gems/wordmove-1.1.0/lib/wordmove/deployer/ftp.rb:99:in `download_remote_db'
    from /home/pioneerskies/.rvm/gems/ruby-2.0.0-p247@wordless/gems/wordmove-1.1.0/lib/wordmove/deployer/ftp.rb:45:in `pull_db'
    from /home/pioneerskies/.rvm/gems/ruby-2.0.0-p247@wordless/gems/wordmove-1.1.0/lib/wordmove/cli.rb:47:in `block in pull'
    from /home/pioneerskies/.rvm/gems/ruby-2.0.0-p247@wordless/gems/wordmove-1.1.0/lib/wordmove/cli.rb:34:in `block in handle_options'
    from /home/pioneerskies/.rvm/gems/ruby-2.0.0-p247@wordless/gems/wordmove-1.1.0/lib/wordmove/cli.rb:32:in `each'
    from /home/pioneerskies/.rvm/gems/ruby-2.0.0-p247@wordless/gems/wordmove-1.1.0/lib/wordmove/cli.rb:32:in `handle_options'
    from /home/pioneerskies/.rvm/gems/ruby-2.0.0-p247@wordless/gems/wordmove-1.1.0/lib/wordmove/cli.rb:46:in `pull'
    from /home/pioneerskies/.rvm/gems/ruby-2.0.0-p247@wordless/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
    from /home/pioneerskies/.rvm/gems/ruby-2.0.0-p247@wordless/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
    from /home/pioneerskies/.rvm/gems/ruby-2.0.0-p247@wordless/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
    from /home/pioneerskies/.rvm/gems/ruby-2.0.0-p247@wordless/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
    from /home/pioneerskies/.rvm/gems/ruby-2.0.0-p247@wordless/gems/wordmove-1.1.0/bin/wordmove:6:in `<top (required)>'
    from /home/pioneerskies/.rvm/gems/ruby-2.0.0-p247@wordless/bin/wordmove:23:in `load'
    from /home/pioneerskies/.rvm/gems/ruby-2.0.0-p247@wordless/bin/wordmove:23:in `<main>'
    from /home/pioneerskies/.rvm/gems/ruby-2.0.0-p247@wordless/bin/ruby_executable_hooks:15:in `eval'
    from /home/pioneerskies/.rvm/gems/ruby-2.0.0-p247@wordless/bin/ruby_executable_hooks:15:in `<main>'

Complete copy

I think would be useful a flag to pull and push the complete WordPress tree.

This would be useful for the first deploy and then to restart working on a production site, getting all the core and plugin updates done in the meantime.

I'm proposing something like:

wordmove pull -w

and:

wordmove pull -W

for a pull/push of everything, database included

Wrong adapt dump if FTP (?)

I'm trying to use the gem configured for ftp.
I see that the database gets wrong urls substitution despite of obsolute/relative paths that I set. For example:

#wordpress_absolute_path: "/home/pioneerskies/web/emisphera.local"
wordpress_path: "emisphera.local"

makes my permalinks http://emisphera.local/emisphera.local/chi-siamo/

wordpress_absolute_path: "/home/pioneerskies/web/emisphera.local"
wordpress_path: "emisphera.local"

makes my permalinks http://home/pioneerskies/web/emisphera.local/chi-siamo/

And if I declare wordpress_path: "emisphera.local" so I need to invoke wordmove outside the wp path:

cd /home/pioneerskies/web
wordmove pull -c emisphera.local/Movefile -vd

More: the easiest

wordpress_path: "/home/pioneerskies/web/emisphera.local"

makes permalinks http://home/pioneerskies/web/emisphera.local/chi-siamo/ (with this conf I can invoke wordmove from inside the wp path)

What's wrong with my configuration?

first push --all doesn't work

if you push --all for the first time the exclusion of wp-content in the push of the core make everything else fail, because the uploads, theme and plugin copy don't create the wp-content folder.

Maybe in the push --all we can always try to create the wp-content folder?

Database Backup on push

It can be a useful feature a new cli option that offer a copy of the dump of the database before the push of it.
The problem is pretty simple: the files are often in a repo or in a compressed file somewhere (email, dropbox, filesystem, etc.), so if you made an error, you can revert everything, but if there are errors on the database, you can't.

It can be nice a new option that doesn't delete the dump of the database (and set it a new name like YYYYMMDDHHMMSS.sql in a htaccess protected folder) or save it in a dump.

Movefile syntax higlihgting

Hi,

I was wondering why the Movefile is a YAML formatted file but does not receive the .yaml extension ?

It's not a big deal but as many developpers, I'm using Sublime Text and the syntax highlighting is not displaying when no file extension was found.

Could you change this ? I think it would bring some confort while editing Movefile files.
This can be achieved in a way to preserve backward compatibility :

      def self.fetch_movefile(path)
        path ||= "Movefile.yaml"
        unless File.exists?(path)
          path = "Movefile"
        end
        unless File.exists?(path)
          raise Thor::Error, "Could not find a valid Movefile"
        end
        YAML::load(File.open(path))
      end

I'm not a ruby developper there's probably a smarter way to do this.

Thanks for considering this request.

N.

lftp check if connect on the host

I have tryed to push on the host by have get this:

remote | put_directory: /home/www/domain/wp-content/languages /wp-content/languages .git/ .gitignore .sass-cache/ bin/ tmp/* Gemfile* Movefile wp-config.php wp-content/*.sql wp-content/*
lftp -c 'set ftp:list-options -a; open ftp://test:[email protected]; mkdir -p /wp-content/languages; cd /wp-content/languages; lcd /home/www/rietitube.dev/wp-content/languages; mirror --delete --use-cache --verbose --allow-chown --allow-suid --no-umask --parallel=2 --reverse --exclude-glob .git/ --exclude-glob .gitignore --exclude-glob .sass-cache/ --exclude-glob bin/ --exclude-glob tmp/* --exclude-glob Gemfile* --exclude-glob Movefile --exclude-glob wp-config.php --exclude-glob wp-content/*.sql --exclude-glob wp-content/*'
mkdir: Errore fatale: Certificate verification: Not trusted      
cd: Errore fatale: Certificate verification: Not trusted
mirror: Errore fatale: Certificate verification: Not trusted

After a search on google i have found this simple configuration for disable the verify of certificate:
http://anils-tips.blogspot.it/2011/05/lftp-fatal-error-certificate.html

It's possible to add a check if lftp connect on the host without any problems?

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.