OpenWhisk ๋Š” Apache ์žฌ๋‹จ์˜ ์ธํ๋ฒ ์ดํŒ… ํ”„๋กœ์ ํŠธ๋กœ ๊ณต๊ฐœ๋œ ์˜คํ”ˆ์†Œ์Šค ์„œ๋ฒ„๋ฆฌ์Šค ํ”Œ๋žซํผ์ž…๋‹ˆ๋‹ค. ์ด ๊ธ€์—์„œ๋Š” OpenWhisk ๋ฅผ ๋น ๋ฅด๊ณ  ์•ˆ์ „ํ•˜๊ฒŒ ๊ฐœ๋ฐœํ•˜๊ธฐ ์œ„ํ•˜์—ฌ Docker container ๋กœ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์„ ๋งŒ๋“ค๊ณ , ๋ฐฐํฌํ•˜๋Š” ํ™˜๊ฒฝ์„ ๋งŒ๋“ค์–ด ๋ด…๋‹ˆ๋‹ค.

์„œ๋ฒ„๋ฆฌ์Šค์™€ Apache OpenWhisk ๋ž€?

ํด๋ผ์šฐ๋“œ ํ™˜๊ฒฝ์—์„œ IaaS (Infrastructure as a Service) ๊ฐ€์ƒ๋จธ์‹  ๋ฐ ๋ฒ ์–ด๋ฉ”ํƒˆ์€ ๋ช‡ ๋ถ„ ๋งŒ์— ์„œ๋ฒ„๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ๊ฒŒ ํ•ด ์ฃผ์—ˆ๊ณ , PaaS (Platform as a service) ์™€ Docker container ๊ธฐ์ˆ ์€ ๊ฐœ๋ฐœ๊ณผ ๋ฐฐ์น˜๋ฅผ ๋ณด๋‹ค ํŽธํ•˜๊ฒŒ ํ•˜๊ณ  ์ž์›์„ ๋ณด๋‹ค ํšจ์œจ์ ์œผ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋„์™€์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค. ์„œ๋ฒ„๋ฆฌ์Šค (Serverless) ํ”Œ๋žซํผ, ํ˜น์€ FaaS (Function as a Service) ๋Š” ์—ฌ๊ธฐ์„œ ๋” ๋‚˜์•„๊ฐ€ ํ•„์š”ํ•  ๋•Œ๋งŒ ์‹คํ–‰๋˜๊ณ  ์‰ฝ๊ฒŒ ํ™•์žฅ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ํ”„๋กœ์ ํŠธ ํ™ˆํŽ˜์ด์ง€: http://openwhisk.incubator.apache.org/

Apache OpenWhisk ๋Š” IBM Bluemix ํด๋ผ์šฐ๋“œ์—์„œ FaaS ํ˜•ํƒœ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜๋„ ์žˆ๊ณ , OpenStack ๊ณผ ๊ฐ™์€ on-premis IaaS ๋‚˜ ํ˜น์€ ํด๋ผ์šฐ๋“œ์— ์„ค์น˜ํ•˜์—ฌ ์„œ๋ฒ„๋ฆฌ์Šค ํ™˜๊ฒฝ์„ ๊ตฌ์ถ•ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๊ฐœ๋ฐœ ํ™˜๊ฒฝ์„ ์œ„ํ•œ Docker inception in Docker

Apache OpenWhisk ๋Š” ์ฃผ ๊ฐœ๋ฐœ ์–ธ์–ด๋กœ Scala ๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ๋ฐฐ์น˜์— Python Ansible ํˆด์„ ์‚ฌ์šฉํ•˜์—ฌ ํ•„์š”ํ•œ ์ปดํผ๋„ŒํŠธ๋ฅผ Docker container ๋กœ ๋ฐฐ์น˜ํ•ฉ๋‹ˆ๋‹ค.

