Open alessandro-fazzi opened 2 years ago
Thanks @nlemoine for this https://github.com/welaika/wordmove/pull/624/commits/ab39a4a699ecdd78f5923b13d8860af9d012c045
Fixed in alpha.8
Sorry for the maybe stupid questions from a pixel pusher:
Since from version 6 mysql and mysqldump options are no longer available, then the connection to the (local) database via socket also no longer works, right?
Currently I use the following entries in the movefile.yml in connection with local (flywheel):
name: local
user: root
password: "root"
host: localhost
mysqldump_options: '--column-statistics=0 --socket "/Users/mario/Library/Application\ Support/Local/run/w_2HLYrYO/mysql/mysqld.sock"'
mysql_options: '--socket "/Users/mario/Library/Application\ Support/Local/run/w_2HLYrYO/mysql/mysqld.sock"'
Hello @electricarts :)
Thnaks for the inquiry. That's not correct or at least that's not intended :P
Flags to the underlying mysql and mysqldump commands are still possible to be proxied by configuring wp-cli. I wrote something about it in a paragraph of this PR, but for sure a more structured documentation will follow the future release.
Moreover I think that using wp-cli to do BD operations, as far as your wordpress is able to connect to the DB, then you should be able to go configuration-lessly: wp-cli reads configurations directly from your wordpress installation.
That said I'd be more than happy to help you troubleshooting the specific flywheel scenario if you'd be able to perform some alpha or - soon - beta testing: I'm very interested in retaining support for such a widespread stack.
Let me know and feel free to open a discussion if you need to chat about the matter :)
P.S.: I've not yet tested the alpha against nothing but a plain standard WP install into a directory
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Alpha version for testing
If you have other versions installed, wipe it with
gem uninstall wordmove
, thengem install wordmove --version '6.0.0.alpha.8'
The alpha version is shipped for internal testing; everyone feels free to be courious, but I'd advice to test it against staging/testing environments and anyway be wise about your backups.
Why such a big refactor?
What was wrong
thus
Which goals?
Since Wordmove is almost doing what it was created to do for almost 10 years, I can't see huge room nor huge urgency to expand its functionalities. But it still has it's place in the "market", thus I'd like to keep it alive.
In order to keep it alive I had some goals:
How does this PR accomplish those goals?
New command line implementation
the command line implementation has been re-implemented using https://dry-rb.org/gems/dry-cli/. dry-rb is minimal, class based and heavily object oriented
Service objects all the way
All the core logic is now organised into service objects; we have two organisers for SSH
Wordmove::Organizers::Ssh::Push
andWordmove::Organizers::Ssh::Pull
and two for FTPWordmove::Organizers::Ftp::Push
andWordmove::Organizers::Ftp::Pull
in charge of orchestrating all the single actions needed to accomplish the procedure. Reading the organisers should immediately give you the idea of what the code is accomplishing to do.Let's look for example into
lib/wordmove/organizers/ssh/push.rb
where it's evident what's the procedure being executed; the list of
actions
will be executed in order, and every action will have access to same context, where all the needed state (almost configurations) resides.This way, and thanks to the new design, development and bug fixes should be naturally more focused.
Testing
Testing single actions is now more straight. The coverage has been preserved and slightly improved.
The CI, moved on GitHub actions, is also a bit more polished and for sure faster.
Documentation
Now the code has an extremely wider in-code documentation coverage. When 6.0.0 will be out of pre-release, you'll find updated developer's documentation at https://www.rubydoc.info/gems/wordmove.
Not a complete rewrite still
Some part of the legacy code have been loosely adapted to work into the new design patter; I'm not happy with this surviving code, but I'll keep it as it is. Time investment has already grown too much.
Features
This release is not about features, but
--debug
flag's now more useful when you actually are dealing with bugs (try it out and you'll see a lot of info about the currently executed actions)WORDMOVE_REVEAL_SECRETS=1
, e.g:WORDMOVE_REVEAL_SECRETS=1 wordmove pull -d -e stging
. Just please don't use this feature to report your STDOUT in GitHub's issues.Maybe for the beta release also the ruby version will be bumped. I've still to check if the update to Ruby 3 would be easily affordable.
Bugfixes
616
581
582
Dropped features
.env
file is supported. Variations like.env.development
are not supported as it stands in the alpha version.default
global.sql_adapter
has been dropped. This is a braking change and means thatwp-cli
will be a required peer dependency for >=6.0.0. Wiki docs will be updated accordingly at release time. The key in themovefile.yml
is still required, so you need to haveBreaking changes
movefile.yml
:local.database
key andlocal.vhost
key are no more required and considered a syntax error.doctor
command is aware of the change. More on this in a later paragraph (see #625 )global.sql_adapter
, stil being mandatory, now supports onlywpcli
.Thus remember to update you movefile.yml accordingly. The wiki documentation will be updated lately so you'll be on your own until then.
Configuring the local section: news and drops
From now on this will be your
local
section inmovefile.yml
:This sounds - and actually is - really cool, but you have to be aware of a few things.
local.database.mysql_options
andlocal.database.mysqldump_options
are dropped. Now we rely on wp-cli in order to dump and import the database. You can still configure wp-cli in order to achieve some of the previous configuration. In order to configure wp-cli you can follow the official docs https://make.wordpress.org/cli/handbook/references/config/#config-files, but here come some examples of awp-cli.yml
fileKeep in mind that we already always use some flags when wrapping wp-cli commands:
search-replace
:--precise
,--regex
,--regex-delimiter="|"
,--skip-columns=guid
,--all-tables
--allow-root
Keep in mind you are able to overwrite them creating hard to track misbehaviours.
Also
local.database.port
andlocal.database.charset
are dropped since they are managed differently in wp-config.php and anyway automatically managed by wp-cli.