Web App for Containers + MySQLでコンテナ対応したRailsアプリを作ろう!Yoichi Kawasaki
Web App for Containers は、アプリスタックのホストに Docker コンテナーを使用するため皆さんが今Linux上で利用しているOSSベースのアプリもアプリスタックごとDockerコンテナ化することでそのまま Web App for Containersで利用することができます。本ウェビナーでは簡単なMySQL + Ruby on Rails アプリ を題材に、アプリをコンテナ化し Web App for Containersにデプロイするまでの一連の流れを解説し、CIツールを使った継続的なデプロイ方法についてご紹介します。今回、AzureのフルマネージドMySQLサービスであるAzure DB for MySQLを利用して完全マネージドな環境でのアプリ実行を実現します。
17. 今回のre:Inventで・・・触ってみた - curlコマンドを叩いてみる
P-1174:~ ma-kobayashi$ curl -v http://kbys-lambda-alb-xxxxxxxxxx.ap-northeast-1.elb.amazonaws.com
* Rebuilt URL to: http://kbys-lambda-alb-xxxxxxxxxx.ap-northeast-1.elb.amazonaws.com/
* Trying xx.xxx.xxx.xxx….
* TCP_NODELAY set
* Connected to kbys-lambda-alb-xxxxxxxxxx.ap-northeast-1.elb.amazonaws.com (xx.xxx.xxx.xxx) port 80 (#0)
> GET / HTTP/1.1
> Host: kbys-lambda-alb-xxxxxxxxxx.ap-northeast-1.elb.amazonaws.com
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 502 Bad Gateway
< Server: awselb/2.0
< Date: Mon, 10 Dec 2018 07:23:54 GMT
< Content-Type: text/html
< Content-Length: 138
< Connection: keep-alive
<
<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
</body>
</html>
* Connection #0 to host kbys-lambda-alb-xxxxxxxxxx.ap-northeast-1.elb.amazonaws.com left intact
18. 触ってみた - curlコマンドを叩いてみる
The response from the Lambda function
is not in the expected format
(レスポンスの型が違います)
19. 触ってみた
Requests can include HTTP GET, HEAD, PUT, POST, DELETE, PATCH and
OPTIONS methods, and request and response bodies can be text or binary.
The Application Load Balancer that you’ve set up with AWS Lambda takes
care of translating an HTTP/S request into an AWS Lambda-compatible event.
要求には、HTTP GET、HEAD、PUT、POST、DELETE、PATCH、OPTIONSメソッドが
含まれ、要求および応答の本文にはテキストまたはバイナリを使用できます。 AWS
Lambdaで設定したApplication Load Balancerは、HTTP(S)リクエストをAWS Lambda
イベントに変換します。
Lambda functions as targets for Application Load Balancers
https://aws.amazon.com/jp/blogs/news/lambda-functions-as-targets-for-application-load-balancers/