๊ณต์‹ ๋ฌธ์„œ์—์„œ๋Š” Vagrant ๋‚˜ Docker for Mac ์„ ์‚ฌ์šฉํ•˜์—ฌ ๋งฅ์—์„œ ๊ฐœ๋ฐœํ•˜๋Š” ๋ฐฉ๋ฒ•๊ณผ Ubuntu 14.04 ํ™˜๊ฒฝ์—์„œ ๊ฐœ๋ฐœํ•˜๋Š” ๋ฐฉ๋ฒ•์ด ์•ˆ๋‚ด๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ํ™˜๊ฒฝ์—์„œ๋Š” ํ˜ธ์ŠคํŠธ ๋จธ์‹ ์— ํ•„์š”ํ•œ ๊ฐœ๋ฐœ ์˜์กด์„ฑ์„ ์„ค์น˜ํ•œ ํ›„, Docker ๋กœ ํ•„์š”ํ•œ ์ปดํฌ๋„ŒํŠธ๋ฅผ ๋ฐฐ์น˜ํ•ฉ๋‹ˆ๋‹ค.

ํ•˜์ง€๋งŒ ๊ฐœ๋ฐœ ๋จธ์‹ ์ด Ubuntu 16.04 ๋“ฑ ๋‹ค๋ฅธ Ubuntu ๋ฒ„์ ผ์„ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜ CentOS, Fedora ๋“ฑ์˜ ๋‹ค๋ฅธ ๋ฐฐํฌํŒ์„ ์‚ฌ์šฉํ•œ๋‹ค๋ฉด ์–ด๋–ป๊ฒŒ ํ•ด์•ผ ํ• ๊นŒ์š”? ๋งฅ์—์„œ๋„ Java VM ์ด ์„ž์ด์ง€ ์•Š๊ฒŒ ํ•˜๊ฑฐ๋‚˜ ๊ฐœ๋ฐœํ™˜๊ฒฝ์ด ๊ผฌ์ด์ง€ ์•Š๊ฒŒ ๊ตฌ์„ฑํ•  ํ•„์š”๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.

์ด๋Ÿฐ ์ƒํ™ฉ์—์„œ Docker ์ž์ฒด๋ฅผ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์œผ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ๊ธ€์—์„œ๋Š” Docker inception ์ด๋ผ๋Š” ๊ฐœ๋…์„ ์‚ฌ์šฉํ•ด์„œ Docker ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์œผ๋กœ๋ถ€ํ„ฐ ๋‹ค๋ฅธ ๊ฐœ๋ฐœ Docker image ๋ฅผ ๋งŒ๋“ค๊ณ  Docker instance ๋ฅผ ๋ฐฐ์น˜ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค.

Docker ํ™˜๊ฒฝ ์ค€๋น„ํ•˜๊ธฐ

ํ˜ธ์ŠคํŠธ ๋จธ์‹ ์— Docker ๊ฐ€ ์„ค์น˜๋˜์–ด ์žˆ์ง€ ์•Š๋‹ค๋ฉด Docker ์„ค์น˜ ๋ฌธ์„œ๋ฅผ ์ฐธ๊ณ ํ•˜์—ฌ ์„ค์น˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  OpenWhisk ๋ฐฐ์น˜๋ฅผ ์œ„ํ•ด Docker tcp API ๊ฐ€ ํ•„์š”ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ผ๋ฐ˜์ ์œผ๋กœ ์‚ฌ์šฉํ•˜๋Š” Docker interface ์ธ 172.17.0.1 ์— ๋Œ€ํ•ด 4243 ํฌํŠธ๋ฅผ ์—ด์–ด์ค˜์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๋‹ค์Œ๊ณผ ๊ฐ™์ด netstat ๋ช…๋ น์–ด๋ฅผ ๋‚ด๋ ธ์„ ๋•Œ ํฌํŠธ๊ฐ€ LISTEN ์ƒํƒœ์ด๋ฉด ์ค€๋น„๋œ ๊ฒƒ์ž…๋‹ˆ๋‹ค.

$ netstat -nl |grep 4243
tcp        0      0 172.17.0.1:4243         0.0.0.0:*               LISTEN

Ubuntu 14.04

/etc/default/docker ํŒŒ์ผ์— ๋‹ค์Œ ์ค„์„ ์ถ”๊ฐ€ํ•œ ํ›„ docker ๋ฅผ ์žฌ์‹œ์ž‘ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค.

DOCKER_OPTS="-H tcp://172.17.0.1:4243 -H unix:///var/run/docker.sock"

Ubuntu 16.04

