Permalink
Browse files

Update auto deployment.

  • Loading branch information...
hbin committed May 8, 2015
1 parent def98af commit b563d6c4837c703ba38033590308a9bc959738a5
View
@@ -1,3 +1,4 @@
APP_NAME=Sample App
SERVER_NAME=sample.dev
HOST=0.0.0.0
@@ -14,3 +15,8 @@ MANDRILL_PASSWORD='mandrill_password'
# Sideqiq
SIDEKIQ_REDIS_URL=redis://localhost:6379/0
SIDEKIQ_CONCURRENCY=5
# PostgreSQL
POSTGRESQL_USERNAME=sample_app
POSTGRESQL_PASSWORD=sample_app
View
@@ -23,3 +23,4 @@
# Ignore the secrets
/.env
/.env.*
View
@@ -0,0 +1 @@
2.2.2
View
@@ -26,4 +26,4 @@ require 'capistrano/puma/monit'
require 'capistrano/puma/nginx'
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
Dir.glob('lib/capistrano/**/*.rake').each { |r| import r }
View
@@ -53,6 +53,9 @@ gem 'lograge'
gem 'sidekiq'
gem 'sinatra', require: false
# dotevn files
gem 'dotenv-rails'
group :development, :test do
gem 'rspec-rails'
gem 'rspec-its'
View
@@ -63,7 +63,7 @@ GEM
capistrano-rbenv (2.0.3)
capistrano (~> 3.1)
sshkit (~> 1.3)
capistrano3-puma (0.9.0)
capistrano3-puma (1.0.0)
capistrano (~> 3.0)
puma (>= 2.6)
capybara (2.4.4)
@@ -97,6 +97,9 @@ GEM
database_cleaner (1.4.1)
debug_inspector (0.0.2)
diff-lcs (1.2.5)
dotenv (2.0.1)
dotenv-rails (2.0.1)
dotenv (= 2.0.1)
erubis (2.7.0)
execjs (2.5.2)
factory_girl (4.5.0)
@@ -128,20 +131,20 @@ GEM
actionpack (>= 3)
activesupport (>= 3)
railties (>= 3)
loofah (2.0.1)
loofah (2.0.2)
nokogiri (>= 1.5.9)
mail (2.6.3)
mime-types (>= 1.16, < 3)
method_source (0.8.2)
mime-types (2.4.3)
mime-types (2.5)
mini_magick (4.2.3)
mini_portile (0.6.2)
minitest (5.6.0)
minitest (5.6.1)
multi_json (1.11.0)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (2.9.2)
newrelic_rpm (3.11.2.286)
newrelic_rpm (3.12.0.288)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
pg (0.18.1)
@@ -164,7 +167,7 @@ GEM
rack (>= 1.1, < 2.0)
quiet_assets (1.1.0)
railties (>= 3.1, < 5.0)
rack (1.6.0)
rack (1.6.1)
rack-protection (1.5.3)
rack
rack-test (0.6.3)
@@ -244,10 +247,10 @@ GEM
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
slop (3.6.0)
spring (1.3.4)
sprockets (3.0.2)
spring (1.3.5)
sprockets (3.0.3)
rack (~> 1.0)
sprockets-rails (2.2.4)
sprockets-rails (2.3.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
@@ -289,6 +292,7 @@ DEPENDENCIES
coffee-rails
coolline
database_cleaner
dotenv-rails
factory_girl_rails
ffaker
hirb
View
@@ -1,2 +1,2 @@
web: bundle exec rails server --binding=$HOST --port=$PORT
web: bundle exec puma -C config/puma.rb
worker: bundle exec sidekiq -C config/sidekiq.yml
View
@@ -0,0 +1,70 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "ubuntu/trusty64"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
config.vm.network "private_network", ip: "192.168.33.11"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
# config.vm.provision "shell", inline <<-SHELL
# sudo apt-get install apache2
# SHELL
end
View
@@ -15,15 +15,16 @@
# gem 'pg'
#
default: &default
adapter: sqlite3
encoding: unicode
adapter: postgresql
# For details on connection pooling, see rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: 5
username: <%= ENV['POSTGRESQL_USERNAME'] %>
password: <%= ENV['POSTGRESQL_PASSWORD'] %>
development:
<<: *default
database: db/development.sqlite3
database: sample_app_development
# The specified database role being used to connect to postgres.
# To create additional roles in postgres see `$ createuser --help`.
@@ -57,7 +58,7 @@ development:
# Do not set this db to the same as development or production.
test:
<<: *default
database: db/test.sqlite3
database: sample_app_test
# As with config/secrets.yml, you never want to store sensitive information,
# like your database password, in your source code. If your source code is
@@ -80,11 +81,5 @@ test:
#
production:
<<: *default
adapter: postgresql
database: sample_app_production
username: sample_app
password: <%= ENV['SAMPLE_APP_DATABASE_PASSWORD'] %>
staging:
<<: *default
database: db/staging.sqlite3
pool: 25
View
@@ -1,16 +1,17 @@
# config valid only for Capistrano 3.1
lock '3.2.1'
lock '3.4.0'
set :rbenv_ruby, '2.1.4'
set :rbenv_ruby, "#{File.read('.ruby-version').chomp}"
set :rbenv_type, :user
set :rbenv_map_bins, %w{rake gem bundle ruby rails}
set :application, 'sample_app'
set :repo_url, 'git@coding.net:hbin/sample_app.git'
# Default branch is :master
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call
# Default deploy_to directory is /var/www/my_app
set :deploy_to, '/home/deployer/apps'
# Puma
set :puma_threads, [0, 16]
set :puma_workers, 2
set :puma_worker_timeout, nil
set :puma_init_active_record, true
# Default value for :format is :pretty
# set :format, :pretty
@@ -22,7 +23,7 @@
set :pty, true
# Default value for :linked_files is []
set :linked_files, %w{config/secrets.yml config/database.yml config/newrelic.yml}
set :linked_files, %w{.env}
# Default value for linked_dirs is []
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets}
@@ -1,44 +1,12 @@
# 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@sample.com}
role :web, %w{deploy@sample.com}
role :db, %w{deploy@sample.com}
role :app, %w{deployer@182.92.130.226}
role :web, %w{deployer@182.92.130.226}
role :db, %w{deployer@182.92.130.226}
set :deploy_user, 'deploy'
server 'sample.com', user: 'deploy', roles: %w{web app}
set :stage, :production
set :branch, 'master'
# Extended Server Syntax
# ======================
# This can be used to drop a more detailed server definition into the
# server list. The second argument is a, or duck-types, Hash and is
# used to set extended properties on the server.
server '182.92.130.226', user: 'deployer', roles: %w{web app}
# Custom SSH Options
# ==================
# You may pass any option but keep in mind that net/ssh understands a
# limited set of options, consult[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)
# }
#
# And/or per server (overrides global)
# ------------------------------------
# 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'
# }
set :full_app_name, "#{fetch(:application)}_#{fetch(:stage)}"
set :deploy_to, "/home/#{fetch(:deploy_user)}/apps/#{fetch(:full_app_name)}"
View

This file was deleted.

Oops, something went wrong.
@@ -1,7 +1,7 @@
upstream puma_<%= fetch(:nginx_config_name) %> { <%
flags = 'fail_timeout=0'
@backends = [fetch(:puma_bind)].flatten.map do |m|
etype, address = /(tcp|unix|ssl):\/\/(.+)/.match(m).captures
etype, address = /(tcp|unix|ssl):\/{1,2}(.+)/.match(m).captures
if etype =='unix'
"server #{etype}:#{address} #{fetch(:nginx_socket_flags)};"
else
@@ -57,7 +57,7 @@ server {
rewrite ^(.*)$ /503.html break;
}
if ($request_method !~ ^(GET|HEAD|PUT|POST|DELETE|OPTIONS)$ ){
if ($request_method !~ ^(GET|HEAD|PUT|PATCH|POST|DELETE|OPTIONS)$ ){
return 405;
}
Oops, something went wrong.

0 comments on commit b563d6c

Please sign in to comment.