Skip to content

Capistrano::NetStorage Plugin for Deployment via Amazon S3

License

Notifications You must be signed in to change notification settings

DeNA/capistrano-net_storage-s3

Repository files navigation

Gem Version Test

Capistrano::NetStorage::S3

Capistrano::NetStorage::S3 is a transport plugin of Capistrano::NetStorage to deploy application via Amazon S3. And Capistrano::NetStorage is a plugin of Capistrano.

Installation

Add this line to your application's Gemfile:

gem 'capistrano-net_storage-s3', require: false

And then execute:

$ bundle

Or install it yourself as:

$ gem install capistrano-net_storage-s3

Configuration

Set Capistrano variables by set name, value.

General Settings

Name Default Description
:net_storage_transport NO DEFAULT Set Capistrano::NetStorage::S3::Transport
:net_storage_s3_bucket NO DEFAULT S3 bucket name (e.g. "your-bucket-name" )
:net_storage_s3_archives_directory "/" Directory for application archives in S3 bucket

Settings for AWS

Name Default Description
:net_storage_s3_aws_access_key_id ENV['AWS_ACCESS_KEY_ID'] AWS Access Key ID
:net_storage_s3_aws_secret_access_key ENV['AWS_SECRET_ACCESS_KEY'] AWS Secret Access Key
:net_storage_s3_aws_session_token ENV['AWS_SESSION_TOKEN'] AWS Session Token
:net_storage_s3_aws_region ENV['AWS_DEFAULT_REGION'] AWS Region
:net_storage_s3_aws_profile ENV['AWS_DEFAULT_PROFILE'] AWS Profile
:net_storage_s3_aws_config_file ENV['AWS_CONFIG_FILE'] AWS Config File

Other Settings

NOTE: We strongly recommend the defaults for integrity and performance. Change at your own risk.

Name Default Description
:net_storage_s3_max_retry 3 Max retry to download from S3 to each servers

See also the configuration section of Capistrano::NetStorage.

Usage

Edit Capfile:

# Load DSL and Setup Up Stages
require 'capistrano/setup'

# Includes default deployment tasks
require 'capistrano/deploy'

# Includes tasks from other gems included in your Gemfile
require "capistrano/net_storage/plugin"
install_plugin Capistrano::NetStorage::Plugin

# Load transport plugin for Capistrano::NetStorage
require 'capistrano/net_storage/s3'

Edit your config/deploy.rb:

set :net_storage_transport, Capistrano::NetStorage::S3::Transport
set :net_storage_config_files, Pathname('path/to/config').glob('*.yml')

# These settings upload archives to s3://bucket-for-deployment/api/#{sha1_hash}.tar.gz
set :net_storage_s3_bucket, 'bucket-for-deployment'
set :net_storage_s3_archives_directory 'api'

set :net_storage_s3_aws_config_file, '~/.aws/config'
# set :net_storage_s3_aws_profile, 'some-name' # If you are using multiple profiles

License

Available as open source under the terms of the MIT License.

Copyright (c) 2017 DeNA Co., Ltd., IKEDA Kiyoshi

About

Capistrano::NetStorage Plugin for Deployment via Amazon S3

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages