GithubHelp home page GithubHelp logo

Comments (7)

aaronthomas avatar aaronthomas commented on May 30, 2024

First thing to check if you're confident something is going wrong but you're not getting any errors would be to change Capistrano's log level. You can do that by changing the value of :log_level in deploy.rb to :debug rather than :info.

Give that a go and see if you get any errors when you try to deploy.

from wp-deploy.

royemmerich avatar royemmerich commented on May 30, 2024

So, I'm back for round 2! It seems the setup isn't working so smoothly with me either.

The local setup seems to be working fine: bundle exec cap production wp:setup:local

When I then try to deploy to my staging server using this command it fails:

bundle exec cap staging wp:setup:remote

Now the error has got something to do with Git. Before attempting to analyse the error I would first like to ask a question:

  • At what stage of the setup process should there be something contained in your remote git repo?

Now for the error message. I changed my debug level in deploy.rb to :debug as suggested. A bunch of stuff is written to the console so I have just limited it to the error messages:

...
DEBUG [81a9daff] Finished in 0.020 seconds with exit status 1 (failed).
DEBUG [a58d846f] Running /usr/bin/env [ -d /var/www/if_2/repo/.git ] on 192.168.1.193
...
DEBUG [aee338e5]    fatal: git checkout: updating paths is incompatible with switching branches.
DEBUG [aee338e5]    Did you intend to checkout 'origin/development' which can not be resolved as commit?
cap aborted!
git stdout: Nothing written
git stderr: Nothing written
...
Tasks: TOP => git:create_release
The deploy has failed with an error: #<SSHKit::Command::Failed: git stdout: Nothing written
git stderr: Nothing written
>
** Invoke deploy:failed (first_time)
** Execute deploy:failed

from wp-deploy.

aaronthomas avatar aaronthomas commented on May 30, 2024

I think you may be onto a bug here.

Theoretically, you should be able to run the wp:setup:remote task without the need for anything to exist in the remote repo. The error log you've shown here however suggest otherwise.

This may be a mistake of mine in not fully understanding some of the differences between Capistrano 3 and 2 which I used extensively before creating this framework.

Did you try committing something to your remote development branch to see if that gets around the issue?

You shouldn't have to commit to the remote repo at this stage to this task to work, so if that is the case then this is definitely a bug which I'll need to look into.

from wp-deploy.

royemmerich avatar royemmerich commented on May 30, 2024

Okay, so I did a local git commit and then a push (git push origin master) and confirmed there was something in my github repo.

I then ran bundle exec cap staging wp:setup:remote --trace and it got a bit further but not all the way through. Here are the errors reported to the console:

...
** Execute deploy:set_previous_revision
DEBUG [ccd53686] Running /usr/bin/env [ -f /var/www/if_2/current/REVISION ] on 192.168.1.193
DEBUG [ccd53686] Command: [ -f /var/www/if_2/current/REVISION ]
DEBUG [ccd53686] Finished in 0.020 seconds with exit status 1 (failed).
...
INFO [06564f2f] Running /usr/bin/env git checkout -B 20140514070503 origin/development on 192.168.1.193
DEBUG [06564f2f] Command: cd /var/www/if_2/repo && ( GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/if-website/git-ssh.sh /usr/bin/env git checkout -B 20140514070503 origin/development )
DEBUG [06564f2f]    fatal: git checkout: updating paths is incompatible with switching branches.
DEBUG [06564f2f]    Did you intend to checkout 'origin/development' which can not be resolved as commit?
cap aborted!
git stdout: Nothing written
git stderr: Nothing written
...

At the moment the directory structure on my staging server in the DocumentRoot, namely /var/www/if_2 looks like this:

├── releases
│   ├── 20140512085355
│   ├── 20140512091256
│   ├── 20140512092359
│   └── 20140514070503
├── repo
└── shared
    └── content
        └── uploads

I am not sure why there are so many releases already since I have only performed a single commit on my local git repo.

from wp-deploy.

aaronthomas avatar aaronthomas commented on May 30, 2024

The reason you have 4 releases in the releases directory is because Capistrano creates a new release each time you run a cap deploy – regardless of whether it succeeds or not.

I think it's now failing because your cached version of the repo which exist on the server is not in line with the remote repo. Try removing the repo folder from your remote server and deploying again.

If that still fails, try removing the entire contents of your document root, and that will rule out any conflicts with what you've already deployed.

from wp-deploy.

royemmerich avatar royemmerich commented on May 30, 2024

A few more steps towards success, however it is still eluding me.

I initially tried just deleting the repo folder on my staging server, re-ran the deploy and it seemed to hang. I then did a rm -rf * in the DocumentRoot on my staging server and the same thing happened. I tried deploying 3 times, each time emptying the DocumentRoot folder before hand. On the fourth time I decided to leave it until something failed instead of hitting Ctrl+C.

Just before the deploy seemed to hang, the following error message was printed to the console:

** Execute git:clone
DEBUG [ef32eac4] Running /usr/bin/env [ -d /var/www/if_2/repo/.git ] on 192.168.1.193
DEBUG [ef32eac4] Command: [ -d /var/www/if_2/repo/.git ]
DEBUG [ef32eac4] Finished in 1.804 seconds with exit status 1 (failed).

Things carried on beyond this failure and the point at which everything seemed to be hanging was when cloning the wordpress github branch. The final console printout, on my fourth, successful attempt, was as follows. Notice how long it took to clone wordpress!

 INFO [285228a0] Running /usr/bin/env git clone -b development --recursive [email protected]:infinitefingers/website.git /var/www/if_2/repo on 192.168.1.193
