cl-mina 0.1.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +83 -1
- data/cl-mina.gemspec +0 -1
- data/lib/cl_mina/tasks/all.rb +2 -0
- data/lib/cl_mina/tasks/check.rb +2 -0
- data/lib/cl_mina/tasks/clouddb.rb +18 -0
- data/lib/cl_mina/tasks/log.rb +5 -5
- data/lib/cl_mina/tasks/sidekiq.rb +28 -0
- data/lib/cl_mina/tasks/utility.rb +2 -8
- data/lib/cl_mina/templates/clouddb.yml.erb +9 -0
- data/lib/cl_mina/templates/logrotate.erb +1 -0
- data/lib/cl_mina/templates/unicorn.rb.erb +2 -0
- data/lib/cl_mina/version.rb +1 -1
- data/lib/generators/cl_mina/install_generator.rb +4 -0
- data/lib/generators/templates/defaults.rb +9 -0
- data/lib/generators/templates/deploy.rb +76 -5
- data/lib/generators/templates/production.rb +35 -0
- data/lib/generators/templates/staging.rb +37 -0
- metadata +6 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 412ef0bb993ac60314015c3888243284ee29daf1
|
4
|
+
data.tar.gz: f4f06e24d646e0c998874cac2d1531346d4f8a2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41c9ecd1a50f1f58bee90ff287f03f58b6bb3d2c8c4ad7185e20861dd0f8541078e584bd6567b02784cdd0572cfd1fd53ae7097f8e358693cdbfb8dd2ade74ea
|
7
|
+
data.tar.gz: af3599738061a9c7c581e713869422924b36ef912e05dd69bbfa497db521a608c3dbd795bad7b85288ad5e8e9afaa4141412967c2586a1c17617a320a4e7e05d
|
data/README.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# What is mina?
|
2
|
+
|
3
|
+
Mina is a gem that allows you to easily write rake tasks to automate deployment tasks. Mina works by generating bash scripts that it then runs on a remote server. This gem includes tasks to configure and deploy to servers with nginx
|
4
|
+
|
1
5
|
# How to use
|
2
6
|
|
3
7
|
1. Add to Gemfile: `gem "cl-mina"`
|
@@ -5,4 +9,82 @@
|
|
5
9
|
3. ???
|
6
10
|
4. Profit
|
7
11
|
|
8
|
-
|
12
|
+
In addition to the documentation here, `config/deploy.rb`, `config/deploy/production.rb`, and `config/deploy/staging.rb` are reasonably well-documented.
|
13
|
+
|
14
|
+
# Install
|
15
|
+
|
16
|
+
## Run generator
|
17
|
+
|
18
|
+
To create the necessary files to run the cl-mina tasks, run `rails generate cl-mina:install`. The install generator creates several files:
|
19
|
+
1. `config/deploy.rb` contains application-specific configuration for all environments as well as the basic deploy script.
|
20
|
+
2. `config/deploy/defaults.rb` contains defaults for configuration variables. Most of the time you won't need to modify this. This task is called by the specific environment tasks, and it will only set variables that have not been set for the environment.
|
21
|
+
3. `config/deploy/staging.rb`, `config/deploy/production.rb` contain configuration variables that are likely to be different for staging and production environments.
|
22
|
+
4. `config/environments/staging.rb` is a base environment configuration for a staging environment since Rails does not include one by default. Generally you will want to keep yours if you already have one.
|
23
|
+
|
24
|
+
## Customize configuration
|
25
|
+
|
26
|
+
For most applications, you'll want to edit three files. All the documentation you need should be in the files themselves.
|
27
|
+
1. `config/deploy.rb`
|
28
|
+
2. `config/deploy/production.rb`
|
29
|
+
3. `config/deploy/staging.rb`
|
30
|
+
|
31
|
+
# Tasks
|
32
|
+
|
33
|
+
To list all available tasks with descriptions, `mina tasks`.
|
34
|
+
|
35
|
+
To run a task, `mina namespace:task to={server}`. So for example, to deploy to production, you would execute `mina deploy to=production`. The default server is set in `config/deploy.rb`. It's a good idea to have the default set to staging to force yourself to be intentional in deploying to production. But that's up to you.
|
36
|
+
|
37
|
+
All of the tasks are in `lib/cl-mina/tasks`, so if you want to see what exactly a task is doing, look there.
|
38
|
+
|
39
|
+
Tasks are listed here by namespace. E.g., to set up a postgresql db and configuration, you'd execute `mina postgresql:setup` (or `mina postgresql:setup to=production` for production server).
|
40
|
+
|
41
|
+
## Variables
|
42
|
+
|
43
|
+
Tasks use variables set in the files in the `config/deploy/` directory. `config/deploy/defaults.rb` includes default variables for all servers/environments, and `config/deploy/production.rb` or `config/deploy/staging.rb` include values specific to the server/environment. If you want to change a variable, you should almost always do so in one of the files in the `config/deploy/` directory.
|
44
|
+
|
45
|
+
## Task descriptions by namespace
|
46
|
+
|
47
|
+
### db
|
48
|
+
|
49
|
+
`db:seed`
|
50
|
+
**Run rake db:seed.**
|
51
|
+
|
52
|
+
### log
|
53
|
+
|
54
|
+
`log:rails`, `log:unicorn`, `log:sidekiq`, `log:nginx`, `log:nginx_access`
|
55
|
+
**Display tail of log.** Gets log locations from variables. Number of lines shown determined by `log_tail` variable (default 50).
|
56
|
+
|
57
|
+
### logrotate
|
58
|
+
|
59
|
+
`logrotate:setup`
|
60
|
+
**Sets up logrotate.** I bet you'd never have guessed that.
|
61
|
+
|
62
|
+
### nginx
|
63
|
+
|
64
|
+
`nginx:setup`
|
65
|
+
**Creates nginx configuration and init script.** Overwrites any existing configuration and restarts nginx.
|
66
|
+
|
67
|
+
`nginx:remove`
|
68
|
+
**Removes nginx configuration.** Removes config from `/etc/nginx/sites-enabled`, restarts nginx.
|
69
|
+
|
70
|
+
`nginx:start`, `nginx:stop`, `nginx:restart`
|
71
|
+
**Start, stop, or restart nginx.**
|
72
|
+
|
73
|
+
### postgresql
|
74
|
+
|
75
|
+
`postgresql:setup`
|
76
|
+
**Creates user and database along with matching database.yml file**. Asks for password, uses it for database user and database.yml template. If user or database already exists, the existing database/user is unchanged. Among other things, this means that if you run this after a user has been created, make sure you enter the same password, or the password in your database.yml file will not match the password of your db user. This is a bug, and it'll be fixed...eventually.
|
77
|
+
|
78
|
+
`postgresql:create_user`
|
79
|
+
**Prompts for password, creates postgresql user with that password**. Generally, you should just run the :setup command above rather than running this directly. The username is determined by `postgresql_user` and by default is the the application name.
|
80
|
+
|
81
|
+
`postgresql:create_database`
|
82
|
+
**Creates a database for the application.** As with :create_user, you should usually just use the :setup command instead of using this directly. The database name is determined by `postgresql_user` and is by default the application name along with the server name, e.g. "your_app_production".
|
83
|
+
|
84
|
+
### unicorn
|
85
|
+
|
86
|
+
`unicorn:setup`
|
87
|
+
**Create unicorn config and init script.**
|
88
|
+
|
89
|
+
`unicorn:start`, `unicorn:stop`, `unicorn:restart`
|
90
|
+
**Start, stop, restart unicorn.**
|
data/cl-mina.gemspec
CHANGED
@@ -24,7 +24,6 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "generator_spec"
|
25
25
|
|
26
26
|
spec.add_runtime_dependency "mina"
|
27
|
-
spec.add_runtime_dependency "pg"
|
28
27
|
spec.add_runtime_dependency "unicorn"
|
29
28
|
spec.add_runtime_dependency "carrier-pigeon"
|
30
29
|
spec.add_runtime_dependency "highline"
|
data/lib/cl_mina/tasks/all.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
require 'cl_mina/tasks/check'
|
2
|
+
require 'cl_mina/tasks/clouddb'
|
2
3
|
require 'cl_mina/tasks/db'
|
3
4
|
require 'cl_mina/tasks/irc'
|
4
5
|
require 'cl_mina/tasks/log'
|
5
6
|
require 'cl_mina/tasks/logrotate'
|
6
7
|
require 'cl_mina/tasks/nginx'
|
7
8
|
require 'cl_mina/tasks/postgresql'
|
9
|
+
require 'cl_mina/tasks/sidekiq'
|
8
10
|
require 'cl_mina/tasks/unicorn'
|
9
11
|
require 'cl_mina/tasks/utility'
|
data/lib/cl_mina/tasks/check.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
require "highline/import"
|
2
|
+
|
3
|
+
namespace :clouddb do
|
4
|
+
desc "Generate the database.yml configuration file"
|
5
|
+
task :setup do
|
6
|
+
get_clouddb_password
|
7
|
+
template "clouddb.yml.erb", "#{config_path}/database.yml"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def get_clouddb_password
|
12
|
+
if !clouddb_password
|
13
|
+
pw = ask "Database password: " do |p|
|
14
|
+
p.echo = '*'
|
15
|
+
end
|
16
|
+
set :clouddb_password, pw
|
17
|
+
end
|
18
|
+
end
|
data/lib/cl_mina/tasks/log.rb
CHANGED
@@ -1,26 +1,26 @@
|
|
1
1
|
namespace :log do
|
2
2
|
desc "View tail of rails log"
|
3
3
|
task :rails do
|
4
|
-
queue "tail #{logs_path}/#{rails_env}.log -n
|
4
|
+
queue "tail #{logs_path}/#{rails_env}.log -n #{log_tail}"
|
5
5
|
end
|
6
6
|
|
7
7
|
desc "View tail of unicorn log"
|
8
8
|
task :unicorn do
|
9
|
-
queue "tail #{unicorn_log} -n
|
9
|
+
queue "tail #{unicorn_log} -n #{log_tail}"
|
10
10
|
end
|
11
11
|
|
12
12
|
desc "View tail of sidekiq log"
|
13
13
|
task :sidekiq do
|
14
|
-
queue "tail #{
|
14
|
+
queue "tail #{sidekiq_log} -n #{log_tail}"
|
15
15
|
end
|
16
16
|
|
17
17
|
desc "View tail of nginx error log"
|
18
18
|
task :nginx do
|
19
|
-
queue "tail /var/log/nginx/error.log -n
|
19
|
+
queue "tail /var/log/nginx/error.log -n #{log_tail}"
|
20
20
|
end
|
21
21
|
|
22
22
|
desc "View tail of nginx access log"
|
23
23
|
task :nginx_access do
|
24
|
-
queue "tail /var/log/nginx/access.log -n
|
24
|
+
queue "tail /var/log/nginx/access.log -n #{log_tail}"
|
25
25
|
end
|
26
26
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
namespace :sidekiq do
|
2
|
+
desc "Start sidekiq"
|
3
|
+
task :start do
|
4
|
+
queue %{cd #{deploy_to}/#{current_path}}
|
5
|
+
|
6
|
+
queue %{echo "-----> Start sidekiq"}
|
7
|
+
queue echo_cmd "bundle exec sidekiq -d -c #{sidekiq_concurrency} -e #{rails_env} -L #{sidekiq_log} -P #{sidekiq_pid}"
|
8
|
+
end
|
9
|
+
|
10
|
+
desc "Quiet sidekiq"
|
11
|
+
task :quiet do
|
12
|
+
queue %{cd #{deploy_to}/#{current_path}}
|
13
|
+
queue echo_cmd "bundle exec sidekiqctl quiet #{sidekiq_pid}"
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "Stop sidekiq"
|
17
|
+
task :stop do
|
18
|
+
queue %{cd #{deploy_to}/#{current_path}}
|
19
|
+
queue echo_cmd "bundle exec sidekiqctl stop #{sidekiq_pid} 60"
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "Restart sidekiq"
|
23
|
+
task :restart do
|
24
|
+
queue %{cd #{deploy_to}/#{current_path}}
|
25
|
+
invoke :'sidekiq:stop'
|
26
|
+
invoke :'sidekiq:start'
|
27
|
+
end
|
28
|
+
end
|
@@ -1,18 +1,12 @@
|
|
1
1
|
task :setup do
|
2
|
-
invoke :'postgresql:setup'
|
2
|
+
invoke :'postgresql:setup' if setup_postgresql
|
3
|
+
invoke :'clouddb:setup' if setup_clouddb
|
3
4
|
invoke :'nginx:setup'
|
4
5
|
invoke :'unicorn:setup'
|
5
6
|
invoke :'logrotate:setup'
|
6
7
|
invoke :create_extra_paths
|
7
8
|
end
|
8
9
|
|
9
|
-
task :echo_config do
|
10
|
-
queue %{echo #{rails_env}}
|
11
|
-
queue %{echo #{deploy_to}}
|
12
|
-
queue %{echo #{shared_path}}
|
13
|
-
queue %{echo #{shared_paths.first}}
|
14
|
-
end
|
15
|
-
|
16
10
|
task :create_extra_paths do
|
17
11
|
queue 'echo "-----> Create configs path"'
|
18
12
|
queue echo_cmd "mkdir -p #{config_path}"
|
data/lib/cl_mina/version.rb
CHANGED
@@ -9,6 +9,7 @@ task :defaults do
|
|
9
9
|
set_default :shared_paths, ['tmp', 'log', 'public/uploads', 'config/database.yml']
|
10
10
|
set_default :branch, 'staging'
|
11
11
|
set_default :deploy_to, "/home/#{user}/#{application}/#{deploy_server}"
|
12
|
+
set_default :log_tail, 50
|
12
13
|
|
13
14
|
set_default :sockets_path, "#{deploy_to}/#{shared_path}/tmp/sockets"
|
14
15
|
set_default :pids_path, "#{deploy_to}/#{shared_path}/tmp/pids"
|
@@ -26,13 +27,21 @@ task :defaults do
|
|
26
27
|
set_default :sidekiq_log, "#{logs_path}/sidekiq.log"
|
27
28
|
set_default :sidekiq_pid, "#{pids_path}/sidekiq.pid"
|
28
29
|
set_default :sidekiq_script, "/etc/init/sidekiq_#{application}_#{deploy_server}.conf"
|
30
|
+
set_default :sidekiq_concurrency, 5
|
29
31
|
|
30
32
|
set_default :nginx_config, "#{nginx_path}/sites-enabled/#{application}_#{deploy_server}"
|
31
33
|
set_default :nginx_log_path, "#{deploy_to}/#{shared_path}/log/nginx"
|
32
34
|
set_default :nginx_server_name, domain || server_ip
|
33
35
|
|
36
|
+
set_default :setup_postgresql, true
|
34
37
|
set_default :postgresql_host, "localhost"
|
35
38
|
set_default :postgresql_user, application
|
36
39
|
set_default :postgresql_database, "#{application}_#{deploy_server}"
|
37
40
|
set_default :postgresql_pid, "/var/run/postgresql/9.1-main.pid"
|
41
|
+
|
42
|
+
set_default :setup_clouddb, false
|
43
|
+
set_default :clouddb_host, 'localhost'
|
44
|
+
set_default :clouddb_adapter, 'mysql2'
|
45
|
+
set_default :clouddb_database, "#{application}_#{rails_env}"
|
46
|
+
set_default :clouddb_user, application
|
38
47
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
###########################################################################
|
2
|
-
|
3
2
|
#### Setup ####
|
4
|
-
# 1. Set
|
3
|
+
# 1. Set common settings for all servers in this file
|
5
4
|
# 2. Set environment-specific settings in config/deploy/staging.rb and config/deploy/production.rb
|
6
5
|
# 3. Verify defaults in config/deploy/defaults.rb
|
7
6
|
|
@@ -12,14 +11,18 @@
|
|
12
11
|
# mina setup to=staging
|
13
12
|
# mina nginx:setup to=production
|
14
13
|
# mina log:rails to=production
|
14
|
+
# mina deploy
|
15
15
|
###########################################################################
|
16
16
|
|
17
|
+
# Include built-in mina tasks
|
17
18
|
require 'mina/bundler'
|
18
19
|
require 'mina/rails'
|
19
20
|
require 'mina/git'
|
20
21
|
|
22
|
+
# Load default configuration from deploy/defaults
|
21
23
|
load 'config/deploy/defaults.rb'
|
22
24
|
|
25
|
+
# Load all tasks in cl-mina gem
|
23
26
|
require 'cl_mina/tasks/all'
|
24
27
|
|
25
28
|
# Load environments from config/deploy
|
@@ -29,35 +32,103 @@ Dir['config/deploy/*.rb'].each { |f| load f }
|
|
29
32
|
# Common settings for all servers
|
30
33
|
###########################################################################
|
31
34
|
|
35
|
+
# application
|
36
|
+
# The...unix-safe name of the application.
|
37
|
+
# It will be used when generating directories, files, usernames, etc.
|
38
|
+
# Guidelines for naming:
|
39
|
+
# - No spaces. Things will break.
|
40
|
+
# - For the sake of standardization, go for all lowercase unless you have a
|
41
|
+
# really good reason not to.
|
32
42
|
set :application, "your_app"
|
43
|
+
|
44
|
+
# application_name
|
45
|
+
# The name of the application.
|
46
|
+
# This is used any time a script broadcasts messages, like upon deployment.
|
47
|
+
# Spaces are fine, even encouraged, here.
|
33
48
|
set :application_name, "Human Name for Your App"
|
49
|
+
|
50
|
+
# domain_name
|
51
|
+
# The domain name where the application will live.
|
52
|
+
# Use the generic domain name that will apply across environments.
|
53
|
+
# You can customize it for specific environments in environment-specific configuration.
|
34
54
|
set :domain_name, "example.com"
|
55
|
+
|
56
|
+
# keep_releases
|
57
|
+
# Number of releases to keep when deploying.
|
58
|
+
# If there are more releases than this on the server, the oldest will be deleted.
|
59
|
+
# TODO: actually implement this.
|
35
60
|
set :keep_releases, 5
|
36
|
-
|
61
|
+
|
62
|
+
# respository
|
63
|
+
# The repository where the application lives.
|
64
|
+
# Only supports git.
|
65
|
+
# When you deploy, the server will pull from this repository to create a new release.
|
66
|
+
# SSH agent forwarding is enabled by default, so the server will use the key
|
67
|
+
# you're using to ssh into the server to fetch the respository. If your key works
|
68
|
+
# when using the git server directly but not when you're deploying, it's probably
|
69
|
+
# an ssh-agent issue. Github has pretty good documentation about that.
|
70
|
+
set :repository, "user@git.example.com:your-app.git"
|
71
|
+
|
72
|
+
# default_server
|
73
|
+
# The server to run a task on if one is not specified.
|
74
|
+
# If you don't specify a server with to=whatever, this is the server where the task(s)
|
75
|
+
# will run. Change to production at your own risk.
|
37
76
|
set :default_server, "staging"
|
38
77
|
|
39
|
-
|
78
|
+
##### IRC options #####
|
79
|
+
# If you want to use IRC, set these.
|
80
|
+
|
81
|
+
# send_irc_messages
|
82
|
+
# Whether to send irc announcements.
|
83
|
+
# If you set this to false, you can ignore the other irc settings.
|
40
84
|
set :send_irc_messages, true
|
85
|
+
|
86
|
+
# irc_uri
|
87
|
+
# Format: irc://{nick}:{password}@{server name}:{port}/#{channel}
|
41
88
|
set :irc_uri, "irc://MinaBot:password@git.example.com:6697/#log"
|
89
|
+
|
90
|
+
# irc_ssl
|
91
|
+
# Whether to use ssl when connecting to the irc server
|
42
92
|
set :irc_ssl, true
|
43
93
|
|
44
|
-
|
94
|
+
##### End IRC options #####
|
95
|
+
|
96
|
+
##### SSL options ####
|
97
|
+
# If you're using https, you can use these options combined with the environment
|
98
|
+
# deploy configuration to set up nginx config.
|
45
99
|
set :ssl_cert_path, "/etc/nginx/ssl/your_app.crt"
|
46
100
|
set :ssl_cert_key_path, "/etc/nginx/ssl/your_app.key"
|
47
101
|
|
48
102
|
###########################################################################
|
49
103
|
|
104
|
+
# Set server based on "to" environment variable.
|
105
|
+
# E.g., mina deploy to=production
|
50
106
|
set :server, ENV['to'] || default_server
|
107
|
+
|
108
|
+
# Load environment-specific deploy config from config/deploy/
|
51
109
|
invoke :"env:#{server}"
|
52
110
|
|
111
|
+
# This is what happens when you run mina deploy
|
53
112
|
desc "Deploys the current version to the server."
|
54
113
|
task :deploy => :environment do
|
55
114
|
deploy do
|
115
|
+
# Make sure local git branch is synced with remote
|
56
116
|
invoke :'check:revision'
|
117
|
+
|
118
|
+
# Clone git repository to create a new release
|
57
119
|
invoke :'git:clone'
|
120
|
+
|
121
|
+
# Link configuration you want shared across releases into new release
|
58
122
|
invoke :'deploy:link_shared_paths'
|
123
|
+
|
124
|
+
# Install gems for new release
|
125
|
+
# Gems are shared across releases, so they won't need to be installed on every deploy.
|
59
126
|
invoke :'bundle:install'
|
127
|
+
|
128
|
+
# Migrate database. If there are no new migrations, does nothing.
|
60
129
|
invoke :'rails:db_migrate'
|
130
|
+
|
131
|
+
# Precompile assets. If there are no changed assets, does nothing.
|
61
132
|
invoke :'rails:assets_precompile'
|
62
133
|
|
63
134
|
to :launch do
|
@@ -1,15 +1,50 @@
|
|
1
1
|
namespace :env do
|
2
2
|
task :production => [:environment] do
|
3
|
+
# server_ip
|
4
|
+
# Ip address of server to deploy staging app to
|
3
5
|
set :server_ip, '1.1.1.1'
|
6
|
+
|
7
|
+
# domain
|
8
|
+
# Domain of staging app.
|
9
|
+
# Feel free to leave as server_ip.
|
4
10
|
set :domain, server_ip
|
11
|
+
|
12
|
+
# deploy_server
|
5
13
|
set :deploy_server, 'production'
|
14
|
+
|
15
|
+
# rails_env
|
16
|
+
# Rails environment to use when setting up and running the app.
|
6
17
|
set :rails_env, 'production'
|
18
|
+
|
19
|
+
# branch
|
20
|
+
# git branch that is used to create new releases.
|
7
21
|
set :branch, 'master'
|
22
|
+
|
23
|
+
# rewrite_www
|
24
|
+
# Whether to include logic in nginx to rewrite www.example.com to example.com.
|
8
25
|
set :rewrite_www, false
|
26
|
+
|
27
|
+
# include_ssl
|
28
|
+
# Whether to include ssl configuration in nginx config.
|
9
29
|
set :include_ssl, false
|
30
|
+
|
31
|
+
# default_host
|
32
|
+
# Whether the app should be set as the default host in nginx config.
|
33
|
+
# Generally, you'll want true if it's the only app running on the server.
|
34
|
+
# If there are multiple apps running on the server, make sure only one of them
|
35
|
+
# is set as the default.
|
10
36
|
set :default_host, true
|
37
|
+
|
38
|
+
# unicorn_workers
|
39
|
+
# Number of unicorn workers to run for this server. Keep in mind that workers
|
40
|
+
# will briefly overlap when transitioning to new release during unicorn:restart.
|
11
41
|
set :unicorn_workers, 2
|
12
42
|
|
43
|
+
# sidekiq_concurrency
|
44
|
+
# Number of threads created by one sidekiq process
|
45
|
+
set :sidekiq_concurrency, 5
|
46
|
+
|
47
|
+
# Set all other configuration using config/deploy/defaults.rb
|
13
48
|
invoke :defaults
|
14
49
|
end
|
15
50
|
end
|
@@ -1,15 +1,52 @@
|
|
1
1
|
namespace :env do
|
2
2
|
task :staging => [:environment] do
|
3
|
+
# server_ip
|
4
|
+
# Ip address of server to deploy staging app to
|
3
5
|
set :server_ip, '1.1.1.1'
|
6
|
+
|
7
|
+
# domain
|
8
|
+
# Domain of staging app.
|
9
|
+
# Feel free to leave as server_ip.
|
4
10
|
set :domain, server_ip
|
11
|
+
|
12
|
+
# deploy_server
|
13
|
+
# Used often in naming files, database, etc. to allow multiple versions of the
|
14
|
+
# same application to run on the same server.
|
5
15
|
set :deploy_server, 'staging'
|
16
|
+
|
17
|
+
# rails_env
|
18
|
+
# Rails environment to use when setting up and running the app.
|
6
19
|
set :rails_env, 'staging'
|
20
|
+
|
21
|
+
# branch
|
22
|
+
# git branch that is used to create new releases.
|
7
23
|
set :branch, 'staging'
|
24
|
+
|
25
|
+
# rewrite_www
|
26
|
+
# Whether to include logic in nginx to rewrite www.example.com to example.com.
|
8
27
|
set :rewrite_www, false
|
28
|
+
|
29
|
+
# include_ssl
|
30
|
+
# Whether to include ssl configuration in nginx config.
|
9
31
|
set :include_ssl, false
|
32
|
+
|
33
|
+
# default_host
|
34
|
+
# Whether the app should be set as the default host in nginx config.
|
35
|
+
# Generally, you'll want true if it's the only app running on the server.
|
36
|
+
# If there are multiple apps running on the server, make sure only one of them
|
37
|
+
# is set as the default.
|
10
38
|
set :default_host, true
|
39
|
+
|
40
|
+
# unicorn_workers
|
41
|
+
# Number of unicorn workers to run for this server. Keep in mind that workers
|
42
|
+
# will overlap when transitioning to new release during unicorn:restart.
|
11
43
|
set :unicorn_workers, 1
|
12
44
|
|
45
|
+
# sidekiq_concurrency
|
46
|
+
# Number of threads created by one sidekiq process
|
47
|
+
set :sidekiq_concurrency, 5
|
48
|
+
|
49
|
+
# Set all other configuration using config/deploy/defaults.rb
|
13
50
|
invoke :defaults
|
14
51
|
end
|
15
52
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cl-mina
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Sharpe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,20 +80,6 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: pg
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: unicorn
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -153,14 +139,17 @@ files:
|
|
153
139
|
- lib/cl_mina.rb
|
154
140
|
- lib/cl_mina/tasks/all.rb
|
155
141
|
- lib/cl_mina/tasks/check.rb
|
142
|
+
- lib/cl_mina/tasks/clouddb.rb
|
156
143
|
- lib/cl_mina/tasks/db.rb
|
157
144
|
- lib/cl_mina/tasks/irc.rb
|
158
145
|
- lib/cl_mina/tasks/log.rb
|
159
146
|
- lib/cl_mina/tasks/logrotate.rb
|
160
147
|
- lib/cl_mina/tasks/nginx.rb
|
161
148
|
- lib/cl_mina/tasks/postgresql.rb
|
149
|
+
- lib/cl_mina/tasks/sidekiq.rb
|
162
150
|
- lib/cl_mina/tasks/unicorn.rb
|
163
151
|
- lib/cl_mina/tasks/utility.rb
|
152
|
+
- lib/cl_mina/templates/clouddb.yml.erb
|
164
153
|
- lib/cl_mina/templates/logrotate.erb
|
165
154
|
- lib/cl_mina/templates/nginx_unicorn.erb
|
166
155
|
- lib/cl_mina/templates/postgresql.yml.erb
|
@@ -195,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
184
|
version: '0'
|
196
185
|
requirements: []
|
197
186
|
rubyforge_project:
|
198
|
-
rubygems_version: 2.2.
|
187
|
+
rubygems_version: 2.2.2
|
199
188
|
signing_key:
|
200
189
|
specification_version: 4
|
201
190
|
summary: Common deploy tasks and settings.
|