The puma-redeploy gem is a puma plugin that allows you to redeploy a new version of your Ruby application in a container without a full container deploy.
- Encourages the separation of the build process from deployment
- Runtime container does not include application code
- Leverages Puma phased-restart to ensure uptime deploy
- Deploys in seconds
- Pluggable handlers to detect redeploy (File, S3, Artifactory, etc..)
Note - Currently there are File and S3 handlers for loading archives.
Example application can be found here
Also see the sidekiq-redeploy gem.
Add this line to your application's Gemfile:
And then execute:
$ bundle install
Or install it yourself as:
$ gem install puma-redeploy
config/puma.rb config file with the following
# Add the puma-redeploy plugin plugin :redeploy # Specify the redeploy watch file from an environment variable. This can a file system location or S3 URL. For example `/app/pkg/watch.me` or `s3://puma-test-app-archives/watch.me`. redeploy_watch_file ENV['WATCH_FILE'] # Specify the number of seconds between checking watch file. Defaults to 30. redeploy_watch_delay 15
The watch file must contain the path to the current archive. This can be a file path or S3 URL.
For example when using a file:
For example when using S3:
archive-loader is a cli used to fetch and deploy the application archive prior to starting the puma server. This is useful when the application code does not exist in the runtime container.
archive-loader Usage: archive-loader [options]. Used to load the archive prior to starting the puma app server. -a, --app-dir=DIR [Required] Location of application directory within the container. -w, --watch=WATCH [Required] Location of watch file (file or s3 location). -h, --help Prints this help
For example this will fetch and unzip the application archive and then start puma.
archive-loader -a /app -w /app/pkg/watch.me && bundle exec puma -C config/puma.rb
After checking out the repo, run
bundle to install dependencies. Then, run
rake spec to run the tests and
rake rubocop to check for rubocop offences.
To install this gem onto your local machine, run the following. Note - You must add any new files to git first.
bundle exec rake install puma-redeploy 0.1.0 built to pkg/puma-redeploy-0.1.0.gem. puma-redeploy (0.1.0) installed.
To release a new version, update the version number in
version.rb, and then run
bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the
.gem file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/puma-redeploy. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the Puma::Redeploy project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.