{"id":20791689,"url":"https://github.com/mailchimp/statistrano","last_synced_at":"2026-04-01T21:03:19.893Z","repository":{"id":7505636,"uuid":"8855585","full_name":"mailchimp/statistrano","owner":"mailchimp","description":"deployment tool for static sites","archived":false,"fork":false,"pushed_at":"2015-11-17T21:30:33.000Z","size":442,"stargazers_count":43,"open_issues_count":4,"forks_count":0,"subscribers_count":28,"default_branch":"master","last_synced_at":"2026-03-27T14:39:10.880Z","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":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mailchimp.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-18T14:08:48.000Z","updated_at":"2026-03-25T12:08:33.000Z","dependencies_parsed_at":"2022-09-16T08:51:55.751Z","dependency_job_id":null,"html_url":"https://github.com/mailchimp/statistrano","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"purl":"pkg:github/mailchimp/statistrano","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailchimp%2Fstatistrano","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailchimp%2Fstatistrano/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailchimp%2Fstatistrano/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailchimp%2Fstatistrano/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mailchimp","download_url":"https://codeload.github.com/mailchimp/statistrano/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailchimp%2Fstatistrano/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31050480,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-27T15:56:29.888Z","status":"ssl_error","status_checked_at":"2026-03-27T15:56:29.182Z","response_time":164,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-17T15:46:37.909Z","updated_at":"2026-04-01T21:03:19.869Z","avatar_url":"https://github.com/mailchimp.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Description\n===========\n\nA gem to simplify the deployment of static sites, and staging of feature branches.\n\n\n\nInstallation\n============\n\nWith Bundler\n```ruby\ngem \"statistrano\", \"~\u003e 1.2.2\"\n```\n\n\nExamples\n========\n\n### Base deployment\n\nThe base setup simply copies a local directory to a remote directory\n\n```ruby\n# deploy.rake\nrequire 'statistrano'\n\ndeployment = define_deployment \"basic\" do\n\n  hostname   'remote_name'\n  user       'freddie' # optional if remote is setup in .ssh/config\n  password   'something long and stuff' # optional if remote is setup in .ssh/config\n\n  remote_dir '/var/www/mailchimp.com'\n  local_dir  'build'\n  build_task 'middleman:build' # optional if nothing needs to be built\n  post_deploy_task 'base:post_deploy' # optional if no task should be run after deploy\n\n  dir_permissions  755 # optional, the perms set on rsync \u0026 setup for directories\n  file_permissions 644 # optional, the perms set on rsync \u0026 setup for files\n  rsync_flags      '-aqz --delete-after' # optional, flags for rsync\n\n  check_git  true # optional, set to false if git shouldn't be checked\n  git_branch 'master' # which branch to check against\n\n  # optional, you can define multiple remotes to deploy to\n  # any config option can be overriden in the remote's data hash\n  remotes [\n    { hostname: 'remote01', remote_dir: '/var/www/mailchimp01' },\n    { hostname: 'remote02', remote_dir: '/var/www/mailchimp02' }\n  ]\n\nend\n```\n\n**Rake Tasks**\n\nOnce a deployment is defined, you can register it's tasks -- or call the methods directly.\n\n```ruby\n# deploy.rake\ndeployment.register_tasks\n# =\u003e rake tasks are registered\n```\n\n`rake basic:deploy`  \ndeploys the local_dir to the remote_dir. optionally call `deployment.deploy`\n\n\n### Releases deployment\n\nOut of the box Statistrano allows you to pick from a release based deployment, or branch based. Releases act as a series of snapshots of your project with the most recent linked to the `public_dir`. You can quickly rollback in case of errors.\n\n```ruby\n# deploy.rake\nrequire 'statistrano'\n\ndeployment = define_deployment \"production\", :releases do\n\n  # in addition to the \"base\" config options, there\n  # are some (all defaulted) options specific for releases\n  release_count 5\n  release_dir  \"releases\"\n  public_dir   \"current\"\n\nend\n```\n\n**Rake Tasks**\n\nOnce a deployment is defined, you can register it's tasks -- or call the methods directly.\n\n```ruby\n# deploy.rake\ndeployment.register_tasks\n# =\u003e rake tasks are registered\n```\n\n`rake production:deploy`  \ndeploys local_dir to the remote, and symlinks remote_dir/current to the release.\n\n`rake production:rollback`  \nrolls back to the previous release.\n\n`rake production:prune`  \nmanually removes old releases beyond the release count\n\n`rake production:list`  \nlists all the currently deployed releases\n\n\n### Branch deployment\n\nThe branch deployment type adds some nice defaults to use the current branch as your release name. So with the correct nginx/apache config you can have your branches mounted as subdomains (eg: `http://my_awesome_branch.example.com`). Aditionally it is set up to create an `index` release that shows a list of your currently deployed branches.\n\n\n```ruby\ndeployment = define_deployment \"branches\", :branches do\n\n  # in addition to the \"base\" options\n  base_domain \"mailchimp.com\" # used to generate the subdomain links in the index file\n  public_dir  \"current_branch\" # defaults to a slugged version of the current branch\n  post_deploy_task \"name:generate_index\" # defaults to create the index file\n\nend\n```\n\n**Rake Tasks**\n\nOnce a deployment is defined, you can register it's tasks -- or call the methods directly.\n\n```ruby\n# deploy.rake\ndeployment.register_tasks\n# =\u003e rake tasks are registered\n```\n\n`rake branches:deploy`  \ndeploys local_dir to the remote named for the current git branch, and generates an index page\n\n`rake branches:list`  \nlists all the currently deployed branches\n\n`rake branches:open`  \nIf you have set a base_domain, opens the branch in your default browser\n\n`rake branches:prune`  \nshows list of currently deployed branches to pick from and remove\n\n`rake branches:generate_index`  \nmanually kicks of index generation, typically you shouldn't need to do this\n\n\n## Build \u0026 Post Deploy Tasks\n\nOf note, the `build_task` \u0026 `post_deploy_task` can be defined as a block. Some release types (like \"releases\") will use a hash if it is returned by the block.\n\n```ruby\ndeployment = define_deployment 'multi', :releases do\n  build_task do\n    Rake::Task['build'].invoke\n    { commit: Asgit.current_commit }\n  end\nend\n\ndeployment.deploy\n# =\u003e remote/manifest.manifest will end up with [{release: 'timestamp', commit: 'commit_sha'}]\n```\n\nYou can also access the current deployment info by giving the block arity.\n\n```ruby\ndeployment = define_deployment 'multi', :releases do\n  build_task do |dep|\n    puts dep.name\n  end\nend\n\ndeployment.invoke_build_task\n# =\u003e will output the deployment name 'multi'\n```\n\n### Config Syntax\n\nIn addition to the \"DSL\" way of configuring, the `define_deployment` block will yield the config if an argument is passed. You can use this if you need to do any specific manipulation to config (is also the \"old\" syntax).\n\n```ruby\ndefine_deployment \"basic\" do |config|\n\n  config.remote     =  'remote_name'\n  config.remote_dir =  '/var/www/mailchimp.com'\n  config.local_dir  =  'build'\n\nend\n```\n\n\nTesting\n=======\n\nTests are written in rspec, and can be run with `rspec`. To run an individual test, run `rspec path/to/spec.rb`.\n\nIntegraton tests run through `localhost`, this requires that you setup ssh through localhost to run the tests. Look at [setup](#setup) for help with that.\n\n\n### Setup\n\nOn Mac OS X 10.8, you should enable remote login.\n\n```\nSystem Preferences -\u003e Sharing -\u003e Turn on Remote Login\n```\n\nAnd setup your `.ssh/config`\n\n```\nHost localhost\n  HostName localhost\n  User {{your_username}}\n```\n\nThen add your pub key to `.ssh/authorized_keys`.\n\nDepending on how you've setup your `.bashrc` is setup, you may need to move any PATH manipulation to the front of the file to prevent commands from failing.\n\n\n### Test accross multiple rubies\n\nTo run specs accross the supported rubies, run `bin/multi_ruby_rspec`\n\n\nContributing\n============\n\nIf there is any thing you'd like to contribute or fix, please:\n\n- Fork the repo\n- Add tests for any new functionality\n- Make your changes\n- Verify all existing tests work properly\n- Make a pull request\n\n\nLicense\n=======\nThe statistrano gem is distributed under the [BSD 3.0 license](/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmailchimp%2Fstatistrano","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmailchimp%2Fstatistrano","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmailchimp%2Fstatistrano/lists"}