{"action":"created","issue":{"url":"https://api.github.com/repos/aws/aws-codedeploy-agent/issues/42","labels_url":"https://api.github.com/repos/aws/aws-codedeploy-agent/issues/42/labels{/name}","comments_url":"https://api.github.com/repos/aws/aws-codedeploy-agent/issues/42/comments","events_url":"https://api.github.com/repos/aws/aws-codedeploy-agent/issues/42/events","html_url":"https://github.com/aws/aws-codedeploy-agent/pull/42","id":122343498,"number":42,"title":"Add support for running hooks with sudo","user":{"login":"brettweavnet-intuit","id":6727884,"avatar_url":"https://avatars.githubusercontent.com/u/6727884?v=3","gravatar_id":"","url":"https://api.github.com/users/brettweavnet-intuit","html_url":"https://github.com/brettweavnet-intuit","followers_url":"https://api.github.com/users/brettweavnet-intuit/followers","following_url":"https://api.github.com/users/brettweavnet-intuit/following{/other_user}","gists_url":"https://api.github.com/users/brettweavnet-intuit/gists{/gist_id}","starred_url":"https://api.github.com/users/brettweavnet-intuit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brettweavnet-intuit/subscriptions","organizations_url":"https://api.github.com/users/brettweavnet-intuit/orgs","repos_url":"https://api.github.com/users/brettweavnet-intuit/repos","events_url":"https://api.github.com/users/brettweavnet-intuit/events{/privacy}","received_events_url":"https://api.github.com/users/brettweavnet-intuit/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-12-15T19:13:48Z","updated_at":"2016-01-11T21:48:36Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/aws/aws-codedeploy-agent/pulls/42","html_url":"https://github.com/aws/aws-codedeploy-agent/pull/42","diff_url":"https://github.com/aws/aws-codedeploy-agent/pull/42.diff","patch_url":"https://github.com/aws/aws-codedeploy-agent/pull/42.patch"},"body":"Code Deploy,\r\n\r\nThis PR is meant to open a conversation around adding support for running hooks with sudo.  We have a requirement to run commands as sudo to provide additional logs to our operation center. There is also a secondary to desire to run the code deploy agent as a non-root user (if possible).\r\n\r\nYou can add now add sudo to hooks to have them executed with sudo:\r\n\r\n```yaml\r\nversion: 0.0\r\nos: linux\r\nfiles:\r\n  - source: /index.html\r\n    destination: /var/www/html/\r\nhooks:\r\n  BeforeInstall:\r\n    - location: scripts/install_dependencies\r\n      timeout: 300\r\n      runas: root\r\n      sudo: true\r\n    - location: scripts/start_server\r\n      timeout: 300\r\n      runas: root\r\n      sudo: true\r\n  ApplicationStop:\r\n    - location: scripts/stop_server\r\n      timeout: 300\r\n      runas: root\r\n      sudo: true\r\n```\r\n\r\nThis has also been tested to allow for running the code deploy agent as a non root user (https://github.com/aws/aws-codedeploy-agent/issues/5) on RHEL 7 via the following process:\r\n\r\n```\r\nuseradd deploy\r\nyum install ruby\r\naws s3 cp s3://aws-codedeploy-us-west-2/latest/codedeploy-agent.noarch.rpm . --region us-west-2\r\nrpm -ivh codedeploy-agent.noarch.rpm\r\nchown -R deploy:deploy /var/log/aws/codedeploy-agent /opt/codedeploy-agent\r\nchmod 755 /var/log/aws\r\n/etc/init.d/codedeploy-agent restart\r\n```\r\n\r\nPlease provide feedback / guidance on the approach and appropriateness of this change."},"comment":{"url":"https://api.github.com/repos/aws/aws-codedeploy-agent/issues/comments/170701270","html_url":"https://github.com/aws/aws-codedeploy-agent/pull/42#issuecomment-170701270","issue_url":"https://api.github.com/repos/aws/aws-codedeploy-agent/issues/42","id":170701270,"user":{"login":"yubangxi","id":11097990,"avatar_url":"https://avatars.githubusercontent.com/u/11097990?v=3","gravatar_id":"","url":"https://api.github.com/users/yubangxi","html_url":"https://github.com/yubangxi","followers_url":"https://api.github.com/users/yubangxi/followers","following_url":"https://api.github.com/users/yubangxi/following{/other_user}","gists_url":"https://api.github.com/users/yubangxi/gists{/gist_id}","starred_url":"https://api.github.com/users/yubangxi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yubangxi/subscriptions","organizations_url":"https://api.github.com/users/yubangxi/orgs","repos_url":"https://api.github.com/users/yubangxi/repos","events_url":"https://api.github.com/users/yubangxi/events{/privacy}","received_events_url":"https://api.github.com/users/yubangxi/received_events","type":"User","site_admin":false},"created_at":"2016-01-11T21:48:36Z","updated_at":"2016-01-11T21:48:36Z","body":"@brettweavnet-intuit I just did the review, the code change overall looks good to me. I will need to talk with the team about how we want to support this feature. I will post a update here soon.\r\n\r\nThanks!"}}