aws / aws-codedeploy-agent

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

CodeDeploy agent is not supporting ruby v3.0.1 #301

Closed charusat09 closed 1 year ago

charusat09 commented 3 years ago

When I tried to install codedeploy agent on my server:

$ bundle install
Fetching gem metadata from http://rubygems.org/...........
Resolving dependencies...
Bundler found conflicting requirements for the Ruby version:
  In Gemfile:
    Ruby

    aws_codedeploy_agent was resolved to 1.3.2, which depends on
      Ruby (~> 2.0)

Ruby (~> 2.0), which is required by gem 'aws_codedeploy_agent', is not
available in the local ruby installation
$ ruby -v
ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-linux]

We are using Rails v6 and Ruby v3.0.1.

rromanchuk commented 3 years ago

@charusat09 i'm going to go down the rabbit hole fork and bump this project 3.0.1 and see how far i can get in my staging env

rromanchuk commented 3 years ago

tracking here https://github.com/rromanchuk/aws-codedeploy-agent/pull/1

charusat09 commented 2 years ago

@rromanchuk Will you please submit your PR to this project? Thanks.

OmriSama commented 2 years ago

So the agent STILL doesn't support Ruby 3?

rromanchuk commented 2 years ago

@OmriSama i've been using ansible/system manager to provision this as a standard systemd service using the same rbenv ruby 3.1.0 environment the rest of my production uses, without an issue. Wanted to make sure there were no major runtime blockers for the agent source on its own. a lot of the complexity here is just cross platform distribution

Another motivation was to get rid of the system ruby dependency, which really is just minor changes to the service config https://github.com/aws/aws-codedeploy-agent/blob/master/init.d/codedeploy-agent.service

Let me at least publish an example of what i am doing. I was thinking about maybe how adding a new install type https://github.com/aws/aws-codedeploy-agent/blob/master/bin/install#L478 to offer rbenv/custom install, which is really just a user supplied path, instead of relying on system packagers, which will consistently always drag many versions behind a modern ruby deployment.

sebastianreloaded commented 2 years ago

I'm trying to use the codedeploy agent with Ubuntu 22.04, but there seems to be no way to achieve that.

  1. The codedeploy package checks for ruby 2.x: Dependency is not satisfiable: ruby2.0|ruby2.1|ruby2.2|ruby2.3|ruby2.4|ruby2.5|ruby2.6|ruby2.7

  2. I can't install ruby 2.7, because it is not compatible with OpenSSL 3.0

So there is no way to use codedeploy on Ubuntu 22.04 atm, except maybe package my own codedeploy package...

OmriSama commented 2 years ago

CodeDeploy should really embed its own Ruby, like Chef does.

philstrong commented 2 years ago

We should look into this

On Tue, May 3, 2022 at 12:40 PM Omri Gabay @.***> wrote:

CodeDeploy should really embed its own Ruby, like Chef does.

— Reply to this email directly, view it on GitHub https://github.com/aws/aws-codedeploy-agent/issues/301#issuecomment-1116308209, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAUCBCMT2HWA4XNKNCUFG3VIFJJRANCNFSM5AVFUNOA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

fleaz commented 2 years ago

It's "funny" that every two years I end up in this issue tracker because the Codedeploy agent is apparently an unloved child to AWS. Release of 18.04: broken (#158), Release of 20.04: broken (#264), Release of 22.04: broken (this issue).

