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
def my_task | |
while(true) do | |
begin | |
database_access_here | |
rescue Exception => ex | |
begin | |
ActiveRecord::Base.connection.reconnect! | |
rescue | |
sleep 10 | |
retry # will retry the reconnect |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
config.vm.define :web do |web_config| | |
web_config.vm.box = "precise64" | |
web_config.vm.box_url = "http://files.vagrantup.com/precise64.box" | |
web_config.vm.network :private_network, ip: "33.33.33.33" | |
web_config.vm.network :forwarded_port, guest: 80, host: 8080 |
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
--- | |
- hosts: webservers | |
user: vagrant | |
sudo: True | |
vars_files: | |
- vars.yml | |
vars: | |
deploy: deploy | |
home_dir: /home/deploy |
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
--- | |
app_name: <APP_NAME> | |
# created with: | |
# python -c 'import crypt; print crypt.crypt("<PASS>", "SomeSaltedValue")' | |
password: SosJkZOQixRak | |
mysql_root_password: <PASS> | |
home_dir: "/home/deploy" | |
repo: <PATH_TO_REPO> | |
project_ruby: 2.0.0-p353 |
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
- hosts: webservers | |
user: vagrant | |
sudo: True | |
vars_files: | |
- vars.yml | |
vars: | |
deploy: deploy | |
home_dir: /home/deploy | |
tasks: |
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
- hosts: webservers | |
user: vagrant | |
vars_files: | |
- vars.yml | |
tasks: | |
- name: Download ruby | |
get_url: "url={{ruby_url}} dest={{ruby_dir}}/ruby-{{ project_ruby }}.tar" | |
- name: Extract ruby |
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
- hosts: webservers | |
user: deploy | |
vars_files: | |
- vars.yml | |
tasks: | |
- name: Make directory for database.yml | |
shell: mkdir -p {{home_dir}}/rails/narui/shared/config | |
- name: Copy database.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
set :application, '<APP_NAME>' | |
set :repo_url, "<git@PATH/REPO.git>" | |
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp } | |
set :deploy_to, "/home/deploy/rails/<APP_NAME>" | |
# set :scm, :git | |
set :format, :pretty | |
set :log_level, :debug |
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
- hosts: webservers | |
user: vagrant | |
sudo: true | |
vars_files: | |
- vars.yml | |
tasks: | |
- name: Install MySQL | |
action: apt pkg=$item state=installed | |
with_items: |
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
set :stage, :production | |
# 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. | |
role :app, %w{deploy@33.33.33.33} | |
role :web, %w{deploy@33.33.33.33} | |
role :db, %w{deploy@33.33.33.33} |
OlderNewer