Cap Setup
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -16,6 +16,8 @@
|
||||
/tmp/*
|
||||
!/log/.keep
|
||||
!/tmp/.keep
|
||||
|
||||
/ssh
|
||||
/config/database.yml
|
||||
/config/secrets.yml
|
||||
# Ignore Byebug command history file.
|
||||
.byebug_history
|
||||
|
||||
47
Capfile
Normal file
47
Capfile
Normal file
@@ -0,0 +1,47 @@
|
||||
# Load DSL and set up stages
|
||||
require "capistrano/setup"
|
||||
|
||||
# Include default deployment tasks
|
||||
require "capistrano/deploy"
|
||||
|
||||
# Load the SCM plugin appropriate to your project:
|
||||
#
|
||||
# require "capistrano/scm/hg"
|
||||
# install_plugin Capistrano::SCM::Hg
|
||||
# or
|
||||
# require "capistrano/scm/svn"
|
||||
# install_plugin Capistrano::SCM::Svn
|
||||
# or
|
||||
require "capistrano/scm/git"
|
||||
install_plugin Capistrano::SCM::Git
|
||||
|
||||
# Include tasks from other gems included in your Gemfile
|
||||
#
|
||||
# For documentation on these, see for example:
|
||||
#
|
||||
# https://github.com/capistrano/rvm
|
||||
# https://github.com/capistrano/rbenv
|
||||
# https://github.com/capistrano/chruby
|
||||
# https://github.com/capistrano/bundler
|
||||
# https://github.com/capistrano/rails
|
||||
# https://github.com/capistrano/passenger
|
||||
#
|
||||
# require "capistrano/rvm"
|
||||
# require "capistrano/rbenv"
|
||||
# require "capistrano/chruby"
|
||||
# require "capistrano/bundler"
|
||||
# require "capistrano/rails/assets"
|
||||
# require "capistrano/rails/migrations"
|
||||
# require "capistrano/passenger"
|
||||
|
||||
require 'capistrano/rails'
|
||||
require 'capistrano/passenger'
|
||||
|
||||
require 'capistrano/rbenv'
|
||||
set :rbenv_type, :user
|
||||
set :rbenv_ruby, '2.3.3'
|
||||
|
||||
|
||||
|
||||
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
|
||||
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
|
||||
8
Gemfile
8
Gemfile
@@ -45,6 +45,12 @@ gem 'bootstrap-multiselect-rails'
|
||||
group :development, :test do
|
||||
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
||||
gem 'byebug', platform: :mri
|
||||
gem 'capistrano'
|
||||
gem 'capistrano-bundler'
|
||||
gem 'capistrano-rails'
|
||||
gem 'capistrano-rbenv'
|
||||
|
||||
|
||||
end
|
||||
|
||||
group :development do
|
||||
@@ -58,3 +64,5 @@ end
|
||||
|
||||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
||||
|
||||
|
||||
|
||||
30
Gemfile.lock
30
Gemfile.lock
@@ -38,12 +38,30 @@ GEM
|
||||
i18n (~> 0.7)
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
airbrussh (1.1.2)
|
||||
sshkit (>= 1.6.1, != 1.7.0)
|
||||
arel (7.1.4)
|
||||
bcrypt (3.1.11)
|
||||
bootstrap-multiselect-rails (0.9.9)
|
||||
rails (>= 4.0.0)
|
||||
builder (3.2.3)
|
||||
byebug (9.0.6)
|
||||
capistrano (3.7.2)
|
||||
airbrussh (>= 1.0.0)
|
||||
capistrano-harrow
|
||||
i18n
|
||||
rake (>= 10.0.0)
|
||||
sshkit (>= 1.9.0)
|
||||
capistrano-bundler (1.2.0)
|
||||
capistrano (~> 3.1)
|
||||
sshkit (~> 1.2)
|
||||
capistrano-harrow (0.5.3)
|
||||
capistrano-rails (1.2.2)
|
||||
capistrano (~> 3.1)
|
||||
capistrano-bundler (~> 1.1)
|
||||
capistrano-rbenv (2.1.0)
|
||||
capistrano (~> 3.1)
|
||||
sshkit (~> 1.3)
|
||||
coffee-rails (4.2.1)
|
||||
coffee-script (>= 2.2.0)
|
||||
railties (>= 4.0.0, < 5.2.x)
|
||||
@@ -101,6 +119,9 @@ GEM
|
||||
mini_portile2 (2.1.0)
|
||||
minitest (5.10.1)
|
||||
multi_json (1.12.1)
|
||||
net-scp (1.2.1)
|
||||
net-ssh (>= 2.6.5)
|
||||
net-ssh (4.1.0)
|
||||
nio4r (1.2.1)
|
||||
nokogiri (1.7.0.1)
|
||||
mini_portile2 (~> 2.1.0)
|
||||
@@ -161,6 +182,9 @@ GEM
|
||||
actionpack (>= 4.0)
|
||||
activesupport (>= 4.0)
|
||||
sprockets (>= 3.0.0)
|
||||
sshkit (1.12.0)
|
||||
net-scp (>= 1.1.2)
|
||||
net-ssh (>= 2.8.0)
|
||||
thor (0.19.4)
|
||||
thread_safe (0.3.5)
|
||||
tilt (2.0.5)
|
||||
@@ -190,6 +214,10 @@ DEPENDENCIES
|
||||
bcrypt (~> 3.1.7)
|
||||
bootstrap-multiselect-rails
|
||||
byebug
|
||||
capistrano
|
||||
capistrano-bundler
|
||||
capistrano-rails
|
||||
capistrano-rbenv
|
||||
coffee-rails (~> 4.2)
|
||||
devise
|
||||
devise_uid
|
||||
@@ -211,4 +239,4 @@ DEPENDENCIES
|
||||
web-console
|
||||
|
||||
BUNDLED WITH
|
||||
1.13.7
|
||||
1.14.3
|
||||
|
||||
@@ -23,4 +23,6 @@ test:
|
||||
|
||||
production:
|
||||
<<: *default
|
||||
database: db/production.sqlite3
|
||||
database: nemo
|
||||
username: deploy
|
||||
password: OU771o3ja3Hn4$r
|
||||
|
||||
61
config/deploy.rb
Normal file
61
config/deploy.rb
Normal file
@@ -0,0 +1,61 @@
|
||||
# config valid only for current version of Capistrano
|
||||
lock "3.7.2"
|
||||
|
||||
set :application, "nemo_encoder"
|
||||
set :repo_url, "git@bitbucket.org:code2lab/nemo_encoder.git"
|
||||
|
||||
|
||||
#set :branch, 'master'
|
||||
# Default deploy_to directory is /var/www/my_app_name
|
||||
set :deploy_user, 'ubuntu'
|
||||
|
||||
# setup rbenv.
|
||||
set :rbenv_type, :global
|
||||
set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec"
|
||||
set :rbenv_map_bins, %w{rake gem bundle ruby rails}
|
||||
|
||||
# how many old releases do we want to keep, not much
|
||||
set :keep_releases, 5
|
||||
|
||||
# files we want symlinking to specific entries in shared
|
||||
set :linked_files, %w{config/database.yml config/secrets.yml}
|
||||
|
||||
# dirs we want symlinking to shared
|
||||
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
|
||||
|
||||
# what specs should be run before deployment is allowed to
|
||||
# continue, see lib/capistrano/tasks/run_tests.cap
|
||||
set :tests, []
|
||||
#set :pty, true
|
||||
set :pty, true
|
||||
|
||||
|
||||
|
||||
|
||||
# Default branch is :master
|
||||
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
|
||||
|
||||
# Default deploy_to directory is /var/www/my_app_name
|
||||
# set :deploy_to, "/var/www/my_app_name"
|
||||
|
||||
# Default value for :format is :airbrussh.
|
||||
# set :format, :airbrussh
|
||||
|
||||
# You can configure the Airbrussh format using :format_options.
|
||||
# These are the defaults.
|
||||
# set :format_options, command_output: true, log_file: "log/capistrano.log", color: :auto, truncate: :auto
|
||||
|
||||
# Default value for :pty is false
|
||||
# set :pty, true
|
||||
|
||||
# Default value for :linked_files is []
|
||||
# append :linked_files, "config/database.yml", "config/secrets.yml"
|
||||
|
||||
# Default value for linked_dirs is []
|
||||
# append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "public/system"
|
||||
|
||||
# Default value for default_env is {}
|
||||
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
|
||||
|
||||
# Default value for keep_releases is 5
|
||||
# set :keep_releases, 5
|
||||
77
config/deploy/production.rb
Normal file
77
config/deploy/production.rb
Normal file
@@ -0,0 +1,77 @@
|
||||
# server-based syntax
|
||||
# ======================
|
||||
# Defines a single server with a list of roles and multiple properties.
|
||||
# You can define all roles on a single server, or split them:
|
||||
|
||||
# server "example.com", user: "deploy", roles: %w{app db web}, my_property: :my_value
|
||||
# server "example.com", user: "deploy", roles: %w{app web}, other_property: :other_value
|
||||
# server "db.example.com", user: "deploy", roles: %w{db}
|
||||
|
||||
set :stage, :production
|
||||
set :server_name, "svr.nemo.host"
|
||||
# server "example.com", user: "deploy", roles: %w{app db web}, my_property: :my_value
|
||||
# server "example.com", user: "deploy", roles: %w{app web}, other_property: :other_value
|
||||
# server "db.example.com", user: "deploy", roles: %w{db}
|
||||
set :full_app_name, "#{fetch(:application)}_#{fetch(:stage)}"
|
||||
|
||||
|
||||
server 'ec2-54-169-212-254.ap-southeast-1.compute.amazonaws.com', user: 'ubuntu', roles: %w{web app db}, primary: true
|
||||
ssh_options[:keys] = %w(ssh/nemo.pem)
|
||||
|
||||
set :deploy_to, "/home/#{fetch(:deploy_user)}/apps/#{fetch(:full_app_name)}"
|
||||
set :rbenv_ruby, '2.3.1'
|
||||
set :rails_env, :production
|
||||
|
||||
set :unicorn_worker_count, 5
|
||||
|
||||
|
||||
# role-based syntax
|
||||
# ==================
|
||||
|
||||
# Defines a role with one or multiple servers. The primary server in each
|
||||
# group is considered to be the first unless any hosts have the primary
|
||||
# property set. Specify the username and a domain or IP for the server.
|
||||
# Don't use `:all`, it's a meta role.
|
||||
|
||||
# role :app, %w{deploy@example.com}, my_property: :my_value
|
||||
# role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value
|
||||
# role :db, %w{deploy@example.com}
|
||||
|
||||
|
||||
|
||||
# Configuration
|
||||
# =============
|
||||
# You can set any configuration variable like in config/deploy.rb
|
||||
# These variables are then only loaded and set in this stage.
|
||||
# For available Capistrano configuration variables see the documentation page.
|
||||
# http://capistranorb.com/documentation/getting-started/configuration/
|
||||
# Feel free to add new variables to customise your setup.
|
||||
|
||||
|
||||
|
||||
# Custom SSH Options
|
||||
# ==================
|
||||
# You may pass any option but keep in mind that net/ssh understands a
|
||||
# limited set of options, consult the Net::SSH documentation.
|
||||
# http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start
|
||||
#
|
||||
# Global options
|
||||
# --------------
|
||||
# set :ssh_options, {
|
||||
# keys: %w(/home/rlisowski/.ssh/id_rsa),
|
||||
# forward_agent: false,
|
||||
# auth_methods: %w(password)
|
||||
# }
|
||||
#
|
||||
# The server-based syntax can be used to override options:
|
||||
# ------------------------------------
|
||||
# server "example.com",
|
||||
# user: "user_name",
|
||||
# roles: %w{web app},
|
||||
# ssh_options: {
|
||||
# user: "user_name", # overrides user setting above
|
||||
# keys: %w(/home/user_name/.ssh/id_rsa),
|
||||
# forward_agent: false,
|
||||
# auth_methods: %w(publickey password)
|
||||
# # password: "please use keys"
|
||||
# }
|
||||
Reference in New Issue
Block a user