Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

So I'm using WP-Stack and trying to deploy from my local machine to an EC2 instance.

Ive follow capistrano's SSH literature and I can for instance get the server info by just running SSH and the user/IP

I have created the user 'deploy' on my EC2 server, I have ensured it has permissions to write the folders I want (infact I can go in and manually from CL do "mkdir /production/" without problems to create the directory Capistrano is trying to make. Ive searched and searched online and I can't find anything specific to my issue. Most seem to be folder's having the wrong errors.

So I have this in by deploy.rb

set :user, "deploy"
set :use_sudo, false
set :deploy_via, :remote_cache
set :copy_exclude, [".git", ".gitmodules", ".DS_Store", ".gitignore"]
set :keep_releases, 5

after "deploy:update", "deploy:cleanup"
after "deploy:update_code", "shared:make_shared_dir"
after "deploy:update_code", "shared:make_symlinks"
after "deploy:update_code", "db:make_config"
after "deploy", "memcached:update"

# Pull in the config file
loadFile 'config/config.rb'

and in config

# Customize this file, and then rename it to config.rb

set :application, "myapp"
set :repository,  "git@bitbucket.org:user/mygit.git"
set :scm, :git
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`

# Using Git Submodules?
set :git_enable_submodules, 1

# This should be the same as :deploy_to in production.rb
set :production_deploy_to, '/var/www/vhost/i-16852366/production/'

# The domain name used for your staging environment
set :staging_domain, 'stage.domain.com'

# Database
# Set the values for host, user, pass, and name for both production and staging.
set :wpdb do
    :production => {
        :host     => 'user.us-east-1.rds.amazonaws.com',
        :user     => 'user',
        :password => 'pass',
        :name     => 'name',
    :staging => {
        :host     => 'user.us-east-1.rds.amazonaws.com',
        :user     => 'user',
        :password => 'pass',
        :name     => 'name2',

 # You're not done! You must also configure production.rb and staging.rb

and finally for production

# This file is only loaded for the production environment
# Customize it and rename it as production.rb

# Where should the site deploy to?
set :deploy_to, '/var/www/vhost/i-16852366/production/'

 # Now configure the servers for this environment


 # role :web, "your web server IP address or hostname here"
 # role :web, "second web server here"
 # role :web, "third web server here, etc"


 # If your web servers are the same as your memcached servers,
 # comment out all the "role" lines and use "server" lines:

server "", :web, :memcached

But when I try 'cap deploy:setup' or 'cap deploy:check' it can't write to folders I can create from command prompt with the deploy user

servers: [""]
[] executing command
** [out ::] mkdir: cannot create directory `/var/www/vhost': Permission denied
** [out ::] mkdir: cannot create directory `/var/www/vhost': Permission denied
** [out ::] mkdir: cannot create directory `/var/www/vhost': Permission denied
command finished in 600ms
failed: "sh -c 'mkdir -p /var/www/vhost/i-16852366/production/ /var/www/vhost/i-    16852366/production/releases /var/www/vhost/i-16852366/production/shared &&  chmod g+w     /var/www/vhost/i-16852366/production/ /var/www/vhost/i-16852366/production/releases    /var/www/vhost/i-16852366/production/shared'" on

Any ideas? Is it due to the .tem file not being used? I can't find a tutorial that shows how to use it if so.

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.