In the pursuit of a more professional WordPress dev and deployment environment I am trying to use Capistrano to deploy from my local dev environment to staging and production servers but I can’t quite get it to work.
I am on Site5 shared hosting and am deploying to one server with two different domains – staging.example.com and example.com.
I have used https://github.com/markjaquith/WP-Stack as a basis and have added
set :user, "myserveruser"
to my config.rb file as the connection didn’t work without that.
Running cap deploy:check
tells me “You appear to have all necessary dependencies installed” and I can run cap deploy:setup
which successfully connects to staging and production creating releases and shared directories etc.
The problem comes when I run cap deploy
. Everything seams to work fine until I am prompted for a sudo password. This is not a normal login prompt though and does not allow me to type a password. As I am on a shared host I don’t have sudo access anyway.
Its similar to this problem Capistrano is hanging when prompting for SUDO password to an Ubuntu box but the solutions didn’t fix all my issues.
I have set default_run_options[:pty] = true
which I seam to need but still get the sudo prompt.
I am using passwordless ssh so Capistrano is able to connect and do everything it needs to do without prompting for a password and I am also using an SSH config file to handel agent forwarding so the server can also connect to my git repository. I have confirmed this is working.
I have found other people having similar problems – Capistrano using sudo even with “set :use_sudo, false” – etc but none of the solutions have worked.
I am using default_run_options[:pty] = true
and have tried using set :use_sudo, false
and default_run_options[:shell] = false
but I still have the same issue.
You can view my Terminal output here – http://pastebin.com/5xZmCnyA
I am seriously going crazy! Any help would be greatly appreciated!!!
Cheers
You can’t run setup without
sudo
. That’s the only part that REQUIRES sudo, because it makes a directorypublic_html/staging.exposecreative.org
, in your case…That step shouldn’t be required, you can make that directory yourself (assuming you have permission)..
The problem you will face however is that the shared host will expect your
index.php
to be directly inpublic_html
, for that to work you’d need write permission to whatever directorypublic_html
is in, which your shared host won’t allow (almost certainly)The line
default_run_options[:pty] = true
has to do with whether Capistrano pretends to be an interactive shell or not. Many commands (sudo included) use this to determine if they should bother asking the user for input, or if they are part of an automated process (in which case there’s no way to ask for input)
My advice (as Capistrano maintainer) – don’t try this on a shared host, it almost certainly won’t work. (Sorry, their limitations, not ours)
I wrote an extensive post on how to deploy WordPress with Capistrano on a shared host (Bluehost). I use the Roots/Bedrock stack and it only took me about 20 minutes to get up and running.
I made a WordPress development stack using Shipit JS instead of Capistrano because I’m not comfortable with Ruby. Maybe that can help. Feel free to use it and/or post some issues if needed. Regards.
WP-Jungle / Bonzai