taperole 1.8.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +13 -0
- data/Gemfile.lock +4 -2
- data/README.md +6 -6
- data/lib/taperole/commands/ansible.rb +2 -2
- data/lib/taperole/core/ansible_runner.rb +1 -1
- data/lib/taperole/core/installer.rb +4 -4
- data/lib/taperole/version.rb +1 -1
- data/requirements.yml +0 -3
- data/roles/backend_checkout/tasks/main.yml +0 -1
- data/roles/backend_install_essentials/meta/main.yml +0 -1
- data/roles/backend_install_essentials/tasks/main.yml +0 -10
- data/roles/deployer_user/tasks/main.yml +2 -2
- data/roles/dev_keys/tasks/main.yml +1 -1
- data/roles/letsencrypt/tasks/main.yml +19 -0
- data/roles/nginx/tasks/main.yml +31 -8
- data/roles/nginx/templates/nginx.conf.j2 +84 -0
- data/roles/nginx/templates/{nginx_unicorn.j2 → nginx_puma.j2} +34 -13
- data/roles/puma_activate/tasks/main.yml +27 -0
- data/roles/puma_install/tasks/main.yml +29 -0
- data/roles/puma_install/templates/puma.rb.j2 +26 -0
- data/roles/puma_install/templates/puma_init.j2 +75 -0
- data/roles/puma_install/templates/puma_monit.j2 +6 -0
- data/spec/commands/installer_spec.rb +3 -3
- data/taperole.gemspec +1 -0
- data/templates/base/deploy.example.yml +1 -1
- data/templates/base/omnibox.example.yml +3 -2
- data/templates/base/tape_vars.example.yml +6 -1
- data/templates/static_html/omnibox.example.yml +1 -0
- data/templates/static_html/tape_vars.example.yml +6 -1
- data/test/base_docker_box/Dockerfile +3 -3
- data/test/rails/Dockerfile +3 -3
- data/test/rails/start_rails.sh +6 -4
- data/test/rails/tape_vars.yml +7 -2
- data/vars/defaults.yml +7 -6
- metadata +24 -26
- data/roles/backend_install_essentials/templates/memcached.j2 +0 -7
- data/roles/unicorn_activate/defaults/main.yml +0 -3
- data/roles/unicorn_activate/tasks/main.yml +0 -16
- data/roles/unicorn_install/tasks/main.yml +0 -21
- data/roles/unicorn_install/templates/unicorn.rb.j2 +0 -47
- data/roles/unicorn_install/templates/unicorn_init.j2 +0 -70
- data/roles/unicorn_install/templates/unicorn_monit.j2 +0 -5
- data/vendor/geerlingguy.memcached/.gitignore +0 -1
- data/vendor/geerlingguy.memcached/.travis.yml +0 -34
- data/vendor/geerlingguy.memcached/README.md +0 -53
- data/vendor/geerlingguy.memcached/defaults/main.yml +0 -9
- data/vendor/geerlingguy.memcached/handlers/main.yml +0 -3
- data/vendor/geerlingguy.memcached/meta/.galaxy_install_info +0 -1
- data/vendor/geerlingguy.memcached/meta/main.yml +0 -24
- data/vendor/geerlingguy.memcached/tasks/main.yml +0 -29
- data/vendor/geerlingguy.memcached/tasks/setup-Debian.yml +0 -6
- data/vendor/geerlingguy.memcached/tasks/setup-RedHat.yml +0 -3
- data/vendor/geerlingguy.memcached/templates/memcached-Debian.conf.j2 +0 -27
- data/vendor/geerlingguy.memcached/templates/memcached-RedHat.conf.j2 +0 -19
- data/vendor/geerlingguy.memcached/tests/inventory +0 -1
- data/vendor/geerlingguy.memcached/tests/test.yml +0 -5
- data/vendor/geerlingguy.memcached/vars/Debian.yml +0 -3
- data/vendor/geerlingguy.memcached/vars/RedHat.yml +0 -3
@@ -64,7 +64,7 @@ describe Taperole::Commands::Installer do
|
|
64
64
|
end
|
65
65
|
|
66
66
|
it 'creates the dev_keys directory' do
|
67
|
-
expect(
|
67
|
+
expect(taperole).to include('dev_keys')
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
@@ -77,7 +77,7 @@ describe Taperole::Commands::Installer do
|
|
77
77
|
FileUtils.touch("#{Dir.pwd}/taperole/rake.yml")
|
78
78
|
FileUtils.touch("#{Dir.pwd}/taperole/roles")
|
79
79
|
FileUtils.touch("#{Dir.pwd}/taperole/hosts")
|
80
|
-
FileUtils.touch("#{Dir.pwd}/dev_keys")
|
80
|
+
FileUtils.touch("#{Dir.pwd}/taperole/dev_keys")
|
81
81
|
FileUtils.touch("#{Dir.pwd}/Vagrantfile")
|
82
82
|
end
|
83
83
|
let(:command) { :uninstall }
|
@@ -107,7 +107,7 @@ describe Taperole::Commands::Installer do
|
|
107
107
|
end
|
108
108
|
|
109
109
|
it 'removes dev_keys' do
|
110
|
-
expect(
|
110
|
+
expect(taperole).to_not include('dev_keys')
|
111
111
|
end
|
112
112
|
|
113
113
|
it 'removes Vagrantfile' do
|
data/taperole.gemspec
CHANGED
@@ -18,5 +18,6 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.add_runtime_dependency 'colorize', '~> 0.8.1'
|
19
19
|
spec.add_development_dependency 'rspec-expectations', '~> 3.5'
|
20
20
|
spec.add_development_dependency 'rspec', '~> 3.5'
|
21
|
+
spec.add_development_dependency 'rake', '12.0.0'
|
21
22
|
spec.require_paths = ['lib']
|
22
23
|
end
|
@@ -28,14 +28,15 @@
|
|
28
28
|
- dev_keys
|
29
29
|
- monit_install
|
30
30
|
- postgres
|
31
|
+
- letsencrypt
|
31
32
|
- nginx
|
32
33
|
- backend_install_essentials
|
33
34
|
- frontend_install_essentials
|
34
35
|
- backend_checkout
|
35
|
-
-
|
36
|
+
- puma_install
|
36
37
|
- backend_config
|
37
38
|
- database_load
|
38
|
-
-
|
39
|
+
- puma_activate
|
39
40
|
- frontend_deploy
|
40
41
|
# - delayed_job
|
41
42
|
# - whenever
|
@@ -1,5 +1,10 @@
|
|
1
1
|
app_name:
|
2
2
|
|
3
|
+
letsencrypt:
|
4
|
+
enabled: false
|
5
|
+
hostname: # REQUIRED should be example.com or subdomain.example.com (do not include the www)
|
6
|
+
email: # REQUIRED
|
7
|
+
|
3
8
|
# Rails App Configs
|
4
9
|
be_app_repo:
|
5
10
|
|
@@ -7,7 +12,7 @@ be_app_repo:
|
|
7
12
|
# Uncomment if you want to deploy a JS/HTML App
|
8
13
|
# fe_app_repo:
|
9
14
|
# fe_app_branch: master
|
10
|
-
# fe_build_command:
|
15
|
+
# fe_build_command: npm run build
|
11
16
|
|
12
17
|
slack_webhook_url:
|
13
18
|
|
@@ -1,6 +1,11 @@
|
|
1
1
|
app_name:
|
2
2
|
|
3
|
+
letsencrypt:
|
4
|
+
enabled: false
|
5
|
+
hostname: # REQUIRED should be example.com or subdomain.example.com (do not include the www)
|
6
|
+
email: # REQUIRED
|
7
|
+
|
3
8
|
# App Configs
|
4
9
|
fe_app_repo:
|
5
10
|
fe_app_branch: master
|
6
|
-
fe_build_command:
|
11
|
+
fe_build_command: npm run build
|
@@ -11,9 +11,9 @@ RUN apt-get install -y python-dev git aptitude sudo wget make zlib1g-dev libssl-
|
|
11
11
|
|
12
12
|
# Install Ruby
|
13
13
|
WORKDIR /tmp
|
14
|
-
RUN wget http://cache.ruby-lang.org/pub/ruby/2.
|
15
|
-
RUN tar -xvzf ruby-2.
|
16
|
-
WORKDIR /tmp/ruby-2.
|
14
|
+
RUN wget http://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.0.tar.gz
|
15
|
+
RUN tar -xvzf ruby-2.4.0.tar.gz
|
16
|
+
WORKDIR /tmp/ruby-2.4.0
|
17
17
|
RUN ./configure --prefix=/usr/local
|
18
18
|
RUN make
|
19
19
|
RUN make install
|
data/test/rails/Dockerfile
CHANGED
@@ -13,8 +13,8 @@ RUN gem install slack-notifier
|
|
13
13
|
RUN gem install taperole # gem installs from local directory first, then remote
|
14
14
|
|
15
15
|
# Configure tape
|
16
|
-
RUN git clone https://github.com/
|
17
|
-
WORKDIR /taperole/
|
16
|
+
RUN git clone https://github.com/BrandonMathis/vanilla-rails-app.git
|
17
|
+
WORKDIR /taperole/vanilla-rails-app
|
18
18
|
RUN echo 'n' | tape installer install
|
19
19
|
ADD ./test/rails/tape_vars.yml taperole/tape_vars.yml
|
20
20
|
|
@@ -25,7 +25,7 @@ RUN sed -i '/ufw/d' taperole/omnibox.yml
|
|
25
25
|
# Run Tape
|
26
26
|
RUN echo '[omnibox]' > taperole/hosts
|
27
27
|
RUN echo 'localhost ansible_connection=local be_app_env=production be_app_branch=master' >> taperole/hosts
|
28
|
-
RUN tape ansible
|
28
|
+
RUN tape ansible provision
|
29
29
|
RUN chown deployer:users /home/deployer -R
|
30
30
|
ADD test/rails/start_rails.sh /
|
31
31
|
|
data/test/rails/start_rails.sh
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
|
-
rm -rf /
|
2
|
+
rm -rf /home/deployer/vanilla/pids/puma.pid
|
3
|
+
rm -rf /home/deployer/vanilla/pids/puma.state
|
4
|
+
rm -rf /home/deployer/vanilla/tmp/*.sock
|
3
5
|
service postgresql start
|
4
|
-
|
5
|
-
monit start
|
6
|
-
sleep
|
6
|
+
monit start puma
|
7
|
+
monit start nginx
|
8
|
+
sleep 2
|
7
9
|
curl https://localhost --insecure
|
data/test/rails/tape_vars.yml
CHANGED
@@ -1,7 +1,12 @@
|
|
1
|
-
app_name:
|
1
|
+
app_name: vanilla
|
2
|
+
|
3
|
+
letsencrypt:
|
4
|
+
enabled: false
|
5
|
+
hostname: # REQUIRED should be example.com or subdomain.example.com (do not include the www)
|
6
|
+
email: # REQUIRED
|
2
7
|
|
3
8
|
# Rails App Configs
|
4
|
-
be_app_repo: https://github.com/
|
9
|
+
be_app_repo: https://github.com/BrandonMathis/vanilla-rails-app.git
|
5
10
|
|
6
11
|
# HTML/JS App Configs
|
7
12
|
# Uncomment if you want to deploy a JS/HTML App
|
data/vars/defaults.yml
CHANGED
@@ -14,8 +14,11 @@ deployer_user:
|
|
14
14
|
# Path where this playbook is being run from
|
15
15
|
local_dir: "{{lookup('env', 'PWD')}}"
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
# Puma Configs
|
18
|
+
puma_workers: "{{ansible_processor_cores}}"
|
19
|
+
puma_pidfile: "{{be_app_path}}/pids/puma.pid"
|
20
|
+
puma_state_path: "{{be_app_path}}/pids/puma.state"
|
21
|
+
puma_sockfile: "{{ be_app_path }}/tmp/puma_{{ app_name }}.sock"
|
19
22
|
|
20
23
|
swap_file:
|
21
24
|
path: /swp
|
@@ -24,14 +27,12 @@ swap_file:
|
|
24
27
|
# echo 'password' | md5
|
25
28
|
database_password: 286755fad04869ca523320acce0dc6a4
|
26
29
|
|
27
|
-
enabled_delayed_job: false
|
28
|
-
|
29
30
|
precompile_assets: true
|
30
31
|
|
31
32
|
# Sets server_name in the nginx sites-enabled file
|
32
33
|
app_url: false
|
33
34
|
|
34
|
-
fe_build_command:
|
35
|
+
fe_build_command: npm run build
|
35
36
|
|
36
37
|
allowed_ports:
|
37
38
|
- 80
|
@@ -69,7 +70,7 @@ backup_profiles:
|
|
69
70
|
rbenv:
|
70
71
|
env: system
|
71
72
|
version: v1.0.0
|
72
|
-
ruby_version: 2.
|
73
|
+
ruby_version: 2.4.0
|
73
74
|
|
74
75
|
rbenv_group: root
|
75
76
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taperole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jack Forrest
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-03-
|
13
|
+
date: 2017-03-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: slack-notifier
|
@@ -82,6 +82,20 @@ dependencies:
|
|
82
82
|
- - "~>"
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '3.5'
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: rake
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - '='
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: 12.0.0
|
92
|
+
type: :development
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - '='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 12.0.0
|
85
99
|
description: General purpose server provisioning and application deployment toolkit
|
86
100
|
email:
|
87
101
|
- jack@smashingboxes.com
|
@@ -126,7 +140,6 @@ files:
|
|
126
140
|
- roles/backend_install_essentials/meta/main.yml
|
127
141
|
- roles/backend_install_essentials/tasks/main.yml
|
128
142
|
- roles/backend_install_essentials/templates/gemrc.j2
|
129
|
-
- roles/backend_install_essentials/templates/memcached.j2
|
130
143
|
- roles/database_load/defaults/main.yml
|
131
144
|
- roles/database_load/tasks/db_reset.yml
|
132
145
|
- roles/database_load/tasks/main.yml
|
@@ -146,16 +159,23 @@ files:
|
|
146
159
|
- roles/general/tasks/main.yml
|
147
160
|
- roles/general/tasks/swapfile.yml
|
148
161
|
- roles/imagemagick/tasks/main.yml
|
162
|
+
- roles/letsencrypt/tasks/main.yml
|
149
163
|
- roles/monit_activate/tasks/main.yml
|
150
164
|
- roles/monit_install/tasks/main.yml
|
151
165
|
- roles/monit_install/templates/monitrc.j2
|
152
166
|
- roles/monit_install/templates/web_interface.j2
|
153
167
|
- roles/nginx/handlers/main.yml
|
154
168
|
- roles/nginx/tasks/main.yml
|
169
|
+
- roles/nginx/templates/nginx.conf.j2
|
155
170
|
- roles/nginx/templates/nginx_monit.j2
|
156
|
-
- roles/nginx/templates/
|
171
|
+
- roles/nginx/templates/nginx_puma.j2
|
157
172
|
- roles/node/tasks/main.yml
|
158
173
|
- roles/postgres/meta/main.yml
|
174
|
+
- roles/puma_activate/tasks/main.yml
|
175
|
+
- roles/puma_install/tasks/main.yml
|
176
|
+
- roles/puma_install/templates/puma.rb.j2
|
177
|
+
- roles/puma_install/templates/puma_init.j2
|
178
|
+
- roles/puma_install/templates/puma_monit.j2
|
159
179
|
- roles/redis/meta/main.yml
|
160
180
|
- roles/redis/tasks/main.yml
|
161
181
|
- roles/redis/templates/rc.local.j2
|
@@ -174,12 +194,6 @@ files:
|
|
174
194
|
- roles/sidekiq/tasks/main.yml
|
175
195
|
- roles/sidekiq/templates/sidekiq.j2
|
176
196
|
- roles/ufw/tasks/main.yml
|
177
|
-
- roles/unicorn_activate/defaults/main.yml
|
178
|
-
- roles/unicorn_activate/tasks/main.yml
|
179
|
-
- roles/unicorn_install/tasks/main.yml
|
180
|
-
- roles/unicorn_install/templates/unicorn.rb.j2
|
181
|
-
- roles/unicorn_install/templates/unicorn_init.j2
|
182
|
-
- roles/unicorn_install/templates/unicorn_monit.j2
|
183
197
|
- roles/whenever/tasks/main.yml
|
184
198
|
- spec/commands/installer_spec.rb
|
185
199
|
- spec/spec_helper.rb
|
@@ -287,22 +301,6 @@ files:
|
|
287
301
|
- vendor/ansible-sysfs/tests/test.yml
|
288
302
|
- vendor/ansible-sysfs/tests/vagrant.yml
|
289
303
|
- vendor/ansible-sysfs/vars/main.yml
|
290
|
-
- vendor/geerlingguy.memcached/.gitignore
|
291
|
-
- vendor/geerlingguy.memcached/.travis.yml
|
292
|
-
- vendor/geerlingguy.memcached/README.md
|
293
|
-
- vendor/geerlingguy.memcached/defaults/main.yml
|
294
|
-
- vendor/geerlingguy.memcached/handlers/main.yml
|
295
|
-
- vendor/geerlingguy.memcached/meta/.galaxy_install_info
|
296
|
-
- vendor/geerlingguy.memcached/meta/main.yml
|
297
|
-
- vendor/geerlingguy.memcached/tasks/main.yml
|
298
|
-
- vendor/geerlingguy.memcached/tasks/setup-Debian.yml
|
299
|
-
- vendor/geerlingguy.memcached/tasks/setup-RedHat.yml
|
300
|
-
- vendor/geerlingguy.memcached/templates/memcached-Debian.conf.j2
|
301
|
-
- vendor/geerlingguy.memcached/templates/memcached-RedHat.conf.j2
|
302
|
-
- vendor/geerlingguy.memcached/tests/inventory
|
303
|
-
- vendor/geerlingguy.memcached/tests/test.yml
|
304
|
-
- vendor/geerlingguy.memcached/vars/Debian.yml
|
305
|
-
- vendor/geerlingguy.memcached/vars/RedHat.yml
|
306
304
|
- vendor/jnv.unattended-upgrades/.gitignore
|
307
305
|
- vendor/jnv.unattended-upgrades/.travis.yml
|
308
306
|
- vendor/jnv.unattended-upgrades/LICENSE
|
@@ -1,7 +0,0 @@
|
|
1
|
-
check process memcached with pidfile /var/run/memcached.pid
|
2
|
-
start program = "/etc/init.d/memcached start"
|
3
|
-
stop program = "/etc/init.d/memcached stop"
|
4
|
-
if failed host 127.0.0.1 port 11211 then restart
|
5
|
-
if cpu > 70% for 2 cycles then alert
|
6
|
-
if cpu > 98% for 5 cycles then restart
|
7
|
-
if 2 restarts within 3 cycles then timeout
|
@@ -1,16 +0,0 @@
|
|
1
|
-
- name: Ensure unicorn is stopped
|
2
|
-
remote_user: "{{ deployer_user.name }}"
|
3
|
-
command: bash -lc "sudo monit restart unicorn"
|
4
|
-
when: kill_unicorn
|
5
|
-
|
6
|
-
- name: Force stop unicorn
|
7
|
-
remote_user: "{{ deployer_user.name }}"
|
8
|
-
command: bash -lc "service unicorn_{{ app_name }} stop"
|
9
|
-
when: kill_unicorn
|
10
|
-
|
11
|
-
- name: Ensure tmp dir present for unicorn pids
|
12
|
-
file: state=directory path={{be_app_path}}/tmp/unicorn owner={{ deployer_user.name }}
|
13
|
-
|
14
|
-
- name: Restart Unicorn
|
15
|
-
remote_user: "{{ deployer_user.name }}"
|
16
|
-
command: bash -lc "sudo monit restart unicorn"
|
@@ -1,21 +0,0 @@
|
|
1
|
-
- name: Install unicorn init.d script
|
2
|
-
template: src=unicorn_init.j2
|
3
|
-
dest=/etc/init.d/unicorn_{{app_name}}
|
4
|
-
mode=u=rw,g=rx,o=rx
|
5
|
-
|
6
|
-
- name: Set up unicorn log dir
|
7
|
-
file: path={{be_app_path}}/log state=directory owner=deployer
|
8
|
-
|
9
|
-
- name: Install unicorn config
|
10
|
-
template: src=unicorn.rb.j2
|
11
|
-
dest={{be_app_path}}/config/unicorn.rb
|
12
|
-
|
13
|
-
- name: Register monit config files
|
14
|
-
template: src=unicorn_monit.j2
|
15
|
-
dest=/etc/monit/conf.d/unicorn
|
16
|
-
mode=u=rw,g=r,o=r
|
17
|
-
register: unicorn_monit_config
|
18
|
-
|
19
|
-
- name: Reload Monit
|
20
|
-
command: bash -lc "monit reload"
|
21
|
-
when: unicorn_monit_config.changed
|
@@ -1,47 +0,0 @@
|
|
1
|
-
worker_processes {{ unicorn_workers }}
|
2
|
-
working_directory "{{ be_app_path }}"
|
3
|
-
pid "{{ be_app_path }}/tmp/unicorn/unicorn.pid"
|
4
|
-
stderr_path "{{ be_app_path }}/log/unicorn.log"
|
5
|
-
stdout_path "{{ be_app_path }}/log/unicorn.log"
|
6
|
-
|
7
|
-
# Please read this and understand the risk you take by enabling preload_app
|
8
|
-
# http://unicorn.bogomips.org/Unicorn/Configurator.html#method-i-preload_app
|
9
|
-
preload_app false
|
10
|
-
|
11
|
-
timeout 30
|
12
|
-
|
13
|
-
listen "{{ unicorn_sockfile }}"
|
14
|
-
|
15
|
-
before_exec do |server|
|
16
|
-
ENV["BUNDLE_GEMFILE"] = "#{Rails.root}/Gemfile"
|
17
|
-
end
|
18
|
-
|
19
|
-
GC.respond_to?(:copy_on_write_friendly=) and
|
20
|
-
GC.copy_on_write_friendly = true
|
21
|
-
|
22
|
-
check_client_connection false
|
23
|
-
|
24
|
-
before_fork do |server, worker|
|
25
|
-
defined?(ActiveRecord::Base) and
|
26
|
-
ActiveRecord::Base.connection.disconnect!
|
27
|
-
|
28
|
-
old_pid = "#{server.config[:pid]}.oldbin"
|
29
|
-
if old_pid != server.pid
|
30
|
-
begin
|
31
|
-
sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU
|
32
|
-
Process.kill(sig, File.read(old_pid).to_i)
|
33
|
-
rescue Errno::ENOENT, Errno::ESRCH
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
# Throttle the master from forking too quickly by sleeping. Due
|
38
|
-
# to the implementation of standard Unix signal handlers, this
|
39
|
-
# helps (but does not completely) prevent identical, repeated signals
|
40
|
-
# from being lost when the receiving process is busy.
|
41
|
-
sleep 1
|
42
|
-
end
|
43
|
-
|
44
|
-
after_fork do |server, worker|
|
45
|
-
defined?(ActiveRecord::Base) and
|
46
|
-
ActiveRecord::Base.establish_connection
|
47
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
|
3
|
-
set -u
|
4
|
-
|
5
|
-
TIMEOUT=${TIMEOUT-60}
|
6
|
-
RBENV_ROOT="{{ rbenv_root }}"
|
7
|
-
PATH="$RBENV_ROOT/bin:$RBENV_ROOT/shims:$PATH"
|
8
|
-
APP_ROOT="{{be_app_path}}"
|
9
|
-
APP_USER="{{ deployer_user.name }}"
|
10
|
-
PID="$APP_ROOT/tmp/unicorn/unicorn.pid"
|
11
|
-
CMD="bundle exec unicorn -E {{be_app_env}} -D -c $APP_ROOT/config/unicorn.rb"
|
12
|
-
|
13
|
-
action="$1"
|
14
|
-
old_pid="$PID.oldbin"
|
15
|
-
|
16
|
-
cd $APP_ROOT || exit 1
|
17
|
-
|
18
|
-
sig () {
|
19
|
-
test -s "$PID" && kill -$1 `cat $PID`
|
20
|
-
}
|
21
|
-
|
22
|
-
oldsig () {
|
23
|
-
test -s $old_pid && kill -$1 `cat $old_pid`
|
24
|
-
}
|
25
|
-
|
26
|
-
case $action in
|
27
|
-
start)
|
28
|
-
sig 0 && echo >&2 "Already running" && exit 0
|
29
|
-
rm -f $PID && $CMD
|
30
|
-
;;
|
31
|
-
stop)
|
32
|
-
sig QUIT && echo "Stopping" && exit 0
|
33
|
-
echo >&2 "Unicorn master process with ID `cat $PID` not found (see: $PID)"
|
34
|
-
;;
|
35
|
-
force-stop)
|
36
|
-
pkill -9 -f "unicorn master" && echo "Forcing a stop\n" && rm -f $PID && echo "Cleaning up pid" && exit 0
|
37
|
-
;;
|
38
|
-
restart|reload)
|
39
|
-
sig HUP && echo reloaded OK && exit 0
|
40
|
-
echo >&2 "Couldn't reload, starting '$CMD' instead"
|
41
|
-
$CMD
|
42
|
-
;;
|
43
|
-
upgrade)
|
44
|
-
if sig USR2 && sleep 2 && sig 0 && oldsig QUIT
|
45
|
-
then
|
46
|
-
n=$TIMEOUT
|
47
|
-
while test -s $old_pid && test $n -ge 0
|
48
|
-
do
|
49
|
-
printf '.' && sleep 1 && n=$(( $n - 1 ))
|
50
|
-
done
|
51
|
-
echo
|
52
|
-
|
53
|
-
if test $n -lt 0 && test -s $old_pid
|
54
|
-
then
|
55
|
-
echo >&2 "$old_pid still exists after $TIMEOUT seconds"
|
56
|
-
exit 1
|
57
|
-
fi
|
58
|
-
exit 0
|
59
|
-
fi
|
60
|
-
echo >&2 "Couldn't upgrade, starting '$CMD' instead"
|
61
|
-
$CMD
|
62
|
-
;;
|
63
|
-
reopen-logs)
|
64
|
-
sig USR1
|
65
|
-
;;
|
66
|
-
*)
|
67
|
-
echo >&2 "Usage: $0 <start|stop|restart|upgrade|force-stop|reopen-logs>"
|
68
|
-
exit 1
|
69
|
-
;;
|
70
|
-
esac
|
@@ -1,5 +0,0 @@
|
|
1
|
-
check process unicorn with pidfile {{ be_app_path }}/tmp/unicorn/unicorn.pid
|
2
|
-
start program "/etc/init.d/unicorn_{{ app_name }} start" as uid deployer and gid deployer with timeout 90 seconds
|
3
|
-
restart program "/etc/init.d/unicorn_{{ app_name }} restart" as uid deployer and gid deployer with timeout 90 seconds
|
4
|
-
stop program "/etc/init.d/unicorn_{{ app_name }} stop" as uid deployer and gid deployer with timeout 90 seconds
|
5
|
-
if 5 restarts within 5 cycles then timeout
|
@@ -1 +0,0 @@
|
|
1
|
-
.DS_Store
|
@@ -1,34 +0,0 @@
|
|
1
|
-
---
|
2
|
-
language: python
|
3
|
-
python: "2.7"
|
4
|
-
|
5
|
-
env:
|
6
|
-
- SITE=test.yml
|
7
|
-
|
8
|
-
before_install:
|
9
|
-
- sudo apt-get update -qq
|
10
|
-
- sudo apt-get install -y curl
|
11
|
-
|
12
|
-
install:
|
13
|
-
# Install Ansible.
|
14
|
-
- pip install ansible
|
15
|
-
|
16
|
-
# Add ansible.cfg to pick up roles path.
|
17
|
-
- "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg"
|
18
|
-
|
19
|
-
script:
|
20
|
-
# Check the role/playbook's syntax.
|
21
|
-
- "ansible-playbook -i tests/inventory tests/$SITE --syntax-check"
|
22
|
-
|
23
|
-
# Run the role/playbook with ansible-playbook.
|
24
|
-
- "ansible-playbook -i tests/inventory tests/$SITE --connection=local --sudo"
|
25
|
-
|
26
|
-
# Run the role/playbook again, checking to make sure it's idempotent.
|
27
|
-
- >
|
28
|
-
ansible-playbook -i tests/inventory tests/$SITE --connection=local --sudo
|
29
|
-
| grep -q 'changed=0.*failed=0'
|
30
|
-
&& (echo 'Idempotence test: pass' && exit 0)
|
31
|
-
|| (echo 'Idempotence test: fail' && exit 1)
|
32
|
-
|
33
|
-
# Check the version of Memcached (if this output fails, it's not running).
|
34
|
-
- memcached -h | head -1
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# Ansible Role: Memcached
|
2
|
-
|
3
|
-
[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-memcached.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-memcached)
|
4
|
-
|
5
|
-
An Ansible Role that installs Memcached on RedHat/CentOS or Debian/Ubuntu Linux.
|
6
|
-
|
7
|
-
## Requirements
|
8
|
-
|
9
|
-
None.
|
10
|
-
|
11
|
-
## Role Variables
|
12
|
-
|
13
|
-
Available variables are listed below, along with default values (see `defaults/main.yml`):
|
14
|
-
|
15
|
-
memcached_user: memcache
|
16
|
-
|
17
|
-
The user under which the Memcached daemon will run.
|
18
|
-
|
19
|
-
memcached_port: 11211
|
20
|
-
memcached_listen_ip: 127.0.0.1
|
21
|
-
|
22
|
-
The port and IP address (127.0.0.1 for localhost) on which Memcached will listen for requests.
|
23
|
-
|
24
|
-
memcached_memory_limit: 64
|
25
|
-
memcached_connections: 1024
|
26
|
-
|
27
|
-
Memcached limits. The maximum amount of RAM `memcached` will consume (64MB is the default), and the maximum number of simultaneous connections memcached will handle.
|
28
|
-
|
29
|
-
memcached_log_file: /var/log/memcached.log
|
30
|
-
|
31
|
-
The location of the memcached log file.
|
32
|
-
|
33
|
-
memcached_log_verbosity: ""
|
34
|
-
|
35
|
-
Normally memcached does not log anything. Change to "-v" to enable logging or to "-vv" for debug logging.
|
36
|
-
|
37
|
-
## Dependencies
|
38
|
-
|
39
|
-
None.
|
40
|
-
|
41
|
-
## Example Playbook
|
42
|
-
|
43
|
-
- hosts: cache
|
44
|
-
roles:
|
45
|
-
- { role: geerlingguy.memcached }
|
46
|
-
|
47
|
-
## License
|
48
|
-
|
49
|
-
MIT / BSD
|
50
|
-
|
51
|
-
## Author Information
|
52
|
-
|
53
|
-
This role was created in 2014 by [Jeff Geerling](http://jeffgeerling.com/), author of [Ansible for DevOps](http://ansiblefordevops.com/).
|
@@ -1 +0,0 @@
|
|
1
|
-
{install_date: 'Thu Jan 5 14:34:16 2017', version: 1.0.4}
|
@@ -1,24 +0,0 @@
|
|
1
|
-
---
|
2
|
-
dependencies: []
|
3
|
-
|
4
|
-
galaxy_info:
|
5
|
-
author: geerlingguy
|
6
|
-
description: Memcached for Linux
|
7
|
-
company: "Midwestern Mac, LLC"
|
8
|
-
license: "license (BSD, MIT)"
|
9
|
-
min_ansible_version: 1.4
|
10
|
-
platforms:
|
11
|
-
- name: EL
|
12
|
-
versions:
|
13
|
-
- 6
|
14
|
-
- 7
|
15
|
-
- name: Ubuntu
|
16
|
-
versions:
|
17
|
-
- precise
|
18
|
-
- trusty
|
19
|
-
- name: Debian
|
20
|
-
versions:
|
21
|
-
- all
|
22
|
-
categories:
|
23
|
-
- web
|
24
|
-
- database
|
@@ -1,29 +0,0 @@
|
|
1
|
-
---
|
2
|
-
# Include variables and define needed variables.
|
3
|
-
- name: Include OS-specific variables.
|
4
|
-
include_vars: "{{ ansible_os_family }}.yml"
|
5
|
-
|
6
|
-
- name: Define memcached_user.
|
7
|
-
set_fact:
|
8
|
-
memcached_user: "{{ __memcached_user }}"
|
9
|
-
when: memcached_user is not defined
|
10
|
-
|
11
|
-
# Setup/install tasks.
|
12
|
-
- include: setup-RedHat.yml
|
13
|
-
when: ansible_os_family == 'RedHat'
|
14
|
-
|
15
|
-
- include: setup-Debian.yml
|
16
|
-
when: ansible_os_family == 'Debian'
|
17
|
-
|
18
|
-
# Configure Memcached.
|
19
|
-
- name: Copy Memcached configuration.
|
20
|
-
template:
|
21
|
-
src: memcached-{{ ansible_os_family }}.conf.j2
|
22
|
-
dest: "{{ memcached_config_file }}"
|
23
|
-
owner: root
|
24
|
-
group: root
|
25
|
-
mode: 0644
|
26
|
-
notify: restart memcached
|
27
|
-
|
28
|
-
- name: Ensure Memcached is started and set to run on startup.
|
29
|
-
service: name=memcached state=started enabled=yes
|