{"id":4673,"date":"2020-10-07T17:26:30","date_gmt":"2020-10-07T10:26:30","guid":{"rendered":"https:\/\/briswell-vn.com\/?p=4673"},"modified":"2020-10-07T17:37:15","modified_gmt":"2020-10-07T10:37:15","slug":"gitlabrunner-nodejs-ec2","status":"publish","type":"post","link":"https:\/\/www.briswell-vn.com\/ja\/news\/gitlabrunner-nodejs-ec2\/","title":{"rendered":"EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306b\u304a\u3051\u308bGITLAB RUNNER\u3068NODEJS\u3092\u4f7f\u3063\u305fCI\/CD\u4f5c\u6210\u65b9\u6cd5"},"content":{"rendered":"<p><\/p>\n<h1>\u7d39\u4ecb<\/h1>\n<h2>CI\/CD\u3068\u306f<\/h2>\n<p>CI\u3068\u306f\u3001Continuous Integration\u306e\u7565\u3067\u3001\u7d99\u7d9a\u7684\u30a4\u30f3\u30c6\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3068\u547c\u3070\u308c\u3001\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u304c\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u7ba1\u7406\u30b7\u30b9\u30c6\u30e0\u306eGIT\u306b\u5909\u66f4\u3055\u308c\u308b\u5ea6\u306b\u81ea\u52d5\u5316\u3055\u308c\u305f\u30d3\u30eb\u30c9\u3068\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3059\u308b\u624b\u6cd5\u3092\u3044\u3044\u307e\u3059\u3002\u958b\u767a\u8005\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u5909\u66f4\u304c\u300e\u826f\u3044\u300f\u72b6\u614b\u3068\u306a\u308a\u3001\u30b3\u30fc\u30c9\u30d9\u30fc\u30b9\u3067\u306e\u958b\u767a\u306b\u3088\u308a\u9069\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>CD\u3068\u306f\u3001Continuous Delivery\u306e\u7565\u3067\u3001\u7d99\u7d9a\u7684\u30c7\u30ea\u30d0\u30ea\u30fc\u3068\u547c\u3070\u308c\u3001\u7d99\u7d9a\u7684\u30a4\u30f3\u30c6\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u62e1\u5f35\u3057\u305f\u624b\u6cd5\u3067\u3042\u308a\u3001\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u304cGIT\u306b\u5909\u66f4\u3055\u308c\u308b\u5ea6\u306b\u81ea\u52d5\u5316\u3055\u308c\u305f\u30d3\u30eb\u30c9\u3068\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3059\u308b\u3060\u3051\u3067\u306a\u304f\u3001\u30a2\u30d7\u30ea\u304c\u3044\u3064\u3082\u5b89\u5b9a\u3057\u3066\u30c7\u30d7\u30ed\u30a4\u304c\u5b9f\u65bd\u3055\u308c\u308b\u304c\u3001\u672c\u756a\u74b0\u5883\u3078\u306e\u30c7\u30d7\u30ed\u30a4\u306f\u624b\u52d5\u3067\u884c\u3046\u3068\u3044\u3046\u3082\u306e\u3067\u3059\u3002<\/p>\n<p>CD\u3068\u306f\u3001Continuous Deployment\u306e\u7565\u3067\u3082\u3042\u308a\u3001\u7d99\u7d9a\u7684\u30c7\u30d7\u30ed\u30a4\u30e1\u30f3\u30c8\u3068\u547c\u3070\u308c\u3001\u7d99\u7d9a\u7684\u30c7\u30ea\u30d0\u30ea\u30fc\u3068\u540c\u69d8\u306b\u3001\u7d99\u7d9a\u7684\u30a4\u30f3\u30c6\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u62e1\u5f35\u3057\u305f\u624b\u6cd5\u3092\u3044\u3044\u307e\u3059\u3002\u305f\u3060\u3057\u3001\u7d99\u7d9a\u7684\u30c7\u30ea\u30d0\u30ea\u30fc\u3068\u7570\u306a\u308a\u672c\u756a\u74b0\u5883\u3078\u306e\u30c7\u30d7\u30ed\u30a4\u3092\u624b\u52d5\u3067\u884c\u3046\u4ee3\u308f\u308a\u306b\u3001\u81ea\u52d5\u7684\u306b\u5b9f\u65bd\u3057\u30e6\u30fc\u30b6\u30fc\u304c\u6700\u65b0\u306e\u3082\u306e\u3092\u3059\u3050\u306b\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>GitLab Runner\u3068\u306f<\/h2>\n<p>GitLab Runner\u306f\u30d3\u30eb\u30c9\u3084\u30c6\u30b9\u30c8\u3084\u30c7\u30d7\u30ed\u30a4\u7b49\u306e\u30b8\u30e7\u30d6\u3092\u5b9f\u884c\u3057\u3001\u305d\u306e\u30b8\u30e7\u30d6\u306e\u7d50\u679c\u3092GitLab\u3078\u8fd4\u5374\u3059\u308b\u3068\u3044\u3063\u305f\u3053\u3068\u306b\u4f7f\u308f\u308c\u308b\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u3059\u3002Runner\u306f\u4eee\u60f3\u30de\u30b7\u30f3\u3067\u3042\u308a\u3001VPS\u3067\u3082\u3042\u308a\u3001Docker\u30b3\u30f3\u30c6\u30ca\u30fc\u3067\u3082\u3042\u308a\u3001\u305d\u3057\u3066\u3001\u5404Docker\u30b3\u30f3\u30c6\u30ca\u30fc\u306e\u30b0\u30eb\u30fc\u30d7\u3067\u3059\u3002GitLab\u3068\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u3068\u3092\u9023\u643a\u3057\u305f \u4ed5\u7d44\u307f\u3067\u3042\u308bGitLab CI\/CD\u3068\u5171\u306b\u4f7f\u3063\u3066\u5404\u30b8\u30e7\u30d6\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002GitLab\u3068Runner\u306fAPI\u3092\u901a\u3057\u3066\u30b3\u30df\u30e5\u30cb\u30b1\u30fc\u30b7\u30e7\u30f3\u3057\u307e\u3059\u3002<\/p>\n<p><strong>Runners\u306e\u7a2e\u985e<\/strong><\/p>\n<ul style=\"list-style-type: disc\">\n<li>Shared Runners\uff1aGitLab\u306b\u3088\u3063\u3066\u63d0\u4f9b\u3055\u308c\u305f\u3082\u306e<\/li>\n<li>Specific Runners\uff1a\u5358\u4e00\u306eGitLab\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u4f7f\u308f\u308c\u308b\u3001\u30e6\u30fc\u30b6\u30fc\u306b\u3088\u3063\u3066\u81ea\u4f5c\u3055\u308c\u305f\u3082\u306e<\/li>\n<li>Group Runners\uff1a\u8907\u6570\u306eGitLab\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u4f7f\u308f\u308c\u308b\u3001\u30e6\u30fc\u30b6\u30fc\u306b\u3088\u3063\u3066\u81ea\u4f5c\u3055\u308c\u305f\u3082\u306e<\/li>\n<\/ul>\n<p><strong>Executor\u9078\u629e<\/strong><\/p>\n<p>GitLab Runner\u306b\u306f\u69d8\u3005\u306a\u76ee\u7684\u306b\u5fdc\u3058\u3066\u9069\u5207\u306a\u3001\u30b8\u30e7\u30d6\u306e\u5b9f\u884c\u65b9\u5f0f\u3067\u3042\u308bExecutor\u3092\u9078\u629e\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002GitLab Runner\u304c\u63d0\u4f9b\u3059\u308bExecutor\u306e\u7a2e\u985e\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<ul style=\"list-style-type: disc\">\n<li>SSH<\/li>\n<li>Shell<\/li>\n<li>Parallels<\/li>\n<li>VirtualBox<\/li>\n<li>Docker<\/li>\n<li>Docker Machine (auto-scaling)<\/li>\n<li>Kubernetes<\/li>\n<li>Custom<\/li>\n<\/ul>\n<p>\u7136\u3057\u3001\u3053\u306e\u8a18\u4e8b\u3067\u306f\u4ee5\u4e0b\u306e\uff12\u3064\u306eExecutor\u306b\u3064\u3044\u3066\u304a\u8a71\u3057\u3057\u307e\u3059\u3002<\/p>\n<ul style=\"list-style-type: disc\">\n<li>\u30fbDocker Executor\uff1a\u300e\u30c6\u30b9\u30c8\u300f\u30b8\u30e7\u30d6\u306b\u4f7f\u308f\u308c\u307e\u3059\u3002\u30b5\u30fc\u30d0\u30fc\u306e\u30ea\u30bd\u30fc\u30b9\u3092\u7bc0\u7d04\u3059\u308b\u305f\u3081\u3001GitLab\u306b\u3088\u3063\u3066\u63d0\u4f9b\u3055\u308c\u305fShared Runners\u3092\u300e\u30c6\u30b9\u30c8\u300f\u30b8\u30e7\u30d6\u306b\u4f7f\u308f\u308c\u307e\u3059\u3002<\/li>\n<li>\u30fbShell Executor\uff1a\u300e\u30c7\u30d7\u30ed\u30a4\u300f\u30b8\u30e7\u30d6\u306b\u4f7f\u308f\u308c\u307e\u3059\u3002\u3053\u306eExecutor\u3092\u7528\u3044\u3066\u30b5\u30fc\u30d0\u30fc\u306b\u3066\u30b3\u30de\u30f3\u30c9\u3092\u76f4\u63a5\u5b9f\u884c\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<p>\u4ed6\u306eExecutor\u53ca\u3073\u305d\u306e\u4f7f\u3044\u65b9\u306b\u3064\u3044\u3066\u3001\u4ee5\u4e0b\u306eURL\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\n<a href=\"https:\/\/docs.gitlab.com\/runner\/executors\/README.html\">https:\/\/docs.gitlab.com\/runner\/executors\/README.html<\/a><\/p>\n<h2>\u69cb\u6210\u56f3<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4700\" src=\"https:\/\/briswell-vn.com\/wp-content\/uploads\/2020\/09\/Digram.png\" alt=\"\" width=\"876\" height=\"622\" srcset=\"https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2020\/09\/01155419\/Digram.png 876w, https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2020\/09\/01155419\/Digram-300x213.png 300w, https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2020\/09\/01155419\/Digram-768x545.png 768w\" sizes=\"auto, (max-width: 876px) 100vw, 876px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>GitLab\u306f\u3001GitLab\u306eDevelop\u30d6\u30e9\u30f3\u30c1\u3078\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u30d7\u30c3\u30b7\u30e5\u3057\u305f\u6642\u3001\u30c6\u30b9\u30c8\u3068\u30c7\u30d7\u30ed\u30a4\u306e\u30b9\u30c6\u30fc\u30b8\u3092\u542b\u3080\u30d1\u30a4\u30d7\u30e9\u30a4\u30f3\u3092\u751f\u6210\u3057\u307e\u3059\u3002\u3053\u3053\u3067NodeJS\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u958b\u767a\u3059\u308b\u306e\u3067\u3001\u3053\u306e\u4e8c\u3064\u306e\u30b9\u30c6\u30fc\u30b8\u306e\u307f\u8981\u308a\u307e\u3059\u304c\u3001Typescript\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306a\u3089\u3070\u3001\u305d\u308c\u3089\u306e\u4ed6\u306b\u300e\u30d3\u30eb\u30c9\u300f\u30b9\u30c6\u30fc\u30b8\u3082\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4702\" src=\"https:\/\/briswell-vn.com\/wp-content\/uploads\/2020\/09\/2stage.png\" alt=\"\" width=\"454\" height=\"143\" srcset=\"https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2020\/09\/01155704\/2stage.png 454w, https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2020\/09\/01155704\/2stage-300x94.png 300w\" sizes=\"auto, (max-width: 454px) 100vw, 454px\" \/><\/p>\n<p>\u300e\u30c6\u30b9\u30c8\u300f\u30b9\u30c6\u30fc\u30b8\u306b\u306f\u300e\u30c6\u30b9\u30c8\u300f\u30b8\u30e7\u30d6\u304c\u542b\u307e\u308c\u307e\u3059\u3002\u3053\u3053\u3067\u3001\u524d\u8ff0\u306e\u5982\u304f\u30b5\u30fc\u30d0\u30fc\u306e\u30ea\u30bd\u30fc\u30b9\u3092\u7bc0\u7d04\u3059\u308b\u305f\u3081\u3001GitLab\u306b\u3088\u3063\u3066\u63d0\u4f9b\u3055\u308c\u305fGitLab Shared Runner\uff08Executor Docker\u5229\u7528\uff09\u3092\u4f7f\u3044\u307e\u3059\u3002\u300c\u30c6\u30b9\u30c8\u300d\u30b8\u30e7\u30d6\u306e\u5b9f\u884c\u304c\u30a8\u30e9\u30fc\u306a\u304f\u6210\u529f\u3057\u305f\u3089\u3001\u300e\u30c7\u30d7\u30ed\u30a4\u300f\u3068\u3044\u3046\u6b21\u306e\u30b9\u30c6\u30fc\u30b8\u3078\u9077\u79fb\u3057\u307e\u3059\u3002<\/p>\n<p>\u300e\u30c7\u30d7\u30ed\u30a4\u300f\u30b9\u30c6\u30fc\u30b8\u306b\u306f\u300e\u30c7\u30d7\u30ed\u30a4\u300f\u30b8\u30e7\u30d6\u304c\u542b\u307e\u308c\u307e\u3059\u3002\u3053\u3053\u3067\u3001EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306b\u3001Web\u30b5\u30fc\u30d0\u30fc\u3068\u5171\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u305fGitLab Runner\uff08Executor Shell\u5229\u7528\uff09\u3092\u4f7f\u3044\u307e\u3059\u3002 Runner\u306e\u30bf\u30b9\u30af\u3068\u3057\u3066\u3001\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306e\u5909\u66f4\u3092\u691c\u51fa\u3057\u3001\u305d\u306e\u5dee\u5206\u3092\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30d5\u30a9\u30eb\u30c0\u30fc\u306b\u30b3\u30d4\u30fc\uff06\u30da\u30fc\u30b9\u30c8\u3057\u3066\u304b\u3089\u3001NodeJS\u30b5\u30fc\u30d3\u30b9\u3092\u518d\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n<p>\u30b9\u30c6\u30fc\u30b8\u3068\u30b8\u30e7\u30d6\u3092\u30b3\u30f3\u30d5\u30a3\u30b0\u3059\u308b\u306b\u306f .gitlab-ci.yml\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u3001GitLab\u3078\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3068\u5171\u306b\u30d7\u30c3\u30b7\u30e5\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u6ce8\uff1a\u30d5\u30a1\u30a4\u30eb\u3092\u5404\u30b9\u30c6\u30fc\u30b8\u3067\u4ea4\u63db\u3059\u308b\u305f\u3081\u306b\u3001 \u5bfe\u8c61\u30d5\u30a1\u30a4\u30eb\u3092GitLab\u306e\u5171\u6709\u30b9\u30c8\u30ec\u30fc\u30b8\u306b\u4fdd\u5b58\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u901a\u5e38\u306f\u3001libraries \/node_modules\u3092\u30ad\u30e3\u30c3\u30b7\u30e5\u306b\u4fdd\u5b58\u3057\u307e\u3059\u3002\u305f\u3060\u3057\u3001Typescript\u306a\u3089\u3070\u3001\u300e.ts\u300f\u304b\u3089\u300e.js\u300f\u306b\u30d3\u30eb\u30c9\u3057\u305f\u6642\u306b\u751f\u6210\u3055\u308c\u308b\u30d5\u30a1\u30a4\u30eb \u3092Artifacts\u306b\u4fdd\u5b58\u3057\u307e\u3059\u3002\u3053\u3053\u3067\u3001NodeJS\u3092\u4f7f\u3063\u3066\u3044\u308b\u306e\u3067\u3001Artifacts\u304c\u4e0d\u8981\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h1>\u5b9f\u73fe\u624b\u9806<\/h1>\n<h2>\u30b5\u30fc\u30d0\u30fc\u8a2d\u5b9a<\/h2>\n<p>\u307e\u305a\u3001Amazon Linux AMI\u3092\u5b9f\u884c\u3059\u308bEC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u65b0\u305f\u306b\u4f5c\u6210\u3057\u307e\u3059\u3002\u30d6\u30e9\u30a6\u30b6\u30fc\u304b\u3089NodeJS\u30b5\u30fc\u30d0\u30fc\u3078\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305f\u3081\u306e\u30dd\u30fc\u30c83000\u3092\u958b\u653e\u3057\u3066\u304a\u304d\u307e\u3059\u3002\u305d\u306e\u5f8c\u3001PuTTY\u3092\u7528\u3044\u3066\u30b5\u30fc\u30d0\u30fc\u3078\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\u3002<\/p>\n<p>\u4e0b\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3001GitLab Runner\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<pre>$ curl -L https:\/\/packages.gitlab.com\/install\/repositories\/runner\/gitlab-runner\/script.rpm.sh | sudo bash\r\n$ sudo yum install gitlab-runner<\/pre>\n<p>\u4e0b\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3001NodeJS\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<pre>$ sudo yum install -y gcc-c++ make\r\n\r\n$ curl -sL https:\/\/rpm.nodesource.com\/setup_14.x | sudo -E bash \u2013\r\n\r\n$ sudo yum install -y nodejs<\/pre>\n<p>\u4e0b\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3001NodeJS\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u30d0\u30c3\u30af\u30b0\u30e9\u30a6\u30f3\u30c9\u3067\u5b9f\u884c\u3059\u308b\u305f\u3081\u306eforever package\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<pre>$ sudo npm install forever -g<\/pre>\n<p>\u4e0b\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre>$ sudo mkdir -p \/var\/www\/project-ci<\/pre>\n<p>\u4e0b\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3078\u8aad\u53d6\u3001\u66f8\u8fbc\u307f\u3001\u5b9f\u884c\u3092GitLab Runner\u304c\u884c\u306a\u3048\u308b\u3088\u3046\u306a\u6a29\u9650\u3092\u4e0e\u3048\u307e\u3059\u3002<\/p>\n<pre>$ sudo setfacl -m user:gitlab-runner:rwx \/var\/www\/project-ci<\/pre>\n<p>&nbsp;<\/p>\n<h2>GitLab\u30ea\u30dd\u30b8\u30c8\u30ea\u304a\u3088\u3073NodeJS\u30c7\u30e2\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u4f5c\u6210<\/h2>\n<p>GitLab\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u3066\u30ed\u30fc\u30ab\u30eb\u306b\u30af\u30ed\u30fc\u30f3\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\uff13\u3064\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u30af\u30ed\u30fc\u30f3\u3057\u305f\u30d5\u30a9\u30eb\u30c0\u30fc\u306b\u8ffd\u52a0\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p>package.json<\/p>\n<pre>{\r\n  \"name\": \"project-ci\",\r\n  \"version\": \"1.0.0\",\r\n  \"description\": \"project to research Gitlab Runner\",\r\n  \"main\": \"index.js\",\r\n  \"scripts\": {\r\n    \"test\": \"echo \\\"Test OK\\\" &amp;&amp; exit 0\",\r\n    \"start\": \"node index.js\"\r\n  },\r\n  \"keywords\": [],\r\n  \"author\": \"nghia.nt\",\r\n  \"license\": \"ISC\",\r\n  \"dependencies\": {\r\n    \"express\": \"^4.17.1\"\r\n  }\r\n}\r\n<\/pre>\n<p>index.js<\/p>\n<pre>const express = require('express');\r\nconst app = express();\r\nconst port = process.env.NODE_PORT || 3000;\r\napp.get('\/', function (req, res) {\r\n  res.send('Hello World From Briswell Vietnam!');\r\n});\r\napp.listen(port, function () {\r\n  console.log('Listening on port ' + port);\r\n});\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>.gitignore<\/p>\n<pre>node_modules\/\r\niisnode\/\r\nnpm-debug.log*\r\n.vscode\/\r\n.idea\/\r\n.env*\r\n**\/*.log\r\ndist\/\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u305d\u306e\u5f8c\u3001\u305d\u308c\u3089\u306e\u30d5\u30a1\u30a4\u30eb\u3092GitLab\u306eDevelop\u30d6\u30e9\u30f3\u30c1\u3078\u30d7\u30c3\u30b7\u30e5\u3057\u307e\u3059\u3002<\/p>\n<h2>GitLab\u3067\u306eGitLab Runner\u767b\u9332<\/h2>\n<p>\u5bfe\u8c61\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306eGitLab\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u3001Settings\u2192CI\/CD\u306b\u8fbf\u3063\u3066\u304b\u3089\u3001Runners\u9805\u76ee\u306e\u300eSet up a specific Runner manually\u300f\u306b\u3042\u308bURL\u3068\u30c8\u30fc\u30af\u30f3\u3092\u30e1\u30e2\u3057\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4739\" src=\"https:\/\/briswell-vn.com\/wp-content\/uploads\/2020\/09\/token.png\" alt=\"\" width=\"441\" height=\"289\" srcset=\"https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2020\/09\/01164951\/token.png 441w, https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2020\/09\/01164951\/token-300x197.png 300w\" sizes=\"auto, (max-width: 441px) 100vw, 441px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>PuTTY\u306b\u623b\u308a\u3001\u4e0b\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u3067GitLab Runner\u3092\u767b\u9332\u3057\u307e\u3059\u3002<\/p>\n<pre>$ sudo gitlab-runner register<\/pre>\n<p>\u4e0a\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u305f\u306e\u3061\u3001\u30a6\u30a3\u30b6\u30fc\u30c9\u304b\u3089\u306f\u4e0a\u8a18\u306b\u53d6\u5f97\u3057\u305fURL\u3068\u30c8\u30fc\u30af\u30f3\u306e\u5165\u529b\u3092\u6c42\u3081\u307e\u3059\u3002<\/p>\n<pre>Please enter the gitlab-ci coordinator URL (e.g. https:\/\/gitlab.com\/):\r\nhttps:\/\/gitlab.com\/\r\nPlease enter the gitlab-ci token for this runner:\r\nk753PaGiosBxxxxxxx\r\nPlease enter the gitlab-ci description for this runner:\r\nmy-shell-runner\r\nPlease enter the gitlab-ci tags for this runner (comma separated):\r\nmy-shell-runner\r\nRegistering runner... succeeded\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 runner=ajgHxcNz\r\nPlease enter the executor: virtualbox, docker+machine, kubernetes, docker, shell, ssh, docker-ssh+machine, docker-ssh, parallels:\r\nshell\r\nRunner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u767b\u9332\u304c\u7d42\u308f\u3063\u305f\u3089\u3001GitLab\u306e\u8a2d\u5b9a\u753b\u9762\u3078\u30a2\u30af\u30bb\u30b9\u3057\u3066\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002\u4ee5\u4e0b\u306e\u753b\u50cf\u306e\u3088\u3046\u306b\u60c5\u5831\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u3042\u308c\u3070\u3001\u767b\u9332\u306b\u6210\u529f\u3057\u305f\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4704\" src=\"https:\/\/briswell-vn.com\/wp-content\/uploads\/2020\/09\/RegiterComplete.png\" alt=\"\" width=\"454\" height=\"200\" srcset=\"https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2020\/09\/01155853\/RegiterComplete.png 454w, https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2020\/09\/01155853\/RegiterComplete-300x132.png 300w\" sizes=\"auto, (max-width: 454px) 100vw, 454px\" \/><\/p>\n<h2>GitLab\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30b9\u30c6\u30fc\u30b8\u53ca\u3073\u30b8\u30e7\u30d6\u306e\u30b3\u30f3\u30d5\u30a3\u30b0<\/h2>\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306b\u4ee5\u4e0b\u306e\u60c5\u5831\u3092\u542b\u3081\u308b.gitlab-ci.yml\u30d5\u30a1\u30a4\u30eb\u3092\u65b0\u305f\u306b\u4f5c\u308a\u307e\u3059\u3002<\/p>\n<pre># We have 2 stage Test and Deploy\r\nstages:\r\n  - test\r\n  - deploy\r\n\r\n# Config cache\r\ncache:\r\n  paths:\r\n    - node_modules\/\r\n\r\n# Test job\r\ntest:\r\n  # Docker image\r\n  image: node:latest\r\n  # Attach Test job to Test stage\r\n  stage: test\r\n  # Config to use GitLab Shared Runner with Executor Docker\r\n  tags:\r\n    - docker\r\n  script:\r\n    - npm install\r\n    - npm run test\r\n  # Defines the names of branches and tags the job runs for\r\n  only:\r\n    - develop\r\n\r\n# Deploy job\r\ndeploy:\r\n  type: deploy\r\n  # Attach Deploy job to Deploy stage\r\n  stage: deploy\r\n  # Config to use our Runner with Executor Shell\r\n  tags:\r\n    - my-shell-runner\r\n  script:\r\n    # Only copy changed files to project folder\r\n    - cp -r -u * $PROJECT_DIR\r\n    - cd $PROJECT_DIR\r\n    - npm install\r\n    # Restart NodeJS service\r\n    - forever stop index.js || true\r\n    - forever start index.js\r\n  only:\r\n    - develop\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u305d\u306e\u5f8c\u3001\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u3092GitLab\u306eDevelop\u30d6\u30e9\u30f3\u30c1\u3078\u30d7\u30c3\u30b7\u30e5\u3057\u307e\u3059\u3002<\/p>\n<p>\u6b21\u306b\u3001\u74b0\u5883\u5909\u6570\u3092\u8a2d\u5b9a\u3057\u307e\u3057\u3087\u3046\u3002GitLab\u753b\u9762\u306b\u3066Settings\u2192CI\/CD\u2192Variables\u306b\u8fbf\u3063\u3066\u304b\u3089\u3001\u300eProtect variable\u300f\u9805\u76ee\u306b\u30c1\u30a7\u30c3\u30af\u3092\u5916\u3057\u3066\u300eAdd Variable\u300f\u30dc\u30bf\u30f3\u3092\u62bc\u4e0b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4720\" src=\"https:\/\/briswell-vn.com\/wp-content\/uploads\/2020\/09\/variable.png\" alt=\"\" width=\"781\" height=\"534\" srcset=\"https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2020\/09\/01162408\/variable.png 781w, https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2020\/09\/01162408\/variable-300x205.png 300w, https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2020\/09\/01162408\/variable-768x525.png 768w\" sizes=\"auto, (max-width: 781px) 100vw, 781px\" \/><\/p>\n<p>GitLab\u753b\u9762\u306b\u3066CI\/CD\u2192Pipelines\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4706\" src=\"https:\/\/briswell-vn.com\/wp-content\/uploads\/2020\/09\/Pipelines.png\" alt=\"\" width=\"789\" height=\"561\" srcset=\"https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2020\/09\/01160006\/Pipelines.png 789w, https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2020\/09\/01160006\/Pipelines-300x213.png 300w, https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2020\/09\/01160006\/Pipelines-768x546.png 768w\" sizes=\"auto, (max-width: 789px) 100vw, 789px\" \/><\/p>\n<p>\u3042\u3068\u3001\u30d6\u30e9\u30a6\u30b6\u30fc\u304b\u3089\u30b5\u30fc\u30d0\u30fc\u3078\u30dd\u30fc\u30c83000\u3067\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4707\" src=\"https:\/\/briswell-vn.com\/wp-content\/uploads\/2020\/09\/browser.png\" alt=\"\" width=\"737\" height=\"485\" srcset=\"https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2020\/09\/01160048\/browser.png 737w, https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2020\/09\/01160048\/browser-300x197.png 300w\" sizes=\"auto, (max-width: 737px) 100vw, 737px\" \/><\/p>\n<p>\u3053\u306e\u3088\u3046\u306b\u3001GitLab Runner\u3092\u4f7f\u3063\u3066NodeJS\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u3001CI\/CD\u3068\u9023\u643a\u3057\u305fEC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3078\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u3053\u3068\u306b\u6210\u529f\u3057\u307e\u3057\u305f\u3002<\/p>\n<h1>\u53c2\u7167\u5143<\/h1>\n<p><a href=\"https:\/\/opensource.com\/article\/18\/8\/what-cicd\">https:\/\/opensource.com\/article\/18\/8\/what-cicd<\/a><\/p>\n<p><a href=\"https:\/\/docs.gitlab.com\/ee\/ci\/quick_start\/\">https:\/\/docs.gitlab.com\/ee\/ci\/quick_start\/<\/a><\/p>\n<p><a href=\"https:\/\/docs.gitlab.com\/runner\/\">https:\/\/docs.gitlab.com\/runner\/<\/a><!--more--><\/p>","protected":false},"excerpt":{"rendered":"<p>\u7d39\u4ecb CI\/CD\u3068\u306f CI\u3068\u306f\u3001Continuous Integration\u306e\u7565\u3067\u3001\u7d99\u7d9a\u7684\u30a4\u30f3\u30c6\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3068\u547c\u3070\u308c\u3001\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9 [&hellip;]<\/p>\n","protected":false},"author":26,"featured_media":4803,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[4,71],"tags":[],"class_list":["post-4673","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news","category-it-tec"],"_links":{"self":[{"href":"https:\/\/www.briswell-vn.com\/ja\/wp-json\/wp\/v2\/posts\/4673","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.briswell-vn.com\/ja\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.briswell-vn.com\/ja\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.briswell-vn.com\/ja\/wp-json\/wp\/v2\/users\/26"}],"replies":[{"embeddable":true,"href":"https:\/\/www.briswell-vn.com\/ja\/wp-json\/wp\/v2\/comments?post=4673"}],"version-history":[{"count":0,"href":"https:\/\/www.briswell-vn.com\/ja\/wp-json\/wp\/v2\/posts\/4673\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.briswell-vn.com\/ja\/wp-json\/wp\/v2\/media\/4803"}],"wp:attachment":[{"href":"https:\/\/www.briswell-vn.com\/ja\/wp-json\/wp\/v2\/media?parent=4673"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.briswell-vn.com\/ja\/wp-json\/wp\/v2\/categories?post=4673"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.briswell-vn.com\/ja\/wp-json\/wp\/v2\/tags?post=4673"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}