aws / aws-codedeploy-agent

Host Agent for AWS CodeDeploy
https://aws.amazon.com/codedeploy
Apache License 2.0
330 stars 187 forks source link

Add the CodeDeploy agent to the PATH #385

Open nbro10 opened 11 months ago

nbro10 commented 11 months ago

The title only describes one problem. In this issue, I'm reporting several issues.

I've used the instructions here to install the CodeDeploy agent.

(I know this is not the recommended way, but using the AWS System Manager seems more complicated. It's not just one click. You need to associate your EC2 with the AWS System Manager and do other stuff. To me, this looks already too complicated, so I don't even know why this is the recommended way.)

On Ubuntu, it seems that the agent is installed in /opt/codedeploy-agent/bin/codedeploy-agent. However, if we do codedeploy-agent --version we get a codedeploy-agent: command not found, which means we can't directly interact with the agent by just specifying the name, but we need to specify the full path, which is tedious.

Is there any reason why we wouldn't want to add the agent to the PATH? I think the only possible reason not to do this is that, if we decide to remove the agent, we may want to update the PATH. But can't this be done consistently?

The other problem is that /opt/codedeploy-agent/bin/codedeploy-agent --version does not return anything because there's no --version option, which is so weird. It seems that there are only the options to start, stop, etc., the agent/service. I think there could be other options, like ways to flush the logs, clean up old deployments, self-update the agent and also to remove the agent. Btw, why isn't there already a way to install the agent with apt or apt-get?

Another problem with CodeDeploy is that there's no way (apparently) to ignore errors in hooks in the appspec.yml. I really don't understand why this option doesn't at least exist for the ApplicationStop hook, which always fails the first time you're setting a new project. It's so tedious to always have to manual deploy until you get it right. I basically had to do this like 30 times so far because ApplicationStop sometimes fails because of what I've just said.

I've just started to use AWS CodeDeploy, but honestly I was expecting it to be more advanced and simpler to use. It looks unnecessary complicated mostly because it lacks many useful features (e.g. I should just need to do sudo apt install codedeploy-agent to install it, and after that I should be able to do codedeploy-agent --version).

psavides-aws commented 10 months ago

For application stop failures there is an option on create deployment to ignore application stop failures. See: https://docs.aws.amazon.com/cli/latest/reference/deploy/create-deployment.html

That setting is available in the console in the "Additional deployment behavior settings" box on the create deployment page.

For installation, we only ever intend to set this up as a daemon, so the best way to start/manage it is through systemctl utility. For example systemctl status codedeploy-agent. When installing through the instructions you linked, the agent systemd service will be automatically enabled and started.

For checking version, the way to do that right now is through cat /opt/codedeploy-agent/.version.