{"id":478,"date":"2012-10-11T18:31:34","date_gmt":"2012-10-11T09:31:34","guid":{"rendered":"http:\/\/tech.fuqinho.net\/?p=478"},"modified":"2012-10-11T18:31:34","modified_gmt":"2012-10-11T09:31:34","slug":"rails%e3%82%a2%e3%83%97%e3%83%aa%e3%82%92git-push%e3%81%a7%e3%83%87%e3%83%97%e3%83%ad%e3%82%a4%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/tech.fuqinho.net\/?p=478","title":{"rendered":"Rails\u30a2\u30d7\u30ea\u3092git push\u3067\u30c7\u30d7\u30ed\u30a4\u3059\u308b"},"content":{"rendered":"<p>\t\t\t\t\u4ee5\u524d\u4f5c\u3063\u305fSumtimer\u3092\u308f\u3051\u3042\u3063\u3066Heroku\u304b\u3089AWS(EC2+RDS)\u306b\u79fb\u3057\u305f\u3093\u3060\u3051\u3069\u3001git push\u3067\u306edeploy\u306f\u6c17\u306b\u5165\u3063\u3066\u305f\u306e\u3067\u9811\u5f35\u3063\u3066\u8a2d\u5b9a\u3057\u305f\u3002\u305d\u306e\u4f5c\u696d\u30e1\u30e2\u3002<\/p>\n<p><strong>\u3084\u308a\u305f\u3044\u3053\u3068<\/strong><\/p>\n<p>Rails\u30a2\u30d7\u30ea(awesome-app)\u3092\u3001<br \/>\nGit Repository(git@example.com:awesome-app.git)\u306bpush\u3057\u305f\u3089\u3001<br \/>\n\u81ea\u52d5\u7684\u306bhttp:\/\/awesome-app.example.com\/\u306b\u30c7\u30d7\u30ed\u30a4\u3055\u308c\u308b<\/p>\n<p><strong>\u624b\u9806<\/strong><\/p>\n<ol>\n<li>\u30b5\u30fc\u30d0\u306b\u30e6\u30fc\u30b6&#8217;git&#8217;\u3092\u4f5c\u3063\u3066\u516c\u958b\u9375\u3067ssh\u30ed\u30b0\u30a4\u30f3\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u304a\u304f<\/li>\n<p>[bash]<br \/>\n# \u30b5\u30fc\u30d0\u5074(example.com)\u3067\u306e\u4f5c\u696d<br \/>\n# \u4e8b\u524d\u306b\u30ed\u30fc\u30ab\u30ebPC\u306e\u516c\u958b\u9375(\u3053\u3053\u3067\u306fid_rsa.pub)\u3092Remote\u306e\u9069\u5f53\u306a\u3068\u3053\u308d\u306b\u30b3\u30d4\u30fc\u3057\u3066\u304a\u304f<br \/>\nsudo useradd -m -s \/bin\/bash git<br \/>\nsudo su git<br \/>\nmkdir \/home\/git\/.ssh<br \/>\ncat id_rsa.pub &gt;&gt; \/home\/git\/.ssh\/authorized_keys<br \/>\n[\/bash]<\/p>\n<li>push\u5148\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u4f5c\u308b<\/li>\n<p>[bash]<br \/>\n# \u30b5\u30fc\u30d0\u5074(example.com)\u3067\u306e\u4f5c\u696d\u3002git\u3067\u30ed\u30b0\u30a4\u30f3\u4e2d\u3002<br \/>\nmkdir ~\/awesome-app.git<br \/>\ncd ~\/awesome-app.git<br \/>\ngit init &#8211;bare<br \/>\n[\/bash]<\/p>\n<li>\u4f5c\u3063\u305f\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u30ea\u30e2\u30fc\u30c8\u30ea\u30dd\u30b8\u30c8\u30ea\u3068\u3057\u3066\u767b\u9332\u3057\u3066\u304a\u304f<\/li>\n<p>[bash]<br \/>\n# \u30ed\u30fc\u30ab\u30ebPC\u4e0a\u3067\u306e\u4f5c\u696d<br \/>\ngit remote add production git@example.com:awesome-app.git<br \/>\n[\/bash]<\/p>\n<li>\u30c7\u30d7\u30ed\u30a4\u5148\u3092\u4f5c\u308b\u3002<\/li>\n<p>[bash]<br \/>\n# \u30b5\u30fc\u30d0\u5074(example.com)\u3067\u306e\u4f5c\u696d\u3002git\u3067\u30ed\u30b0\u30a4\u30f3\u4e2d<br \/>\nmkdir ~\/deployed<br \/>\ncd ~\/deployed<br \/>\ngit clone ~\/awesome-app.git<br \/>\n[\/bash]<\/p>\n<li>http:\/\/awesome-app.example.com\/\u304c\u30c7\u30d7\u30ed\u30a4\u5148\u3092\u53c2\u7167\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u304a\u304f<\/li>\n<p>(\u4f8b:Apache\/Passenger\u306e\u5834\u5408)<br \/>\n[text]<br \/>\n&lt;VirtualHost *:80&gt;<br \/>\n   ServerName awesome-app.example.com<br \/>\n   DocumentRoot \/home\/git\/deployed\/awesome-app\/public<br \/>\n   &lt;Directory \/home\/git\/deployed\/awesome-app\/public&gt;<br \/>\n      AllowOverride all<br \/>\n      Options -MultiViews<br \/>\n   &lt;\/Directory&gt;<br \/>\n&lt;\/VirtualHost&gt;<br \/>\n[\/text]<\/p>\n<li>git push\u306bhook\u3092\u4ed5\u639b\u3051\u308b<\/li>\n<p>[bash]<br \/>\nvi ~\/awesome-app.git\/hooks\/post-receive<br \/>\nchmod +x ~\/awesome-app.git\/hooks\/post-receive<br \/>\n[\/bash]<br \/>\n~\/awesome-app.git\/hooks\/post-receive\u306e\u4e2d\u8eab\u306f\u3053\u3093\u306a\u611f\u3058\u3002git pull\u3057\u3066build\/migrate\u3057\u3066Rails\u3092restart<br \/>\n[bash]<br \/>\n#!\/bin\/sh<br \/>\n(<br \/>\ncd \/home\/git\/deployed\/awesome-app &amp;&amp;<br \/>\ngit &#8211;git-dir=.git pull &amp;&amp;<br \/>\nbundle install &#8211;path vendor\/bundler &amp;&amp;<br \/>\nRAILS_ENV=production bundle exec rake db:migrate &amp;&amp;<br \/>\nRAILS_ENV=production bundle exec rake assets:precompile &amp;&amp;<br \/>\ntouch .\/tmp\/restart.txt<br \/>\n)<br \/>\n[\/bash]<\/p>\n<\/ol>\n<p>\u4ee5\u4e0a\u3067\u3001<code>git push production master<\/code>\u3068\u3084\u308c\u3070\u30c7\u30d7\u30ed\u30a4\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<br \/>\nHeroku\u307f\u305f\u3044\u306b\u3061\u3083\u3093\u3068\u3084\u308b\u306a\u3089\u4ed6\u306b\u3082\u8272\u3005\u3084\u308b\u3053\u3068\u3042\u308a\u305d\u3046\u3060\u3051\u3069\u3001\u3068\u308a\u3042\u3048\u305a\u30e4\u30c3\u30bf\u30fc\uff01\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5\u524d\u4f5c\u3063\u305fSumtimer\u3092\u308f\u3051\u3042\u3063\u3066Heroku\u304b\u3089AWS(EC2+RDS)\u306b\u79fb\u3057\u305f\u3093\u3060\u3051\u3069\u3001git push\u3067\u306edeploy\u306f\u6c17\u306b\u5165\u3063\u3066\u305f\u306e\u3067\u9811\u5f35\u3063\u3066\u8a2d\u5b9a\u3057\u305f\u3002\u305d\u306e\u4f5c\u696d\u30e1\u30e2\u3002 \u3084\u308a\u305f\u3044\u3053\u3068 Rails\u30a2\u30d7\u30ea(awes &#8230; <a title=\"Rails\u30a2\u30d7\u30ea\u3092git push\u3067\u30c7\u30d7\u30ed\u30a4\u3059\u308b\" class=\"read-more\" href=\"https:\/\/tech.fuqinho.net\/?p=478\" aria-label=\"\u8a73\u7d30\u306f\u3053\u3061\u3089 Rails\u30a2\u30d7\u30ea\u3092git push\u3067\u30c7\u30d7\u30ed\u30a4\u3059\u308b\">\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[2],"tags":[],"class_list":["post-478","post","type-post","status-publish","format-standard","hentry","category-2"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.2.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Rails\u30a2\u30d7\u30ea\u3092git push\u3067\u30c7\u30d7\u30ed\u30a4\u3059\u308b - Happy Coder<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/tech.fuqinho.net\/?p=478\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Rails\u30a2\u30d7\u30ea\u3092git push\u3067\u30c7\u30d7\u30ed\u30a4\u3059\u308b - Happy Coder\" \/>\n<meta property=\"og:description\" content=\"\u4ee5\u524d\u4f5c\u3063\u305fSumtimer\u3092\u308f\u3051\u3042\u3063\u3066Heroku\u304b\u3089AWS(EC2+RDS)\u306b\u79fb\u3057\u305f\u3093\u3060\u3051\u3069\u3001git push\u3067\u306edeploy\u306f\u6c17\u306b\u5165\u3063\u3066\u305f\u306e\u3067\u9811\u5f35\u3063\u3066\u8a2d\u5b9a\u3057\u305f\u3002\u305d\u306e\u4f5c\u696d\u30e1\u30e2\u3002 \u3084\u308a\u305f\u3044\u3053\u3068 Rails\u30a2\u30d7\u30ea(awes ... \u7d9a\u304d\u3092\u8aad\u3080\" \/>\n<meta property=\"og:url\" content=\"https:\/\/tech.fuqinho.net\/?p=478\" \/>\n<meta property=\"og:site_name\" content=\"Happy Coder\" \/>\n<meta property=\"article:published_time\" content=\"2012-10-11T09:31:34+00:00\" \/>\n<meta name=\"author\" content=\"fuqinho\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"fuqinho\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"1\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/tech.fuqinho.net\/?p=478#article\",\"isPartOf\":{\"@id\":\"https:\/\/tech.fuqinho.net\/?p=478\"},\"author\":{\"name\":\"fuqinho\",\"@id\":\"https:\/\/tech.fuqinho.net\/#\/schema\/person\/3f5c2a20c9acba8360c501cb7038a4e7\"},\"headline\":\"Rails\u30a2\u30d7\u30ea\u3092git push\u3067\u30c7\u30d7\u30ed\u30a4\u3059\u308b\",\"datePublished\":\"2012-10-11T09:31:34+00:00\",\"dateModified\":\"2012-10-11T09:31:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/tech.fuqinho.net\/?p=478\"},\"wordCount\":215,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/tech.fuqinho.net\/#\/schema\/person\/3f5c2a20c9acba8360c501cb7038a4e7\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/tech.fuqinho.net\/?p=478#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/tech.fuqinho.net\/?p=478\",\"url\":\"https:\/\/tech.fuqinho.net\/?p=478\",\"name\":\"Rails\u30a2\u30d7\u30ea\u3092git push\u3067\u30c7\u30d7\u30ed\u30a4\u3059\u308b - Happy Coder\",\"isPartOf\":{\"@id\":\"https:\/\/tech.fuqinho.net\/#website\"},\"datePublished\":\"2012-10-11T09:31:34+00:00\",\"dateModified\":\"2012-10-11T09:31:34+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/tech.fuqinho.net\/?p=478#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/tech.fuqinho.net\/?p=478\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/tech.fuqinho.net\/?p=478#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u30db\u30fc\u30e0\",\"item\":\"https:\/\/tech.fuqinho.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Rails\u30a2\u30d7\u30ea\u3092git push\u3067\u30c7\u30d7\u30ed\u30a4\u3059\u308b\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/tech.fuqinho.net\/#website\",\"url\":\"https:\/\/tech.fuqinho.net\/\",\"name\":\"Happy Coder\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/tech.fuqinho.net\/#\/schema\/person\/3f5c2a20c9acba8360c501cb7038a4e7\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/tech.fuqinho.net\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"ja\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/tech.fuqinho.net\/#\/schema\/person\/3f5c2a20c9acba8360c501cb7038a4e7\",\"name\":\"fuqinho\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/tech.fuqinho.net\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/tech.fuqinho.net\/wp-content\/uploads\/2023\/02\/hatena-block_400x400.png\",\"contentUrl\":\"https:\/\/tech.fuqinho.net\/wp-content\/uploads\/2023\/02\/hatena-block_400x400.png\",\"width\":400,\"height\":400,\"caption\":\"fuqinho\"},\"logo\":{\"@id\":\"https:\/\/tech.fuqinho.net\/#\/schema\/person\/image\/\"},\"sameAs\":[\"http:\/\/tech.fuqinho.net\"],\"url\":\"https:\/\/tech.fuqinho.net\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Rails\u30a2\u30d7\u30ea\u3092git push\u3067\u30c7\u30d7\u30ed\u30a4\u3059\u308b - Happy Coder","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/tech.fuqinho.net\/?p=478","og_locale":"ja_JP","og_type":"article","og_title":"Rails\u30a2\u30d7\u30ea\u3092git push\u3067\u30c7\u30d7\u30ed\u30a4\u3059\u308b - Happy Coder","og_description":"\u4ee5\u524d\u4f5c\u3063\u305fSumtimer\u3092\u308f\u3051\u3042\u3063\u3066Heroku\u304b\u3089AWS(EC2+RDS)\u306b\u79fb\u3057\u305f\u3093\u3060\u3051\u3069\u3001git push\u3067\u306edeploy\u306f\u6c17\u306b\u5165\u3063\u3066\u305f\u306e\u3067\u9811\u5f35\u3063\u3066\u8a2d\u5b9a\u3057\u305f\u3002\u305d\u306e\u4f5c\u696d\u30e1\u30e2\u3002 \u3084\u308a\u305f\u3044\u3053\u3068 Rails\u30a2\u30d7\u30ea(awes ... \u7d9a\u304d\u3092\u8aad\u3080","og_url":"https:\/\/tech.fuqinho.net\/?p=478","og_site_name":"Happy Coder","article_published_time":"2012-10-11T09:31:34+00:00","author":"fuqinho","twitter_card":"summary_large_image","twitter_misc":{"\u57f7\u7b46\u8005":"fuqinho","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"1\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/tech.fuqinho.net\/?p=478#article","isPartOf":{"@id":"https:\/\/tech.fuqinho.net\/?p=478"},"author":{"name":"fuqinho","@id":"https:\/\/tech.fuqinho.net\/#\/schema\/person\/3f5c2a20c9acba8360c501cb7038a4e7"},"headline":"Rails\u30a2\u30d7\u30ea\u3092git push\u3067\u30c7\u30d7\u30ed\u30a4\u3059\u308b","datePublished":"2012-10-11T09:31:34+00:00","dateModified":"2012-10-11T09:31:34+00:00","mainEntityOfPage":{"@id":"https:\/\/tech.fuqinho.net\/?p=478"},"wordCount":215,"commentCount":0,"publisher":{"@id":"https:\/\/tech.fuqinho.net\/#\/schema\/person\/3f5c2a20c9acba8360c501cb7038a4e7"},"inLanguage":"ja","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/tech.fuqinho.net\/?p=478#respond"]}]},{"@type":"WebPage","@id":"https:\/\/tech.fuqinho.net\/?p=478","url":"https:\/\/tech.fuqinho.net\/?p=478","name":"Rails\u30a2\u30d7\u30ea\u3092git push\u3067\u30c7\u30d7\u30ed\u30a4\u3059\u308b - Happy Coder","isPartOf":{"@id":"https:\/\/tech.fuqinho.net\/#website"},"datePublished":"2012-10-11T09:31:34+00:00","dateModified":"2012-10-11T09:31:34+00:00","breadcrumb":{"@id":"https:\/\/tech.fuqinho.net\/?p=478#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/tech.fuqinho.net\/?p=478"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/tech.fuqinho.net\/?p=478#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u30db\u30fc\u30e0","item":"https:\/\/tech.fuqinho.net\/"},{"@type":"ListItem","position":2,"name":"Rails\u30a2\u30d7\u30ea\u3092git push\u3067\u30c7\u30d7\u30ed\u30a4\u3059\u308b"}]},{"@type":"WebSite","@id":"https:\/\/tech.fuqinho.net\/#website","url":"https:\/\/tech.fuqinho.net\/","name":"Happy Coder","description":"","publisher":{"@id":"https:\/\/tech.fuqinho.net\/#\/schema\/person\/3f5c2a20c9acba8360c501cb7038a4e7"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/tech.fuqinho.net\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"ja"},{"@type":["Person","Organization"],"@id":"https:\/\/tech.fuqinho.net\/#\/schema\/person\/3f5c2a20c9acba8360c501cb7038a4e7","name":"fuqinho","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/tech.fuqinho.net\/#\/schema\/person\/image\/","url":"https:\/\/tech.fuqinho.net\/wp-content\/uploads\/2023\/02\/hatena-block_400x400.png","contentUrl":"https:\/\/tech.fuqinho.net\/wp-content\/uploads\/2023\/02\/hatena-block_400x400.png","width":400,"height":400,"caption":"fuqinho"},"logo":{"@id":"https:\/\/tech.fuqinho.net\/#\/schema\/person\/image\/"},"sameAs":["http:\/\/tech.fuqinho.net"],"url":"https:\/\/tech.fuqinho.net\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/tech.fuqinho.net\/index.php?rest_route=\/wp\/v2\/posts\/478","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tech.fuqinho.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tech.fuqinho.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tech.fuqinho.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tech.fuqinho.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=478"}],"version-history":[{"count":0,"href":"https:\/\/tech.fuqinho.net\/index.php?rest_route=\/wp\/v2\/posts\/478\/revisions"}],"wp:attachment":[{"href":"https:\/\/tech.fuqinho.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tech.fuqinho.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=478"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tech.fuqinho.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}