Staging a WordPress site with WP-Deploy

I am testing WP-Deploy, but can’t get it work. I follow the steps in the docs but for some reason when I execute

$ bundle exec cap staging wp:setup:local
 INFO [b4d7f211] Running /usr/bin/env wp core install --url="http://localhost/blog" --title="TITLE" --admin_user="YYYY" --admin_password='YYYY' --admin_email="YYYY" on 
 INFO [b4d7f211] Finished in 0.054 seconds with exit status 0 (successful).

    =========================================================================
      WordPress has successfully been installed. Here are your login details:

      Username:       ***
      Password:       ***
      Email address:  ***
    ========================================================================= 

And then:

$ bundle exec cap staging deploy

I get:

INFO [2482ebbf] Running /usr/bin/env mkdir -p /tmp/elbauldelprogramador/ on localhost
cap aborted!
Connection refused - connect(2) for "localhost" port 22

Tasks: TOP => git:check => git:wrapper
(See full trace by running task with --trace)
The deploy has failed with an error: #<Errno::ECONNREFUSED: Connection refused - connect(2) for "localhost" port 22>

UPDATE

Now all is working perfectly. My configuration is the following. A local environment within a Virtual Machine, a development environment in the real server and a production environment in the real server. I needed a SSH connection between my local environment and the remote server, and between my local environment and my git repo at Bitbucket. Right now is all working great and I have a staging environment for WordPress with Capistrano using WP-Deploy

I do not know why I need a SSH connection on my local environment, I’ve using a virtual machine for the local environment and nothing is copied to the path specified in staging.rb (/opt/lampp/htdocs/blog/) . Here are my config files:

Deploy.rb

############################################
# Setup WordPress
############################################

set :wp_user, "algui91" # The admin username
set :wp_email, "****" # The admin email address
set :wp_sitename, "El Baúl del Programador" # The site title
set :wp_localurl, "http://localhost/blog" # Your local environment URL

############################################
# Setup project
############################################

set :application, "elbauldelprogramador"
set :repo_url, "[email protected]:algui91/elbauldelprogramador.git"
set :scm, :git

Production.rb

############################################
# Setup Server
############################################

set :stage, :production
set :stage_url, "http://elbauldelprogramador.com"
server "ip", user: "user", roles: %w{web app db}
set :deploy_to, "path"

############################################
# Setup Git
############################################

set :branch, "master"

Staging.rb

############################################
# Setup Server
############################################

set :stage, :staging
set :stage_url, "http://localhost/blog"
server "127.0.0.1", user: "hkr", roles: %w{web app db}
set :deploy_to, "/opt/lampp/htdocs/blog/"

############################################
# Setup Git
############################################

set :branch, "development"

What am I missing?

Thank you

2 Answers
2

First off, you need to set your global WP settings under the “WordPress” heading in config/deploy.rb:

set :wp_user, "aaronthomas" # The admin username
set :wp_email, "[email protected]" # The admin email address
set :wp_sitename, "WP Deploy" # The site title
set :wp_localurl, "localhost" # Your local environment URL

These are the settings used for your inital installation of WordPress. You also need to define your git repository in the same file:

set :application, "wp-deploy"
set :repo_url, "[email protected]:Mixd/wp-deploy.git"

Here is how to configure the rest of wp-deploy

Leave a Comment