0

我有多个 CodeIgniter 应用程序,我想使用 Amazon OpsWorks 部署这些应用程序,其中包含一个非常标准的“PHP 应用程序服务器”层和一个用于调整权限的自定义配方。问题是部署脚本似乎会自动删除任何current/public/system目录并将其替换为shared/system.

这很烦人,因为所有 CodeIgniter 的文件曾经都在该current/public/system目录中。

任何人都知道如何防止 OpsWorks 创建此符号链接?

谢谢

4

1 回答 1

1

This is not possible UNLESS you create your own modified version of the AWS Cookbook that does this. The specific reason for this is the recipes at : here

A Possible Work around this :

## deploy/before_migrate.rb (in your app repo )

deploy_to = deploy_resource.deploy_to

dirs_to_protect = [ "public" ]
dirs_to_protect.each {|dir| 
    bash "save #{dir}" do
      code <<-EOL
        cp -a #{release_path}/#{dir}/* #{deploy_to}/shared/#{dir} 
      EOL
    end
}

This will save the dirs you need to protect in the shared folder where the symlink is sent to. You can easily change the destination, or just write another hook after the symlink to remove the symlinked directories. etc. Keep in mind that if it's not a default folder, you will need to create it yourself inside the loop.

More about Hooks : Chef Deployment Hooks

于 2014-06-25T22:45:05.670 回答