AWS ALBã®ã«ã¼ãã£ã³ã°ã«èªè¨¼ãå ¥ããã500ã¨ã©ã¼ã«ãªã£ãæ
Webã¢ããªãéçºãã¦ããã¨ããã¹ãã¼ã¸ã³ã°ç°å¢ãä½ããã¨ã£ã¦å¤ãã¨æãã
ã§ãã¹ãã¼ã¸ã³ã°ã¯å¤é¨ããã¢ã¯ã»ã¹ãããããªãã®ã§ä½ãããå¶éããããã
æã¯nginx/apacheã§èªè¨¼ãã¦ã¿ãããã¯ã©ã¤ã¢ã³ã証ææ¸ãä½ã£ã¦é
å¸ããããã¢ã¯ã»ã¹å
IPã§ãã£ã«ã¿ãã¦ããã®ã ãã©ã»ã»ã»
ä»ã ã¨AWS ALB + Amazon Cognitoã§æ¥½ã«å®ç¾ã§ããï¼
Application Load Balancer 組み込み認証によりログインを簡略化 | Amazon Web Services ブログ
ä½ãããè¶
ç°¡åã
ãããããã³ã³ããæä½ã§ããããå°è¦æ¨¡éçºãªãç¡ææ ã§åååã¾ãã
ææ°æã
ã¨è¨å®ãã¦ãå®éã«åããã¦ã¿ãããã°ã¤ã³ç»é¢åºã¾ãããã¼
Cognitoã§ä½æããã¦ã¼ã¶ã§ãã°ã¤ã³ãã¦ã¿ãã¨ã»ã»ã»
?!?!
ãªãã¦ãã¨ã»ã»ã»ã
ããã³ãã¨ã³ããããã°ãåºã¦ããªãã
ALBã®ãã°ãåã£ã¦ã¿ãã¨ãããããã§æ¢ã¾ã£ã¦ãããã
ãã¦å°ã£ãã¨ããã¥ã¡ã³ããæ¼ã£ã¦ã¿ããããã£ã±ãããã¾ããã
Application Load Balancer のトラブルシューティング - Elastic Load Balancing
ããã¤ãã±ã¼ã¹ãæ¸ãã¦ãããã©ãããããALBãå¤é¨ã¨éä¿¡ã§ãã¦ããªãæ§åã
VPCã«ã¯internet gatewayã¨ã«ã¼ãã£ã³ã°ãè¨å®ãã¦ãããã©ãSecurityGroupã®ã¢ã¦ããã¦ã³ãè¨å®ãæ¼ãã¦ããã
ElasticBeanstalkã§çæããããã©ãªãã¤ã使ã£ã¦ããããã§ã443ã®ã«ã¼ãã£ã³ã°è¨å®ãä¸ååã ã£ãã®ãåå ã
ã¨ã¦ãåç´ãªè©±ãªãã ãã©ãããã³ã³ã½ã¡ã½ã¡ã§500ã¨ã©ã¼ã«ééããã¨é¢é£ãããªã¼ã
git bad default revision 'HEAD' ã«å°ã£ãã®ã§æåä¿®æ£ãããã©ä¸å®ããæ®ããªãã£ã
VirtualBoxä¸ã®CentOSã§éçºããã¦ãã¦ãããæ¥VMãããªã¼ãºããã®ã§æ¸ã
å¼·å¶åèµ·åããããã¼ã«ã«ãªãã¸ããªãå£ããã
表é¡ã®ã¨ã©ã¼ãåºãã®ã§ã¨ãããã修復ããããå®å
¨ã«ç´ã£ã¦ãããä¸å®ã§çµå±ãªãã¸ããªãcloneãç´ããã¨ããè¨é²ã
gitã³ãã³ããè»ä¸¦ã¿å¤±æãã
$ git status fatal: bad default revision 'HEAD' $ git log fatal: bad default revision 'HEAD'
ï¼ï¼
ã©ããããã¨ãã¨æã£ã¦HEADã®ä¸èº«ãè¦ã¦ã¿ã
$ cat .git/HEAD ref: refs/heads/mybranch
ãããããç´è¿ã§ä½æ¥ãã¦ããã©ã³ãã®ã¾ã¾ã
ãã©ã³ãã®ãã¡ã¤ã«ã念ã®ãã確èª
$ find -name *mybranch* ./.git/refs/heads/mybranch ./.git/refs/remotes/origin/mybranch
ãã¡ã¤ã«ã¯ãããªã¼
ä¸èº«ã©ããªã£ã¦ãã ã
$ cat .git/refs/heads/mybranch (空) $ cat .git/refs/remotes/origin/mybranch (空)
ãã¼ä½ãç¡ã
HEADã³ãããã®SHAãåããªãããã¨ã©ã¼ã«ãªã£ã¦ãã®ããª
ãªã¢ã¼ããããã©ã³ãã®ææ°ã³ããããè¦ã¤ãã¦æåã§åãã¦ã¿ã
$ git ls-remote origin mybranch ãªã¢ã¼ãä¸ã®ææ°SHA refs/heads/mybranch $ echo -n "ãªã¢ã¼ãä¸ã®ææ°SHA" > .git/refs/heads/mybranch
ã¨ããããããã§åãããã«ã¯ãªã£ããã©...
VMããªã¼ãºã®å½±é¿ã§ä¸é¨ãã¡ã¤ã«ãå£ãã¦ããããã§ãä»ã«ãå½±é¿ãæ®ã£ã¦ããå¯è½æ§ããããã
æåã§ãã¡ã¤ã«æ¸ãæãã¦ããã®ã§å®å
¨ã«ç´ã£ã¦ããä¿è¨¼ããªããã ããªã¼
ã§ãçµå±ä¸å®ã ããã ã£ãã®ã§ãªãã¸ããªãcloneãç´ããã
ããããçµãã£ã¦ããæ°ã¥ãããã©ãããã¦ãã¡ã¤ã«ãç·¨éç¶æ
ã®ã¾ã¾æ®ã£ã¦ããã確èªãã¦éé¿ãããã°ããã£ã
æ°æã¡æªãããã¨ãå¾è
ããªãåé¤ããå¾ã ã£ã...
Railsã§renderåã«å ±éå¦çãå ¥ãããã¦
ä¸è¦§è¡¨ç¤ºãããéã«ããã°ã¤ã³ã¦ã¼ã¶ã«å¿ãã¦ä¸è¦§ãã«ã¹ã¿ãã¤ãºãããã£ãã
è¤æ°ã³ã³ããã¼ã©ã§åãå¦çãå¿
è¦ã ã£ãã®ã§after_actionã§å®è£
ãã¦ã¿ããã©æå¾
éãã«åããªãï¼ãªãã§ãï¼
ã¨æã£ãããrenderã®å¾ã«after_actionãå®è¡ãããã¨ãããªãã§ããã
ã§ãrenderåã«å¦çãå
¥ããä»çµã¿ãªããã ã£ãï¼ã¨èª¿ã¹ããã ãã©ãçµå±èªåå®è£
ãããªãã«ã
renderããªã¼ãã¼ã©ã¤ã
ã±ã£ã¨æãã¤ãã¦ã»ã«ãå´ä¸ã
ã¢ã¯ã·ã§ã³å¤å®ããªãã¨ãããªããã¤ã±ã¦ãªãããªã¼ã¨æã£ãããã
class IndexCustomizedController < ApplicationController def customize ... end def render(*args) customize if @_action_name == "index" super end end
before_render
ãã¼ããããããã£ã±ãããããã
Rails5ç³»ã®æ
å ±ãè¦ã¤ãããªãã£ããã©åèã«ã§ãããã
æãã¨ã©ã¾ã£ã¦èªåå®è£
ããã§ãã¡ãã£ã¨å¾
ã¦ã
ãã¬ã¼ã ã¯ã¼ã¯ã«æãå
¥ãã¦ã¾ã§ãããã¨ã...?ã¨æãã¨ã©ã¾ã£ãã
(AOPçã«ã¯renderåãããã¯ãã¤ã³ãã¨èªèããããã ãããï¼)
ãããbefore_renderãããã¨ãã³ã¼ããèªãã¨ãã«ãã®åå¨ãè¦ãã¦èªã¾ãªãã¨ãããªãã®ã§*_actionã¨ã¯éã£ã¦å¯èªæ§ãè½ã¡ããã
ã¨ãããã¨ã§çµå±moduleãå®ç¾©ãããã¨ã«ããã
class MyController < ApplicationController def index ... custom_data = IndexCustomizer.costom(user, data) ... end ... end