{"id":19010324,"url":"https://github.com/railsware/capistrano-patch","last_synced_at":"2025-04-22T23:13:56.681Z","repository":{"id":56843241,"uuid":"2625481","full_name":"railsware/capistrano-patch","owner":"railsware","description":"Capistrano patch recipes","archived":false,"fork":false,"pushed_at":"2012-04-27T20:26:40.000Z","size":94,"stargazers_count":30,"open_issues_count":1,"forks_count":4,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-04-22T23:13:51.452Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/railsware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-10-22T10:00:53.000Z","updated_at":"2025-02-06T16:03:06.000Z","dependencies_parsed_at":"2022-09-09T04:12:09.990Z","dependency_job_id":null,"html_url":"https://github.com/railsware/capistrano-patch","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fcapistrano-patch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fcapistrano-patch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fcapistrano-patch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fcapistrano-patch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/railsware","download_url":"https://codeload.github.com/railsware/capistrano-patch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250337949,"owners_count":21414104,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T19:10:52.480Z","updated_at":"2025-04-22T23:13:56.664Z","avatar_url":"https://github.com/railsware.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Capistrano patch recipes\n\n## Concept\n\nUsual deployment procedure is pretty good. \nBut real project are big and offen have several megabytes of code. So standard deployment is not so fast.\nYou need chekout new code, prepare all symplinks, etc ... It takes the time.\n\nSometimes you need to *quickly* apply hostfix that fixes critical bug. \nUsually such fix is small and may contain only several lines of code.\nDoing it manual it's not good from any point of view.\n\nSo that's why *capistrano patch recipes* appears. They are extracted from real big project.\n\nIt's automated solution for safely code patching on any stage.\n\nDepending on patch strategy `cap patch` :\n\n* creates patch file\n* delivers patch file to all application servers\n* checks patch\n* applies patch\n* updates REVISION\n\nIf something went wrong your also able to quickly revert patch with `cap patch:revert`. See recipes below.\n\n\n## Installation\n\n    gem install capistrano-patch\n\nAdd to `Capfile`\n\n    # load standard capistrano recipes\n    load 'deploy' \n\n    # load patch recipes\n    require 'capistrano/patch' \n\n## Configuration\n\n* *:patch_via* - patch strategy (default `:git`)\n* *:patch_repository* - SCM repository that will be using for generating diffs (default `.git`)\n* *:patch_directory* - directory for storing generated patches (default `.`)\n* *:patch_base_url* - base url for patch download ( default `nil`)\n* *:patch_server_host* - server host for patch generating ( default `nil`)\n* *:patch_server_options* -server host options ( default `{}`)\n\n## Patch strategies\n\nPatch strategy is about how to process code patching on stage. It also depends on patch source (or scm).\n\nCurrently implemented patch strategies:\n\n* git\n* git_server\n\n## Git strategy\n\nIt's simple strategy that is suitable for almost all git projects.\n\n### Integrated deployment\n\nWhen you use capistrano directly into your application you need zero configuration.\n\n### Separated deployment\n\nWhen you have separated deployment repository you need to specify patch repository and directory.\n\nExample:\n\n    set(:patch_repository) { \"../#{application}.git\" }\n    set(:patch_directory)  { \"/tmp/patches/#{application}\" }\n\n## GitServer strategy\n\nFor big projects offen is required to generate patch using some certain or origin repository and store generated patch in some directory there. Thus patch can be accessible from directory server via http and delivered to application servers from the same host where repository is located.\n\nExample:\n\n    set :patch_via, :git_server\n\n    set(:patch_repository) { \"/var/git/repositories/#{application}.git\" }\n    set(:patch_directory)  { \"/var/www/patches/#{application}\" }\n    set(:patch_base_url)   { \"http://scm.example.com/patches/#{application}\" }  \n\n    set :patch_server_host, \"scm.example.com\"\n\n### Extra options\n\nPatch server is not in global capistrano servers list.\nSo any other task will not affect your server. And this is good.\nBut offen you need to specify different options to patch server instead of global values.\n\nWhen you want to specify just another `user` or `port` you can do it in `patch_server_host` variable:\n\n    set :patch_server_host, \"USER@scm.example.com:PORT\"\n\nor using `patch_server_options` variable:\n\n    set :patch_server_options, {\n      :user =\u003e 'patcher',\n      :port =\u003e 2222\n    }\n\nAlso you are able to specify another ssh keys:\n\n    set :patch_server_options, {\n      :ssh_options =\u003e { :auth_methods =\u003e %w(publickey), :keys =\u003e %w(keys/patcher.pem) }\n    }\n\n## Recipes\n\n### Create deliver and apply patch\n\n    $ cap patch FROM=v0.0.1 TO=v0.0.2\n\nor\n\n    $ cap patch PATCH=v0.0.1-v0.0.2\n\nor\n\n    $ cap patch FROM=development TO=master\n\n\n* It will create patch file like `sha1-sha2.patch`\n* It will deliver patch file to all application servers\n* It will check patch before applying\n* It will apply check\n* It will update REVISION after applying\n\n\n### Create patch\n\n    $ cap patch:create FROM=v0.0.1 TO=v0.0.2\n\nCreate file like: `6c5923863a288b089a6a2bc11e560f0d28dabfb6-92e018dbda8a91c442e40257b81097ceeb150876.patch`\n\n### Deliver patch\n\nIf patch file is missing on some server you can manualy deliver it with\n\n    $ cap patch:deliver FROM=v0.0.1 TO=v0.0.2 HOSTFILTER='app1'\n\n### Apply patch\n\nIf may manualy apply patch on some server:\n\n    $ cap patch:apply FROM=v0.0.1 TO=v0.0.2 HOSTFILTER='app1'\n\n### Revert patch\n\n\nIf something went bad you may revert patch\n\n    $ cap patch:revert FROM=v0.0.1 TO=v0.0.2\n    # or\n    $ cap patch:revert PATCH=v0.0.1-v0.0.2\n    # or\n    $ cap patch:revert PATCH=6c5923863a288b089a6a2bc11e560f0d28dabfb6-92e018dbda8a91c442e40257b81097ceeb150876.patch\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frailsware%2Fcapistrano-patch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frailsware%2Fcapistrano-patch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frailsware%2Fcapistrano-patch/lists"}