habrã§ãããŒãžã§ã³1.12ã®æ°æ©èœã§ããDocker swarmã¢ãŒã ïŒ swarmã®ã¢ãŒã ïŒã«ã€ããŠæ¢ã«æžããŠããŸãã ãã®ãªãã·ã§ã³ã¯ãã¹ã¿ã³ãã¢ãã³ã®Docker Swarmå®è£ ã«ç²ŸéããŠãã人ã ã®é ã«å°ãæ··ä¹±ããããããŸãããããã¯ã以åã«é åžããããã®ã§ãã»ããã¢ãããšäœ¿çšã®å®¹æãã«ãããŠéãã¯ãããŸããã§ããã ãã ããDockerã䜿çšããŠSwarmãããã¯ã¹ã«è¿œå ãããšããã¹ãŠãããã·ã³ãã«ã«ãªããããæ確ã«ãªããããæ©èœçã«ãªããŸããã
ã³ã³ããã®æ°ããDockerã¯ã©ã¹ã¿ãŒããŠãŒã¶ãŒã®èŠ³ç¹ããã©ã®ããã«é 眮ãããŠããããããã«ä»»æã®ã€ã³ãã©ã¹ãã©ã¯ãã£ã«DockerãµãŒãã¹ãå±éããããã®ç°¡åã§äŸ¿å©ãªæ¹æ³ã«ã€ããŠãããã«è©³ãã説æããŸãã
ãŸããåã®èšäºã§çŽæããããã«ãå°ãé ããŠãDockerãµãŒãã¹ããµããŒãããFabricioãªãªãŒã¹ããªãªãŒã¹ããŸããã åæã«ãåã ã®ã³ã³ããã§äœæ¥ããããšãå¯èœã§ããããã«ããŠãŒã¶ãŒã€ã³ã¿ãŒãã§ã€ã¹ãšæ§æã®éçºè ã¯å€æŽãããªããããåã ã®ã³ã³ããã«åºã¥ãæ§æãããã©ãŒã«ããã¬ã©ã³ãã§æ°Žå¹³æ¹åã«ã¹ã±ãŒã©ãã«ãªãµãŒãã¹ãžã®ç§»è¡ãå€§å¹ ã«ç°¡çŽ åãããŸãã
Docker Swarmã¢ãŒãã®æå¹å
swarmã¢ãŒãã§ã¯ããã¹ãŠã®ããŒãã¯ãããŒãžã£ãŒãšã¯ãŒã«ãŒã®2ã€ã®ã¿ã€ãã«åããããŸãã åæã«ãæ¬æ Œçãªã¯ã©ã¹ã¿ãŒã¯ãäžè¬ã«ããŒããåäœãããªããŠãå®è¡ã§ããŸããã€ãŸããããã©ã«ãã§ãããŒãžã£ãŒãåäœããŠããŸãã
ãããŒãžã£ã®äžã«ã¯ãåžžã«çŸåšã¯ã©ã¹ã¿ã®ãªãŒããŒã§ãã人ãããŸãã ä»ã®ãããŒãžã£ãŒã§å®è¡ããããã¹ãŠã®å¶åŸ¡ã³ãã³ãã¯ãèªåçã«ãªãã€ã¬ã¯ããããŸãã
å®è¡äžã®Dockerã¯ã©ã¹ã¿ãŒã®ããŒããªã¹ãã®äŸ
$ docker node ls ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS 6pbqkymsgtnahkqyyw7pccwpz * docker-1 Ready Active Leader avjehhultkslrlcrevaqc4h5f docker-2 Ready Active Reachable cg1maoa11ep7h14f2xciwylf3 docker-3 Ready Active Reachable
ã¹ãŠã©ãŒã ã¢ãŒããæå¹ã«ããã«ã¯ãå°æ¥ã®ã¯ã©ã¹ã¿ãŒã§æåã®ãªãŒããŒãšãªããã¹ããéžæãããã®äžã§1ã€ã®ã³ãã³ãã®ã¿ãå®è¡ããŸãã
docker swarm init
ãswarmããåæåããããšãä»»æã®æ°ã®ãµãŒãã¹ãèµ·åããæºåãæŽããŸãã 確ãã«ããã®ãããªã¯ã©ã¹ã¿ãŒã®ç¶æ ã¯äžè²«æ§ããããŸããïŒãããŒãžã£ãŒã®æ°ãå°ãªããšã3ã§ããå Žåãäžè²«ããç¶æ ãéæãããŸãïŒã ãããŠãã¡ããããã®å Žåã§ãã¹ã±ãŒãªã³ã°ãšãã©ãŒã«ããã¬ã©ã³ã¹ã«ã€ããŠã¯è©±ããŸããã ãããè¡ãã«ã¯ãå°ãªããšã2ã€ã®å¶åŸ¡ããŒããã¯ã©ã¹ã¿ãŒã«æ¥ç¶ããå¿ èŠããããŸãã ãªãŒããŒã§æ¬¡ã®ã³ãã³ããå®è¡ããŠããããè¡ãæ¹æ³ãåŠç¿ã§ããŸãã
å¶åŸ¡ããŒãã®è¿œå
$ docker swarm join-token manager To add a manager to this swarm, run the following command: docker swarm join \ --token SWMTKN-1-1yptom678kg6hryfufjyv1ky7xc4tx73m8uu2vmzm1rb82fsas-c12oncaqr8heox5ed2jj50kjf \ 172.28.128.3:2377
äœæ¥ããŒããè¿œå ãã
$ docker swarm join-token worker To add a worker to this swarm, run the following command: docker swarm join \ --token SWMTKN-1-1yptom678kg6hryfufjyv1ky7xc4tx73m8uu2vmzm1rb82fsas-511vapm98iiz516oyf8j00alv \ 172.28.128.3:2377
ããŒãã¯ãã¯ã©ã¹ã¿ãŒã®åç¶æéäžãã€ã§ãè¿œå ããã³åé€ã§ããŸããããã¯ãæ·±å»ãªæ¹æ³ã§ããã©ãŒãã³ã¹ã«é倧ãªåœ±é¿ãäžããããšã¯ãããŸããã
ãµãŒãã¹äœæ
Dockerã§ãµãŒãã¹ãäœæããããšã¯ãåºæ¬çã«ã³ã³ãããäœæããããšãšåãã§ãã
docker service create --name nginx --publish 8080:80 --replicas 2 nginx:stable-alpine
ååãšããŠãéãã¯ç°ãªããªãã·ã§ã³ã®ã»ããã«ãããŸãã ããšãã°ããµãŒãã¹ã«ã¯--volumeãªãã·ã§ã³ã¯ãããŸãããã -mountãªãã·ã§ã³ããããŸãããããã®ãªãã·ã§ã³ã䜿çšãããšãããŒã«ã«ããŒããªãœãŒã¹ãã³ã³ãããŒã«æ¥ç¶ã§ããŸãããããã¯ããŸããŸãªæ¹æ³ã§è¡ããŸãã
ãµãŒãã¹æŽæ°
ãããããã³ã³ãããŒã®äœæ¥ãšã³ã³ãããŒã®ã¯ã©ã¹ã¿ãŒïŒãµãŒãã¹ïŒã®äœæ¥ã®æ倧ã®éããå§ãŸããŸãã éåžžãåäžã®ã³ã³ãããæŽæ°ããã«ã¯ãçŸåšã®ã³ã³ãããåæ¢ããŠæ°ããã³ã³ãããéå§ããå¿ èŠããããŸãã ããã¯ãéèŠã§ã¯ãããŸãããããµãŒãã¹ã®æ¢åã®ããŠã³ã¿ã€ã ã«ã€ãªãããŸãïŒä»ã®ããŒã«ã䜿çšããŠãã®ãããªç¶æ³ãåŠçããããšã«ç ©ããããŠããªãå ŽåïŒã
å°ãªããšã2ã€ã®ã¬ããªã«ã®æ°ã§ãµãŒãã¹ã䜿çšããå Žåãã»ãšãã©ã®å ŽåããµãŒãã¹ã®åæ¢ã¯çºçããŸããã ããã¯ãDockerããµãŒãã¹ã³ã³ãããé çªã«æŽæ°ããããšã§å®çŸãããŸã ã ã€ãŸããåæã«ããŠãŒã¶ãŒã®ãªã¯ãšã¹ããåŠçã§ããå°ãªããšã1ã€ã®äœæ¥ã³ã³ãããåžžã«ååšããŸãã
ããã€ãã®å€ïŒããšãã°ã-- publishãŸãã¯--label ïŒãæã€ããšãã§ãããµãŒãã¹ããããã£ãæŽæ°ïŒè¿œå ããã³åé€ãå«ãïŒããã«ã¯ãDockerã¯ãæ¥å°ŸèŸ-addããã³-rmã§çµããç¹å¥ãªãªãã·ã§ã³ã䜿çšããããšããå§ãããŸãã
# docker service update --label-add foo=bar nginx
ãã ããäžéšã®ãªãã·ã§ã³ãåé€ããã®ã¯ç°¡åã§ã¯ãªããå€ãã®å Žåããªãã·ã§ã³èªäœã«äŸåããŸãã
# docker service update --label-rm foo nginx # (target port) docker service update --publish-rm 80 nginx
åãªãã·ã§ã³ã®è©³çŽ°ã«ã€ããŠã¯ã docker service updateã³ãã³ãã®èª¬æãåç §ããŠãã ããã
ã¹ã±ãŒãªã³ã°ãšãã©ã³ã¹
æ¢åã®DockerããŒãéã§ãªã¯ãšã¹ããåæ£ããããã«ã ã€ã³ã°ã¬ã¹ããŒããã¬ãŒã·ã³ã°ãšåŒã°ããåè·¯ã䜿çšãããŸãã ãã®ã¡ã«ããºã ã®æ¬è³ªã¯ããŠãŒã¶ãŒãã©ã®ããŒããèŠæ±ããŠããæåã«å éšãã©ã³ã·ã³ã°ã¡ã«ããºã ãééããŠããããã®ãããªèŠæ±ãçŸåšåŠçã§ããããŒãã«ãªãã€ã¬ã¯ããããããšã§ãã ã€ãŸããã©ã®ããŒãã§ããä»»æã®ã¯ã©ã¹ã¿ãŒãµãŒãã¹ãžã®èŠæ±ãåŠçã§ããŸãã
DockerãµãŒãã¹ã®ã¹ã±ãŒãªã³ã°ã¯ãå¿ èŠãªã¬ããªã«ã®æ°ãæå®ããããšã«ããå®çŸãããŸãã ã¯ã©ã€ã¢ã³ãããã®ãªã¯ãšã¹ããåŠçããããŒãã®æ°ãå¢ããïŒãŸãã¯æžããïŒå¿ èŠãããæç¹ã§ãå¿ èŠãª--replicasãªãã·ã§ã³ã®å€ã§ãµãŒãã¹ããããã£ãæŽæ°ããŸãã
docker service update --replicas 3 nginx
ãã®å Žåã䜿çšå¯èœãªããŒãã®æ°ãã䜿çšããã¬ããªã«ã®æ°ããå°ãªããªãããšãå¿ããªãã§ãã ããã ããŒããã¬ããªã«ãããå°ãããŠãäœãæªãããšã¯èµ·ãããŸããããäžéšã®ããŒãã¯åããµãŒãã¹ã®è€æ°ã®ã³ã³ãããèµ·åããã ãã§ãïŒããã§ãªãå ŽåãDockerã¯ç°ãªããµãŒãã¹ã§åããµãŒãã¹ã®ã¬ããªã«ãå®è¡ããããšããŸãïŒã
èé害æ§
ãµãŒãã¹ã®ãã©ãŒã«ããã¬ã©ã³ã¹ã¯Dockerã«ãã£ãŠä¿èšŒãããŠããŸãã ããã¯ããšããããã¯ã©ã¹ã¿ãŒå ã§è€æ°ã®å¶åŸ¡ããŒããåæã«æ©èœãããã€ã§ãæ éãããªãŒããŒã眮ãæããããšãã§ãããšããäºå®ã«ããéæãããŸãã ãã詳现ã«ã¯ãããããåæ£ã³ã³ã»ã³ãµã¹ç¶æã¢ã«ãŽãªãºã ã§ããRaftã䜿çšãããŸãã èå³ã®ããæ¹ã«ã¯ããã®çŽ æŽãããèŠèŠçãªãã¢ã³ã¹ãã¬ãŒã·ã§ã³ãèŠãããšããå§ãããŸãã
ããã ïŒæ°ãããªãŒããŒãéžã¶
èªåå±é
ãµãŒããŒãšæŠãããã«ã¢ããªã±ãŒã·ã§ã³ã®æ°ããããŒãžã§ã³ãå±éãããšãåžžã«äœããããŸããããªããšãããªã¹ã¯ã䌎ããŸãã ãã®ãããé±æ«ãäŒæ¥ã®åã«ã¢ããªã±ãŒã·ã§ã³ã®æ°ããããŒãžã§ã³ãå ¬éããã®ã¯æªãå åãšèŠãªãããŸãã ããã«ã幎æ«å¹Žå§ãªã©ã®é·æäŒæã®åã«ãè»äºã€ã³ãã©ã®å€æŽã¯ãéå§ããåã«1ã2é±éåæ¢ããŸãã
DockerãµãŒãã¹ã¯ã¢ããªã±ãŒã·ã§ã³ãèµ·åããã³æŽæ°ããããã®å®å šã«ä¿¡é Œã§ããæ¹æ³ãæäŸãããšããäºå®ã«ãããããããå€ãã®å Žåã以åã®ããŒãžã§ã³ãžã®è¿ éãªããŒã«ããã¯ã¯äœããã®çç±ã§å°é£ã§ãããããã«ãããŠãŒã¶ãŒãäœæéãã¢ã¯ã»ã¹ã§ããªããªãå¯èœæ§ããããŸãã
ã¢ããªã±ãŒã·ã§ã³ã®æŽæ°æã«åé¡ãåé¿ããæãä¿¡é Œã§ããæ¹æ³ã¯ã èªååãšãã¹ãã§ãã ãã®ããã«ãèªåå±éã·ã¹ãã ãéçºãããŠããŸãã ãã®ãããªã·ã¹ãã ã®éèŠãªéšåã¯ãååãšããŠãéžæããã€ã³ãã©ã¹ãã©ã¯ãã£ã§ä»¥åã®ããŒãžã§ã³ã«è¿ éã«ã¢ããã°ã¬ãŒãããŠããŒã«ããã¯ã§ããããšã§ãã
ãã¡ããªã·ãª
ã»ãšãã©ã®å±éèªååããŒã«ã¯ãXMLãYAMLãªã©ã®äžè¬çãªããŒã¯ã¢ããèšèªã䜿çšããŠæ§æã®èª¬æãæäŸããŸãã ããã€ãã¯ããã«é²ãã§ããã®ãããªæ§æãèšè¿°ããããã®ç¬èªã®èšèªãéçºããŸãïŒäŸïŒ HCLãŸãã¯Puppetèšèª ïŒã 次ã®çç±ã«ããããããã®ãã¹ã䜿çšããå¿ èŠã¯ãããŸããã
- XML / YAMLã¯ãæ¡åŒµã䜿çšã«é¢ããŠæ¬æ Œçãªããã°ã©ãã³ã°èšèªãšæ¯èŒããããšã¯ã§ããŸããããŸããåçŽåãããããŒã¯ã¢ããã䜿çšããŠæ§æãç°¡çŽ åãããšããèŠæã¯ãã°ãã°å察ã§ããããã¹ãŠãè€éã«ãªããŸããã©ã¹ããã°ã©ãã³ã°ã®ç¹å¥ãªå Žåã
- ç¬èªã®ããã°ã©ãã³ã°èšèªã®éçºã¯éåžžã«è€éã§éå±ãªããã»ã¹ã§ãããã»ãšãã©ã®å Žåãããã«è²»ãããåŽåã®äŸ¡å€ã¯ãããŸããã
ãã®ãããFabricioã¯ãéåžžã®Pythonã䜿çšããŠãæ§æãšä¿¡é Œæ§ãé«ãå®çžŸã®ããã©ã€ãã©ãªïŒæªåé«ãFabric ïŒãèšè¿°ããŸãã
ãã¡ãããå€ãã®äººã¯ããã«å察ãããããããŸããããã¹ãŠã®éçºè ãšDevOpsãPythonãç¥ã£ãŠããããã§ã¯ãªããšèšã£ãŠããŸãã ãŸãããŸããPythonïŒããã³BashïŒã¯ããã¹ãŠã®èªå°å¿ã®ããDevOpsãç¥ã£ãŠããã¹ãã§ããïŒãŸãããŸãã¯ã»ãŒå šå¡ïŒçŽ³å£«çãªã¹ã¯ãªããèšèªã®ã»ããã«å«ãŸããŠããŸãã ãããŠç¬¬äºã«ãé説çã«ãPythonãç¥ãããšã¯ã»ãšãã©ãªãã·ã§ã³ã§ãã ç§ã®èšèãæ¯æããŠãDjango for Fabricioã«åºã¥ãããµãŒãã¹ã®æ§æäŸã瀺ããŸãã
fabfile.py
from fabricio import tasks from fabricio.apps.python.django import DjangoService django = tasks.DockerTasks( service=DjangoService( name="django", image="project/django", options={ "publish": "8080:80", "env": "DJANGO_SETTINGS_MODULE=my_settings", "replicas": 3, }, ), hosts=["user@manager1", "user@manager2", "user@manager3"], )
ãã®äŸã¯ãYAMLã®åæ§ã®èª¬æã»ã©è€éã§ã¯ãªãããšã«åæããŸãã å°ãªããšã1ã€ã®ããã°ã©ãã³ã°èšèªãç¥ã£ãŠãã人ã¯ããã®æ§æãåé¡ãªãç解ã§ããŸãã
ããããããããªæè©ã
å±éããã»ã¹
æŠç¥çã«ãFabricioã䜿çšããŠãµãŒãã¹ããããã€ããããã»ã¹ã¯ãäžã®å³ã«ç€ºãããã«ãªããŸãïŒäžèšã®æ§æã«å¯ŸããŠfab djangoã³ãã³ããå®è¡ããåŸïŒã
åé ç®ãé çªã«æ€èšããŠãã ããã ãŸãæåã«ã䞊åå®è¡ã¢ãŒãããªã³ã«ãªã£ãŠããå ŽåïŒæå®ããããªãã·ã§ã³--parallelãæå®ããå ŽåïŒãæ瀺ãããã¹ããŒã ãé¢é£ããŠããããšã«ããã«æ³šæããŸãã ã·ãŒã±ã³ã·ã£ã«ã¢ãŒãã®éãã¯ãã¢ãŒãå ã®ãã¹ãŠã®ã¢ã¯ã·ã§ã³ãå³å¯ã«ã·ãŒã±ã³ã·ã£ã«ã«å®è¡ãããããšã ãã§ãã
å±éã³ãã³ããèµ·åãããšããã«ã次ã®æé ãé çªã«éå§ãããŸãã
- pullãšåæã«ãæ°ããDockerã€ã¡ãŒãžãããŠã³ããŒãããããã»ã¹ããã¹ãŠã®ããŒãã§éå§ãããŸãã æ§æã§ã¯ãå¶åŸ¡ããŒãïŒãããŒãžã£ãŒïŒã®ã¢ãã¬ã¹ã®ã¿ãæå®ããã ãã§ååã§ããããšã«æ³šæããŠãã ããã䜿çšå¯èœãªãããŒãžã£ãŒããã¹ãŠãªã¹ãããå¿ èŠã¯ãããŸãããæå®ãããŠããªãããŒãã¯Dockerã«ãã£ãŠèªåçã«æŽæ°ãããŸãã ã¯ãŒã«ãŒãå«ãæ§æã§ã®æå®ã劚ãããã®ã¯äœããããŸãããïŒ SSHãã³ãã«ã䜿çšããå Žåãªã©ãå Žåã«ãã£ãŠã¯ãããå¿ èŠã§ãïŒ
- migrate ã次ã®ã¹ãããã¯ç§»è¡ã®é©çšã§ãã ãã®ã¹ãããã¯äžåºŠã«1ã€ã®çŸåšã®ããŒãã§ã®ã¿å®è¡ãããããšãéèŠã§ãããã®å ŽåãFabricioã¯ç¹å¥ãªã¡ã«ããºã ã䜿çšããŠã移è¡ããã»ã¹ã1ã€ã®ããŒãã§ã®ã¿å®è¡ãããäžåºŠã ãå®è¡ãããããã«ããŸãã
- update㯠ããã¹ãŠã®ãµãŒãã¹ã³ã³ãããæŽæ°ããããã«ãupdateã³ãã³ãã1åå®è¡ããã ãã§ååãªããããã®ã¹ãããã§Fabricioã2åå®è¡ãããªãããã«ããŸãã
å¿ èŠã«å¿ããŠãåã³ãã³ãïŒãã«ã移è¡ãæŽæ°ïŒãåå¥ã«å®è¡ã§ããŸãã ãã®ä»¥åã®Fabricioã¬ãã¥ãŒèšäºã§èª¬æãããŠããããã«ãå±éããã»ã¹ã«è¿œå ã®æé ïŒæºåãããã·ã¥ãããã¯ã¢ããïŒãå«ããããšãã§ããŸã ã
Fabricioã®ãã¹ãŠã®ã³ãã³ãïŒããã¯ã¢ãããšåŸ©å ãé€ãïŒã¯içã§ããã€ãŸããåããã©ã¡ãŒã¿ãŒã§åå®è¡ããŠãå®å šã§ãã
ã¹ãçæ§æ€å®
fab --parallel nginx
$ fab --parallel nginx [vagrant@172.28.128.3] Executing task 'nginx.pull' [vagrant@172.28.128.4] Executing task 'nginx.pull' [vagrant@172.28.128.5] Executing task 'nginx.pull' [vagrant@172.28.128.5] run: docker pull nginx:stable-alpine [vagrant@172.28.128.4] run: docker pull nginx:stable-alpine [vagrant@172.28.128.3] run: docker pull nginx:stable-alpine [vagrant@172.28.128.3] out: stable-alpine: Pulling from library/nginx [vagrant@172.28.128.3] out: Digest: sha256:ce50816e7216a66ff1e0d99e7d74891c4019952c9e38c690b3c5407f7af57555 [vagrant@172.28.128.3] out: Status: Image is up to date for nginx:stable-alpine [vagrant@172.28.128.3] out: [vagrant@172.28.128.4] out: stable-alpine: Pulling from library/nginx [vagrant@172.28.128.4] out: Digest: sha256:ce50816e7216a66ff1e0d99e7d74891c4019952c9e38c690b3c5407f7af57555 [vagrant@172.28.128.4] out: Status: Image is up to date for nginx:stable-alpine [vagrant@172.28.128.4] out: [vagrant@172.28.128.5] out: stable-alpine: Pulling from library/nginx [vagrant@172.28.128.5] out: Digest: sha256:ce50816e7216a66ff1e0d99e7d74891c4019952c9e38c690b3c5407f7af57555 [vagrant@172.28.128.5] out: Status: Image is up to date for nginx:stable-alpine [vagrant@172.28.128.5] out: [vagrant@172.28.128.3] Executing task 'nginx.migrate' [vagrant@172.28.128.4] Executing task 'nginx.migrate' [vagrant@172.28.128.5] Executing task 'nginx.migrate' [vagrant@172.28.128.5] run: docker info 2>&1 | grep 'Is Manager:' [vagrant@172.28.128.4] run: docker info 2>&1 | grep 'Is Manager:' [vagrant@172.28.128.3] run: docker info 2>&1 | grep 'Is Manager:' [vagrant@172.28.128.3] Executing task 'nginx.update' [vagrant@172.28.128.4] Executing task 'nginx.update' [vagrant@172.28.128.5] Executing task 'nginx.update' [vagrant@172.28.128.5] run: docker inspect --type image nginx:stable-alpine [vagrant@172.28.128.4] run: docker inspect --type image nginx:stable-alpine [vagrant@172.28.128.3] run: docker inspect --type image nginx:stable-alpine [vagrant@172.28.128.3] run: docker inspect --type container nginx_current [vagrant@172.28.128.3] run: docker info 2>&1 | grep 'Is Manager:' [vagrant@172.28.128.4] run: docker inspect --type container nginx_current [vagrant@172.28.128.3] run: docker service inspect nginx [vagrant@172.28.128.4] run: docker info 2>&1 | grep 'Is Manager:' [vagrant@172.28.128.3] No changes detected, update skipped. [vagrant@172.28.128.4] No changes detected, update skipped. [vagrant@172.28.128.5] run: docker inspect --type container nginx_current [vagrant@172.28.128.5] run: docker info 2>&1 | grep 'Is Manager:' [vagrant@172.28.128.5] No changes detected, update skipped. Done. Disconnecting from vagrant@127.0.0.1:2222... done. Disconnecting from vagrant@127.0.0.1:2200... done. Disconnecting from vagrant@127.0.0.1:2201... done.
fab nginx
$ fab nginx [vagrant@172.28.128.3] Executing task 'nginx.pull' [vagrant@172.28.128.3] run: docker pull nginx:stable-alpine [vagrant@172.28.128.3] out: stable-alpine: Pulling from library/nginx [vagrant@172.28.128.3] out: Digest: sha256:ce50816e7216a66ff1e0d99e7d74891c4019952c9e38c690b3c5407f7af57555 [vagrant@172.28.128.3] out: Status: Image is up to date for nginx:stable-alpine [vagrant@172.28.128.3] out: [vagrant@172.28.128.4] Executing task 'nginx.pull' [vagrant@172.28.128.4] run: docker pull nginx:stable-alpine [vagrant@172.28.128.4] out: stable-alpine: Pulling from library/nginx [vagrant@172.28.128.4] out: Digest: sha256:ce50816e7216a66ff1e0d99e7d74891c4019952c9e38c690b3c5407f7af57555 [vagrant@172.28.128.4] out: Status: Image is up to date for nginx:stable-alpine [vagrant@172.28.128.4] out: [vagrant@172.28.128.5] Executing task 'nginx.pull' [vagrant@172.28.128.5] run: docker pull nginx:stable-alpine [vagrant@172.28.128.5] out: stable-alpine: Pulling from library/nginx [vagrant@172.28.128.5] out: Digest: sha256:ce50816e7216a66ff1e0d99e7d74891c4019952c9e38c690b3c5407f7af57555 [vagrant@172.28.128.5] out: Status: Image is up to date for nginx:stable-alpine [vagrant@172.28.128.5] out: [vagrant@172.28.128.3] Executing task 'nginx.migrate' [vagrant@172.28.128.3] run: docker info 2>&1 | grep 'Is Manager:' [vagrant@172.28.128.4] Executing task 'nginx.migrate' [vagrant@172.28.128.4] run: docker info 2>&1 | grep 'Is Manager:' [vagrant@172.28.128.5] Executing task 'nginx.migrate' [vagrant@172.28.128.5] run: docker info 2>&1 | grep 'Is Manager:' [vagrant@172.28.128.3] Executing task 'nginx.update' [vagrant@172.28.128.3] run: docker inspect --type image nginx:stable-alpine [vagrant@172.28.128.3] run: docker inspect --type container nginx_current [vagrant@172.28.128.3] run: docker service inspect nginx [vagrant@172.28.128.3] No changes detected, update skipped. [vagrant@172.28.128.4] Executing task 'nginx.update' [vagrant@172.28.128.4] run: docker inspect --type image nginx:stable-alpine [vagrant@172.28.128.4] run: docker inspect --type container nginx_current [vagrant@172.28.128.4] No changes detected, update skipped. [vagrant@172.28.128.5] Executing task 'nginx.update' [vagrant@172.28.128.5] run: docker inspect --type image nginx:stable-alpine [vagrant@172.28.128.5] run: docker inspect --type container nginx_current [vagrant@172.28.128.5] No changes detected, update skipped. Done. Disconnecting from vagrant@172.28.128.3... done. Disconnecting from vagrant@172.28.128.5... done. Disconnecting from vagrant@172.28.128.4... done.
åã®ããŒãžã§ã³ãžã®ããŒã«ããã¯
åã®ããŒãžã§ã³ãžã®ããŒã«ããã¯ïŒåè¿°ã®æ§æã®fab django.rollbackã³ãã³ã ïŒã¯ãå±éããã»ã¹ãšã»ãŒåãã§ãã
移è¡ã®ããŒã«ããã¯ãšãµãŒãã¹èªäœã®ä»¥åã®ç¶æ ãžã®ããŒã«ããã¯ã®äž¡æ¹ãããããŒãžã£ãŒããŒãã®1ã€ã§å³å¯ã«1åå®è¡ãããŸãã
ãããã«
ã³ã³ããåã¯ããµãŒããŒéçºã®æªæ¥ã§ãã ãŸã ããã«æ°ä»ããŠããªã人ã¯ããã«æ¢æäºå®ã«çŽé¢ããã§ãããã ã³ã³ããã¯ãéçºè ãšDevOpsã®æã«ãšã£ãŠäŸ¿å©ã§ã·ã³ãã«ã§åŒ·åãªæŠåšã§ãã
Docker 1.12ã®ãªãªãŒã¹ã§ã¯ãKubernetesã®æ¯æè ã¯åŸè ã䜿çšããããšã«ã€ããŠã»ãšãã©è°è«ãããŠããŸããã DockerãµãŒãã¹ã¯KubernetesãµãŒãã¹ãšåãæ©èœããã¹ãŠæäŸããã ãã§ãªããOSïŒLinuxãmacOSãWindowsïŒã§ã®æ§æã容æã§ãããè¿œå ã®ã³ã³ããŒãã³ãïŒã³ã³ãããŒïŒãã€ã³ã¹ããŒã«ããŠå®è¡ããå¿ èŠããªããããå€ãã®å©ç¹ãããããŸãã
Fabricio-Dockerã䜿çšããŠãµãŒããŒãšæŠãããã¹ãããã¢ããªã±ãŒã·ã§ã³ã®æ°ããããŒãžã§ã³ã®éçºããã¹ããããã³å±éãæ¯æŽããããŒã«-ã¹ã±ãŒã©ãã«ã§ãã©ãŒã«ããã¬ã©ã³ããªãµãŒãã¹ã®å±éããµããŒãããããã«ãªããŸããã ããŒãžäžã®Fabricioã®ããŸããŸãªäœ¿çšæ³ã«ã€ããŠã äŸãšã¬ã·ãã䜿çšããŠç解ããããšãã§ããŸã ïŒãã¹ãŠã®äŸã¯è©³çŽ°ã«èª¬æãããVagrantã䜿çšããŠèªååãããŠããŸãïŒã