I really can't wrap my head around how such a fundamental* piece of software can be such a trash fire for years when released by a multi-billion dollar company. This repo once again hasn't seen a commit for 10 months now :(

Sorry for all the negativity in most of my comments in this repo, but it's really frustrating when you have to work with this every day and run into the same walls every Ubuntu release :(

* Or am I one of the last 5 persons on earth that aren't using containers and still rely on Codedeploy?

OmriSama commented 2 years ago

It's "funny" that every two years I end up in this issue tracker because the Codedeploy agent is apparently an unloved child to AWS. Release of 18.04: broken (#158), Release of 20.04: broken (#264), Release of 22.04: broken (this issue).

I really can't wrap my head around how such a fundamental* piece of software can be such a trash fire for years when released by a multi-billion dollar company. This repo once again hasn't seen a commit for 10 months now :(

Sorry for all the negativity in most of my comments in this repo, but it's really frustrating when you have to work with this every day and run into the same walls every Ubuntu release :(

  • Or am I one of the last 5 persons on earth that aren't using containers and still rely on Codedeploy?

You are not alone, my friend.

Although, you could still be using CodeDeploy even if you did use containers!

rromanchuk commented 2 years ago

@philstrong I was thinking about maybe a BYOB(inary) solution, something simple like passing --binary-path. The cross platform requirements are what makes this challenging. Apt and Amazon Linux 2 are always going to be 5 years behind, so there would never be a case where the daemon would be able to use the same production ruby binary.

alexekorn commented 2 years ago

I've verified a successful installation and deployment, using a similar process to 20.04's required installation, where you repackage the .deb to require ruby3.0 instead of 2.x:

cd /tmp
wget https://aws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com/releases/codedeploy-agent_1.3.2-1902_all.deb
mkdir codedeploy-agent_1.3.2-1902_ubuntu22
dpkg-deb -R codedeploy-agent_1.3.2-1902_all.deb codedeploy-agent_1.3.2-1902_ubuntu22
sed 's/Depends:.*/Depends:ruby3.0/' -i ./codedeploy-agent_1.3.2-1902_ubuntu22/DEBIAN/control
dpkg-deb -b codedeploy-agent_1.3.2-1902_ubuntu22/
dpkg -i codedeploy-agent_1.3.2-1902_ubuntu22.deb

You will also need to install ruby-webrick via apt/yum/etc, since it is no longer included by default in Ruby 3.

And afterward, voila:

$ systemctl list-units --type=service | grep codedeploy
  codedeploy-agent.service                       loaded active running LSB: AWS CodeDeploy Host Agent

(It sure feels like CodeDeploy is abandoned/deprecated. Or, if not, it's been the biggest issue for our Ubuntu upgrades the last two times. Given this experience, I'll be looking for a less janky way to deploy.)

EDITED to add information about webrick, now that I've verified a successful deployment.

moosthuizen42 commented 2 years ago

Expanding on the answer above, here is a full script. Massive thank you to @alexekorn. This script essentially replaces all the intructions in the official documentation (Install the CodeDeploy agent for Ubuntu Server).

#!/bin/bash
# This installs the CodeDeploy agent and its prerequisites on Ubuntu 22.04.

sudo apt-get update
sudo apt-get install ruby-full ruby-webrick wget -y
cd /tmp
wget https://aws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com/releases/codedeploy-agent_1.3.2-1902_all.deb
mkdir codedeploy-agent_1.3.2-1902_ubuntu22
dpkg-deb -R codedeploy-agent_1.3.2-1902_all.deb codedeploy-agent_1.3.2-1902_ubuntu22
sed 's/Depends:.*/Depends:ruby3.0/' -i ./codedeploy-agent_1.3.2-1902_ubuntu22/DEBIAN/control
dpkg-deb -b codedeploy-agent_1.3.2-1902_ubuntu22/
sudo dpkg -i codedeploy-agent_1.3.2-1902_ubuntu22.deb
systemctl list-units --type=service | grep codedeploy
sudo service codedeploy-agent status

You should see this when installation has been successfully completed:

output

Working on Ubuntu 22.04 (ami-09d56f8956ab235b3) deployed on a t3.nano instance in N. Virginia.

OmriSama commented 2 years ago

Update to CodeDeploy agent has been postponed to end of June: https://github.com/aws/aws-codedeploy-agent/issues/318#issuecomment-1142632801

wbelk commented 2 years ago

@moosthuizen42 thanks for this, worked perfectly, had a time finding this

mpdude commented 2 years ago

So there is no code issue/compatibility issue per se, only the question of how to package this to make it installable on different Debian/Ubuntu/… distros?

wbelk commented 2 years ago

@mpdude that is my recent experience, yes. once installed properly works as expected.

trunov commented 2 years ago

@alexekorn Thank you so much ! I've been struggling with this for one day.

philstrong commented 1 year ago

Agent 1.4 will be out soon. The version of the agent following that will support Ruby 3. This may need a major version bump to agent 2.0 as it will not support Ruby 2. The team will also look into including our own version of isolated Ruby.

The agent is anything but abandoned. We now have a dedicated team just focused on it and host deployments.

On Sun, May 15, 2022 at 7:08 PM Alex Korn @.***> wrote:

I haven't actually verified a full deployment using the agent, but I was able to get it installed, using a similar process to 20.04's required installation https://github.com/aws/aws-codedeploy-agent/issues/239#issuecomment-622630774, where you repackage the .deb to require ruby3.0 instead of 2.x:

cd /tmp wget https://aws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com/releases/codedeploy-agent_1.3.2-1902_all.deb mkdir codedeploy-agent_1.3.2-1902_ubuntu22 dpkg-deb -R codedeploy-agent_1.3.2-1902_all.deb codedeploy-agent_1.3.2-1902_ubuntu22 sed 's/Depends:.*/Depends:ruby3.0/' -i ./codedeploy-agent_1.3.2-1902_ubuntu22/DEBIAN/control dpkg-deb -b codedeploy-agent_1.3.2-1902_ubuntu22/ dpkg -i codedeploy-agent_1.3.2-1902_ubuntu22.deb

And afterward, voila:

$ systemctl list-units --type=service | grep codedeploy codedeploy-agent.service loaded active running LSB: AWS CodeDeploy Host Agent

(It sure feels like CodeDeploy is abandoned/deprecated. Or, if not, it's been the biggest issue for our Ubuntu upgrades the last two times. Given this experience, I'll be looking for a less janky way to deploy.)

— Reply to this email directly, view it on GitHub https://github.com/aws/aws-codedeploy-agent/issues/301#issuecomment-1127080073, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAUCBG3DREJTHMTNXGZAC3VKF7WFANCNFSM5AVFUNOA . You are receiving this because you were mentioned.Message ID: @.***>

yasircodingcrafts commented 1 year ago

Thanks @moosthuizen42

For anyone who doesn't know how to do anything like me, here's the noob steps:

  1. Enter the following command: touch install-code-deploy-ubuntu22-ec2.sh

  2. Enter the following command: cat > install-code-deploy-ubuntu22-ec2.sh

  3. Paste the following:

    #!/bin/bash
    # This installs the CodeDeploy agent and its prerequisites on Ubuntu 22.04.
    sudo apt-get update
    sudo apt-get install ruby-full ruby-webrick wget -y
    cd /tmp
    wget https://aws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com/releases/codedeploy-agent_1.3.2-1902_all.deb
    mkdir codedeploy-agent_1.3.2-1902_ubuntu22
    dpkg-deb -R codedeploy-agent_1.3.2-1902_all.deb codedeploy-agent_1.3.2-1902_ubuntu22
    sed 's/Depends:.*/Depends:ruby3.0/' -i ./codedeploy-agent_1.3.2-1902_ubuntu22/DEBIAN/control
    dpkg-deb -b codedeploy-agent_1.3.2-1902_ubuntu22/
    sudo dpkg -i codedeploy-agent_1.3.2-1902_ubuntu22.deb
    systemctl list-units --type=service | grep codedeploy
  4. Press ctrl + d

  5. Enter the following command: chmod u+x install-code-deploy-ubuntu22-ec2.sh

  6. Enter the following command: ./install-code-deploy-ubuntu22-ec2.sh

  7. Enter the following command: sudo service codedeploy-agent status

pysonic commented 1 year ago

Expanding on the answer above, here is a full script. Massive thank you to @alexekorn. This script essentially replaces all the intructions in the official documentation (Install the CodeDeploy agent for Ubuntu Server).

#!/bin/bash
# This installs the CodeDeploy agent and its prerequisites on Ubuntu 22.04.

sudo apt-get update
sudo apt-get install ruby-full ruby-webrick wget -y
cd /tmp
wget https://aws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com/releases/codedeploy-agent_1.3.2-1902_all.deb
mkdir codedeploy-agent_1.3.2-1902_ubuntu22
dpkg-deb -R codedeploy-agent_1.3.2-1902_all.deb codedeploy-agent_1.3.2-1902_ubuntu22
sed 's/Depends:.*/Depends:ruby3.0/' -i ./codedeploy-agent_1.3.2-1902_ubuntu22/DEBIAN/control
dpkg-deb -b codedeploy-agent_1.3.2-1902_ubuntu22/
sudo dpkg -i codedeploy-agent_1.3.2-1902_ubuntu22.deb
systemctl list-units --type=service | grep codedeploy
sudo service codedeploy-agent status

You should see this when installation has been successfully completed:

output

Working on Ubuntu 22.04 (ami-09d56f8956ab235b3) deployed on a t3.nano instance in N. Virginia.

thank you!!!

iramello commented 1 year ago

CodeDeploy: one of the worst products within AWS. If you need an update, they take years. Minor mod on the script above to isolate version and ease the task on upgrades:

#!/bin/bash

# Installs CodeDeploy agent and its prerequisites on Ubuntu 22.04 given AWS CodeDeploy team doesn't exist
# https://docs.aws.amazon.com/codedeploy/latest/userguide/codedeploy-agent.html#codedeploy-agent-version-history
CODEDEPLOY_VERSION=1.4.1-2244

sudo apt update
sudo apt install ruby-full ruby-webrick wget -y

cd /tmp
wget https://aws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com/releases/codedeploy-agent_"$CODEDEPLOY_VERSION"_all.deb
mkdir codedeploy-agent_"$CODEDEPLOY_VERSION"_ubuntu22
dpkg-deb -R codedeploy-agent_"$CODEDEPLOY_VERSION"_all.deb codedeploy-agent_"$CODEDEPLOY_VERSION"_ubuntu22
sed 's/Depends:.*/Depends:ruby3.0/' -i ./codedeploy-agent_"$CODEDEPLOY_VERSION"_ubuntu22/DEBIAN/control
dpkg-deb -b codedeploy-agent_"$CODEDEPLOY_VERSION"_ubuntu22/
sudo dpkg -i codedeploy-agent_"$CODEDEPLOY_VERSION"_ubuntu22.deb

systemctl list-units --type=service | grep codedeploy
sudo systemctl status codedeploy-agent
pixeltrix commented 1 year ago

Just an FYI on this thread that Ruby 2.7 is end-of-life in just over 2 months: https://endoflife.date/ruby

image

alilland commented 1 year ago

ok, regardless of EOL for 2.7.x

what do I do right now if im using ubuntu 22 and ruby 2.7.7? Upgrading to 3.x is not a possibility today for my codebase

wbelk commented 1 year ago

@alilland Switch to debian, and write your own automation using systemd and bash. I had massive problems with both code deploy and ubuntu 22. Code deploy was grenading my ec2 server randomly while trying to spin up a new process. Removed code deploy and no more issues. The debian switch was for other (i think mostly unrelated) reasons, but snap and appArmor were causing so many stupid headaches, absolutely not worth it. Just my experience, your mileage may vary. I ended up with the strong feeling I would have saved much time and energy just doing my own from the start, but I thought oh cool, codeDeploy...nope.

wbelk commented 1 year ago

CodeDeploy: one of the worst products within AWS

Seems like facts

alilland commented 1 year ago

I dont like this option, but what If I have rvm installed and I keep two rubies on the machine? 3.0.2 as the default for code deploy agent, and 2.7 for my application?

edit: I moved my question to its own issue https://github.com/aws/aws-codedeploy-agent/issues/346

SkullDesperados commented 1 year ago

Hello, I allow myself to add solution for people who use RockyLinux or Centos 9. I haven't found solution to force ruby 3 with CodeDeploy Agent, but I have found solution to have ruby 2.7 and openssl 1.1 on updated environnement with OpenSSL 3.

Install RVM packages managers for ruby
$> gpg2 --keyserver hkp://keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
$> dnf install curl gcc bzip2 openssl-devel libffi-devel readline-devel zlib-devel ncurses-devel which
$> curl -sSL https://get.rvm.io | bash -s stable
$> bash

Install OpenSSL 1.1 and Ruby 2.7 with RVM
$> rvm pkg install openssl
$> rvm install ruby-2.7 --with-openssl-dir=/usr/local/rvm/usr

Install AWS CodeDeploy Agent
$> dnf install chkconfig wget
$> mkdir /opt/aws-codedeploy 
$> cd /opt/aws-codedeploy
$> wget https://aws-codedeploy-eu-west-1.s3.eu-west-1.amazonaws.com/latest/install
$> chmod +x ./install
$> ./install auto
$> service codedeploy-agent status

I hope that will help you

yacinehmito commented 1 year ago

CodeDeploy cannot be installed with Systems Manager on AL2022 for the same reason. It's a blocker.

karlkatzke commented 1 year ago

Any status update on an official fix? June sure was a long time ago, and Ruby 2.7 is EOL in a month.

rnhurt commented 1 year ago

We are in the process of upgrading our Rails apps to Ruby 3.0.5 and this is a huge blocker for us. It's inconceivable that this agent doesn't support a more updated version of Ruby! 😡

NOTE: I was actually able to remove the Ruby checks and it seems like the agent installed correctly. However, I'm pretty sure that the auto-update function will try to update to the next version which will probably screw up somewhere/somehow.

philstrong commented 1 year ago

The next version of the agent will support Ruby 3. We’re sorry for the delay in this support.

On Mon, Feb 20, 2023 at 4:26 PM Richard Hurt @.***> wrote:

We are in the process of upgrading our Rails apps to Ruby 3.0.5 and this is a huge blocker for us. It's inconceivable that this agent doesn't support a more updated version of Ruby! 😡

NOTE: I was actually able to remove the Ruby checks and it seems like the agent installed correctly. However, I'm pretty sure that the auto-update function will try to update to the next version which will probably screw up somewhere/somehow.

— Reply to this email directly, view it on GitHub https://github.com/aws/aws-codedeploy-agent/issues/301#issuecomment-1437565012, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAUCBD53HFW3JQQRB7UOJLWYPOQFANCNFSM5AVFUNOA . You are receiving this because you were mentioned.Message ID: @.***>

rnhurt commented 1 year ago

The next version of the agent will support Ruby 3. We’re sorry for the delay in this support.

That's great news! Any thoughts on when the next version might appear? I don't even really need any new features or bug fixes, just adding Ruby 3.x support would be enough. :grin:

philstrong commented 1 year ago

Target is to begin shipping in early March and complete all commercial regions by mid March.

sasha-id commented 1 year ago

Amazon Linux 2022 script, with 3.1, 3.2 support

#!/bin/bash

# Installs CodeDeploy agent and its prerequisites on Ubuntu 22.04 given AWS CodeDeploy team doesn't exist
# https://docs.aws.amazon.com/codedeploy/latest/userguide/codedeploy-agent.html#codedeploy-agent-version-history
CODEDEPLOY_VERSION=1.4.1-2244

cd /tmp
wget https://aws-codedeploy-ap-southeast-2.s3.ap-southeast-2.amazonaws.com/releases/codedeploy-agent-"$CODEDEPLOY_VERSION".noarch.rpm
mkdir codedeploy-agent_"$CODEDEPLOY_VERSION"_al2022
rpm2cpio codedeploy-agent-"$CODEDEPLOY_VERSION".noarch.rpm |  (cd codedeploy-agent_"$CODEDEPLOY_VERSION"_al2022; cpio -idmv)
sudo cp -r codedeploy-agent_"$CODEDEPLOY_VERSION"_al2022/etc /
sudo cp -r codedeploy-agent_"$CODEDEPLOY_VERSION"_al2022/usr /

sudo git clone https://github.com/brandinfluencegroup/aws-codedeploy-agent.git /opt/codedeploy-agent

sudo dnf install chkconfig -y

sudo systemctl enable codedeploy-agent
sudo systemctl start codedeploy-agent
systemctl list-units --type=service | grep codedeploy
sudo systemctl status codedeploy-agent
karlkatzke commented 1 year ago

I have it on good authority that codedeploy agent version 1.5 is in QA and will be released within a few weeks.

sasha-id commented 1 year ago

I have it on good authority that codedeploy agent version 1.5 is in QA and will be released within a few weeks.

few weeks for ruby 3.0, few months for 3.1 and few years for 3.2 🤦

t0shiii commented 1 year ago

I have it on good authority that codedeploy agent version 1.5 is in QA and will be released within a few weeks.

Confirmed. 1.5 rollout is imminent and will add support for Ruby 3.0 along with Ubuntu 22.04 LTS support. Release notes and official docs coming soon.

iramello commented 1 year ago

I have it on good authority that codedeploy agent version 1.5 is in QA and will be released within a few weeks.

Confirmed. 1.5 rollout is imminent and will add support for Ruby 3.0 along with Ubuntu 22.04 LTS support. Release notes and official docs coming soon.

Great to see it after only 27 months for ruby 3 and 11 months for Jammy! Thanks! <3

rnhurt commented 1 year ago

This article is apropos - https://www.lastweekinaws.com/blog/AWS-is-Asleep-at-the-Lambda-Wheel/

t0shiii commented 1 year ago

FYI: as mentioned in #349 1.5.0 is live. Installation instructions are linked in the announcement.

sasha-id commented 1 year ago

as predicted, no 3.1 and 3.2 support

philstrong commented 1 year ago

as predicted, no 3.1 and 3.2 support 😄

few weeks for ruby 3.0, few months for 3.1 and few years for 3.2

I promise it won't be that long. We're spinning up tests now for 3.1 and 3.2. 1.5.1 will have that support with good regression tests going forward.

alboyadjian commented 1 year ago

1.5 doesn't seem to be working under ruby3.1 for me. I'm getting the same issue as reported here https://github.com/aws/aws-codedeploy-agent/issues/352

rnhurt commented 1 year ago

1.5 doesn't seem to be working under ruby3.1 for me. I'm getting the same issue as reported here #352

I think v1.5 only supports Ruby 3.0.x, not Ruby v3.1.x (or v3.2.x).

e200 commented 1 year ago

AWS is forcing us to switch to Fargate.

yacinehmito commented 1 year ago

AWS is forcing us to switch to Fargate.

@e200 Just released Ruby 3.2 support. I don't think there's anything left to be complaining about.

mwjones-aws commented 1 year ago

Correct, CodeDeploy Agent 1.6.0 adds support for Ruby 3.1 and 3.2. It has been deployed to most commercial AWS regions as of this comment.

Please track its rollout on #360

e200 commented 1 year ago

AWS is forcing us to switch to Fargate.

@e200 Just released Ruby 3.2 support. I don't think there's anything left to be complaining about.

My region is eu-south-2, that’s why.

t0shiii commented 1 year ago

My region is eu-south-2, that’s why.

@e200 just wanted to let you know that CodeDeploy Agent 1.6.0 is available in all commercial regions now including eu-south-2