{"id":13818272,"url":"https://github.com/capistrano/rails","last_synced_at":"2025-05-13T15:10:01.348Z","repository":{"id":8801793,"uuid":"10496245","full_name":"capistrano/rails","owner":"capistrano","description":"Official Ruby on Rails specific tasks for Capistrano","archived":false,"fork":false,"pushed_at":"2024-12-30T17:54:02.000Z","size":143,"stargazers_count":881,"open_issues_count":19,"forks_count":270,"subscribers_count":31,"default_branch":"master","last_synced_at":"2025-04-30T22:38:58.895Z","etag":null,"topics":["capistrano","deployment","rails"],"latest_commit_sha":null,"homepage":"http://www.capistranorb.com/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/capistrano.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-06-05T06:17:50.000Z","updated_at":"2025-04-26T15:36:41.000Z","dependencies_parsed_at":"2022-08-07T04:16:47.224Z","dependency_job_id":"2d0ddee8-690a-4aed-b67b-5cc1c2c2b94d","html_url":"https://github.com/capistrano/rails","commit_stats":{"total_commits":136,"total_committers":56,"mean_commits":"2.4285714285714284","dds":0.7647058823529411,"last_synced_commit":"727fa58851921e95af712a303c3ef3e2e2883e17"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capistrano%2Frails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capistrano%2Frails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capistrano%2Frails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capistrano%2Frails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/capistrano","download_url":"https://codeload.github.com/capistrano/rails/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251981709,"owners_count":21675081,"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":["capistrano","deployment","rails"],"created_at":"2024-08-04T07:00:39.433Z","updated_at":"2025-05-13T15:09:56.336Z","avatar_url":"https://github.com/capistrano.png","language":"Ruby","funding_links":[],"categories":["Awesome Capistrano"],"sub_categories":["Gems"],"readme":"# Capistrano::Rails\n\nRails specific tasks for Capistrano v3:\n\n  - `cap deploy:migrate`\n  - `cap deploy:compile_assets`\n\n## Installation\n\nAdd these Capistrano gems to your application's Gemfile using `require: false`:\n\n```ruby\ngroup :development do\n  gem \"capistrano\", \"~\u003e 3.10\", require: false\n  gem \"capistrano-rails\", \"~\u003e 1.6\", require: false\nend\n```\n\nRun the following command to install the gems:\n\n```\nbundle install\n```\n\nThen run the generator to create a basic set of configuration files:\n\n```\nbundle exec cap install\n```\n\n## Usage\n\nRequire everything (`bundler`, `rails/assets` and `rails/migrations`):\n\n```ruby\n# Capfile\nrequire 'capistrano/rails'\n```\n\nOr require just what you need manually:\n\n```ruby\n# Capfile\nrequire 'capistrano/bundler' # Rails needs Bundler, right?\nrequire 'capistrano/rails/assets'\nrequire 'capistrano/rails/migrations'\n```\n\nPlease note that any `require`s should be placed in `Capfile`, not in `config/deploy.rb`.\n\nYou can tweak some Rails-specific options in `config/deploy.rb`:\n\n```ruby\n# If the environment differs from the stage name\nset :rails_env, 'staging'\n\n# Defaults to :db role\nset :migration_role, :db\n\n# Defaults to the primary :db server\nset :migration_servers, -\u003e { primary(fetch(:migration_role)) }\n\n# Defaults to `db:migrate`\nset :migration_command, 'db:migrate'\n\n# Defaults to false\n# Skip migration if files in db/migrate were not modified\nset :conditionally_migrate, true\n\n# Defaults to [:web]\nset :assets_roles, [:web, :app]\n\n# Defaults to 'assets'\n# This should match config.assets.prefix in your rails config/application.rb\nset :assets_prefix, 'prepackaged-assets'\n\n# Defaults to [\"/path/to/release_path/public/#{fetch(:assets_prefix)}/.sprockets-manifest*\", \"/path/to/release_path/public/#{fetch(:assets_prefix)}/manifest*.*\", \"/path/to/release_path/public/#{fetch(:assets_prefix)}/.manifest.json\"]\n# This should match config.assets.manifest in your rails config/application.rb\nset :assets_manifests, ['app/assets/config/manifest.js']\n\n# RAILS_GROUPS env value for the assets:precompile task. Default to nil.\nset :rails_assets_groups, :assets\n\n# If you need to touch public/images, public/javascripts, and public/stylesheets on each deploy\nset :normalize_asset_timestamps, %w{public/images public/javascripts public/stylesheets}\n\n# Defaults to nil (no asset cleanup is performed)\n# If you use Rails 4+ and you'd like to clean up old assets after each deploy,\n# set this to the number of versions to keep\nset :keep_assets, 2\n```\n\n### Symlinks\n\nYou'll probably want to symlink Rails shared files and directories like `log`, `tmp` and `public/uploads`.\nMake sure you enable it by setting `linked_dirs` and `linked_files` options:\n\n```ruby\n# deploy.rb\nappend :linked_dirs, 'log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', '.bundle', 'public/system', 'public/uploads'\nappend :linked_files, 'config/database.yml', 'config/secrets.yml'\n```\n\nIn capistrano \u003c 3.5, before `append` was introduced, you can use `fetch` and `push` to get the same result.\n\n### Recommendations\n\nWhile migrations looks like a concern of the database layer, Rails migrations\nare strictly related to the framework. Therefore, it's recommended to set the\nrole to `:app` instead of `:db` like:\n\n```ruby\nset :migration_role, :app\n```\n\nThe advantage is you won't need to deploy your application to your database\nserver, and overall a better separation of concerns.\n\n#### Uploading your master.key\n\nYou can use the below configuration to upload your `master.key` to the server if it isn't already present.\n\n```ruby\nappend :linked_files, \"config/master.key\"\n\nnamespace :deploy do\n  namespace :check do\n    before :linked_files, :set_master_key do\n      on roles(:app) do\n        unless test(\"[ -f #{shared_path}/config/master.key ]\")\n          upload! 'config/master.key', \"#{shared_path}/config/master.key\"\n        end\n      end\n    end\n  end\nend\n```\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapistrano%2Frails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcapistrano%2Frails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapistrano%2Frails/lists"}