2014-01-05 32 views

回答

1

澄清部署過程:AWS Elastic Beanstalk上沒有git服務器。 aws.push僅僅是shell命令的包裝器,它從本地存儲庫創建歸檔並將歸檔文件上載到Elastic Beanstalk服務器。它是爲了方便而製作的。

Elastic Beanstalk實例上的默認用戶是ec2-user,具有相同的組ec2-user

您可以.ebextensions/appname.config

語法創建自己的groupsusers用實例進行定製機制:

users: 
    <name of user>: 
    groups: 
     - <name of group> 
    uid: "<id of the user>" 
    homeDir: "<user's home directory>" 

groups: 
    <name of group>: 
    <name of group>: 
    gid: "<group id>" 

例子:

users: 
    myuser: 
    groups: 
     - group1 
     - group2 
    uid: "50" 
    homeDir: "/tmp" 

groups: 
    groupOne: 
    groupTwo: 
    gid: "45" 

的情況下定製的附加信息中可以找到Customizing the Software on EC2 Instances Running Linux

使用commands來操作EC2實例上的文件/目錄,以及container commands來操作您的應用程序文件/目錄。

container_commands: 
    10-change-owner: 
     command: "chown myuser tmpfile" 

    20-change-group: 
     command: "chown :mygroup tmpfile" 
+0

好的,但我如何使用git推送到ElasticBeanstalk的文件屬於我選擇的特定用戶而不是「webapp」,這似乎是默認情況下的情況? 換句話說,在使用'git aws.push'時如何利用'.ebextensions/appname.config'創建的用戶? –

+0

@AlexanderShcheblikin:更新了有關用戶/組的更多信息的答案。 – kukido

+0

現在我的問題是:在每個'git aws.push'之後執行那些chown命令嗎? –