Closed kaktux closed 5 years ago
Hello there!
Attempting to a complete answer would result in a too long and too open one. I'll try to stay as tiny as possible; feel free to iterate.
Scenario 1) if you push and can't see any file on the remote than the assumption is that you have not specified the right wordpress_path
. Double check the wordpress_path
both in local
and youknowthenameofyourremote
configs.
Should be useful to read the composed rsync
command printed to STDOUT in order to find this sort of problems.
Scenario 2) If you have no wp-config.php
file after pull
ing, then the assumption is that it was excluded by movefile.yml
. Moreover: I feel it right that you do not move back and forth the wp-config.php
, since it is environment dependant. I always prefer to ignore it in movefile.yml
and .gitignore
and after a fresh pull I simply re-run the WP installation process locally (WP will notice to be already installed after you'll setup the DB).
Requirements for a fresh pull
/push
) The only one should be having the database already created, since wordmove
wont create it for you.
so as i couldn't find a solution i tinkered around some more. I currently use a ubuntu 18.04 netboot installation in virtualbux where i could easily install ruby and other needed dependencies.
But - i still get some errors which i couldn't figure out myself - hope i didnt get your answer wrong.
My movefile looks the following:
global:
sql_adapter: wpcli
#Environment 1 - local:
local:
vhost: http://vhost.local
wordpress_path: /var/www/html/wpfolder # use an absolute path here
database:
name: mydb
user: myuser
password: "mypassword"
host: localhost
#Environment 2 - staging:
staging:
vhost: "https://staging.mydomain.com"
wordpress_path: "staging.mywebhost.com/"
database:
name: "mydb"
user: "mydb"
password: "mypass"
host: "localhost"
# exclude:
# - ".git/"
# - ".gitignore"
# - ".sass-cache/"
# - "bin/"
# - "tmp/*"
# - "Gemfile*"
# - "Movefile"
# - "wp-config.php"
# - "wp-content/*.sql"
ssh:
host: "ssh-username@my.webhost.com"
user: "ssh-username"
# password: "none" password is optional, will use public keys if available.
# paths: # you can customize wordpress internal paths
# wp_content: wp-content
# uploads: wp-content/uploads
# plugins: wp-content/plugins
# mu_plugins: wp-content/mu-plugins
# themes: wp-content/themes
# languages: wp-content/languages
when i now navitage to wpfolder and do:
wordmove pull --all -e staging
most files are downloaded - but i get some errors. Here a condensed version of the terminal output:
wp-includes/widgets/class-wp-widget-text.php
21,195 100% 279.71kB/s 0:00:00 (xfr#1618, to-chk=0/1761)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1668) [generator=3.1.2]
▬▬ Pulling Uploads ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
remote | get_directory: staging.mydomain.com/ /var/www/html/wpfolder /wp-content/* /* /wp-content/uploads/ /wp-content/
ℹ️ info | rsync --progress -e 'ssh ssh-username@my.webhost.com' -rlpt --compress --omit-dir-times --delete --include /wp-content/uploads/ --include /wp-c
ontent/ --exclude /wp-content/\* --exclude /\* :staging.mydomain.com/ /var/www/html/wpfolder
receiving incremental file list
rsync: failed to set permissions on "/var/www/html/wpfolder/.": Operation not permitted (1)
./
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1668) [generator=3.1.2]
▬▬ Pulling Themes ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
remote | get_directory: staging.mydomain.com/ /var/www/html/wpfolder /wp-content/* /* /wp-content/themes/ /wp-content/
ℹ️ info | rsync --progress -e 'ssh ssh-username@my.webhost.com' -rlpt --compress --omit-dir-times --delete --include /wp-content/themes/ --include /wp-co
ntent/ --exclude /wp-content/\* --exclude /\* :staging.mydomain.com/ /var/www/html/wpfolder
receiving incremental file list
rsync: failed to set permissions on "/var/www/html/wpfolder/.": Operation not permitted (1)
./
wp-content/themes/
wp-content/themes/index.php
28 100% 27.34kB/s 0:00:00 (xfr#1, to-chk=238/242)
.....
wp-content/themes/twentysixteen/template-parts/content.php
1,763 100% 59.37kB/s 0:00:00 (xfr#195, to-chk=0/242)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1668) [generator=3.1.2]
▬▬ Pulling Plugins ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
remote | get_directory: staging.mydomain.com/ /var/www/html/wpfolder /wp-content/* /* /wp-content/plugins/ /wp-content/
ℹ️ info | rsync --progress -e 'ssh ssh-username@my.webhost.com' -rlpt --compress --omit-dir-times --delete --include /wp-content/plugins/ --include /wp-c
ontent/ --exclude /wp-content/\* --exclude /\* :staging.mydomain.com/ /var/www/html/wpfolder
receiving incremental file list
rsync: failed to set permissions on "/var/www/html/wpfolder/.": Operation not permitted (1)
./
wp-content/plugins/
wp-content/plugins/hello.php
2,578 100% 2.46MB/s 0:00:00 (xfr#1, to-chk=25/29)
.....
wp-content/plugins/akismet/views/stats.php
744 100% 11.91kB/s 0:00:00 (xfr#22, to-chk=0/29)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1668) [generator=3.1.2]
▬▬ Pulling Mu Plugins ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
remote | get_directory: staging.mydomain.com/ /var/www/html/wpfolder /wp-content/* /* /wp-content/mu-plugins/ /wp-content/
ℹ️ info | rsync --progress -e 'ssh ssh-username@my.webhost.com' -rlpt --compress --omit-dir-times --delete --include /wp-content/mu-plugins/ --include /w
p-content/ --exclude /wp-content/\* --exclude /\* :staging.mydomain.com/ /var/www/html/wpfolder
receiving incremental file list
rsync: failed to set permissions on "/var/www/html/wpfolder/.": Operation not permitted (1)
./
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1668) [generator=3.1.2]
▬▬ Pulling Languages ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
remote | get_directory: staging.mydomain.com/ /var/www/html/wpfolder /wp-content/* /* /wp-content/languages/ /wp-content/
ℹ️ info | rsync --progress -e 'ssh ssh-username@my.webhost.com' -rlpt --compress --omit-dir-times --delete --include /wp-content/languages/ --include /wp
-content/ --exclude /wp-content/\* --exclude /\* :staging.mydomain.com/ /var/www/html/wpfolder
receiving incremental file list
rsync: failed to set permissions on "/var/www/html/wpfolder/.": Operation not permitted (1)
./
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1668) [generator=3.1.2]
▬▬ Pulling Database ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
local | mysqldump --host=localhost --user=root --password=mypassword --result-file="/var/www/html/wpfolder/wp-content/local-backup-1559547810.s
ql" mydb
mysqldump: [Warning] Using a password on the command line interface can be insecure.
local | gzip -9 -f "/var/www/html/wpfolder/wp-content/local-backup-1559547810.sql"
remote | mysqldump --host=localhost --user=mydbuser --password=mydbpassword --result-file="staging.mydomain.com/wp-content/dump.sql" mydatabase
remote | gzip -9 -f "staging.mydomain.com/wp-content/dump.sql"
remote | get: staging.mydomain.com/wp-content/dump.sql.gz /var/www/html/wpfolder/wp-content/dump.sql.gz
remote | delete: staging.mydomain.com/wp-content/dump.sql.gz
local | gzip -d -f "/var/www/html/wpfolder/wp-content/dump.sql.gz"
local | mysql --host=localhost --user=root --password=mypassword --database=mydb --execute="SET autocommit=0;SOURCE /var/www/html/wpfolder/wp-content/dump.sql;COMMIT"
mysql: [Warning] Using a password on the command line interface can be insecure.
local | adapt dump for vhost
local | wp search-replace https://staging.mydomain.com http://vhost.local --quiet --skip-columns=guid --all-tables --allow-root
Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.
Traceback (most recent call last):
14: from /usr/local/bin/wordmove:23:in `<main>'
13: from /usr/local/bin/wordmove:23:in `load'
12: from /var/lib/gems/2.5.0/gems/wordmove-4.0.1/exe/wordmove:6:in `<top (required)>'
11: from /var/lib/gems/2.5.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
10: from /var/lib/gems/2.5.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
9: from /var/lib/gems/2.5.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
8: from /var/lib/gems/2.5.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
7: from /var/lib/gems/2.5.0/gems/wordmove-4.0.1/lib/wordmove/cli.rb:78:in `pull'
6: from /var/lib/gems/2.5.0/gems/wordmove-4.0.1/lib/wordmove/cli.rb:41:in `handle_options'
5: from /var/lib/gems/2.5.0/gems/wordmove-4.0.1/lib/wordmove/cli.rb:41:in `each'
4: from /var/lib/gems/2.5.0/gems/wordmove-4.0.1/lib/wordmove/cli.rb:42:in `block in handle_options'
3: from /var/lib/gems/2.5.0/gems/wordmove-4.0.1/lib/wordmove/cli.rb:79:in `block in pull'
2: from /var/lib/gems/2.5.0/gems/wordmove-4.0.1/lib/wordmove/deployer/ssh.rb:48:in `pull_db'
1: from /var/lib/gems/2.5.0/gems/wordmove-4.0.1/lib/wordmove/deployer/ssh/wpcli_sql_adapter.rb:37:in `adapt_remote_db!'
/var/lib/gems/2.5.0/gems/wordmove-4.0.1/lib/wordmove/deployer/base.rb:93:in `run': Return code reports an error (Wordmove::ShellCommandError)
When i navigate my browser to the folder i get the redirect to wp-admin/setup-config.php with the statement:
Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.
Database name Database username Database password Database host Table prefix (if you want to run more than one WordPress in a single database)
We’re going to use this information to create a wp-config.php file. If for any reason this automatic file creation doesn’t work, don’t worry. All this does is fill in the database information to a configuration file. You may also simply open wp-config-sample.php in a text editor, fill in your information, and save it as wp-config.php. Need more help? We got it.[...]
Which is the "normal" new installation - which i dont want to have. When accessing the database via adminer - it all looks like it should work.
As when i read "permissions" i first think user rights: i already did try simply repeating: chown -R www-data:www-data /var/www/html
So this shouldn't be the problem.
I tried everything already that came into my mind (like maybe doing wordmove pull as sudo) - but none of my tries worked. Also i couldn't find the error message and a possible workaround here or somewhere else via websearch.
Would be great if anyone here knows what could be causing that problem - or where i get wordmove usage wrong
Let's try to approach this step by step.
rsync error: some files/attrs were not transferred (see previous errors) (code 23)
could just represent a failure in attributes sync (permissione, times, etc.) and it should depend on your permissions/system/user setup. This should not be a blocker, since you can fix permissions after the pull/push operation (even with hooks)
if your log is ordered, than you are doing a first time ever pull of --all
, but the db is getting imported before the core, thus you have not the wp-config.php
file. Anyway i think it's useless - but up to you - to pull/push the wp-config.php
if you have not a logic inside it to switch between local and remote credentials dynamically. So from my point of view after a first pull is ok to to the normal new installation: once put in the credentials wordpress will say "Hey, I see I'm already installed, mate!"
Try this way:
wordmove pull -w
wp-config.php
wp-config.php
within the movefile.yml
wordmove pull --all
Let me know if that helps/changes someway :)
thx - that helped a lot. I was dumb enough to overread your statement that you simply can "newly" install wordpress and the existing/pulled db is recognized.
So this worked - but somehow i got a weird error now - after the pull my movefile.yml was changed to my first "draft"
"Back" then i tried wordmove in /var/www/html/wordpress instead of /var/www/html/myfolder. Also i did just replace my info into the premade movefile i got from "wordmove init". As i got an error i also added ssh keys instead of using a password. So - after a pull for some reason the movefile was changed back to a former state. Which is weird - right? I got a backup of the correct and working movefile - but i doubt that the intention is to edit it new every time.
The second problem i have may be a dumb mistake also: redirection. Everything on the local installation redirects to the online installation. I can access mylocalip/mywpfolder/wp-login.php - but after login im on my webhost. Also all blog posts, comments etc of the local wp-startpage lead to the webhost.
For both i couldn't find a solution myself so far.
We've reached something at least :)
movefile.yml
in the exclude sectionexclude:
- 'movefile.yml'
If it was not already excluded within the default movefile.yml
then it could be considered a bug. Anyway you have to exclude it and to do it for every remote you've configured.
The redirect mess is caused for sure (I mean: sure®) by some error in your vhost
parameters.
vhost: "https://staging.mydomain.com"
must be equal to what wp option get siteurl
returns on each environment. Keep an eye to trailing slash, http(s?) and typos.
Aside: I've seen in you previous movefile.yml
snippet something like
wordpress_path: "staging.mywebhost.com/"
That is an error. That param must be an absolute path. in the docs it's well reported, but I think wordmove doctor
has not this check in its deck (and this could be an improvement ticket)
Aside number 2: if you reach mylocalip/mywpfolder/wp-login.php
it means you have a subfolder installation type. In this case you have mywpfolder
in you site url, therefor I'm asking if you have correctly set up vhost
param correctly e.g.
local:
vhost: http://vhost.local/mywpfolder
Newly your guide should be wp option get siteurl
.
If you have not a subfolder installation, but you're reaching your wordpress installation with a subfolder in the url...well...I could also consider to surrender 😛But you know that knowing specs about you installation is totally up to you ;)
Best luck
Thx for all your help. With some (ok a lot but with an actual easy solution) tryouts i seem to have my staging environment workin with wordmove.
To write down my findings in case some other happens to have the same level.
Regarding 1: it was indeed movefile.yml missing. For some reason i have "Movefile" - but comparing with a movfile created via 'wordmove' init i saw the missing not-excluded files. That cured the rewriting for the movefile.
Regading 2:
That was a three step solution for me.
First i had https where http was right.
Second as i was using a virtual machine (to which my router gives an ip) i had to set
vhost: "http://my.local.ip/mywpfolder
And third the thing that will be branded in my brain regarding wordmove: second time is the charme.
Means:
Regarding 3: wordpress_path: "staging.mywebhost.com/" actually isnt and error. At least if i understand right what an absolute path is. The working solution for me is /staging.mywebhost.com My hoster adds domains and subdomains like that - with their actual name. So when i access via ftp i land in a folder which includes folders named mydomain.com, staging.mydomain.com etc.
Regarding 4: wp option get siteurl - as this seems a wp-cli commend i couldn't try it on the server. But either looking in the wordpress dashboard unter settings->general or in the database under wp_options should show the site-url also.
Luck seems to be appropiate since the solution for me was to simply read what you suggested (add/delete s,/ and simlar) and then redo the pull a second time ;) - instead to try again instantly with different settings.
Now I'll try the same to backup the current live website (and older wp (4.3)) which should later be replaced with the staging.
Again thx a lot.
Happy to read about an happy ending :)
1 last note before closing: folder/
is not an absolute path, while /folder
is :) But hosting are so different from each other, you have to know or discover how your is configured.
Best luck!
Hi there,
i just was able to get wordmove working thx to existing examples in the issues here (how to use ssh) - but: now i have a general question that i couldn't find an answer to.
I have wordmove on a virtual machine (debian buster) and then did several approaches after creating a movefile:
Anyway - i couldn't get this to work so i tried the other way around.
So long story short - my question to which i couldn't find an answer to is: When starting a new wordpress installation - What are (besides the movefile) the requirements a) for the remote folder/db b) for the local folder/db
Can one be empty? Does wordpress need to be installed on both? This may be a dumb question - but until now i thought wordmove pulls/pushes everything - and changes the needed settings according to the movefile.
As github just showed me related topics: https://github.com/welaika/wordmove/issues/356 There the answer is: exclude wp-config.php after first push.
So the answer is: one can be empty? Sorry - i am a bit confused. btw. also missing is a robot.txt i placed in the remote folder - this was excluded also. Dont know why and doesnt really matter - but i wanted to add this info.