No commit activity in last 3 years
No release in over 3 years
Capistrano setup for Panter Rails Hosting
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
 Project Readme

Panter Rails Deploy

Gem Version Build Status Dependency Status

This gem sets up everything you need to deploy your application on the Panter Rails hosting:

How to use

  • Add to your Gemfile (globally, not in a group):

    gem 'panter-rails-deploy'

    Note: Also remove these gems if already present:

    • unicorn, unicorn-rails
    • dotenv, dotenv-rails
    • capistrano, capistrano-ext, capistrano-rails, capistrano-bundler, capistrano-rbenv
    • therubyracer
    • mini_racer
  • Capify your project (bundle exec is required here, unless you use rbenv-binstubs):

    bundle exec cap install
  • Load the gem in your Capfile with one of these lines:

    For a standard Rails project with asset compilation:

    require 'panter-rails-deploy'

    For a Rails project that doesn't use asset compilation:

    require 'panter-rails-deploy/without-assets'

    For other Rack applications:

    require 'panter-rails-deploy/without-rails'
  • Set :application and :repo_url in config/deploy.rb (note that in previous Capistrano versions it was called :repository instead)

  • Set up your stages in config/deploy folder (e.g. config/deploy/production.rb):

    server 'my-server.example.com', roles: %w[ web app db ]
    set :branch, 'master'
    set :rails_env, 'staging' # 'production' by default for all stages
  • Profit:

    bundle exec cap production deploy

dotenv setup

Using dotenv is the recommended approach to store sensitive configuration in the environment instead of code repositories.

  • Add a file on your servers in /home/app/app/shared/.env with your keys:

    RAILS_SECRET_KEY_BASE: 89d20f0...
    • You can add any other key-value pairs, they'll simply be injected into ENV
    • You can use rake secret / rails secret (Rails 5) to generate a new secure key
    • Rails uses SECRET_KEY_BASE by default, but adding a RAILS_ prefix is recommended since dotenv itself is framework-agnostic
  • If you need keys in development as well, add .env locally and add it to .gitignore

  • Replace your keys in config/secrets.yml and other places with references to ENV:

    production:
      secret_key_base: <%= ENV["RAILS_SECRET_KEY_BASE"] %>
  • Update config/deploy.rb to symlink the .env file during deploy:

    append :linked_files, '.env'