2014-01-19 39 views
0

所以我使用WP-Stack并尝试从本地机器部署到EC2实例。Capistrano 2,SSH,Mac,EC2 - 写入权限被拒绝

伊夫遵循Capistrano酒店的SSH文学,我可以例如通过只是运行SSH和用户/ IP

我已经创建的用户我EC2服务器上的“部署”获取服务器信息,我已确保它有权限写我想要的文件夹(事实上,我可以进去,并从CL手动进入“mkdir/production /”,没有任何问题来创建目录Capistrano正在尝试创建.Ive在网上搜索和搜索,我无法找到任何特定于我的问题。大多数似乎是文件夹的错误。

所以我有这个由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' 

和配置

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

set :application, "myapp" 
set :repository, "[email protected]: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', 
    } 
} 
end 

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

终于为生产

# 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 

# OPTION 1 

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

# OPTION 2 

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

server "54.242.153.162", :web, :memcached 

但是当我尝试“帽部署:安装”或“帽部署:检查”无法写入文件夹我可以通过部署用户的命令提示符创建

servers: ["54.242.153.162"] 
[54.242.153.162] executing command 
** [out :: 54.242.153.162] mkdir: cannot create directory `/var/www/vhost': Permission denied 
** [out :: 54.242.153.162] mkdir: cannot create directory `/var/www/vhost': Permission denied 
** [out :: 54.242.153.162] 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 54.242.153.162 

任何想法?是否由于.tem文件未被使用?如果是这样的话,我找不到说明如何使用它的教程。

回答

0

通过SSH访问EC2实例使用常规用户 - 例如,对于Amazon AMI,您将以ec2用户身份登录。

/var/www属于root,所以ec2-user将无法创建子目录。

我改变此行真正的开始:

set :use_sudo, false 
+0

我的图像使用root作为主要用户。我没有使用亚马逊AMI,我使用animo来wordpress Nginx之一,http://megumi-cloud.com/category/blog/ 我创建了一个部署用户,并声明它可以ssh在很好并创建它在Web根目录中拥有的目录,我的用户设置没有任何问题。哦,我试图将sudo虚假为真,但仍然无效。 – Daniel

+0

/var/www上有什么权限? – chris