Ubuntu 22.04 ã«CodeDeployã¨ã¼ã¸ã§ã³ããå ¥ãã
ãã®è¨äºã¯ãUbuntu 22.04 ã§åããã¦ãããã·ã³ã«ãAWSã®CodeDeployã®ã¨ã¼ã¸ã§ã³ããã¤ã³ã¹ãã¼ã«ããæé çã«ã¤ãã¦è¿°ã¹ãè¨äºã§ãã
â»æ°æ¥åã«tweetãã¦ããå
容ãããã°è¨äºã¨ãã¦ã¾ã¨ãã¦è£è¶³ããã ãã®å
容ã§ãã®ã§ãæ¥é ããçè
ã®tweetãè¦ããã¦ããæ¹åãã®æ°è¦ã®æ
å ±ã¯ãããªã«ããã¾ããã
AWS CodeDeploy ã¨ã¯ï¼
éæè¡è åãã®å ¬å¼ãã¼ã¸æ°ãâ¦
AWS CodeDeploy ã¯ãAmazon EC2ãAWS FargateãAWS Lambdaããªã³ãã¬ãã¹ã§å®è¡ããããµã¼ãã¼ãªã©ããã¾ãã¾ãªã³ã³ãã¥ã¼ãã£ã³ã°ãµã¼ãã¹ã¸ã®ã½ããã¦ã§ã¢ã®ãããã¤ãèªååããããã«ããã¼ã¸ãåã®ãµã¼ãã¹ã§ããAWS CodeDeploy ã使ç¨ããã¨ãæ°ããæ©è½ããã°ããç°¡åã«ãªãªã¼ã¹ã§ãã¾ããã¾ããã¢ããªã±ã¼ã·ã§ã³ã®ãããã¤æã®ãã¦ã³ã¿ã¤ã ãåé¿ããã¢ããªã±ã¼ã·ã§ã³ã®è¤éãªã¢ãããã¼ãå¦çã«ã対å¿ãã¾ããããã«ãã½ããã¦ã§ã¢ã®ãããã¤ãèªååã§ããããããã¹ãèµ·ãããããæåæä½ã®å¿ è¦ããªããªãã¾ãããã®ãµã¼ãã¹ã§ã¯ããããã¤ã®ãã¼ãºã«å¿ãã¦ã¹ã±ã¼ã«ã§ãã¾ãã
https://aws.amazon.com/jp/codedeploy/
ã§ãã詳細ã¯技術者向けの公式ページãè¦ã¦æ¬²ããã¨ããã§ãããï¼EC2çãã¿ã¼ã²ããã§ããå ´åã¯ï¼ã¿ã¼ã²ããã®ãã·ã³ã§agentã常é§ããã¦ãããCodeDeployä¸ã§ãããã¤ã®æ示ãåºãã¨ãagentãããã«åå¿ãã¦åãã¦ããããã¤ã®ã¹ã¯ãªãããåããâ¦ã¿ãããªåãã«ãªãã¾ãã
éå»ãã¼ã¸ã§ã³ã®Ubuntuã¸ã®æ£å¼ãªã¤ã³ã¹ãã¼ã«æé
公式ドキュメントã®éãããã°ããããªãã¨ã¤ã³ã¹ãã¼ã«ã§ãã¾ããå°ãªãã¨ã18.04ã¨20.04ã¯ç°¡åã ã£ããããªè¦ããããã¾ãã
Ubuntu 22.04 ã§ã®åé¡
CodeDeploy agent ï¼ã¾ãã¯ãã®ã¤ã³ã¹ãã¼ã©ï¼ã¯ ruby 2.x ã«ä¾åãã¦ããã®ã§ãããUbuntu 22.04 ã® apt
ã§æ®éã«rubyãã¤ã³ã¹ãã¼ã«ãããã¨ããã¨ã3.x ãå
¥ãã¾ããruby 3.x ãå
¥ã£ãç¶æ
㧠CodeDeploy agent ã®ã¤ã³ã¹ãã¼ã©ãåããã¨ãã¨ã©ã¼ã«ãªãã¾ãã
å
·ä½çã«ã¯ã Ubuntu 20.04 åãã®æé ã¨ãã¦æ示ããã¦ãã sudo ./install auto > /tmp/logfile
ãå®è¡ããã¨ãstderrã«ããã°ãã¡ã¤ã«ã«ãä½ãåºåãããªãã¾ã¾ãçµäºã¹ãã¼ã¿ã¹ 1
ã§å³åº§ã«çµäºãã¾ãã
å¤ãUbuntuåãã®æé ã§ãã sudo ./install auto
ãå®è¡ããã¨ãï¼stdoutãªã®ãstderrãªã®ããããã¾ãããï¼ä»¥ä¸ã®ãããªå
容ãåºåããã¦ããã¯ãçµäºã¹ãã¼ã¿ã¹1
ã§çµäºãã¾ãã
I, [2022-10-02T07:01:40.954937 #2149] INFO -- : Starting Ruby version check. E, [2022-10-02T07:01:40.955082 #2149] ERROR -- : Current running Ruby version for root is 3.0.2, but Ruby version 2.x needs to be installed. E, [2022-10-02T07:01:40.955108 #2149] ERROR -- : If you already have the proper Ruby version installed, please either create a symlink to /usr/bin/ruby2.x, E, [2022-10-02T07:01:40.955130 #2149] ERROR -- : or run this install script with right interpreter. Otherwise please install Ruby 2.x for root user. E, [2022-10-02T07:01:40.955150 #2149] ERROR -- : You can get more information by running the script with --help option.
ã¾ããä¸è¨ã§è¨ãã¨ãRuby 2.x å ¥ãã¦ãã£ã¦ããã¡ãã»ã¼ã¸ãªã®ã§ããâ¦ð
ãã®åé¡ã¸ã®å¯¾çã¨ãã¦ã¯ã大ããåãã¦3éãã®ãã®ãèãããã¾ãã
1. agentï¼ã¾ãã¯ãã®ã¤ã³ã¹ãã¼ã©ï¼ã ruby 3.x ã«å¯¾å¿ããã®ãå¾
ã¤ðµ
2. Ubuntu 22.04 ã« ruby 2.x ãå
¥ãã
3. ãã§ãã¯ãããæãã¦ãç¡çç¢ç ruby 3.x ã§åä½ããããã«ãã
ã㤠3.x 対å¿ãããã®ãä¸æãªç¶æ³ã§å¾
ã¤ã¨ããã®ã¯ã¤ããã®ã§ãããã§ã¯æ¤è¨ããªãããã«ãã¾ãããã
ruby 2.x ãã¤ã³ã¹ãã¼ã«ããæ¹æ³ã¯ããã¨ãã°ä»¥ä¸ã®è¨äºã«è©³ç´°ãªè§£èª¬ãããã¾ãã®ã§ããã¡ããã覧ã«ãªãã¨è¯ãã§ãããã
blog.noellabo.jp
ãã ãããããã£ã¦ã¤ã³ã¹ãã¼ã«ãã ruby 2.x ã以ã£ã¦ CodeDeploy Agent ãã¤ã³ã¹ãã¼ã«ã§ãããã¨ã®ç¢ºèªã¯åã£ã¦ããã¾ããã
åæï¼ãã§ãã¯ãããæãã
çè ã¯rubyã«å¼·ã訳ã§ã¯ããã¾ããããruby ã 3.0 ã«ãªãã«ããã£ã¦ breaking change ããããªã«å¤ãã¨ããå°è±¡ã¯ç¡ãã®ã§ããã§ãã¯ãã誤éåãããåãã®ã§ã¯ï¼ã¨æãã¾ããããã¡ãããããã§åãããã¨ãã¦ãåä½ä¿è¨¼ã¯ç¡ãã®ã§ããð
ããã¦ããããã¨æ¤ç´¢ãã¦ããã¨ããã以ä¸ã®ãã㪠StackOverflow ã®è³ªåããã³åçãè¦ã¤ãã¾ããã
stackoverflow.com
ãã£ã¦ãããã¨ã¯ã以ä¸ã®ãããªãã¨ã§ãã
- å¿ è¦ãªãã®ãaptã§ã¤ã³ã¹ãã¼ã«ãã¦ã
- ããã±ã¼ã¸ï¼.debãã¡ã¤ã«ï¼ããã¦ã³ãã¼ããã¦ãã¦ã
- 解åãã¦ã
- ã¡ã¿ãã¼ã¿ã«æ¸ããã¦ããä¾åããã±ã¼ã¸ã
ruby3.0
ï¼aptã§rubyãå ¥ããã¨ãã®ããã±ã¼ã¸å称ï¼ã«æ¸ãæãã¦ã - ããã±ã¼ã¸ãå度æ§ç¯ãã¦ã
- ã¤ã³ã¹ãã¼ã«ãã¦ã
- åä½ç¢ºèªãã
以ä¸ã¯ãä¸è¨StackOverflowã®åçã«å¯¾ããè£è¶³ã§ãã
å¿ è¦ãªãã®ãaptã§ã¤ã³ã¹ãã¼ã«
å
ã®ã³ãã³ãã§ã¯ ruby-webrick
ãã¤ã³ã¹ãã¼ã«ããããã«æå®ãã¦ããã¾ããããããã«ä¸è¦ã ã¨æããã¾ããããå¿
è¦ã ã£ãã¨ãã¦ã ruby-full
ãå
¥ããã¨ä¸ç·ã«å
¥ãã¾ãã
ã¾ããwget
ããUbuntu 22.04 ã®æ¨æºçï¼ï¼ï¼ãªAMIããç«ã¦ãEC2ã¤ã³ã¹ã¿ã³ã¹ã§ã¯æåããå
¥ã£ã¦ãã¾ããUbuntuã®ã¤ã³ã¹ãã¼ã«æ¹æ³ã«ãã£ã¦ã¯æ示çã«å
¥ããå¿
è¦ã¯ããã¾ããã©ãã
ããã±ã¼ã¸ï¼.debãã¡ã¤ã«ï¼ããã¦ã³ãã¼ã
wget㧠https://aws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com/releases/codedeploy-agent_1.3.2-1902_all.deb
ãããã¦ã³ãã¼ããããããªã³ãã³ãã«ãªã£ã¦ãã¾ããããã®URLã¯ãæ¥ç¶ãããS3ã®ãªã¼ã¸ã§ã³ãããã¦ã³ãã¼ãããããã¼ã¸ã§ã³ã«ãã£ã¦å¤åãã¾ãã
æ£ããURLãæ§æããæ¹æ³ã¯ãAWSの公式情報ã«æ¸ããã¦ãã¾ãããã¡ã¤ã³é¨åã§ã¯ãªã¼ã¸ã§ã³ãæå®ãã¦ããã¡ã¤ã«åé¨åã§ã¯ãã¼ã¸ã§ã³ãæå®ãã¾ãã
ãã®å
¬å¼æ
å ±ã®éããæ±äº¬ãªã¼ã¸ã§ã³ã§ããã°ã以ä¸ã®ã³ãã³ãï¼è¦ã»AWS CLIï¼ãå©ããã¨ã§ãã¼ã¸ã§ã³ã®ä¸è¦§ãè¦ããã¨ãã§ãã¾ãã
aws s3 ls --recursive s3://aws-codedeploy-ap-northeast-1 --region ap-northeast-1
話ã¯æ»ãã¾ããããã®StackOverflowã§ç¤ºãããæé ã§ã¯ã2021å¹´5æã«ãªãªã¼ã¹ããã 1.3.2
ãæå®ããã¦ãã¾ããã¡ãªã¿ã«æ¬è¨äºå·çæç¹ã§ã®ææ°çã¯ããã®æ¬¡ã®ãã¼ã¸ã§ã³ã§ããã2022å¹´9æã«ãªãªã¼ã¹ãããã°ããã® 1.4.0
ã§ãã
ãã®ããã§ãã¯ãããæãããæ¹æ³ãå°æ¥ã®ãã¼ã¸ã§ã³ã§ãæå¹ãã©ããã¯ä¸æãªã®ã§ãä½è¨ãªæéã使ããããªãã®ã§ããã°ãStackOverflowã®åçã«å£ã£ã¦ 1.3.2
ãå
¥ãã¦ããã®ãç¡é£ããããã¾ããã
ä¾åããã±ã¼ã¸ã®æ¸ãæã
CodeDeploy agent 1.3.2 ã«ããã¦ã¯ãå ã ã¯ä¾åããã±ã¼ã¸ã¯ä»¥ä¸ã®ããã«æ¸ããã¦ãã¾ãã
Depends: ruby2.0 | ruby2.1 | ruby2.2 | ruby2.3 | ruby2.4 | ruby2.5 | ruby2.6 | ruby2.7
ããã sed
ã³ãã³ããç¨ãã¦ç·¨éãããã¨ã«ãã£ã¦ Depends: ruby3.0
ã«ããããã¨ããä½æ¦ã§ããã
åä½ç¢ºèª
StackOverflowã®åçã®æé ã§ã¯ãåä½ç¢ºèªã§ä»¥ä¸ã®ã³ãã³ããæ¸ããã¦ãã¾ãã
sudo systemctl list-units --type=service | grep codedeploy
sudo service codedeploy-agent status
ã§ãããããã«sudo
ã¯ä¸è¦ã§ããããããè¦ãã ããªãroot権éã¯ä¸è¦ã§ãã
ãããã«
ããã§ãUbuntu 22.04 ã§ãå¿«é©ãª CodeDeploy çæ´»ãéããã¨ãã§ãã¾ããð