forked from adamwiggins/scanty
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provisioning with vagrant, capistrano and ansible just works
- Loading branch information
1 parent
ff6b30d
commit 52e0d5e
Showing
15 changed files
with
189 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ blog.db | |
capybara* | ||
coverage/ | ||
.env | ||
provisioning/vars/defaults.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Load DSL and Setup Up Stages | ||
require 'capistrano/setup' | ||
|
||
# Includes default deployment tasks | ||
require 'capistrano/deploy' | ||
|
||
require 'capistrano/bundler' | ||
|
||
|
||
# Includes 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 | ||
# | ||
# require 'capistrano/rvm' | ||
# require 'capistrano/rbenv' | ||
# require 'capistrano/chruby' | ||
# require 'capistrano/bundler' | ||
# require 'capistrano/rails/assets' | ||
# require 'capistrano/rails/migrations' | ||
|
||
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined. | ||
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
set :application, 'emmanueldelgado.me' | ||
set :repo_url, 'git@github.com:chischaschos/scanty.git' | ||
set :deploy_to, '/data/site' | ||
set :log_level, :debug | ||
set :linked_files, %w{config/database.yml} | ||
set :linked_dirs, %w{tmp/sockets log config/puma public/spree} | ||
set :sockets_path, Pathname.new("#{fetch(:deploy_to)}/shared/tmp/sockets/") | ||
|
||
# These puma settings are only here because capistrano-puma is borked. | ||
# See issue #4. | ||
set :puma_roles, :app | ||
set :puma_socket, "unix://#{fetch(:sockets_path).join('puma_' + fetch(:application) + '.sock')}" | ||
set :pumactl_socket, "unix://#{fetch(:sockets_path).join('pumactl_' + fetch(:application) + '.sock')}" | ||
set :puma_state, fetch(:sockets_path).join('puma.state') | ||
set :puma_log, -> { shared_path.join("log/puma-#{fetch(:stage )}.log") } | ||
set :puma_flags, nil | ||
|
||
set :bundle_flags, '--deployment' | ||
|
||
namespace :deploy do | ||
task :restart do | ||
invoke 'puma:restart' | ||
end | ||
end | ||
|
||
namespace :spree_sample do | ||
task :load do | ||
on roles(:app) do | ||
within release_path do | ||
ask(:confirm, "Are you sure you want to delete everything and start again? Type 'yes'") | ||
if fetch(:confirm) == "yes" | ||
execute :rake, "db:reset AUTO_ACCEPT=true" | ||
execute :rake, "spree_sample:load" | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
namespace :puma do | ||
desc "Restart puma instance for this application" | ||
task :restart do | ||
on roles fetch(:puma_roles) do | ||
within release_path do | ||
execute :bundle, "exec pumactl -S #{fetch(:puma_state)} restart" | ||
end | ||
end | ||
end | ||
|
||
desc "Show status of puma for this application" | ||
task :status do | ||
on roles fetch(:puma_roles) do | ||
within release_path do | ||
execute :bundle, "exec pumactl -S #{fetch(:puma_state)} stats" | ||
end | ||
end | ||
end | ||
|
||
desc "Show status of puma for all applications" | ||
task :overview do | ||
on roles fetch(:puma_roles) do | ||
within release_path do | ||
execute :bundle, "exec puma status" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Simple Role Syntax | ||
# ================== | ||
# Supports bulk-adding hosts to roles, the primary | ||
# server in each group is considered to be the first | ||
# unless any hosts have the primary property set. | ||
# Don't declare `role :all`, it's a meta role | ||
role :app, %w{deploy@example.com} | ||
role :web, %w{deploy@example.com} | ||
role :db, %w{deploy@example.com} | ||
|
||
# Extended Server Syntax | ||
# ====================== | ||
# This can be used to drop a more detailed server | ||
# definition into the server list. The second argument | ||
# something that quacks like a hash can be used to set | ||
# extended properties on the server. | ||
server 'example.com', user: 'deploy', roles: %w{web app}, my_property: :my_value | ||
|
||
# you can set custom ssh options | ||
# it's possible to pass any option but you need to keep in mind that net/ssh understand limited list of options | ||
# you can see them in [net/ssh documentation](http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start) | ||
# set it globally | ||
# set :ssh_options, { | ||
# keys: %w(/home/rlisowski/.ssh/id_rsa), | ||
# forward_agent: false, | ||
# auth_methods: %w(password) | ||
# } | ||
# and/or per server | ||
# 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' | ||
# } | ||
# setting per server overrides global ssh_options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
server '127.0.0.1', | ||
user: 'deploy', | ||
roles: %w{app} | ||
|
||
set :ssh_options, { | ||
forward_agent: true, | ||
port: 2222, | ||
#keys: %w(/some/place/private_key), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
provisioning/roles/webserver/templates/data_site_shared_config_env.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
DATABASE_URL=postgres://deploy:deploy@localhost:5432/app_emmanueldelgado.me | ||
BLOG_PASSWD=123 | ||
COOKIE_KEY=123 | ||
COOKIE_VALUE=123 | ||
DISQUS_SHORTNAME=123 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
--- | ||
- hosts: all | ||
sudo: yes | ||
|
||
vars_files: | ||
- vars/defaults.yml | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
## webapp | ||
webserver_name: emmanueldelgado.me | ||
deploy_directory: /data/site | ||
app_name: emmanueldelgado.me | ||
|
||
## stolen from https://github.com/jgrowl/ansible-playbook-ruby-from-src | ||
rubyTmpDir: /usr/local/src | ||
rubyUrl: http://cache.ruby-lang.org/pub/ruby/ruby-1.9.3-p545.tar.gz | ||
rubyCompressedFile: ruby-1.9.3-p545.tar.gz | ||
rubyName: ruby-1.9.3-p545 | ||
tmpRubyPath: "{{rubyTmpDir}}/{{rubyName}}" | ||
|
||
## deploy | ||
deploy_public_key: /your/deploy/public_key |