è¦ç´
- WebSocketãããæãã«æ±ã£ã¦ãããããã«ã¦ã§ã¢kuiperbeltã®Dockerfileãä½ã£ã
- Docker対å¿ã®ããã«å¹¾ã¤ãã®äºæããã£ã
- ãªãã·ã§ã³ãç°å¢å¤æ°ã§æ¸¡ããããã«ããã¨ã
- ãã¨ã¾ããããããã£ã
çµç·¯
- YAPC::Okinawaã§çµæ§å¤§ã çã«å®£ä¼ããã(ã¤ãã)ãªãã ããã©ãããããæ®å¿µãªã¨ãããç´ãã¦ããããã¨æã£ãã®ã§ãããããã£ã¦ãã
README.md
ã®ã¤ã³ã¹ãã¼ã«æ¹æ³ãè ã£ã¦ããã¨ã- Goã¯åºæ¬
go get
ã§ã³ãã³ãã¤ã³ã¹ãã¼ã«ã§ãããããã©kuiperbeltã¯depã§ä¾åã©ã¤ãã©ãªã®ãã¼ã¸ã§ã³åºå®ããã¦ãããgo get
ã¯ãããªã®ç¡è¦ãã¦ææ°ãã¼ã¸ã§ã³åã£ã¦ããããã¼ã«ã«ã«ãã§ã«ãããã¼ã¸ã§ã³ã使ããã¨ãã¦ãã¤ã³ã¿ã¼ãã§ã¤ã¹ãå¤ããã¨ã³ã³ãã¤ã«ã«å¤±æãã - ãã¨åä½ã³ãã³ãã§åããã¤ã¯Goã³ã³ãã¤ã©ã¯è¦ããªãã®ã§ãrelease binaryãç¨ããã®ãåãkuiperbeltã¯ä»¥åãããããæä¾ãã¦ãã
- Goã¯åºæ¬
- ã¨ããã§release binaryããããã¼ã«ã¯id:Songmuããä½ã®ghgãç¨ããã¨ãOSãã¢ã¼ããã¯ãã£ãèæ
®ãã¦ãã¦ã³ãã¼ããã¦ãããã®ã§ä¾¿å©ã¨ãããã¨ãç¥ããã¦ãã¾ãããkuiperbeltã¯release binaryã®ããã±ã¼ã¸ã³ã°ãghgã«å¯¾å¿ãã¦ããªãã¦é©ç¨ã§ãã¦ãªãã£ã
- ã¨ããã®ãYAPC::Okinawaã®ã¹ã©ã¤ããæ¸ãã¦ããæã«æ°ãã¤ãã
- ãããããã±ã¼ã¸ã³ã°ãå¤æ´ããã¨ä¼ç¤¾ã®æ¹ã§ä½¿ããã¦ããã¢ããªã±ã¼ã·ã§ã³ã§å½±é¿ãããã®ã§ã¯ï¼(chefã¬ã·ãã¨ã)ã¨ç¤¾å Slackã§è¨ã£ããããããããDockerfileã®å¤æ´ããããã¨è¨ããã¦ããããã«ä»ã¯Dockerä¸ã§åããã¦ããããããããã¨ãªã£ã
- ã¨ããããã§ããã±ã¼ã¸ã³ã°å¤æ´ã¨å ¬å¼Dockerfile/docker imageã®é å¸ããããããã¨ã«ãã
ãã£ããã¨
ããã±ã¼ã¸ã³ã°å¤æ´
- ããããã°Goã®ãã¼ã«ä½ãæã«ãã«ããããã¹ãããrelease binaryä¸ããã®ã¨ãæ¯åã³ããããªã£ã¦æã£ã
- ã³ããã§ããããã¯èªåç¨ãã³ãã¬ãããã¨ããããã¨æããä½ã£ã
- ä¸èº«ã¯depã¨ãã¯ãã¹ã³ã³ãã¤ã«ãã¼ã«goxzãGitHub releaseã«çæç©ãä¸ããghrã¨ããã¤ã³ã¹ãã¼ã«ããããæå®ã®ãã£ã¬ã¯ããªã«çæç©ãã¯ãããããããã¢ãããã¼ãããMakefileã®éå½¢ã¿ãããªãã¤
- ã¢ã¤ãã£ã¢ã®å ãã¿ã¯Arduino-Makefile
- ãããkuiperbeltãã使ãããã«ãã
- travisã§ãã«ãããã¾ãè¡ããªãã£ãããã¦è©¦è¡é¯èª¤ã®è·¡ãè¦ããã
- æçµçã«ã¯ghrã¯ä½¿ããã«ãtravisã®deployæ©è½ã使ã£ã¦ã¿ã°åããããGitHub releaseã«åºãããã«ãã
.travis.yml
ãjetpackã«å ¥ããã®ã¯ã©ãããªã¨ã¯æã£ã¦ãã- GitHub tokenã®æå·åã¨ããããã®ã§ä¸çºã§ã¯ãããªããã
- ããã§ããã±ã¼ã¸ã³ã°å¤æ´ããv1.2.6ãåºãã
Dockerfileä½æ
- 課é¡ã¨ãã¦ãDockerå
ã§åä½ããkuiperbeltã«å¯¾ãã¦ãªãã·ã§ã³ãã©ã®ããã«æ¸¡ããã¨ããåé¡ããã
- ç¾ç¶ãkuiperbeltã¯æ°å¤ãã®ãªãã·ã§ã³ãymlå½¢å¼ã§è¨å®ãã¡ã¤ã«ãè¨è¿°ãããã¨ã§è¡ã£ã¦ãã
- Docker containerã§è¨å®ãã¡ã¤ã«ãå¿
è¦ã¨ããã¢ããªã±ã¼ã·ã§ã³ã¯åºæ¬çã«ã¯ããªã¥ã¼ã ãã¦ã³ãããããã¤ã¡ã¼ã¸ãã«ãæã«å«ãã¦ãã¾ãããã¯ãã¾ãèµ·åæã«S3ããcurlã¹ã¯ãªããã§å¼ã£å¼µã£ã¦ããã¨ãããããã®ãå¿
è¦
- å ¨é¨ããã©ããã
- 社å ã§ã¯ã¤ã¡ã¼ã¸ãã«ãæã«å«ãã¤ã¤ãã¤ã³ã¹ã¿ã³ã¹ã«ãã£ã¦å¤åããããªè¦ç´ ã¯èµ·åæã«ç°å¢å¤æ°ããè¨å®ãã¡ã¤ã«ã«æ¸ãè¾¼ãããã«ãã¦ãã
- ãã¨ãã³ã³ããèµ·åæã®å¼æ°ã§æ¸¡ãæ¹æ³ã¨ãç°å¢å¤æ°ã§æ¸¡ãæ¹æ³ããã
- ã¾ãç°å¢å¤æ°ã§ããã®ãä¸çªç°¡å
- The Twelve-Factor Appããã
- ããããããããã®ãªãã·ã§ã³ãç°å¢å¤æ°ã§ä½¿ããããã«ããã®ããã©ããªã£ã¦ãªã
- ã¨ãããkayac/go-configã£ã¦è¨ã便å©ãªãã¤ãããã£ã½ãã®ã§ããã使ããã¨ã«ãããã¹ãã
- ãã¨ã¯æè¿å ¥ã£ãmulti stage buildãªãã使ã£ã¦scratchã¤ã¡ã¼ã¸ãã¼ã¹ãªã®ã§çµæ§è»½ãã4MBã§ããã試ããã
$ docker pull mackee/kuiperbelt:latest
- static buildããGoãã¤ããªã£ã¦ããã©ã¼ãã³ã¹ã«ã©ãä½å½±é¿ããã®ã ããããä»åº¦ãã³ããã¼ã¯ãåã£ã¦è©¦ãã¦ã¿ãã
ãµã³ãã«ã¢ããªãdocker-composeã§è©¦ããããã«ãã
- ç°¡åãªãã£ããã¢ããªã_example以ä¸ã«å ã å ¥ã£ã¦ãã
- Perl/PSGI製
- Perlã®Preforkãµã¼ãã§ãåºãããªãWebSocketã¢ããªã±ã¼ã·ã§ã³ãæ¸ããã¨ããã®ã示ãããã®ãã®
- sinatraã¨ãflaskã§ãä½ããããªã¨ã¯æã£ã¦ããããã©ã¾ã ããæ°ãåºãªã
- ãã«ãããã®ã«ç¾ä»£Perlã®ç¥èãå¿ è¦ã ã£ãã®ã§ããããDockerã«æ¼ãè¾¼ããã¨ã«ãã
- å
·ä½çã«ã¯docker-composeã§kuiperbeltã¨ãã¼ã¿ã¹ãã¢ã¨ãã¦å©ç¨ããRedisãç«ã¦ã¤ã¤ããã¼ã«ã«ã®Perlã¢ããªã±ã¼ã·ã§ã³ãåä½ããã³ã³ããããã«ããã
- ä»äºã§å¾ãç¥èã使ã£ã¦ãã¦ãä¾ãã°ä¾åãæ¸ãããcpanfileã ããCOPYãã¦ããã¦ãã®ä¸ã§cpmã§ä¾åå
¥ããå¾ã«å¿
è¦ãª
app.psgi
ã¨ãindex.html
ãCOPYããæ¦æ³ã§è¡ãã¨ãä¾åã®å¤æ´ãç¡ããã°å ¨ã¢ã¸ã¥ã¼ã«ã¤ã³ã¹ãã¼ã«ãç´ãã§ãã«ãæéããªãï½ãã«ãªããªã - æ®æ®µã¯ããããä»äºãæã ãã£ã¦ã¾ã
- ä»äºã§å¾ãç¥èã使ã£ã¦ãã¦ãä¾ãã°ä¾åãæ¸ãããcpanfileã ããCOPYãã¦ããã¦ãã®ä¸ã§cpmã§ä¾åå
¥ããå¾ã«å¿
è¦ãª
- ãã¨ç«ã¦ã¦ã¿ããä¸å¯©ãªåä½ããã¦ããã®ã§ããã£ããã¡ãã»ã¼ã¸ã®ããã¼ããã£ã¹ãé¨åãå¤§å¹ ã«ç´ãã
- ãã®ã³ã³ãããå®ã¯å¥ã¿ã°ã§DockerHubããè½ã¨ãã¾ã
$ docker pull mackee/kuiperbelt:webchat-example
- ä»ã¯Bootstrap + jQueryã§è²§ç¸ãªæãã®è¦ãç®ã ããã©ãVue.jsã¨UIãã¼ã«ãããã©ã¤ãã©ãªä½¿ã£ã¦ãã£ã¨ã¾ã¨ããªæãã«ã¯ãããã¨æã£ã¦ããã¾ã
- ç´ãã¦ããæã«ãããããã°XSSã¤ãã¼ããããã¨æã£ã¦ãããã§ã°ã°ã£ã¦åºã¦ããXSSãã±ã¼ã¿ã¼ãªããã®ãå ¥ãã¦ã¿ããæ¡ã®å®ãããã¢ãããã¦ç¬ã£ãã®ã§ãPerlå´ã§HTML::Escapeåã¾ããããã¨ãã¯ã©ã¤ã¢ã³ãã®çæããUUIDããã®ã¾ã¾ä½¿ã£ã¦ããã®ã§ããããç¡è¦ãã¦Perlå´ã§UUIDãçæããããã«ãããããã§ã大ä¸å¤«ãªãã§ã
- ã¯ã©ã¤ã¢ã³ãå´ã«ã¯ãªãã©ã¤æ©æ§ã¨ãå ¥ã£ã¦ãªãããã¢ã¤ãã«ã¿ã¤ã ã¢ã¦ãã®æ©è½ã使ã£ã¦ãªãã®ã§ããã®ã¸ããæãå ¥ãããããã©ãJSã®ç¥èããªãã
ãã®è¾ºã®è©¦è¡é¯èª¤ã¯ãã¡ã
https://github.com/mackee/kuiperbelt/pull/48github.com
試ãããå ´åã¯ã
$ git clone https://github.com/mackee/kuiperbelt $ cd kuiperbelt/_example $ make up $ make open
ã§çµããã§ããã試ããã
DockerHubã«ä¸ãã
- å½åãtravisã®deployã«ããã®ããªã¨æã£ã¦ãããã©ããããªãã¨ã¯ãªãã¦ãDockerHubããGitHubã®é£æºããã¨webhookãä½ãã§å¤æ´æ¤ç¥ãã¦èªåãã«ããã¦ãããã£ã½ãã便å©
- ã¿ãæ ã ãããªã®ããããªãããã©ããã«ããã¥ã¼å ¥ã£ã¦ããã¤ã¡ã¼ã¸ã§ããã¾ã§ã¯çµæ§æéãããã
- ã¨ããããã§å ¬å¼ã¤ã¡ã¼ã¸ã§ã
https://hub.docker.com/r/mackee/kuiperbelt/hub.docker.com
README.mdæ´æ°
- ã¡ãã£ã¨ã ãæ°åãå ¥ãã¦æ¸ãæãã
- ã¨ããã§è±èªã¯ããªãã§ããªãã§ãããã©ã¦ããããã¬ãã«
- ä»åã¯Grammerlyã¨Google翻訳ãä½µç¨ãã¤ã¤æ¸ããããã©ãã¾ã ã¾ã æå³ä¸æãªæãããã¨æããã¤ãã
- ã©ããªæ©è½ããããåãããã¨ãã声ããã£ãã®ã§ãAPIã¨Callbackã®summaryã¿ãããªãã®ãä½ã£ã¦ã¿ã
- å°ãã¯è¦æ ããè¯ããªã£ãã®ã§ã¯ãªãã®ã§ãããã
ãç¥ãã
- kuiperbeltã§ã¯ã¦ã¼ã¶ãåéãã¦ããã¾ã
- 社å éè¦ãæºããã ãã ã¨å¤æ§æ§ããªããã®ã§ããã
- 使ã£ã¦ä½ã£ã¦ã¿ãã¨ãããã°æãã¦ãã ãã
- ã©ãã¶ã¤ã¿ã¯ã¼ããã«ã®ã³ãã¼ãç¿ä½ã¨ãã¦ä½ãããã¨å»å¹´æ«ããæã£ã¦ããã¾ããããªããªãåãæããã¦ããã¾ãã
- ãã¨è¦æ ãã®ãããã´ãâ¦â¦