systemd ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” Linux ๋ฐฐํฌํŒ์—์„œ๋Š” ์‹คํ–‰ ์˜ต์…˜์„ ๋ณ€๊ฒฝํ•ด์ค˜์•ผ ํ•ฉ๋‹ˆ๋‹ค. /etc/systemd/system/docker.service.d/tcp.conf ํŒŒ์ผ์„ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค.

[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// -H 172.17.0.1:4243

๊ทธ๋ฆฌ๊ณ  ๋‹ค์Œ ๋ช…๋ น์–ด๋กœ ๋ณ€๊ฒฝ ๋‚ด์šฉ์„ ์ ์šฉํ•˜๊ณ  Docker ๋ฐ๋ชฌ์„ ์žฌ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค.

sudo systemctl daemon-reload
sudo systemctl restart docker

Inception ์ปจํ…Œ์ด๋„ˆ ์ธ์Šคํ„ด์Šค ์‹คํ–‰

  • ๋‹ค์Œ ๋ช…๋ น์œผ๋กœ OpenWhisk ๊ฐœ๋ฐœ์šฉ inception ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ธ์Šคํ„ด์Šค ์ด๋ฆ„์€ openwhisk_inception_1 ๋กœ ์„ค์ •ํ•˜๊ณ , ํ˜ธ์ŠคํŠธ ๋จธ์‹ ๊ณผ Docker ์†Œ์ผ“ ๋ฐ /tmp ๋””๋ ‰ํ„ฐ๋ฆฌ๋ฅผ ๊ณต์œ ํ•˜๋Š” ์„ค์ •์ž…๋‹ˆ๋‹ค.
docker run -it --name openwhisk_inception_1 -v /var/run/docker.sock:/var/run/docker.sock -v /tmp:/tmp jgkong/openwhisk-inception bash
  • ์‰˜์ด ์‹คํ–‰๋˜๋ฉด inception ์ธ์Šคํ„ด์Šค์—์„œ docker ps ๋ช…๋ น์–ด๋กœ ํ˜„์žฌ inception ์ธ์Šคํ„ด์Šค๊ฐ€ ์ž˜ ๋ณด์ด๋Š”์ง€ ํ™•์ธํ•œ ํ›„ exit ๋ช…๋ น์–ด๋กœ ๋น ์ ธ๋‚˜์˜ต๋‹ˆ๋‹ค.
root@85b3e0d2754d:/# docker ps
CONTAINER ID        IMAGE                        COMMAND             CREATED             STATUS              PORTS               NAMES
85b3e0d2754d        jgkong/openwhisk-inception   "bash"              3 seconds ago       Up 2 seconds                            openwhisk_inception_1
  • ํ˜ธ์ŠคํŠธ์—์„œ ๋‹ค์Œ ๋ช…๋ น์–ด๋กœ inception ์ธ์Šคํ„ด์Šค์˜ docker ๊ทธ๋ฃน GID ๋ฅผ ๋งž์ถฐ์ค€ ํ›„ ๋‹ค์‹œ ์ธ์Šคํ„ด์Šค๋กœ ๋“ค์–ด๊ฐ‘๋‹ˆ๋‹ค.
docker start openwhisk_inception_1
docker exec openwhisk_inception_1 groupmod -g $(grep ^docker /etc/group |cut -d : -f 3) docker
docker exec -it openwhisk_inception_1 bash
  • (์„ ํƒ์‚ฌํ•ญ) root ์‚ฌ์šฉ์ž๋กœ ์ž‘์—…ํ•˜๋Š” ๊ฒƒ์€ ๋ณด์•ˆ์ƒ ์œ„ํ—˜ํ•˜๋‹ˆ, dev ์‚ฌ์šฉ์ž๋ฅผ ์ถ”๊ฐ€ํ•ด์ฃผ๊ณ , su ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด dev ์‚ฌ์šฉ์ž๋กœ ์ž‘์—…์„ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค. root ๋กœ ์ž‘์—…ํ•˜๋Š” ๊ฒƒ๋„ ๊ฐ€๋Šฅํ•˜๋ฉฐ, dev ๋Œ€์‹  ๋‹ค๋ฅธ ์‚ฌ์šฉ์ž์ด๋ฆ„์„ ์‚ฌ์šฉํ•ด๋„ ๋ฌด๋ฐฉํ•ฉ๋‹ˆ๋‹ค.
root@85b3e0d2754d:/# useradd -m dev
root@85b3e0d2754d:/# echo "dev ALL=(ALL) NOPASSWD:ALL" |sudo tee /etc/sudoers.d/dev
dev ALL=(ALL) NOPASSWD:ALL
root@85b3e0d2754d:/# adduser dev docker
Adding user `dev' to group `docker' ...
Adding user dev to group docker
Done.
root@85b3e0d2754d:/# su - dev
dev@85b3e0d2754d:~$
  • (์„ ํƒ์‚ฌํ•ญ) dev ์‚ฌ์šฉ์ž๋„ docker ๊ทธ๋ฃน์— ํฌํ•จํ–ˆ๊ธฐ ๋•Œ๋ฌธ์— docker ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. docker ps ๋ช…๋ น์–ด๋กœ root ์™€ ๋งˆ์ฐฌ๊ฐ€์ง€ ๊ฒฐ๊ณผ๊ฐ€ ๋‚˜์˜ค๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.
dev@85b3e0d2754d:~$ docker ps
CONTAINER ID        IMAGE                        COMMAND             CREATED              STATUS              PORTS               NAMES
85b3e0d2754d        jgkong/openwhisk-inception   "bash"              About a minute ago   Up About a minute                       openwhisk_inception_1

OpenWhisk ๋นŒ๋“œ

  • Git ์œผ๋กœ OpenWhisk ๋ฆฌํŒŒ์ง€ํ† ๋ฆฌ๋ฅผ ๋‹ค์šด๋ฐ›๊ณ  ํ•„์š”ํ•œ Docker ์ด๋ฏธ์ง€๋ฅผ ๋นŒ๋“œํ•ฉ๋‹ˆ๋‹ค.
dev@85b3e0d2754d:~$ git clone --depth=1 https://github.com/apache/incubator-openwhisk.git openwhisk
Cloning into 'openwhisk'...
remote: Counting objects: 880, done.
remote: Compressing objects: 100% (743/743), done.
remote: Total 880 (delta 137), reused 417 (delta 51), pack-reused 0
Receiving objects: 100% (880/880), 9.32 MiB | 683.00 KiB/s, done.
Resolving deltas: 100% (137/137), done.
Checking connectivity... done.
dev@85b3e0d2754d:~$ cd openwhisk/
dev@85b3e0d2754d:~/openwhisk$ ./gradlew distDocker
  • ์„œ๋ฒ„์˜ ์„ฑ๋Šฅ๊ณผ ๋„คํŠธ์›Œํฌ ์ƒํ™ฉ์— ๋”ฐ๋ผ ๋‹ค๋ฅด์ง€๋งŒ, OpenWhisk ์— ํ•„์š”ํ•œ 20์—ฌ๊ฐœ์˜ Docker ์ด๋ฏธ์ง€๋ฅผ ๋นŒ๋“œํ•˜๋Š”๋ฐ๋Š” ๋ช‡์‹ญ๋ถ„์˜ ์‹œ๊ฐ„์ด ๊ฑธ๋ฆด ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋นŒ๋“œ๊ฐ€ ์™„๋ฃŒ๋œ ํ›„ docker images ๋ช…๋ น์–ด๋กœ ๋นŒ๋“œ๋œ ์ด๋ฏธ์ง€๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
dev@85b3e0d2754d:~/openwhisk$ docker images
REPOSITORY                     TAG                 IMAGE ID            CREATED              SIZE
badproxy                       latest              f94950ce7b2c        15 seconds ago       107MB
whisk/badproxy                 latest              f94950ce7b2c        15 seconds ago       107MB
badaction                      latest              41fa4e2a2eda        15 seconds ago       107MB
whisk/badaction                latest              41fa4e2a2eda        15 seconds ago       107MB
cli                            latest              d86c401c4a0c        17 seconds ago       753MB
whisk/cli                      latest              d86c401c4a0c        17 seconds ago       753MB
whisk/example                  latest              0b4beaff35fc        About a minute ago   108MB
example                        latest              0b4beaff35fc        About a minute ago   108MB
swift3action                   latest              bd050270b93b        2 minutes ago        1.47GB
whisk/swift3action             latest              bd050270b93b        2 minutes ago        1.47GB
action-swift-v3.1.1            latest              1f160857de71        9 minutes ago        1.37GB
whisk/action-swift-v3.1.1      latest              1f160857de71        9 minutes ago        1.37GB
python3action                  latest              2eba74b62cdd        13 minutes ago       287MB
whisk/python3action            latest              2eba74b62cdd        13 minutes ago       287MB
whisk/python2action            latest              3d7b5244f4a3        16 minutes ago       293MB
python2action                  latest              3d7b5244f4a3        16 minutes ago       293MB
nodejs6action                  latest              b09a36ad839b        20 minutes ago       487MB
whisk/nodejs6action            latest              b09a36ad839b        20 minutes ago       487MB
nodejsactionbase               latest              ec6b47795cc5        22 minutes ago       303MB
whisk/nodejsactionbase         latest              ec6b47795cc5        22 minutes ago       303MB
java8action                    latest              ba5346794d77        25 minutes ago       453MB
whisk/java8action              latest              ba5346794d77        25 minutes ago       453MB
invoker                        latest              18806c0492b4        25 minutes ago       457MB
whisk/invoker                  latest              18806c0492b4        25 minutes ago       457MB
controller                     latest              71935c333d30        25 minutes ago       437MB
whisk/controller               latest              71935c333d30        25 minutes ago       437MB
dockerskeleton                 latest              5ee27f40dbe1        28 minutes ago       107MB
whisk/dockerskeleton           latest              5ee27f40dbe1        28 minutes ago       107MB
scala                          latest              20a2e316c237        30 minutes ago       353MB
whisk/scala                    latest              20a2e316c237        30 minutes ago       353MB
jgkong/openwhisk-inception     latest              8ac988dca566        2 hours ago          1.67GB
buildpack-deps                 trusty              a7bcc05e2568        2 days ago           551MB
buildpack-deps                 trusty-curl         bdba6257828d        2 days ago           200MB
python                         3.6.1-alpine        ddd6300d05a3        10 days ago          88.7MB
golang                         1.8                 d2f558dda133        2 weeks ago          699MB
ibmcom/swift-ubuntu            3.1.1               39995571098d        2 weeks ago          1.19GB
python                         2.7.12-alpine       9c8c07c0f9b7        7 months ago         72.2MB
clarity                        latest              263920854b31        8 months ago         974MB
consul                         0.7.0               2ba9010ee3cc        8 months ago         33.7MB
ches/kafka                     0.10.0.1            6330d31d4be4        10 months ago        698MB
gliderlabs/registrator         latest              3b59190c6c80        14 months ago        23.8MB
docker/docker-bench-security   latest              c27d95c6a9d0        21 months ago        46.5MB

OpenWhisk ๋ฐฐ์น˜

https://github.com/apache/incubator-openwhisk/blob/master/ansible/README.md ์— ์„ค๋ช…๋œ๊ฒƒ์ฒ˜๋Ÿผ ansible ๋กœ ํ•„์š”ํ•œ ํ™˜๊ฒฝ์„ ๋ฐฐ์น˜ํ•ฉ๋‹ˆ๋‹ค.

  1. CouchDB ํ™˜๊ฒฝ ์„ค์ •
    ansible ๋””๋ ‰ํ„ฐ๋ฆฌ์—์„œ ansible-playbook setup.yml ์ปค๋งจ๋“œ๋กœ CouchDB ํ™˜๊ฒฝ์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. ๋‹คํ๋จผํŠธ ์„ค๋ช…๋Œ€๋กœ Cloudant ๋ฅผ ์‚ฌ์šฉํ•ด๋„
    ๋˜๋ฉฐ, ๋ชจ๋“  ansible ์‹คํ–‰๋•Œ๋Š” ๋นจ๊ฐ„์ƒ‰ ์—๋Ÿฌ๊ฐ€ ๋‚˜์˜ค์ง€ ์•Š์•„์•ผ ํ•ฉ๋‹ˆ๋‹ค.

    dev@85b3e0d2754d:~/openwhisk$ cd ansible/
    dev@85b3e0d2754d:~/openwhisk/ansible$ ansible-playbook setup.yml
  2. ๋‹ค์Œ ๋ช…๋ น์–ด๋กœ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ์ดˆ๊ธฐํ™”ํ•ฉ๋‹ˆ๋‹ค.

    ansible-playbook prereq.yml
    ansible-playbook couchdb.yml
    ansible-playbook initdb.yml
    ansible-playbook wipe.yml

    docker ps ๋ช…๋ น์–ด๋กœ couchdb ์ธ์Šคํ„ด์Šค๊ฐ€ ๋ณด์ด๋ฉด ๋ฉ๋‹ˆ๋‹ค.

    dev@85b3e0d2754d:~/openwhisk/ansible$ docker ps
    CONTAINER ID        IMAGE                        COMMAND                  CREATED              STATUS              PORTS                    
    NAMES
    c870ab6f7c83        couchdb:1.6                  "tini -- /docker-e..."   About a minute ago   Up About a minute   0.0.0.0:5984->5984/tcp   couchdb
    85b3e0d2754d        jgkong/openwhisk-inception   "bash"                   45 minutes ago       Up 44 minutes                                openwhisk_inception_1
  3. ๋‹ค์Œ ๋ช…๋ น์–ด๋กœ api-gateway ์™€ OpenWhisk ์ปดํฌ๋„ŒํŠธ๋ฅผ ๋„์›๋‹ˆ๋‹ค.

    ansible-playbook apigateway.yml
    ansible-playbook openwhisk.yml
    ansible-playbook postdeploy.yml
  4. docker ps ๋ช…๋ น์–ด๋กœ ํ•„์š”ํ•œ ์ปดํฌ๋„ŒํŠธ๋“ค์ด ์‹คํ–‰๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

    dev@85b3e0d2754d:~/openwhisk/ansible$ docker ps
    CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS                  PORTS                                                                                                                                                  NAMES
    b422cabba350        nginx:1.11                   "nginx -g 'daemon ..."   3 minutes ago       Up 3 minutes            0.0.0.0:8443->8443/tcp, 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp                                                                                     nginx
    418536116a02        whisk/nodejs6action:latest   "/bin/sh -c 'node ..."   3 minutes ago       Up 3 minutes                                                                                                                                                                   wsk0_3_warmJsContainer_20170709T115814324Z
    02311a6dafd3        whisk/nodejs6action:latest   "/bin/sh -c 'node ..."   3 minutes ago       Up 3 minutes (Paused)                                                                                                                                                          wsk0_2_whisksysteminvokerHealthTestAction001_20170709T115814097Z
    1d82c1388bec        whisk/nodejs6action:latest   "/bin/sh -c 'node ..."   3 minutes ago       Up 3 minutes                                                                                                                                                                   wsk0_1_warmJsContainer_20170709T115813790Z
    cdcf77a6b179        whisk/invoker:latest         "/bin/sh -c 'exec ..."   3 minutes ago       Up 3 minutes            0.0.0.0:12001->8080/tcp                                                                                                                                invoker0
    c91be5666f3b        whisk/controller:latest      "/bin/sh -c 'contr..."   3 minutes ago       Up 3 minutes            0.0.0.0:10001->8080/tcp                                                                                                                                controller0
    80d16698c63e        ches/kafka:0.10.2.1          "/start.sh"              3 minutes ago       Up 3 minutes            7203/tcp, 0.0.0.0:9092->9092/tcp                                                                                                                       kafka
    65f6d97218af        zookeeper:3.4                "/docker-entrypoin..."   4 minutes ago       Up 4 minutes            2888/tcp, 0.0.0.0:2181->2181/tcp, 3888/tcp                                                                                                             zookeeper
    988f09942f93        gliderlabs/registrator       "/bin/registrator ..."   4 minutes ago       Up 4 minutes                                                                                                                                                                   registrator
    e2b974f00474        consul:0.7.0                 "docker-entrypoint..."   4 minutes ago       Up 4 minutes            0.0.0.0:8300-8302->8300-8302/tcp, 0.0.0.0:8400->8400/tcp, 0.0.0.0:8301-8302->8301-8302/udp, 0.0.0.0:8500->8500/tcp, 0.0.0.0:8600->8600/udp, 8600/tcp   consul
    23711d5fdfc6        openwhisk/apigateway:0.8.2   "/usr/local/bin/du..."   About an hour ago   Up About an hour        80/tcp, 8423/tcp, 0.0.0.0:9000->9000/tcp, 0.0.0.0:9001->8080/tcp                                                                                       apigateway
    4a1328c21664        redis:3.2                    "docker-entrypoint..."   About an hour ago   Up About an hour        0.0.0.0:6379->6379/tcp                                                                                                                                 redis
    c870ab6f7c83        couchdb:1.6                  "tini -- /docker-e..."   About an hour ago   Up About an hour        0.0.0.0:5984->5984/tcp                                                                                                                                 couchdb
    85b3e0d2754d        jgkong/openwhisk-inception   "bash"                   2 hours ago         Up 2 hours                                                                                                                                                                     openwhisk_inception_1

OpenWhisk ์„ค์น˜ ํ™•์ธ

  1. wskadmin ๋ช…๋ น์–ด๋กœ ์‚ฌ์šฉ์ž๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

    dev@85b3e0d2754d:~/openwhisk/ansible$ ../bin/wskadmin user create user1
    7fecc680-c267-4f06-90cc-84a691780683:wFR6Wa5pLVUu7rjOrlPEOFsnGN7lLBtXuiRIMCneHGDeoqkgVS81NJFRcVYqmoDU
  2. ์œ„์˜ ์‹คํ–‰๊ฒฐ๊ณผ๋กœ ๋‚˜์˜ค๋Š” API KEY ๋กœ ์ธ์ฆ์ •๋ณด์™€ API HOST ๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

    dev@85b3e0d2754d:~/openwhisk/ansible$ ../bin/wsk property set --auth 7fecc680-c267-4f06-90cc-84a691780683:wFR6Wa5pLVUu7rjOrlPEOFsnGN7lLBtXuiRIMCneHGDeoqkgVS81NJFRcVYqmoDU
    ok: whisk auth set. Run 'wsk property get --auth' to see the new value.
    dev@85b3e0d2754d:~/openwhisk/ansible$ ../bin/wsk property set --apihost 172.17.0.1
    ok: whisk API host set to 172.17.0.1
  3. hello, ์ž…๋ ฅ๊ฐ’ ์„ ํ‘œ์‹œํ•˜๋Š” ํ…Œ์ŠคํŠธ ์•ก์…˜์„ ๋งŒ๋“ค๊ณ  ์‹คํ–‰ํ•ด ๋ด…๋‹ˆ๋‹ค. payload ๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ์ถœ๋ ฅ๋˜๋ฉด OpenWhisk ์„ค์น˜ ๋ฐ ๋ฐฐ์น˜๊ฐ€ ์™„๋ฃŒ๋ฉ๋‹ˆ๋‹ค.

    dev@85b3e0d2754d:~/openwhisk/ansible$ ../bin/wsk -i action create hello ../tests/dat/actions/hello.js
    ok: created action hello
    dev@85b3e0d2754d:~/openwhisk/ansible$ ../bin/wsk -i action invoke hello -p payload world --result
    {
    "payload": "hello, world!"
    }

๋ฌธ์ œ ํ•ด๊ฒฐ

  • Ansible ์‹คํ–‰ ๋„์ค‘ ๋ฌธ์ œ๊ฐ€ ์ƒ๊ธฐ๋ฉด -e mode=clean ์„ ๋ถ™์—ฌ ์‹คํ–‰ํ•˜๋ฉด ์‹คํ–‰์ด ์ทจ์†Œ๋ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, ansible-playbook openwhisk.yml ๋ฐฐ์น˜๋ฅผ ์ทจ์†Œํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด ansible-playbook openwhisk.yml -e mode=clean ๋กœ ์‹คํ–‰ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค.

์ฐธ๊ณ  ๋งํฌ

ํ† ๋ก  ์ฐธ๊ฐ€

์ด๋ฉ”์ผ์€ ๊ณต๊ฐœ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ํ•„์ˆ˜ ์ž…๋ ฅ์ฐฝ์€ * ๋กœ ํ‘œ์‹œ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.