{"id":3583,"date":"2019-03-17T23:41:51","date_gmt":"2019-03-17T14:41:51","guid":{"rendered":"https:\/\/akamist.com\/blog\/?p=3583"},"modified":"2019-03-17T23:42:30","modified_gmt":"2019-03-17T14:42:30","slug":"circleci%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89%e3%81%aelocal%e5%ae%9f%e8%a1%8c%e3%81%a7ssh%e3%82%ad%e3%83%bc%e3%82%92%e3%82%b3%e3%83%b3%e3%83%86%e3%83%8a%e3%81%ab%e6%b8%a1%e3%81%99","status":"publish","type":"post","link":"https:\/\/akamist.com\/blog\/archives\/3583","title":{"rendered":"circleci\u30b3\u30de\u30f3\u30c9\u306elocal\u5b9f\u884c\u3067ssh\u30ad\u30fc\u3092\u30b3\u30f3\u30c6\u30ca\u306b\u6e21\u3059"},"content":{"rendered":"\n\n<p>CircleCI\u3067\u306fcircleci\u30b3\u30de\u30f3\u30c9\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3053\u3068\u3067\u3001\u30ed\u30fc\u30ab\u30eb\u306ePC\u304b\u3089<code>.circleci\/config.yml<\/code>\u30d5\u30a1\u30a4\u30eb\u306e\u5b9a\u7fa9\u306b\u57fa\u3065\u3044\u305f\u30b8\u30e7\u30d6\u306e\u5b9f\u884c\u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n<p>\u30ed\u30fc\u30ab\u30eb\u3067\u306e\u30c6\u30b9\u30c8\u4e2d\u3067\u30bf\u30fc\u30b2\u30c3\u30c8\u306e\u30b5\u30fc\u30d0\u3078\u30ed\u30b0\u30a4\u30f3\u3059\u308b\u305f\u3081\u306b\u3001ssh\u306e\u30ad\u30fc\u30d5\u30a1\u30a4\u30eb\u3092docker\u30b3\u30f3\u30c6\u30ca\u306b\u53d7\u3051\u6e21\u3057\u305f\u3044\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n<p>\u3053\u306e\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b--volume\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u6307\u5b9a\u3057\u3066\u3001\u30db\u30b9\u30c8OS\u4e0a\u306e\u30ad\u30fc\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30f3\u30c6\u30ca\u306b\u6e21\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n<h2>\u30d5\u30a1\u30a4\u30eb\u306e\u6e96\u5099<\/h2>\n\n<p>\u307e\u305a\u3001\u624b\u5143\u306ePC\u306e\u9069\u5f53\u306a\u5834\u6240\u306b\u30bf\u30fc\u30b2\u30c3\u30c8\u30b5\u30fc\u30d0\u3078\u30ed\u30b0\u30a4\u30f3\u3059\u308b\u305f\u3081\u306eSSH\u30ad\u30fc\u3092\u8a2d\u7f6e\u3057\u307e\u3059\u3002<\/p>\n\n<pre><code class=\"language-bash\">[localpc]$ ls \/path\/to\/sshkey_dir\nid_rsa\n<\/code><\/pre>\n\n<p>\u6b21\u306b.circleci\/config.yml\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n\n<p>\u4eca\u56de\u306fssh\u30ad\u30fc\u304c\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u8a2d\u7f6e\u5834\u6240\u3067\u3042\u308b<code>~\/.ssh\/id_rsa<\/code>\u306b\u3042\u308b\u3053\u3068\u3092\u524d\u63d0\u3068\u3057\u3066\u3001ssh\u30b3\u30de\u30f3\u30c9\u3084scp\u30b3\u30de\u30f3\u30c9\u3092\u66f8\u3044\u3066\u3044\u307e\u3059\u3002<\/p>\n\n<p>\u63a5\u7d9a\u5148\u30b5\u30fc\u30d0\u306f\u74b0\u5883\u5909\u6570\u3067\u6307\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n<pre><code class=\"language-yaml\"># .circleci\/config.yml\nversion: 2\njobs:\n  build:\n    docker:\n      - image: circleci\/python:3.6\n\n    steps:\n      - checkout\n\n      - run:\n          name: check key file\n          command: ls -al \/home\/circleci\/.ssh\n\n      - run: \n          name: test ssh login.\n          command: ssh -oStrictHostKeyChecking=no\u3000-p ${PORT} ${USER}@${SERVER}  ls -al\n\n      - run: \n          name: scp to server.\n          command: scp -rp -oStrictHostKeyChecking=no -P ${PORT} ~\/project ${USER}@${SERVER}:${DIR}\n<\/code><\/pre>\n\n<h2>circleci\u30b3\u30de\u30f3\u30c9\u306b\u3088\u308b\u5b9f\u884c<\/h2>\n\n<p>\u6e96\u5099\u304c\u3067\u304d\u305f\u3089\u3001local\u306ecircleci\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3059\u3002\n\u74b0\u5883\u5909\u6570\u306f<code>--env<\/code>\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u6307\u5b9a\u3057\u3001\u30ad\u30fc\u30d5\u30a1\u30a4\u30eb\u306f<code>--volume<\/code>\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u30de\u30a6\u30f3\u30c8\u5143\uff0f\u5148\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u30b3\u30f3\u30c6\u30ca\u306b\u53d7\u3051\u6e21\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n<pre><code class=\"language-bash\">[localpc]$ circleci build \\\n                    --env SERVER=11.22.33.44 \\\n                    --env PORT=22 \\\n                    --env USER=ec2-user \\\n                    --env DIR=\/usr\/local\/bin\/app \\\n                    --volume \/path\/to\/sshkey_dir:\/home\/circleci\/.ssh\n<\/code><\/pre>\n\n<p>\u5b9f\u884c\u7d50\u679c\u306e\u4f8b\u3067\u3059\u3002\u30b3\u30de\u30f3\u30c9\u306e\u51fa\u529b\u3088\u308assh\u30b3\u30de\u30f3\u30c9\u306b\u3088\u308b\u30bf\u30fc\u30b2\u30c3\u30c8\u30b5\u30fc\u30d0\u3078\u306e\u30ed\u30b0\u30a4\u30f3\u3084scp\u3067\u306e\u30b3\u30d4\u30fc\u304c\u884c\u3048\u305f\u304b\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n\n<pre><code class=\"language-bash\">[localpc]$ circleci build \\\n                    --env SERVER=11.22.33.44 \\\n                    --env PORT=22 \\\n                    --env USER=ec2-user \\\n                    --env DIR=\/usr\/local\/app \\\n                    --volume \/path\/to\/sshkey_dir:\/home\/circleci\/.ssh\n\nBuild-agent version 0.1.750-336e0196 (2018-09-13T19:48:06+0000)\nStarting container circleci\/python:3.6\n  using image circleci\/python@sha256:af628d8a68ec537739541b80a60587dc77ccbaf8909482e4f8e6e0f673198f1b\n\nUsing build environment variables:\n  BASH_ENV=\/tmp\/.bash_env-localbuild-1552823340\n  CI=true\n  CIRCLECI=true\n  CIRCLE_BRANCH=master\n  CIRCLE_BUILD_NUM=\n  CIRCLE_JOB=build\n  CIRCLE_NODE_INDEX=0\n  CIRCLE_NODE_TOTAL=1\n  CIRCLE_REPOSITORY_URL=...\n  CIRCLE_SHA1=...\n  CIRCLE_SHELL_ENV=...\n  CIRCLE_WORKING_DIRECTORY=...\n\n\n====&gt;&gt; check key file\n  #!\/bin\/bash -eo pipefail\nls -al \/home\/circleci\/.ssh\ntotal 16\ndrwxr-xr-x 5 circleci circleci  160 Mar 17 11:39 .\ndrwxr-xr-x 1 circleci circleci 4096 Mar 17 11:49 ..\n-rw------- 1 circleci circleci 1679 Nov 23 08:23 id_rsa\n\n====&gt;&gt; test ssh login.\n  #!\/bin\/bash -eo pipefail\nssh ${USER}@${SERVER} -oStrictHostKeyChecking=no ls -al\ntotal 72\ndrwx------ 8 root  root 4096 Mar 17 20:41 .\ndrwxr-xr-x 3 root  root 4096 Mar  2 13:02 ..\n\n====&gt;&gt; scp to server.\n  #!\/bin\/bash -eo pipefail\nscp -rp -oStrictHostKeyChecking=no -P ${PORT} ~\/project\/ ${USER}@${SERVER}:${DIR}\n...\n\nSuccess!\n<\/code><\/pre>\n\n\n","protected":false},"excerpt":{"rendered":"<p>CircleCI\u3067\u306fcircleci\u30b3\u30de\u30f3\u30c9\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3053\u3068\u3067\u3001\u30ed\u30fc\u30ab\u30eb\u306ePC\u304b\u3089.circleci\/config.yml\u30d5\u30a1\u30a4\u30eb\u306e\u5b9a\u7fa9\u306b\u57fa\u3065\u3044\u305f\u30b8\u30e7\u30d6\u306e\u5b9f\u884c\u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 \u30ed\u30fc\u30ab\u30eb\u3067\u306e\u30c6\u30b9\u30c8\u4e2d\u3067\u30bf\u30fc\u30b2\u30c3\u30c8 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[163],"tags":[],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":3198,"url":"https:\/\/akamist.com\/blog\/archives\/3198","url_meta":{"origin":3583,"position":0},"title":"[CircleCI]github\u306bpush\u3057\u305f\u3089\u30ed\u30ea\u30dd\u30c3\u30d7\u30b5\u30fc\u30d0\u3078\u81ea\u52d5\u30c7\u30d7\u30ed\u30a4\u3055\u305b\u308b","date":"2018\u5e748\u670813\u65e5","format":false,"excerpt":"\u30ed\u30ea\u30dd\u30c3\u30d7\u30b5\u30fc\u30d0\u306b\u5c55\u958b\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3092github\u3067\u7ba1\u7406\u3057\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u5909\u66f4\u3092github\u306bpush\u3057\u2026","rel":"","context":"CircleCI","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2018\/08\/3198_2.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3190,"url":"https:\/\/akamist.com\/blog\/archives\/3190","url_meta":{"origin":3583,"position":1},"title":"\u30ed\u30ea\u30dd\u30c3\u30d7\u306e\u30ec\u30f3\u30bf\u30eb\u30b5\u30fc\u30d0\u306bSSH\u30ad\u30fc\u8a8d\u8a3c\u3067\u30ed\u30b0\u30a4\u30f3\u3059\u308b","date":"2018\u5e748\u670812\u65e5","format":false,"excerpt":"\u30ec\u30f3\u30bf\u30eb\u30b5\u30fc\u30d0\u306e\u30ed\u30ea\u30c3\u30dd\u30c3\u30d7\u3067\u306f\u3001\u30b9\u30bf\u30f3\u30c0\u30fc\u30c9\u30d7\u30e9\u30f3\u4ee5\u4e0a\u3067\u5951\u7d04\u3059\u308b\u3068\u3001ssh\u30ed\u30b0\u30a4\u30f3\u6a29\u9650\u3092\u624b\u306b\u5165\u308c\u308b\u2026","rel":"","context":"\u672a\u5206\u985e","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2018\/07\/icon_lolipop.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3284,"url":"https:\/\/akamist.com\/blog\/archives\/3284","url_meta":{"origin":3583,"position":2},"title":"ssh\u30b3\u30de\u30f3\u30c9\u3067\u30ed\u30b0\u30a4\u30f3\u6642\u3001'-i'\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u306e\u30ad\u30fc\u30d5\u30a1\u30a4\u30eb\u6307\u5b9a\u3092\u7701\u7565\u3059\u308b(ssh_config)","date":"2018\u5e7411\u67084\u65e5","format":false,"excerpt":"ssh\u30b3\u30de\u30f3\u30c9\u3067\u306f\u3001\u30ad\u30fc\u30d5\u30a1\u30a4\u30eb\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u306f`~\/.ssh\/id_rsa`\u3068\u306a\u3063\u3066\u304a\u308a\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u2026","rel":"","context":"\u30af\u30e9\u30a6\u30c9","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2017\/09\/icon_ssh.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3195,"url":"https:\/\/akamist.com\/blog\/archives\/3195","url_meta":{"origin":3583,"position":3},"title":"CircleCI\u304b\u3089scp\u3067\u521d\u56de\u63a5\u7d9a\u6642\u306b\u3001Are you sure you want to continue connecting (yes\/no)? \u3092\u805e\u304b\u308c\u306a\u3044\u3088\u3046\u306b\u3059\u308b","date":"2018\u5e748\u670812\u65e5","format":false,"excerpt":"ssh\u3067\u30b5\u30fc\u30d0\u306b\u521d\u3081\u3066\u63a5\u7d9a\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u63a5\u7d9a\u3057\u3066\u826f\u3044\u304b\u306e\u78ba\u8a8d\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002 \u5bfe\u8a71\u7684\u306b\u5b9f\u884c\u3057\u3066\u2026","rel":"","context":"CircleCI","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2018\/04\/icon_circleci.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3368,"url":"https:\/\/akamist.com\/blog\/archives\/3368","url_meta":{"origin":3583,"position":4},"title":"[GMO Cloud VPS]\u30e6\u30fc\u30b6\u3092\u4f5c\u6210\u3057\u3066ssh\u30ad\u30fc\u3067\u30ed\u30b0\u30a4\u30f3\u3059\u308b","date":"2018\u5e7411\u670823\u65e5","format":false,"excerpt":"GMO Cloud VPS\u3067\u30e6\u30fc\u30b6\u3092\u4f5c\u6210\u3057\u3001ssh\u30ad\u30fc\u30d5\u30a1\u30a4\u30eb\u3092\u4f7f\u3063\u3066\u30ed\u30b0\u30a4\u30f3\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002 \u2026","rel":"","context":"\u672a\u5206\u985e","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2017\/09\/icon_ssh.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3324,"url":"https:\/\/akamist.com\/blog\/archives\/3324","url_meta":{"origin":3583,"position":5},"title":"[PHP,Deployer,CircleCI]\u30b5\u30fc\u30d0\u306b\u30c7\u30d7\u30ed\u30a4\u6642\u306b\u30a8\u30e9\u30fc\"The authenticity of host xx can't be established.\"\u304c\u51fa\u308b\u6642","date":"2018\u5e7411\u670817\u65e5","format":false,"excerpt":"CircleCI\u3067PHP\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092Deployer\u3092\u4f7f\u7528\u3057\u3066\u30c7\u30d7\u30ed\u30a4\u30e1\u30f3\u30c8\u3057\u3088\u3046\u3068\u3059\u308b\u3068\u3001\u4e0b\u8a18\u2026","rel":"","context":"CircleCI","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2018\/04\/icon_deployer.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/posts\/3583"}],"collection":[{"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/comments?post=3583"}],"version-history":[{"count":7,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/posts\/3583\/revisions"}],"predecessor-version":[{"id":3590,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/posts\/3583\/revisions\/3590"}],"wp:attachment":[{"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/media?parent=3583"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/categories?post=3583"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/tags?post=3583"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}