1

I am using Capistrano for deploying a Rails app to Amazon EC2. In the deploy files, I have following credentials for connecting to Amazon EC2:

set :user, "bitnami"
#set :user, "root"
server "ec2-XX-XXX-XXX-XX.compute-1.amazonaws.com", :app, :web, :db, :primary => true
ssh_options[:keys] = ["/Users/ada/my_amazon_ec2.pem"]

When I run cap deploy:setup and cap deploy:check, I get following:

The following dependencies failed. Please check them and try again:
--> You do not have permissions to write to `/www/myapp'. (ec2-XX-XXX-XXX-XX.compute-1.amazonaws.com)
--> You do not have permissions to write to `/www/myapp/releases'. (ec2-XX-XXX-XXX-XX.compute-1.amazonaws.com)

How's that possible? I am able to connect via SSH to EC2 as the user bitnami, but when I try it as the user root, I get the message that I should use the bitnami user for login and the connection is closed.

If I try to change in the deploy files change the bitnami user for root, the whole deployment process is ok, but then when I log in through SSH (as the bitnami user) to EC2, I don't see any files that should be deployed, the final directory is just empty.

What is wrong in this case?

Thank you so much

4

4 回答 4

1
sudo chown -R <user> <folder path>

成功了。用户不是文件夹的所有者,因此上限检查会引发错误。

于 2013-07-22T10:00:07.483 回答
0

Do you have the /www/myapp directory already created and does bitnami user have writing permissions there?

Let's assume your application is called "myapp123" and you want to deploy it to /opt/bitnami/apps/myapp123.

Create application directory and set proper permissions:

mkdir -p /opt/bitnami/apps/myapp123
chown -R bitnami /opt/bitnami/apps/myapp123

Add the following options to your deployment config file:

set :application, "myapp123"
set :deploy_to, "/opt/bitnami/apps/#{application}"

Are you going to use Phussion Passenger? In this case you will also need to add the following to the Capistrano config:

namespace :deploy do
  task :start do ; end
  task :stop do ; end
  task :restart, :roles => :app, :except => { :no_release => true } do
    run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
  end
end

Which BitNami AMI do you use?

于 2013-05-02T14:31:41.323 回答
0

Do you have this:

ssh_options[:auth_methods] = ["publickey"]
于 2013-05-05T03:14:52.837 回答
0

Bitnami 堆栈通常有默认的 webroot 在

/opt/bitnami/apache2/htdocs

尝试写入该文件夹(使用 bitnami 用户)。

如果您想将 webroot 更改为另一个目录,您需要创建目录并设置适当的权限,并告诉 apache 您已经更改了 web 根目录(单击以获取有关如何执行此操作的更多信息)。

如果您在创建目录或应用权限时遇到问题,请在命令前加上sudolike sudo mkdir www

于 2013-05-02T15:23:15.667 回答