DEBUG [285228a0] Command: cd /var/www/if_2 && ( GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/if-website/git-ssh.sh /usr/bin/env git clone -b development --recursive [email protected]:infinitefingers/website.git /var/www/if_2/repo )
DEBUG [285228a0]    Cloning into '/var/www/if_2/repo'...
DEBUG [285228a0]    Cloning into '/var/www/if_2/repo'...
DEBUG [285228a0]    warning: Remote branch development not found in upstream origin, using HEAD instead
DEBUG [285228a0]    Submodule 'wordpress' ([email protected]:WordPress/WordPress.git) registered for path 'wordpress'
DEBUG [285228a0]    warning: Remote branch development not found in upstream origin, using HEAD instead
DEBUG [285228a0]    Cloning into 'wordpress'...
DEBUG [285228a0]    warning: Remote branch development not found in upstream origin, using HEAD instead
DEBUG [285228a0]    Submodule path 'wordpress': checked out '9f00179c586e28a6078a8c51909b4a858df4683f'
DEBUG [285228a0]    warning: Remote branch development not found in upstream origin, using HEAD instead
 INFO [285228a0] Finished in 199.902 seconds with exit status 0 (successful).

Everything seemed to be going swimmingly until the message below was printed to the console:

 INFO [7f3354e9] Running /usr/bin/env git checkout -B 20140516071025 origin/development on 192.168.1.193
DEBUG [7f3354e9] Command: cd /var/www/if_2/repo && ( GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/if-website/git-ssh.sh /usr/bin/env git checkout -B 20140516071025 origin/development )
DEBUG [7f3354e9]    fatal: git checkout: updating paths is incompatible with switching branches.
DEBUG [7f3354e9]    Did you intend to checkout 'origin/development' which can not be resolved as commit?
cap aborted!
SSHKit::Command::Failed: git exit status: 128
git stdout: Nothing written
git stderr: fatal: git checkout: updating paths is incompatible with switching branches.
Did you intend to checkout 'origin/development' which can not be resolved as commit?
...
The deploy has failed with an error: #<SSHKit::Command::Failed: git exit status: 128
git stdout: Nothing written
git stderr: fatal: git checkout: updating paths is incompatible with switching branches.
Did you intend to checkout 'origin/development' which can not be resolved as commit?
>
** Invoke deploy:failed (first_time)
** Execute deploy:failed

And now, while typing up this post, I wondered why capistrano is trying to checkout the origin/development branch. I ran grep -R "development" /var/www/if_2/config/ and realised that in my config/deploy/staging.rb file the Git setup section was set to this: set :branch, "development". I changed development to master and it now seems to mostly work! Yay!!

I still have to sort out my themes but essentially it looks like the deployment to my VirtualBox staging server has succeeded, bar the following errors:

...
DEBUG [28c2f863] Running /usr/bin/env [ -d /var/www/if_2/repo/.git ] on 192.168.1.193
DEBUG [28c2f863] Command: [ -d /var/www/if_2/repo/.git ]
DEBUG [28c2f863] Finished in 1.733 seconds with exit status 1 (failed).
...
DEBUG [5dbe994f] Command: [ -L /var/www/if_2/releases/20140516073406/wp-config.php ]
DEBUG [5dbe994f] Finished in 0.021 seconds with exit status 1 (failed).
DEBUG [08894294] Running /usr/bin/env [ -f /var/www/if_2/releases/20140516073406/wp-config.php ] on 192.168.1.193
DEBUG [08894294] Command: [ -f /var/www/if_2/releases/20140516073406/wp-config.php ]
DEBUG [08894294] Finished in 0.020 seconds with exit status 1 (failed).
...
DEBUG [7cb4933b] Running /usr/bin/env [ -L /var/www/if_2/releases/20140516073406/.htaccess ] on 192.168.1.193
DEBUG [7cb4933b] Command: [ -L /var/www/if_2/releases/20140516073406/.htaccess ]
DEBUG [7cb4933b] Finished in 0.019 seconds with exit status 1 (failed).
DEBUG [f80314bc] Running /usr/bin/env [ -f /var/www/if_2/releases/20140516073406/.htaccess ] on 192.168.1.193
DEBUG [f80314bc] Command: [ -f /var/www/if_2/releases/20140516073406/.htaccess ]
DEBUG [f80314bc] Finished in 0.027 seconds with exit status 1 (failed).
...
DEBUG [1a7557e1] Running /usr/bin/env [ -L /var/www/if_2/releases/20140516073406/content/uploads ] on 192.168.1.193
DEBUG [1a7557e1] Command: [ -L /var/www/if_2/releases/20140516073406/content/uploads ]
DEBUG [1a7557e1] Finished in 0.019 seconds with exit status 1 (failed).
DEBUG [febdb8f4] Running /usr/bin/env [ -d /var/www/if_2/releases/20140516073406/content/uploads ] on 192.168.1.193
DEBUG [febdb8f4] Command: [ -d /var/www/if_2/releases/20140516073406/content/uploads ]
DEBUG [febdb8f4] Finished in 0.018 seconds with exit status 1 (failed).

from wp-deploy.

aaronthomas avatar aaronthomas commented on May 30, 2024

By default, we set the staging environment to deploy from a origin/development branch, and the production environment to deploy from origin/master, which helps for a much better development workflow (particularly with how we work at Mixd, though I understand others work in different ways). Perhaps I should document this a little better.

I think those last outstanding errors are to be expected, though I can't be sure without trying to replicate them myself (which I'll do eventually). For the time being, can you confirm that if you set your debug level back to :info you're no longer getting any errors at all?

from wp-deploy.

Related Issues (20)

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.