{"id":116,"date":"2013-02-21T14:19:17","date_gmt":"2013-02-21T05:19:17","guid":{"rendered":"http:\/\/tech.eshima.info\/?p=116"},"modified":"2013-04-05T14:41:42","modified_gmt":"2013-04-05T05:41:42","slug":"cakephp%e3%81%ae%e3%83%97%e3%83%ad%e3%82%b8%e3%82%a7%e3%82%af%e3%83%88%e3%82%92capistrano%e3%81%a7%e3%83%87%e3%83%97%e3%83%ad%e3%82%a4","status":"publish","type":"post","link":"https:\/\/tech.eshima.info\/?p=116","title":{"rendered":"CakePHP\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092capistrano\u3067\u30c7\u30d7\u30ed\u30a4"},"content":{"rendered":"<p>capistrano\u306fRuby On Rails\u7528\u306b\u4f5c\u3089\u308c\u305f\u30c7\u30d7\u30ed\u30a4\u30c4\u30fc\u30eb\u3067\u3001<br \/>\n\u8a2d\u5b9a\u3092\u3059\u308c\u3070PHP\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u3082\u5229\u7528\u3067\u304d\u308b\u3002<\/p>\n<p>\u30c7\u30d7\u30ed\u30a4\u3092\u81ea\u52d5\u5316\u3067\u304d\u308b\u305f\u3081\u3001\u6700\u521d\u306e\u8a2d\u5b9a\u3055\u3048\u3057\u3066\u304a\u3051\u3070\u5f8c\u304c\u697d\u3002<br \/>\n\u30c4\u30fc\u30eb\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f\u30c7\u30d7\u30ed\u30a4\u3092\u3059\u308b\u7aef\u672b\u3060\u3051\u306b\u3059\u308c\u3070\u826f\u304f\u3001<br \/>\n\u5404\u30b5\u30fc\u30d0\u30fc\u306b\u306f\u7279\u306b\u4f55\u3082\u3059\u308b\u5fc5\u8981\u306f\u306a\u3057\u3002<\/p>\n<p>\u8907\u6570\u30b5\u30fc\u30d0\u30fc\u306b\u5bfe\u3057\u3066\u4e00\u6c17\u306b\u30c7\u30d7\u30ed\u30a4\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u308b\u306e\u3067<br \/>\n\u540c\u3058\u30bd\u30fc\u30b9\u3092\u8907\u6570\u306e\u30b5\u30fc\u30d3\u30b9\u306b\u4f7f\u3063\u3066\u3044\u308b\u5834\u5408\u306a\u3069\u306b\u306f\u4fbf\u5229\u3002<\/p>\n<h4>\u6e96\u5099<\/h4>\n<p>Ruby\u3067\u4f5c\u3089\u308c\u3066\u3044\u308b\u30c4\u30fc\u30eb\u306a\u306e\u3067<br \/>\ngem\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<\/p>\n<pre>\r\n$ gem install -y capistrano\r\n<\/pre>\n<h4>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3054\u3068\u306b\u9069\u7528<\/h4>\n<pre>\r\n$ cd {project_path}\r\n$ capify .\r\n<\/pre>\n<p>\u3053\u308c\u3067<br \/>\n{project_path}\/Capistrano<br \/>\n{Project_path}\/config\/deploy.rb<br \/>\n\u304c\u4f5c\u6210\u3055\u308c\u308b\u3002deploy.rb\u304c\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306a\u306e\u3067<br \/>\n\u3053\u308c\u3092\u81ea\u5206\u306e\u74b0\u5883\u306b\u5fdc\u3058\u3066\u5909\u66f4\u3059\u308b\u3002<\/p>\n<h4>\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb<\/h4>\n<p>CakePHP\u7528\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u516c\u958b\u3057\u3066\u304f\u3060\u3055\u3063\u3066\u3044\u308b\u65b9\u304c\u3044\u305f\u306e\u3067<br \/>\n\u305d\u308c\u3092\u53c2\u7167\u3055\u305b\u3066\u3082\u3089\u3044\u3064\u3064\u81ea\u5206\u7528\u306b\u4fee\u6b63\u3002<\/p>\n<p><a href=\"http:\/\/doruby.kbmj.com\/trinityt_on_rails\/20100907\/CakePHP_Capistrano_\" title=\"CakePHP\u3092Capistrano\u3092\u4f7f\u3063\u3066\u697d\u3005\u30c7\u30d7\u30ed\u30a4\u3057\u3088\u3046\uff01\">CakePHP\u3092Capistrano\u3092\u4f7f\u3063\u3066\u697d\u3005\u30c7\u30d7\u30ed\u30a4\u3057\u3088\u3046\uff01<\/a><\/p>\n<p>\u8ffd\u52a0\u5206\u306e\u8a2d\u5b9a<\/p>\n<pre lang=\"ruby\">\r\nset :ssh_options, :port => \"99999\" # SSH\u306e\u30dd\u30fc\u30c8\u6307\u5b9a\r\n<\/pre>\n<p>\u7d50\u69cb\u3064\u307e\u3065\u3044\u305f\u90e8\u5206\u3002<br \/>\ngit\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u7f6e\u3044\u3066\u3044\u308b\u30b5\u30fc\u30d0\u30fc\u3068\u30c7\u30d7\u30ed\u30a4\u5148\u304c\u540c\u3058\u3060\u3063\u305f\u306e\u3067<br \/>\nset :repository,   &#8220;file:\/\/\/var\/git\/xxxxx.git&#8221;<br \/>\n\u306a\u3069\u3068\u8a2d\u5b9a\u3057\u305f\u304c\u3069\u3046\u3057\u3066\u3082\u30a8\u30e9\u30fc\u3067\u3067\u304d\u305a\u3002<\/p>\n<p>\u7d50\u5c40\u3001Capistrano\u3092\u52d5\u304b\u3057\u3066\u3044\u308b\u81ea\u5206\u306eMac\u306b\u4e00\u65e6\u5c55\u958b\u3057\u3066\u304b\u3089<br \/>\n\u30b5\u30fc\u30d0\u30fc\u306b\u30a2\u30c3\u30d7\u3059\u308b\u3068\u3044\u3046\u8a2d\u5b9a\u306b\u3002<br \/>\nSSH\u306e\u9375\u8a2d\u5b9a\u306a\u3069\u3092\u30b5\u30fc\u30d0\u30fc\u9593\u3067\u3057\u306a\u304f\u3066\u3059\u3080\u53cd\u9762\u3001\u56de\u7dda\u304c\u9045\u3044\u3068\u56f0\u308b\u3053\u3068\u3082\u3042\u308a\u305d\u3046\u3002<\/p>\n<pre lang=\"ruby\">\r\n# set :deploy_via, :export\r\nset :deploy_via, :copy # \r\n<\/pre>\n<p>delpoy:symlink\u3067\u306f\u52d5\u304b\u306a\u304b\u3063\u305f\u306e\u3067\u65b0\u3057\u304f\u306a\u3063\u3066\u5909\u308f\u3063\u305f\u306e\u304b\u3082\u3002<br \/>\ndeploy:create_symlink\u306b\u4fee\u6b63\u3002<br \/>\n\u5f8c\u306f\u3001CakePHP\u7528\u306b\u30b5\u30fc\u30d0\u30fc\u7528\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092shared\u306b\u7f6e\u3044\u3066\u305d\u3053\u304b\u3089\u30b7\u30f3\u30dc\u30ea\u30c3\u30af\u30ea\u30f3\u30af\u3002<br \/>\n\u307e\u305f\u3001tmp\u4ee5\u4e0b\u3092.gitignore\u3067\u7121\u8996\u3057\u3066\u308b\u306e\u3067\u5fc5\u8981\u306a\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3002<\/p>\n<pre lang=\"ruby\">\r\n  desc \"\u6a19\u6e96\u306e\u30b7\u30f3\u30dc\u30ea\u30c3\u30af\u5f35\u308a\u76f4\u3057\u5b9f\u884c\u5f8c\u306b\u884c\u3046\u51e6\u7406\u3092\u8a18\u8ff0\u3059\u308b\"\r\n  # after \"deploy:symlink\", :roles => [:app] do\r\n  after \"deploy:create_symlink\", :roles => [:app] do\r\n    run \"ln -fns #{shared_path}\/system\/database.php #{latest_release}\/app\/Config\/database.php\"\r\n    run \"ln -fns #{shared_path}\/system\/email.php #{latest_release}\/app\/Config\/email.php\"\r\n    run \"mkdir #{latest_release}\/app\/tmp\/cache\"\r\n    run \"mkdir #{latest_release}\/app\/tmp\/cache\/models\"\r\n    run \"mkdir #{latest_release}\/app\/tmp\/cache\/persistent\"\r\n    run \"mkdir #{latest_release}\/app\/tmp\/cache\/views\"\r\n    run \"mkdir #{latest_release}\/app\/tmp\/sessions\"\r\n    run \"mkdir #{latest_release}\/app\/tmp\/tests\"\r\n    run \"chmod -R 777 #{latest_release}\/app\/tmp\"\r\n<\/pre>\n<h4>capistrano\u306e\u30b3\u30de\u30f3\u30c9<\/h4>\n<pre>\r\n$ cap -T\r\n<\/pre>\n<p>\u3068\u5165\u529b\u3059\u308b\u3053\u3068\u3067\u4f7f\u7528\u3067\u304d\u308b\u30b3\u30de\u30f3\u30c9\u304c\u8868\u793a\u3055\u308c\u308b\u3002<br \/>\n\u6a19\u6e96\u306e\u3082\u306e\u306b\u52a0\u3048\u3001\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3067\u81ea\u5206\u304c\u8a2d\u5b9a\u3057\u305f\u3082\u306e\u3082\u51fa\u308b\u3002<\/p>\n<pre>\r\ncap deploy                 # Deploys your project.\r\ncap deploy:check           # Test deployment dependencies.\r\ncap deploy:cleanup         # Clean up old releases.\r\ncap deploy:cold            # Deploys and starts a `cold' application.\r\ncap deploy:create_symlink  # Updates the symlink to the most recently deployed version.\r\ncap deploy:finalize_update # CakePHP\u7528\u306bfinalize_update\u3092\u4e0a\u66f8\u304d\u3059\u308b\r\ncap deploy:migrate         # Run the migrate rake task.\r\ncap deploy:migrations      # Deploy and run pending migrations.\r\ncap deploy:pending         # Displays the commits since your last deploy.\r\ncap deploy:pending:diff    # Displays the `diff' since your last deploy.\r\ncap deploy:rollback        # Rolls back to a previous version and restarts.\r\ncap deploy:rollback:code   # Rolls back to the previously deployed version.\r\ncap deploy:setup           # Prepares one or more servers for deployment.\r\ncap deploy:start           # \u6a19\u6e96\u306e\u30b7\u30f3\u30dc\u30ea\u30c3\u30af\u5f35\u308a\u76f4\u3057\u5b9f\u884c\u5f8c\u306b\u884c\u3046\u51e6\u7406\u3092\u8a18\u8ff0\u3059\u308b\r\ncap deploy:symlink         # Deprecated API.\r\ncap deploy:update          # Copies your project and updates the symlink.\r\ncap deploy:update_code     # Copies your project to the remote servers.\r\ncap deploy:upload          # Copy files to the currently deployed version.\r\ncap development            # Set the target stage to `development'.\r\ncap invoke                 # Invoke a single command on the remote servers.\r\ncap multistage:prepare     # Stub out the staging config files.\r\ncap production             # Set the target stage to `production'.\r\ncap shell                  # Begin an interactive Capistrano session.\r\ncap staging                # Set the target stage to `staging'.\r\n\r\nSome tasks were not listed, either because they have no description,\r\nor because they are only used internally by other tasks. To see all\r\ntasks, type `cap -vT'.\r\n\r\nExtended help may be available for these tasks.\r\nType `cap -e taskname' to view it.\r\n<\/pre>\n<h4>\u30c7\u30d7\u30ed\u30a4\u5148\uff08\u30b5\u30fc\u30d0\u30fc\uff09\u306e\u6e96\u5099<\/h4>\n<p>\u7aef\u672b\u304b\u3089\u30b5\u30fc\u30d0\u30fc\u306bSSH\u3067\u5165\u308c\u308b\u3088\u3046\u306b\u3057\u3066\u304a\u304f\u3002<\/p>\n<p>\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3067\u6307\u5b9a\u3059\u308b\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30bd\u30fc\u30b9\u3092\u7f6e\u304f\u305f\u3081\u306e<br \/>\n\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306f\u4e8b\u524d\u306b\u4f5c\u3063\u3066\u304a\u304f\u3002<br \/>\nSSH\u3067\u5165\u308b\u30e6\u30fc\u30b6\u30fc\u304c\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u64cd\u4f5c\u6a29\u9650\u3092\u6301\u3063\u3066\u3044\u308b\u3088\u3046\u306b\u3059\u308b\u3002<\/p>\n<p>\u305d\u306e\u4e0a\u3067\u3001\u4e0b\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u3067\u5fc5\u8981\u306a\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210<\/p>\n<pre>\r\ncap deploy:setup\r\n<\/pre>\n<h4>\u6bce\u56de\u306e\u30c7\u30d7\u30ed\u30a4\u4f5c\u696d<\/h4>\n<pre>\r\ncap deploy\r\n<\/pre>\n<p>\u3068\u5165\u529b\u3059\u308b\u3060\u3051\u3002\u5834\u5408\u306b\u3088\u3063\u3066\u306fjenkins\u304b\u3089\u5b9f\u884c\u3055\u305b\u3066\u3082\u826f\u3044\u3002<\/p>\n<h4>\uff08\u8ffd\u8a18\uff09git submodule\u306e\u7ba1\u7406<\/h4>\n<p>Plugin\/Debugkit \u306a\u3069\u3092git submodule\u3067\u7ba1\u7406\u3057\u3066\u3044\u305f\u304c<br \/>\ngit clone\u3057\u3066\u3082\u53d6\u5f97\u3055\u308c\u306a\u3044\u306e\u3067\u30a8\u30e9\u30fc\u306b\u306a\u3063\u3066\u3044\u305f\u3002<\/p>\n<p>config\/deploy.rb \u306b\u4e0b\u8a18\u3092\u8ffd\u52a0\u3057\u3066\u89e3\u6c7a\u3002<\/p>\n<pre>\r\nset :git_enable_submodules, 1\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>capistrano\u306fRuby On Rails\u7528 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,5],"tags":[],"class_list":["post-116","post","type-post","status-publish","format-standard","hentry","category-cakephp","category-5"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/tech.eshima.info\/index.php?rest_route=\/wp\/v2\/posts\/116","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tech.eshima.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tech.eshima.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tech.eshima.info\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/tech.eshima.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=116"}],"version-history":[{"count":12,"href":"https:\/\/tech.eshima.info\/index.php?rest_route=\/wp\/v2\/posts\/116\/revisions"}],"predecessor-version":[{"id":121,"href":"https:\/\/tech.eshima.info\/index.php?rest_route=\/wp\/v2\/posts\/116\/revisions\/121"}],"wp:attachment":[{"href":"https:\/\/tech.eshima.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=116"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tech.eshima.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=116"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tech.eshima.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=116"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}