2017年6月15日木曜日

localstack 動かしてみた


localstack

ローカルでAWS検証できるよーと教えていただきました。
SQSを検証したいのでやってみます。





git cloneしますっ

$ git clone https://github.com/atlassian/localstack.git
Cloning into 'localstack'...
remote: Counting objects: 1734, done.
remote: Compressing objects: 100% (67/67), done.
remote: Total 1734 (delta 49), reused 70 (delta 32), pack-reused 1629
Receiving objects: 100% (1734/1734), 643.27 KiB | 209.00 KiB/s, done.
Resolving deltas: 100% (1129/1129), done.

↓を参考に起動します

dockerです

$ docker run -it -p 4567-4578:4567-4578 -p 8080:8080 atlassianlabs/localstack
docker: Cannot connect to the Docker daemon at tcp://192.168.59.103:2376. Is the docker daemon running?.
See 'docker run --help'.


エラーになりますねー。ググると以下の情報がありました。


環境変数を調べます

$ export -p
declare -x DOCKER_CERT_PATH="/Users/xxxxx/.boot2docker/certs/boot2docker-vm"
declare -x DOCKER_HOST="tcp://192.168.59.103:2376"
declare -x DOCKER_TLS_VERIFY="1"

先のサイトにあったように DOCKER_某 を削除しますー

$ unset DOCKER_CERT_PATH
$ unset DOCKER_HOST
$ unset DOCKER_TLS_VERIFY


再び・・・

$ docker run -it -p 4567-4578:4567-4578 -p 8080:8080 atlassianlabs/localstack
Unable to find image 'atlassianlabs/localstack:latest' locally
latest: Pulling from atlassianlabs/localstack
a59xxxxxxxxx: Pull complete 
Digest: sha256:45xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Status: Downloaded newer image for atlassianlabs/localstack:latest
/usr/lib/python2.7/site-packages/supervisor/options.py:296: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
  'Supervisord is running as root and it is searching '
2017-06-14 15:40:19,301 CRIT Supervisor running as root (no user in config file)
2017-06-14 15:40:19,304 INFO supervisord started with pid 1
2017-06-14 15:40:20,310 INFO spawned: 'dashboard' with pid 8
2017-06-14 15:40:20,312 INFO spawned: 'infra' with pid 9
. .venv/bin/activate; PYTHONPATH=. exec localstack/mock/infra.py
(. .venv/bin/activate; bin/localstack web --port=8080)
2017-06-14 15:40:21,325 INFO success: dashboard entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-06-14 15:40:21,325 INFO success: infra entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
Starting local dev environment. CTRL-C to quit.
 * Running on http://0.0.0.0:8080/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 172-913-376
Starting local Elasticsearch (port 4571)...
Starting mock ES service (port 4578)...
Starting mock S3 (port 4572)...
Starting mock SNS (port 4575)...
Starting mock SQS (port 4576)...
Starting mock API Gateway (port 4567)...
Starting mock DynamoDB (port 4569)...
Starting mock DynamoDB Streams service (port 4570)...
Starting mock Firehose service (port 4573)...
Starting mock Lambda service (port 4574)...
Starting mock Kinesis (port 4568)...
Starting mock Redshift (port 4577)...
Starting mock Route53 (port 4580)...
Starting mock SES (port 4579)...
Starting mock CloudFormation (port 4581)...
Starting mock CloudWatch (port 4582)...
[2017-06-14T15:40:29,272][INFO ][o.e.n.Node               ] [] initializing ...
(略)
Ready.

Ready.になりました!うまくいったようです!
http://localhost:8080 にアクセスします。

Ready.
となっているターミナルの続きにリクエストがズラズラ表示されます
Ready.
172.17.0.1 - - [14/Jun/2017 15:48:59] "GET / HTTP/1.1" 200 -
172.17.0.1 - - [14/Jun/2017 15:48:59] "GET /node_modules/@atlassian/aui/dist/aui/css/aui.css HTTP/1.1" 200 -
172.17.0.1 - - [14/Jun/2017 15:48:59] "GET /node_modules/@atlassian/aui/dist/aui/css/aui-experimental.css HTTP/1.1" 200 -


つづく・・・