forked from minamarkham/sassy-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.rb
103 lines (86 loc) · 4.95 KB
/
deploy.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# This is a sample Capistrano config file for EC2 on Rails.
# It should be edited and customized.
set :application, "yourapp"
set :repository, "http://svn.foo.com/svn/#{application}/trunk"
# NOTE: for some reason Capistrano requires you to have both the public and
# the private key in the same folder, the public key should have the
# extension ".pub".
ssh_options[:keys] = ["#{ENV['HOME']}/.ssh/your-ec2-key"]
# Your EC2 instances. Use the ec2-xxx....amazonaws.com hostname, not
# any other name (in case you have your own DNS alias) or it won't
# be able to resolve to the internal IP address.
role :web, "ec2-12-xx-xx-xx.z-1.compute-1.amazonaws.com"
role :memcache, "ec2-12-xx-xx-xx.z-1.compute-1.amazonaws.com"
role :db, "ec2-56-xx-xx-xx.z-1.compute-1.amazonaws.com", :primary => true
# role :db, "ec2-56-xx-xx-xx.z-1.compute-1.amazonaws.com", :primary => true, :ebs_vol_id => 'vol-12345abc'
# optinally, you can specify Amazon's EBS volume ID if the database is persisted
# via Amazon's EBS. See the main README for more information.
# Whatever you set here will be taken set as the default RAILS_ENV value
# on the server. Your app and your hourly/daily/weekly/monthly scripts
# will run with RAILS_ENV set to this value.
set :rails_env, "production"
# EC2 on Rails config.
# NOTE: Some of these should be omitted if not needed.
set :ec2onrails_config, {
# S3 bucket and "subdir" used by the ec2onrails:db:restore task
# NOTE: this only applies if you are not using EBS
:restore_from_bucket => "your-bucket",
:restore_from_bucket_subdir => "database",
# S3 bucket and "subdir" used by the ec2onrails:db:archive task
# This does not affect the automatic backup of your MySQL db to S3, it's
# just for manually archiving a db snapshot to a different bucket if
# desired.
# NOTE: this only applies if you are not using EBS
:archive_to_bucket => "your-other-bucket",
:archive_to_bucket_subdir => "db-archive/#{Time.new.strftime('%Y-%m-%d--%H-%M-%S')}",
# Set a root password for MySQL. Run "cap ec2onrails:db:set_root_password"
# to enable this. This is optional, and after doing this the
# ec2onrails:db:drop task won't work, but be aware that MySQL accepts
# connections on the public network interface (you should block the MySQL
# port with the firewall anyway).
# If you don't care about setting the mysql root password then remove this.
:mysql_root_password => "your-mysql-root-password",
# Any extra Ubuntu packages to install if desired
# If you don't want to install extra packages then remove this.
:packages => ["logwatch", "imagemagick"],
# Any extra RubyGems to install if desired: can be "gemname" or if a
# particular version is desired "gemname -v 1.0.1"
# If you don't want to install extra rubygems then remove this
# NOTE: if you are using rails 2.1, ec2onrails calls 'sudo rake gem:install',
# which will install gems defined in your rails configuration
:rubygems => ["rmagick", "rfacebook -v 0.9.7"],
# extra security measures are taken if this is true, BUT it makes initial
# experimentation and setup a bit tricky. For example, if you do not
# have your ssh keys setup correctly, you will be locked out of your
# server after 3 attempts for upto 3 months.
:harden_server => false,
#if you want to harden the server, or setup email signing, you will need to set the domain
#if you use Capistrano's multistage extension (recommended!), you can add a line like this to your
#environment specific file:
# ec2onrails_config[:service_domain] = 'staging.mydomain.com'
:service_domain => nil,
# Set the server timezone. run "cap -e ec2onrails:server:set_timezone" for
# details
:timezone => "UTC",
# Files to deploy to the server (they'll be owned by root). It's intended
# mainly for customized config files for new packages installed via the
# ec2onrails:server:install_packages task. Subdirectories and files inside
# here will be placed in the same structure relative to the root of the
# server's filesystem.
# If you don't need to deploy customized config files to the server then
# remove this.
:server_config_files_root => "../server_configs",
# If config files are deployed, some services might need to be restarted.
# If you don't need to deploy customized config files to the server then
# remove this.
:services_to_restart => %w(postfix sysklogd),
# Set an email address to forward admin mail messages to. If you don't
# want to receive mail from the server (e.g. monit alert messages) then
# remove this.
:mail_forward_address => "[email protected]",
# Set this if you want SSL to be enabled on the web server. The SSL cert
# and key files need to exist on the server, The cert file should be in
# /etc/ssl/certs/default.pem and the key file should be in
# /etc/ssl/private/default.key (see :server_config_files_root).
:enable_ssl => true
}