Skip to content

Instantly share code, notes, and snippets.

@faddah
Created October 5, 2016 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save faddah/bc6ac650d879d1e4f517a821156694ea to your computer and use it in GitHub Desktop.
Save faddah/bc6ac650d879d1e4f517a821156694ea to your computer and use it in GitHub Desktop.
Capistrano *.rb file for a WordPress deployment
# The project repo name. (one word: no spaces, dashes, or underscores)
set :application, "wp_capistrano_martian" #FIXME
# Legacy from porting from drupal, best to just leave this as "default"
set :domains, ["default"]
# Set the repository type and location to deploy from.
set :scm, :git
set :repository, "git@github.com:faddah/wp_capistrano_martian.git" #FIXME
# set :scm, :subversion
# set :repository, "https://svn.example.com/svn/#{application}/trunk/"
# set(:scm_password) { Capistrano::CLI.password_prompt("SCM Password: ") }
# Set the database passwords that we'll use for maintenance. Probably only used
# during setup.
set(:db_root_pass) { Capistrano::CLI.password_prompt("Production Root MySQL password: ") }
set(:db_pass) { random_password }
# The subdirectory within the repo containing the DocumentRoot.
set :app_root, "wp_martian"
set :local_path, "/Users/yuetsu/Documents/code/web\ site\ projects/martian\ arts/martian_vm" #FIXME
# Use a remote cache to speed things up
set :deploy_via, :remote_cache
ssh_options[:user] = 'faddah' #FIXME
# Multistage support - see config/deploy/[STAGE].rb for specific configs
set :default_stage, "prod"
set :stages, %w(dev staging prod)
# Generally don't need sudo for this deploy setup
set :use_sudo, false
# This allows the sudo command to work if you do need it
default_run_options[:pty] = true
# Override these in your stage files if your web server group is something other than apache
set :httpd_group, 'apache'
#set this to where you have installed your wp site locally (http://[local_domain]/wp-admin/ should exist. )
set :local_domain, '127.0.0.1:8080/wp_martian/' #FIXME
# Set the deployment directory on the target hosts.
set :deploy_to, "/home1/faddah/public_html/wp_transfer_test/#{application}-#{stage}" #FIXME
# Use the correct branch on github. Uncomment this if you have set up seperate branches for each staging area
set :branch, "dev" #FIXME
# The hostnames to deploy to.
role :web, "140moviereview.com" #FIXME
# Specify one of the web servers to use for database backups or updates.
# This server should also be running Wordpress.
role :db, "140moviereview.com", :primary => true #FIXME
# The path to wp-cli
set :wp, "cd #{current_path}/#{app_root} ; /usr/local/bin/wp" #FIXME (Should be the full path to the wp command on your server)
# The username on the target system, if different from your local username
ssh_options[:user] = 'faddah' #FIXME
# Set the deployment directory on the target hosts.
set :deploy_to, "/home1/faddah/public_html/wp_transfer_test/#{application}-#{stage}"
# Use the correct branch on github. Uncomment this if you have set up seperate branches for each staging area
set :branch, "prod"
# The hostnames to deploy to.
role :web, "140moviereview.com"
# role :web, "#{application}-#{stage}.140moviereview.com"
# Specify one of the web servers to use for database backups or updates.
# This server should also be running Wordpress.
role :db, "#140moviereview.com", :primary => true
# role :db, "#{application}-#{stage}.140moviereview.com", :primary => true
# The path to wp-cli
set :wp, "cd #{current_path}/#{app_root} ; /usr/local/bin/wp"
# The username on the target system, if different from your local username
ssh_options[:user] = 'faddah'
# Set the deployment directory on the target hosts.
set :deploy_to, "/home/username/sites/#{application}-#{stage}"
# Use the correct branch on github. Uncomment this if you have set up seperate branches for each staging area
# set :branch, "staging"
# The hostnames to deploy to.
role :web, "#{application}-#{stage}.example.com"
# Specify one of the web servers to use for database backups or updates.
# This server should also be running Wordpress.
role :db, "#{application}-#{stage}.example.com", :primary => true
# The path to wp-cli
set :wp, "cd #{current_path}/#{app_root} ; /usr/bin/wp"
# The username on the target system, if different from your local username
ssh_options[:user] = 'username'
=======
# 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}
# 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'
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment