3

I've recently converted over to Amazon's Elastic Beanstalk which has been great but I have one problem I haven't been able to fix or find a decent solution to.

When deploying via GIT with $ git aws.push

My files are deployed but all my folders and files do not have the correct permissions. Currently running Win 8 with xampp for local development. For example on a recent WordPress deployment, all my folders were 777 once deployed to beanstlak. It is an NTFS partition the files are in too.

It is easy enough to SSH in and run:

$  sudo su
$  find /var/www/html/ -type d -exec chmod 755 {} \;
$  find /var/www/html/ -type f -exec chmod 644 {} \;

However I'd rather fix my permissions before upload however I don't think this is possible with Windows. I'm sure I can setup a script or some type of service hook to run these on deployment but I was hoping there may be an easier way.

Any insight from the SO community on setting windows file permissions to match Apache's?

4

2 回答 2

7

在您的代码被提取到您的实例之后但在它被视为“部署”之前,设置一个挂钩来修复权限实际上并不难。您可以创建一个名为 的文件.ebextensions/00permissions.conifg,只要它位于带有扩展名的正确文件夹中,名称并不重要.config- 配置脚本按字母顺序执行。内容如下:

container_commands:
  00fix_permissions_dirs:
    command: "find . -type d -exec chmod 755 {} \;"
    ignoreErrors: true
  01fix_permissions_files:
    command: "find . -type f -exec chmod 644 {} \;"
    ignoreErrors: true

注意 a 的默认目录container_command是部署文件已被提取到的目录,因此无需设置显式路径。

您可以在 Elastic Beanstalk 文档中查看有关可以在实例上运行的命令种类的更多信息。

于 2013-05-19T10:26:12.460 回答
0

container_commands:00fix_permissions_dirs:命令:“find /var/app/ondeck -type d -exec chmod 755 {} \;” ignoreErrors: true 01fix_permissions_files: command: "find /var/app/ondeck -type f -exec chmod 644 {} \;" 忽略错误:真

这将更改应用程序的文件权限。目前,当应用程序完全部署时,无法运行命令,但您可以利用“ondeck”文件夹,这是 beanstalk 在部署应用程序文件之前放置应用程序文件的文件夹。

于 2014-03-25T16:52:11.220 回答