deploy_mate 0.2 → 0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Gemfile.lock +7 -9
- data/README.md +37 -46
- data/deploy-mate.gemspec +7 -4
- data/lib/capistrano/configs/logrotate.erb +2 -2
- data/lib/capistrano/configs/nginx_app.conf.erb +4 -9
- data/lib/capistrano/configs/nginx_base.conf.erb +1 -1
- data/lib/capistrano/configs/unicorn.pill.erb +28 -0
- data/lib/capistrano/configs/upstart.conf.erb +1 -1
- data/lib/capistrano/deploy_mate_capfile.rb +2 -2
- data/lib/capistrano/deploy_mate_defaults.rb +4 -5
- data/lib/capistrano/helpers.rb +2 -4
- data/lib/capistrano/scripts/set_defaults.sh +1 -2
- data/lib/capistrano/tasks/bluepill.rake +5 -29
- data/lib/capistrano/tasks/logrotate.rake +0 -1
- data/lib/capistrano/tasks/machine.rake +17 -91
- data/lib/capistrano/tasks/nginx.rake +4 -7
- data/lib/capistrano/tasks/unicorn.rake +17 -1
- data/lib/capistrano/tasks/upstart.rake +0 -2
- data/lib/deploy_mate/tasks.rake +50 -49
- data/lib/deploy_mate/templates/Capfile.erb +1 -7
- data/lib/deploy_mate/templates/deploy.rb.erb +5 -22
- data/lib/deploy_mate/templates/deploy/stage.rb.erb +4 -4
- metadata +5 -19
- data/CHANGELOG.md +0 -19
- data/lib/capistrano/configs/application.pill.erb +0 -59
- data/lib/capistrano/configs/fail2ban-nginx-request-limit-filter.conf.erb +0 -13
- data/lib/capistrano/configs/fail2ban-nginx-request-limit-jail.conf.erb +0 -494
- data/lib/capistrano/configs/puma.rb.erb +0 -64
- data/lib/capistrano/modules/shell.rb +0 -7
- data/lib/capistrano/modules/user_management.rb +0 -11
- data/lib/capistrano/scripts/create_ubuntu_user.sh +0 -9
- data/lib/capistrano/tasks/elasticsearch.rake +0 -18
- data/lib/capistrano/tasks/fail2ban.rake +0 -22
- data/lib/capistrano/tasks/puma.rake +0 -18
- data/lib/deploy_mate.rb +0 -9
- data/lib/deploy_mate/templates/deploy_mate.yml.erb +0 -79
@@ -1,64 +0,0 @@
|
|
1
|
-
# puma configuration
|
2
|
-
|
3
|
-
shared_path = "<%= shared_path %>"
|
4
|
-
environment_name = "<%= fetch(:environment) %>"
|
5
|
-
|
6
|
-
begin
|
7
|
-
require 'dotenv'
|
8
|
-
dotenv_path = '<%= fetch(:dotenv_path, shared_path.join(".env.#{fetch(:environment)}")) %>'
|
9
|
-
Dotenv.load(dotenv_path)
|
10
|
-
rescue LoadError
|
11
|
-
puts "Dotenv not found, skipping load of env vars..."
|
12
|
-
end
|
13
|
-
|
14
|
-
# Puma can serve each request in a thread from an internal thread pool.
|
15
|
-
# The `threads` method setting takes two numbers a minimum and maximum.
|
16
|
-
# Any libraries that use thread pools should be configured to match
|
17
|
-
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
18
|
-
# and maximum, this matches the default thread size of Active Record.
|
19
|
-
#
|
20
|
-
threads_count = ENV.fetch("PUMA_THREADS", <%= fetch(:puma_threads) %>)
|
21
|
-
threads threads_count, threads_count
|
22
|
-
|
23
|
-
# Specifies the `environment` that Puma will run in.
|
24
|
-
#
|
25
|
-
environment environment_name
|
26
|
-
|
27
|
-
# Specifies the number of `workers` to boot in clustered mode.
|
28
|
-
# Workers are forked webserver processes. If using threads and workers together
|
29
|
-
# the concurrency of the application would be max `threads` * `workers`.
|
30
|
-
# Workers do not work on JRuby or Windows (both of which do not support
|
31
|
-
# processes).
|
32
|
-
#
|
33
|
-
workers ENV.fetch("PUMA_WORKERS", <%= fetch(:puma_workers) %>)
|
34
|
-
|
35
|
-
# Use the `preload_app!` method when specifying a `workers` number.
|
36
|
-
# This directive tells Puma to first boot the application and load code
|
37
|
-
# before forking the application. This takes advantage of Copy On Write
|
38
|
-
# process behavior so workers use less memory. If you use this option
|
39
|
-
# you need to make sure to reconnect any threads in the `on_worker_boot`
|
40
|
-
# block.
|
41
|
-
#
|
42
|
-
preload_app!
|
43
|
-
|
44
|
-
# The code in the `on_worker_boot` will be called if you are using
|
45
|
-
# clustered mode by specifying a number of `workers`. After each worker
|
46
|
-
# process is booted this block will be run, if you are using `preload_app!`
|
47
|
-
# option you will want to use this block to reconnect to any threads
|
48
|
-
# or connections that may have been created at application boot, Ruby
|
49
|
-
# cannot share connections between processes.
|
50
|
-
#
|
51
|
-
on_worker_boot do
|
52
|
-
ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
|
53
|
-
end
|
54
|
-
|
55
|
-
# Set up socket location
|
56
|
-
bind "unix://#{shared_path}/system/sockets/puma.sock"
|
57
|
-
|
58
|
-
# Logging
|
59
|
-
stdout_redirect "#{shared_path}/log/puma.stdout.log", "#{shared_path}/log/puma.stderr.log", true
|
60
|
-
|
61
|
-
# Set master PID and state locations
|
62
|
-
pidfile "#{shared_path}/system/pids/puma.pid"
|
63
|
-
state_path "#{shared_path}/system/pids/puma.state"
|
64
|
-
activate_control_app
|
@@ -1,9 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
sudo mkdir -p /home/ubuntu/.ssh/
|
3
|
-
sudo groupadd ubuntu
|
4
|
-
sudo useradd ubuntu -g ubuntu -d /home/ubuntu -s /bin/bash
|
5
|
-
sudo adduser ubuntu sudo
|
6
|
-
sudo cp ~/.ssh/authorized_keys /home/ubuntu/.ssh/
|
7
|
-
sudo chown -R ubuntu:ubuntu /home/ubuntu
|
8
|
-
sudo echo "ubuntu ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/ubuntu_no_sudo_password
|
9
|
-
sudo chmod 0440 /etc/sudoers.d/ubuntu_no_sudo_password
|
@@ -1,18 +0,0 @@
|
|
1
|
-
set_default(:elasticsearch_version, "1.7")
|
2
|
-
|
3
|
-
namespace :elasticsearch do
|
4
|
-
include Aptitude
|
5
|
-
task :install do
|
6
|
-
on roles(:search) do
|
7
|
-
unless is_package_installed?("elasticsearch")
|
8
|
-
apt_get_install("openjdk-7-jre-headless") unless is_package_installed?("openjdk-7-jre-headless")
|
9
|
-
execute "wget -qO - https://packages.elasticsearch.org/GPG-KEY-elasticsearch | sudo apt-key add -"
|
10
|
-
sudo "add-apt-repository 'deb http://packages.elasticsearch.org/elasticsearch/#{fetch(:elasticsearch_version)}/debian stable main'"
|
11
|
-
apt_get_update
|
12
|
-
apt_get_install("elasticsearch")
|
13
|
-
sudo "update-rc.d elasticsearch defaults 95 10"
|
14
|
-
sudo :service, :elasticsearch, :start
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
namespace :fail2ban do
|
2
|
-
include Shell
|
3
|
-
|
4
|
-
desc "Installs the fail2ban configs"
|
5
|
-
task :setup do
|
6
|
-
on roles(:web) do
|
7
|
-
template "fail2ban-nginx-request-limit-jail.conf.erb", "/tmp/fail2ban_jail"
|
8
|
-
sudo "mv /tmp/fail2ban_jail /etc/fail2ban/jail.conf"
|
9
|
-
template "fail2ban-nginx-request-limit-jail.conf.erb", "/tmp/fail2ban_req_filter"
|
10
|
-
sudo "mv /tmp/fail2ban_req_filter /etc/fail2ban/filter.d/nginx-req-limit.conf"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
desc "Restart fail2ban"
|
15
|
-
task :restart do
|
16
|
-
on roles(:web) do
|
17
|
-
sudo "service fail2ban restart"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
after "fail2ban:setup", "fail2ban:restart"
|
22
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
set_default(:puma_workers, "5")
|
2
|
-
set_default(:puma_threads, "10")
|
3
|
-
set_default(:puma_timeout, "30")
|
4
|
-
set_default(:puma_worker_grace_time, "60")
|
5
|
-
|
6
|
-
namespace :puma do
|
7
|
-
include Bluepill
|
8
|
-
include Shell
|
9
|
-
|
10
|
-
desc "Installs the puma config"
|
11
|
-
task :setup do
|
12
|
-
on roles(:app) do
|
13
|
-
execute "mkdir -p #{shared_path}/config"
|
14
|
-
template "puma.rb.erb", "#{shared_path}/config/puma.rb"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
data/lib/deploy_mate.rb
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
# This file represents your application deployment configuration and
|
2
|
-
# will be used to generate the capistrano deployment and server setup.
|
3
|
-
# Please go through this file and when you are ready execute:
|
4
|
-
#
|
5
|
-
# bundle exec rake deploy_mate:install
|
6
|
-
|
7
|
-
---
|
8
|
-
|
9
|
-
# Name of the application, which is usually the same as the
|
10
|
-
# repository name.
|
11
|
-
app_name: <%= @app_name %>
|
12
|
-
|
13
|
-
# The url of your GIT repository.
|
14
|
-
repo_url: "git@github.com:your-github-name/<%= @app_name %>.git"
|
15
|
-
|
16
|
-
# For which stage should the server-setup/deployment be generated. It is
|
17
|
-
# recommended to start with a prestage system and afterwards configure
|
18
|
-
# the production system when it is ready.
|
19
|
-
stage_name: prestage
|
20
|
-
|
21
|
-
# Under which rails environment will the application run.
|
22
|
-
environment: prestage
|
23
|
-
|
24
|
-
# Which GIT branch should be deployed to the defined server by default?
|
25
|
-
# You can overrule this value by providing a branch on the deployment command:
|
26
|
-
#
|
27
|
-
# bundle exec cap prestage deploy branch=feature/xyz
|
28
|
-
branch_name: dev
|
29
|
-
|
30
|
-
# Which is the ssh shortcut to connect to the server. It should be configured
|
31
|
-
# in your ~/.ssh/config. You should be able to connect to the server using:
|
32
|
-
#
|
33
|
-
# ssh specified_ssh_name
|
34
|
-
#
|
35
|
-
ssh_name: prestage-server
|
36
|
-
|
37
|
-
# Since you are able to connect to the server with the specified ssh shortcurt,
|
38
|
-
# usually more persons should be able to access it. You can specify a list of
|
39
|
-
# public ssh keys which will be copied to the ~/.ssh/authorized_keys file on the
|
40
|
-
# server. If the list is empty, the current key setting will be left untouched on
|
41
|
-
# the server.
|
42
|
-
ssh_file_names:
|
43
|
-
- "~/.ssh/*.pub"
|
44
|
-
|
45
|
-
# Under which URL should your server be available? An IP address does the job
|
46
|
-
# too
|
47
|
-
host_name: example.com
|
48
|
-
|
49
|
-
# The ruby version, that will be installed and used on the server. It is used
|
50
|
-
# by RVM and must have a compatible syntax like '2.3.0' or 'ruby-2.3.0'.
|
51
|
-
ruby_version: <%= @ruby_version %>
|
52
|
-
|
53
|
-
# Currently there are two database engines supported: 'postgresql' and 'mysql'
|
54
|
-
db_engine: postgresql
|
55
|
-
|
56
|
-
# Currently there are two appservers supported: 'unicorn' and 'puma'.
|
57
|
-
# Remember to add the chosen appserver to your Gemfile if you are not
|
58
|
-
# already using it locally.
|
59
|
-
app_server: unicorn
|
60
|
-
|
61
|
-
# Are your running a rails application?
|
62
|
-
# Possible values 'yes' or 'no'.
|
63
|
-
rails: <%= @rails %>
|
64
|
-
|
65
|
-
# Are you depending on imagemagick for image manipulation (E.g. paperclip gem)?
|
66
|
-
# Possible values 'yes' or 'no'.
|
67
|
-
imagemagick: <%= @imagemagick %>
|
68
|
-
|
69
|
-
# Are you depending on sidekiq (E.g. as active job backend)?
|
70
|
-
# Possible values 'yes' or 'no'.
|
71
|
-
sidekiq: <%= @sidekiq %>
|
72
|
-
|
73
|
-
# Are you depending on elastic search?
|
74
|
-
# Possible values 'yes' or 'no'.
|
75
|
-
elasticsearch: no
|
76
|
-
|
77
|
-
# Are you depending on memcached for example as a cache store?
|
78
|
-
# Possible values 'yes' or 'no'.
|
79
|
-
memcached: <%= @memcached %>
|