KISO Themes is easily deployable. It works out of the box on Heroku (as long as you remember to set your credentials as described on the Installation page).


There is some slight tweaking you'll have to do to your deploy.rb to have Capistrano tell bundler how to set your credentials on the machine you're deploying to. This step takes the form of calling bundler config <your_credentials> before Capistrano executes the bundler:install hook.
In your deploy.rb you'll want to create a task for setting up the execution:
namespace :deploy do
  task :prepare_bundle_config do

    # Potentially change the role here to whatever is suitable for you
    on roles(:app) do

      # This command is using an rbenv Cap variable which was set like this:
      # set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec"
      # But your circumstance may be different, so configure accordingly
      execute "#{fetch :rbenv_prefix} bundle config #{ENV['KISO_CREDENTIALS']}"
In the example above we are using best practices by pulling the credentials from an Environment variable as opposed to creating a security concern by simply pasting in the credentials.
Next, you want to hook onto the bundler:install Capistrano hook:
namespace :deploy do
  before 'bundler:install', 'deploy:prepare_bundle_config'
When you attempt a deploy, you should see in the deploy logs that Capistrano executes the prepare_bundler_config task before running bunlder:install - thus setting your credentials on your deploy machine.


If you're using Heroku, you need to set a special Environment variable as well, by running this on the command line:
If you're using Review Apps, make sure to read the Heroku documentation on inheriting config vars and ensure that you setup the BUNDLE_GEMS__KISO__IO environment variable is required.

#Inside Docker Containers

In order for Bundler to be able to access the private Gem server, you'll have to let it know what you're credentials are. This is achieved much in the same way as a Heroku deploy: you use Bundler's ability to be configured via environment variables, specifically BUNDLE_GEMS__KISO__IO
The preferred method would be:
  1. Add your Kiso authentication token to an .env file in your project root, that is not checked in to Git and is in .gitignore to prevent accidental credential leakage.
  2. Configure docker-compose.yml to reference the environment variable in the .env file as a value to be used for a named argument used in the build configuration.
  3. Configure the Dockerfile to accept the argument and inject that value into a final ENV declaration for BUNDLE_GEMS__KISO__IO.
Note: If you're not using Docker Compose, then you would just pass the argument with the Kiso docker when running docker build
Here's an example:
  1. The .env file should contain an entry like so:
  1. Then in your docker-compose.yml you would specify the argument and reference an environment variable in an environment file as its value. The following example assumes your docker-compose.yml file lives in your project root, along with an .env file which holds your environment variables that you wish to keep secret (and should be in your .gitignore to prevent accidental credential leakage in your Git history).
    env_file: .env
  1. This environment variable needs to be set during the container build phase so that Bundler can access it when bundling your project gems, so you'll need to add it as an argument that is used in your Dockerfile to set the environment variable that Bundler expects: