taperole 1.2.8 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/.hound.yml +7 -0
  3. data/CHANGELOG.md +12 -0
  4. data/README.md +7 -16
  5. data/config/style_guides/ruby.yml +238 -0
  6. data/lib/tape/ansible_runner.rb +41 -33
  7. data/lib/tape/installer.rb +56 -28
  8. data/lib/tape.rb +8 -0
  9. data/requirements.yml +5 -2
  10. data/roles/backend_install_essentials/meta/main.yml +1 -1
  11. data/roles/database_load/tasks/db_reset.yml +3 -3
  12. data/roles/deployer_user/tasks/keys.yml +3 -2
  13. data/roles/frontend_deploy/tasks/main.yml +5 -1
  14. data/roles/frontend_install_essentials/meta/main.yml +3 -0
  15. data/roles/general/meta/main.yml +2 -0
  16. data/roles/general/tasks/basic_packages.yml +3 -0
  17. data/roles/general/tasks/main.yml +11 -1
  18. data/roles/nginx/tasks/main.yml +6 -2
  19. data/taperole.gemspec +1 -1
  20. data/templates/base/hosts.example +1 -1
  21. data/templates/base/tape_vars.example.yml +0 -3
  22. data/templates/static_html/tape_vars.example.yml +0 -3
  23. data/vars/defaults.yml +5 -0
  24. data/vendor/ANXS.postgresql/.travis.yml +11 -6
  25. data/vendor/ANXS.postgresql/README.md +5 -1
  26. data/vendor/ANXS.postgresql/Vagrantfile +1 -1
  27. data/vendor/ANXS.postgresql/defaults/main.yml +35 -1
  28. data/vendor/ANXS.postgresql/meta/.galaxy_install_info +1 -1
  29. data/vendor/ANXS.postgresql/tasks/configure.yml +34 -3
  30. data/vendor/ANXS.postgresql/tasks/databases.yml +13 -0
  31. data/vendor/ANXS.postgresql/tasks/install.yml +22 -0
  32. data/vendor/ANXS.postgresql/tasks/users_privileges.yml +4 -4
  33. data/vendor/ANXS.postgresql/templates/etc_apt_preferences.d_apt_postgresql_org_pub_repos_apt.pref.j2 +5 -0
  34. data/vendor/ANXS.postgresql/templates/postgresql.conf-9.3.j2 +596 -0
  35. data/vendor/ANXS.postgresql/templates/postgresql.conf-9.4.j2 +614 -0
  36. data/vendor/ANXS.postgresql/vagrant-inventory +1 -1
  37. data/vendor/bennojoy.memcached/meta/.galaxy_install_info +1 -1
  38. data/vendor/jnv.mosh/LICENSE +24 -0
  39. data/vendor/jnv.mosh/README.md +56 -0
  40. data/vendor/jnv.mosh/meta/.galaxy_install_info +1 -0
  41. data/vendor/jnv.mosh/meta/main.yml +96 -0
  42. data/vendor/jnv.mosh/tasks/main.yml +20 -0
  43. data/vendor/jnv.mosh/vars/main.yml +4 -0
  44. data/vendor/jnv.unattended-upgrades/meta/.galaxy_install_info +1 -1
  45. data/vendor/lxhunter.apt/.gitignore +1 -0
  46. data/vendor/lxhunter.apt/.kitchen.yml +67 -0
  47. data/vendor/lxhunter.apt/README.md +33 -25
  48. data/vendor/lxhunter.apt/defaults/main.yml +1 -5
  49. data/vendor/lxhunter.apt/meta/.galaxy_install_info +1 -1
  50. data/vendor/lxhunter.apt/tasks/main.yml +23 -23
  51. data/vendor/lxhunter.apt/test/integration/default/bats/simple.bats +35 -0
  52. data/vendor/lxhunter.apt/test/integration/default/default.yml +16 -0
  53. data/vendor/tersmitten.htop/.gitignore +29 -0
  54. data/vendor/tersmitten.htop/.travis.yml +75 -0
  55. data/vendor/tersmitten.htop/LICENSE.txt +19 -0
  56. data/vendor/tersmitten.htop/README.md +45 -0
  57. data/vendor/tersmitten.htop/Vagrantfile +71 -0
  58. data/vendor/tersmitten.htop/defaults/main.yml +8 -0
  59. data/vendor/tersmitten.htop/files/etc/skel/.config/htop/htoprc +23 -0
  60. data/vendor/tersmitten.htop/handlers/main.yml +2 -0
  61. data/vendor/tersmitten.htop/meta/.galaxy_install_info +1 -0
  62. data/vendor/tersmitten.htop/meta/main.yml +18 -0
  63. data/vendor/tersmitten.htop/tasks/main.yml +27 -0
  64. data/vendor/tersmitten.htop/templates/empty +0 -0
  65. data/vendor/tersmitten.htop/tests/inventory +1 -0
  66. data/vendor/tersmitten.htop/tests/test.yml +6 -0
  67. data/vendor/tersmitten.htop/tests/vagrant.yml +17 -0
  68. data/vendor/tersmitten.htop/vars/main.yml +2 -0
  69. data/vendor/williamyeh.nodejs/.gitignore +1 -0
  70. data/vendor/williamyeh.nodejs/LICENSE +22 -0
  71. data/vendor/williamyeh.nodejs/README.md +107 -0
  72. data/vendor/williamyeh.nodejs/Vagrantfile +33 -0
  73. data/vendor/williamyeh.nodejs/circle.yml +32 -0
  74. data/vendor/williamyeh.nodejs/defaults/main.yml +17 -0
  75. data/vendor/williamyeh.nodejs/files/nodesource.gpg.key +52 -0
  76. data/vendor/williamyeh.nodejs/meta/.galaxy_install_info +1 -0
  77. data/vendor/williamyeh.nodejs/meta/main.yml +27 -0
  78. data/vendor/williamyeh.nodejs/tasks/main.yml +19 -0
  79. data/vendor/williamyeh.nodejs/tasks/set-role-variables.yml +15 -0
  80. data/vendor/williamyeh.nodejs/tasks/use-apt.yml +88 -0
  81. data/vendor/williamyeh.nodejs/tasks/use-yum.yml +34 -0
  82. data/vendor/williamyeh.nodejs/test/Dockerfile-centos6 +29 -0
  83. data/vendor/williamyeh.nodejs/test/Dockerfile-centos7 +29 -0
  84. data/vendor/williamyeh.nodejs/test/Dockerfile-debian7 +29 -0
  85. data/vendor/williamyeh.nodejs/test/Dockerfile-debian8 +29 -0
  86. data/vendor/williamyeh.nodejs/test/Dockerfile-ubuntu12.04 +29 -0
  87. data/vendor/williamyeh.nodejs/test/Dockerfile-ubuntu14.04 +29 -0
  88. data/vendor/williamyeh.nodejs/test.yml +12 -0
  89. data/vendor/zzet.rbenv/.travis.yml +5 -2
  90. data/vendor/zzet.rbenv/README.md +1 -1
  91. data/vendor/zzet.rbenv/defaults/main.yml +3 -3
  92. data/vendor/zzet.rbenv/meta/.galaxy_install_info +1 -1
  93. data/vendor/zzet.rbenv/tasks/apt_build_depends.yml +7 -0
  94. data/vendor/zzet.rbenv/tasks/homebrew_build_depends.yml +4 -2
  95. data/vendor/zzet.rbenv/tasks/main.yml +5 -2
  96. metadata +53 -7
  97. data/lib/tape/vagrant_provisioner.rb +0 -42
  98. data/vendor/ANXS.postgresql/templates/postgresql.conf.j2 +0 -446
  99. data/vendor/lxhunter.apt/.travis.yml +0 -12
  100. data/vendor/lxhunter.apt/Vagrantfile +0 -16
  101. data/vendor/lxhunter.apt/templates/apt_10general.j2 +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b222a5a4cae4120e81b66cb9000fe978e757a8c1
4
- data.tar.gz: dd1609ccb8a53d633fed08b303fe00285f2c3c5e
3
+ metadata.gz: 32498ae112df7133fcf2c96346e0665e0c4d139b
4
+ data.tar.gz: ea3f9bc72d365df38432cbacfc3166bd82c3b054
5
5
  SHA512:
6
- metadata.gz: 713a7ff37a753a09d8a0a4a449fce988360b958d437c63736e78879fc5f263a7327670949736825402f68e42a44c08d06f9d0b6bac6f9f8bcb653a30c2ff1e2f
7
- data.tar.gz: dc899db4d9cefe5439f57a0925743449d64795599a21a74d1806eb2d5aca774ce9c75b255ba14477749b9d8c1e647531a3f1bf501746914b9894a2088d8147a4
6
+ metadata.gz: be6c223a0f1aee40640b6b8f80c37534915953034eef3884a76876ad8e1bb9dcf65a4d2b5d45d19cd9646dbdd0215c8fa17dedcf74542a4e3f64cd421cac000e
7
+ data.tar.gz: 69d9871011dff3e0522b3dc335146e982f97e83add1343263df1542d14f0df2d44ecec9d19b8e4e8902d59d8492b3538c52802b427cd10b365850be997557b3a
data/.hound.yml ADDED
@@ -0,0 +1,7 @@
1
+ fail_on_violations: true
2
+
3
+ ruby:
4
+ config_file: config/style_guides/ruby.yml
5
+
6
+ AllCops:
7
+ RunRailsCops: false
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ### 1.3.0
2
+ * Puts all tape focused files for a repo into a taperole/ directory
3
+ * Installs mosh
4
+ * Installs htop
5
+ * Removes vagrant runner
6
+ * Auto-detect dev_keys
7
+ * Only try to fe_deploy if fe_app_repo is defined
8
+ * Control nginx with monit
9
+ * Updates Readme
10
+ * Disable retry files
11
+ * tape will not check that requires vars are defined before proceeding with provisioning
12
+
1
13
  ### 1.2.3
2
14
  * Fixed issue where users who were using vagrant could not ssh into the deployer user
3
15
  * Fixed issue where vagrant boxes init script was failing because .ssh dir already existed
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  [![Stories in Ready](https://badge.waffle.io/smashingboxes/taperole.png?label=ready&title=Ready)](https://waffle.io/smashingboxes/tape)
2
2
  # Infrastructure Management
3
3
 
4
+ [![Join the chat at https://gitter.im/smashingboxes/taperole](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/smashingboxes/taperole?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5
+
4
6
  ## Deploying & provisioning with tape
5
7
  **Use Unbuntu precise64 (12.04 x64)**
6
8
 
@@ -36,7 +38,7 @@ tape installer install
36
38
  ```
37
39
 
38
40
  ### Custom roles
39
- You can write app specific roles in the roles files storred in the `roles` directory
41
+ You can write app specific roles in the roles files stored in the `roles` directory
40
42
 
41
43
  You must then specify the roles you want to use in `omnibox.yml` or `deploy.yml`
42
44
 
@@ -55,7 +57,7 @@ production
55
57
  staging
56
58
  ```
57
59
 
58
- then use the `-l` option to specify the staging
60
+ Then use the `-l` option to specify the staging
59
61
 
60
62
  ```sh
61
63
  tape ansible deploy -l staging
@@ -65,31 +67,20 @@ tape ansible deploy -l staging
65
67
  ### With vagrant
66
68
 
67
69
 
68
- 1. `vagrant up` or `tape vagrant create`
70
+ 1. `vagrant up`
69
71
  2. Put the following into your [hosts inventory file](http://docs.ansible.com/intro_inventory.html):
70
72
 
71
73
  ```
72
74
  [vagrant]
73
- <192.168.13.37> ansible_ssh_private_key_file=~/.vagrant.d/insecure_private_key
75
+ localhost:2222 ansible_ssh_private_key_file=~/.vagrant.d/insecure_private_key
74
76
  ```
75
77
 
76
78
  The port number might be different if other vagrant machines are running, run `vagrant ssh-config` to find the correct configuration.
77
- You can speicfy a port using the `ansible_ssh_port` in your hosts inventory file.
79
+ You can specify a port using the `ansible_ssh_port` in your hosts inventory file.
78
80
 
79
81
  3. Update `tape_vars.yml` with information to a [rails app you want to deploy](https://github.com/BrandonMathis/vanilla-rails-app)
80
82
  4. `tape ansible everything -l vagrant`
81
83
 
82
-
83
- ### With QEMU
84
-
85
- 1. `tape qemu create --name fe_test`
86
- 2. `tape qemu start --name fe_test -p2255`
87
- 3. `ssh-add ./id_rsa_sb_basebox`
88
- 4. `echo 'localhost:2255' >test_hosts`
89
- 5. `tape ansible everything`
90
-
91
- Run `tape -h` for a quick rundown of the tool's modules and options.
92
-
93
84
  ## Development
94
85
 
95
86
  ```sh
@@ -0,0 +1,238 @@
1
+ AllCops:
2
+ Exclude:
3
+ - "vendor/**/*"
4
+ - "db/schema.rb"
5
+ UseCache: false
6
+ Style/CollectionMethods:
7
+ Description: Preferred collection methods.
8
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size
9
+ Enabled: false
10
+ PreferredMethods:
11
+ collect: map
12
+ collect!: map!
13
+ find_all: select
14
+ reduce: inject
15
+ Style/DotPosition:
16
+ Description: Checks the position of the dot in multi-line method calls.
17
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
18
+ Enabled: true
19
+ EnforcedStyle: trailing
20
+ SupportedStyles:
21
+ - leading
22
+ - trailing
23
+ Style/FileName:
24
+ Description: Use snake_case for source file names.
25
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
26
+ Enabled: false
27
+ Exclude: []
28
+ Style/GuardClause:
29
+ Description: Check for conditionals that can be replaced with guard clauses
30
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
31
+ Enabled: false
32
+ MinBodyLength: 1
33
+ Style/IfUnlessModifier:
34
+ Description: Favor modifier if/unless usage when you have a single-line body.
35
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier
36
+ Enabled: false
37
+ MaxLineLength: 100
38
+ Style/OptionHash:
39
+ Description: Don't use option hashes when you can use keyword arguments.
40
+ Enabled: false
41
+ Style/PercentLiteralDelimiters:
42
+ Description: Use `%`-literal delimiters consistently
43
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-literal-braces
44
+ Enabled: false
45
+ PreferredDelimiters:
46
+ "%": "()"
47
+ "%i": "()"
48
+ "%q": "()"
49
+ "%Q": "()"
50
+ "%r": "{}"
51
+ "%s": "()"
52
+ "%w": "()"
53
+ "%W": "()"
54
+ "%x": "()"
55
+ Style/PredicateName:
56
+ Description: Check the names of predicate methods.
57
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
58
+ Enabled: true
59
+ NamePrefix:
60
+ - is_
61
+ - has_
62
+ - have_
63
+ NamePrefixBlacklist:
64
+ - is_
65
+ Exclude:
66
+ - spec/**/*
67
+ Style/RaiseArgs:
68
+ Description: Checks the arguments passed to raise/fail.
69
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#exception-class-messages
70
+ Enabled: false
71
+ EnforcedStyle: exploded
72
+ SupportedStyles:
73
+ - compact
74
+ - exploded
75
+ Style/SignalException:
76
+ Description: Checks for proper usage of fail and raise.
77
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method
78
+ Enabled: false
79
+ EnforcedStyle: semantic
80
+ SupportedStyles:
81
+ - only_raise
82
+ - only_fail
83
+ - semantic
84
+ Style/SingleLineBlockParams:
85
+ Description: Enforces the names of some block params.
86
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#reduce-blocks
87
+ Enabled: false
88
+ Methods:
89
+ - reduce:
90
+ - a
91
+ - e
92
+ - inject:
93
+ - a
94
+ - e
95
+ Style/SingleLineMethods:
96
+ Description: Avoid single-line methods.
97
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-single-line-methods
98
+ Enabled: false
99
+ AllowIfMethodIsEmpty: true
100
+ Style/StringLiterals:
101
+ Enabled: false
102
+ Style/StringLiteralsInInterpolation:
103
+ Description: Checks if uses of quotes inside expressions in interpolated strings
104
+ match the configured preference.
105
+ Enabled: false
106
+ EnforcedStyle: single_quotes
107
+ SupportedStyles:
108
+ - single_quotes
109
+ - double_quotes
110
+ Style/TrailingComma:
111
+ Description: Checks for trailing comma in parameter lists and literals.
112
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas
113
+ Enabled: false
114
+ EnforcedStyleForMultiline: no_comma
115
+ SupportedStyles:
116
+ - comma
117
+ - no_comma
118
+ Metrics/AbcSize:
119
+ Description: A calculated magnitude based on number of assignments, branches, and
120
+ conditions.
121
+ Enabled: false
122
+ Max: 15
123
+ Metrics/ClassLength:
124
+ Description: Avoid classes longer than 100 lines of code.
125
+ Enabled: false
126
+ CountComments: false
127
+ Max: 100
128
+ Metrics/ModuleLength:
129
+ CountComments: false
130
+ Max: 100
131
+ Description: Avoid modules longer than 100 lines of code.
132
+ Enabled: false
133
+ Metrics/CyclomaticComplexity:
134
+ Description: A complexity metric that is strongly correlated to the number of test
135
+ cases needed to validate a method.
136
+ Enabled: false
137
+ Max: 6
138
+ Metrics/MethodLength:
139
+ Description: Avoid methods longer than 10 lines of code.
140
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
141
+ Enabled: false
142
+ CountComments: false
143
+ Max: 10
144
+ Metrics/ParameterLists:
145
+ Description: Avoid parameter lists longer than three or four parameters.
146
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params
147
+ Enabled: false
148
+ Max: 5
149
+ CountKeywordArgs: true
150
+ Metrics/PerceivedComplexity:
151
+ Description: A complexity metric geared towards measuring complexity for a human
152
+ reader.
153
+ Enabled: false
154
+ Max: 7
155
+ Metrics/LineLength:
156
+ Max: 100
157
+ # To make it possible to copy or click on URIs in the code, we allow lines
158
+ # contaning a URI to be longer than Max.
159
+ AllowURI: true
160
+ URISchemes:
161
+ - http
162
+ - https
163
+ Lint/AssignmentInCondition:
164
+ Description: Don't use assignment in conditions.
165
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition
166
+ Enabled: false
167
+ AllowSafeAssignment: true
168
+ Style/ClassAndModuleChildren:
169
+ Enabled: false
170
+ Style/InlineComment:
171
+ Description: Avoid inline comments.
172
+ Enabled: false
173
+ Style/AccessorMethodName:
174
+ Description: Check the naming of accessor methods for get_/set_.
175
+ Enabled: fals
176
+ Style/Alias:
177
+ Description: Use alias_method instead of alias.
178
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#alias-method
179
+ Enabled: false
180
+ Style/Documentation:
181
+ Description: Document classes and non-namespace modules.
182
+ Enabled: false
183
+ Style/DoubleNegation:
184
+ Description: Checks for uses of double negation (!!).
185
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-bang-bang
186
+ Enabled: false
187
+ Style/EachWithObject:
188
+ Description: Prefer `each_with_object` over `inject` or `reduce`.
189
+ Enabled: false
190
+ Style/EmptyLiteral:
191
+ Description: Prefer literals to Array.new/Hash.new/String.new.
192
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#literal-array-hash
193
+ Enabled: false
194
+ Style/ModuleFunction:
195
+ Description: Checks for usage of `extend self` in modules.
196
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#module-function
197
+ Enabled: false
198
+ Style/OneLineConditional:
199
+ Description: Favor the ternary operator(?:) over if/then/else/end constructs.
200
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
201
+ Enabled: false
202
+ Style/PerlBackrefs:
203
+ Description: Avoid Perl-style regex back references.
204
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers
205
+ Enabled: false
206
+ Style/Send:
207
+ Description: Prefer `Object#__send__` or `Object#public_send` to `send`, as `send`
208
+ may overlap with existing methods.
209
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#prefer-public-send
210
+ Enabled: false
211
+ Style/SpecialGlobalVars:
212
+ Description: Avoid Perl-style global variables.
213
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms
214
+ Enabled: false
215
+ Style/VariableInterpolation:
216
+ Description: Don't interpolate global, instance and class variables directly in
217
+ strings.
218
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate
219
+ Enabled: false
220
+ Style/WhenThen:
221
+ Description: Use when x then ... for one-line cases.
222
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases
223
+ Enabled: false
224
+ Lint/EachWithObjectArgument:
225
+ Description: Check for immutable argument given to each_with_object.
226
+ Enabled: true
227
+ Lint/HandleExceptions:
228
+ Description: Don't suppress exception.
229
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions
230
+ Enabled: false
231
+ Lint/LiteralInCondition:
232
+ Description: Checks of literals used in conditions.
233
+ Enabled: false
234
+ Lint/LiteralInInterpolation:
235
+ Description: Checks for literals used in interpolation.
236
+ Enabled: false
237
+ Rails/Output:
238
+ Enabled: false
@@ -4,45 +4,45 @@ class AnsibleRunner < ExecutionModule
4
4
  TapeBoxer.register_module :ansible, self
5
5
 
6
6
  action :configure_dj_runner,
7
- proc {ansible '-t configure_dj_runner -e force_dj_runner_restart=true'},
8
- "Configures and restarts the delayed job runner"
7
+ proc { ansible '-t configure_dj_runner -e force_dj_runner_restart=true' },
8
+ "Configures and restarts the delayed job runner"
9
9
  action :restart_unicorn,
10
- proc {ansible '-t unicorn_restart'},
11
- "Restarts the unicorns running on the app servers"
10
+ proc { ansible '-t unicorn_restart' },
11
+ "Restarts the unicorns running on the app servers"
12
12
  action :stop_unicorn,
13
- proc {ansible '-t unicorn_stop -e kill_unicorn=true'},
14
- "Stops the unicorns running on the app servers"
13
+ proc { ansible '-t unicorn_stop -e kill_unicorn=true' },
14
+ "Stops the unicorns running on the app servers"
15
15
  action :force_stop_unicorn,
16
- proc {ansible '-t unicorn_force_stop -e kill_unicorn=true'},
17
- "Stops the unicorns running on the app servers"
16
+ proc { ansible '-t unicorn_force_stop -e kill_unicorn=true' },
17
+ "Stops the unicorns running on the app servers"
18
18
  action :start_unicorn,
19
- proc {ansible '-t unicorn_start'},
20
- "Starts the unicorns running on the app servers"
19
+ proc { ansible '-t unicorn_start' },
20
+ "Starts the unicorns running on the app servers"
21
21
  action :restart_nginx,
22
- proc {ansible '-t restart_nginx'},
23
- "Restarts Nginx"
22
+ proc { ansible '-t restart_nginx' },
23
+ "Restarts Nginx"
24
24
  action :configure_deployer_user,
25
- proc {ansible '-t deployer'},
26
- "Ensures the deployer user is present and configures his SSH keys"
25
+ proc { ansible '-t deployer' },
26
+ "Ensures the deployer user is present and configures his SSH keys"
27
27
  action :reset_db,
28
- proc {ansible '-t db_reset -e force_db_reset=true'},
29
- "wipes and re-seeds the DB"
28
+ proc { ansible '-t db_reset -e force_db_reset=true' },
29
+ "wipes and re-seeds the DB"
30
30
  action :bundle,
31
- proc {ansible '-t bundle -e force_bundle=true'},
32
- "Bundles the gems running on the app servers"
31
+ proc { ansible '-t bundle -e force_bundle=true' },
32
+ "Bundles the gems running on the app servers"
33
33
  action :be_deploy,
34
- proc {ansible_deploy '-t be_deploy'},
35
- "Re-deploys fe code"
34
+ proc { ansible_deploy '-t be_deploy' },
35
+ "Re-deploys fe code"
36
36
  action :fe_deploy,
37
- proc {ansible_deploy '-t fe_deploy'},
38
- "Re-deploys fe code"
37
+ proc { ansible_deploy '-t fe_deploy' },
38
+ "Re-deploys fe code"
39
39
  action :deploy,
40
- proc {ansible_deploy '-t be_deploy,fe_deploy'},
41
- "Checks out app code, installs dependencies and restarts unicorns for "\
42
- "both FE and BE code."
40
+ proc { ansible_deploy '-t be_deploy,fe_deploy' },
41
+ "Checks out app code, installs dependencies and restarts unicorns for "\
42
+ "both FE and BE code."
43
43
  action :everything,
44
- proc { ansible if valid_preconfigs },
45
- "This does it all."
44
+ proc { ansible if valid_preconfigs },
45
+ "This does it all."
46
46
 
47
47
  def initialize(*args)
48
48
  super
@@ -53,7 +53,11 @@ class AnsibleRunner < ExecutionModule
53
53
 
54
54
  def valid_preconfigs
55
55
  if rails_app?
56
- return valid_gems
56
+ valid_gems
57
+ elsif fe_app?
58
+ true
59
+ else
60
+ false
57
61
  end
58
62
  end
59
63
 
@@ -71,11 +75,11 @@ class AnsibleRunner < ExecutionModule
71
75
  end
72
76
 
73
77
  def ansible(cmd_str = '')
74
- exec_ansible('omnibox.yml', cmd_str)
78
+ exec_ansible("#{tapefiles_dir}/omnibox.yml", cmd_str)
75
79
  end
76
80
 
77
81
  def ansible_deploy(cmd_str = '')
78
- exec_ansible('deploy.yml', cmd_str)
82
+ exec_ansible("#{tapefiles_dir}/deploy.yml", cmd_str)
79
83
  end
80
84
 
81
85
  def exec_ansible(playbook, args)
@@ -89,9 +93,13 @@ class AnsibleRunner < ExecutionModule
89
93
 
90
94
  def enforce_roles_path!
91
95
  Dir.mkdir('.tape') unless Dir.exists?('.tape')
92
- File.open('.tape/ansible.cfg', 'w') do |f|
96
+
97
+ File.open("#{local_dir}/.tape/ansible.cfg", 'w') do |f|
93
98
  f.puts '[defaults]'
94
- f.puts "roles_path=./roles:#{tape_dir}/roles:#{tape_dir}/vendor"
99
+ f.puts "roles_path=.tape/roles:#{tape_dir}/roles:#{tape_dir}/vendor"
100
+ f.puts "inventory=#{tapefiles_dir}/hosts"
101
+ f.puts "retries-dir=/dev/null"
102
+ f.puts "retry_files_enabled = False"
95
103
  f.puts '[ssh_connection]'
96
104
  f.puts 'ssh_args = -o ForwardAgent=yes'
97
105
  end
@@ -102,7 +110,7 @@ class AnsibleRunner < ExecutionModule
102
110
  end
103
111
 
104
112
  def inventory_file
105
- opts.inventory_file || "#{local_dir}/hosts"
113
+ opts.inventory_file || "#{tapefiles_dir}/hosts"
106
114
  end
107
115
  end
108
116
  end
@@ -3,11 +3,11 @@ module TapeBoxer
3
3
  TapeBoxer.register_module :installer, self
4
4
 
5
5
  action :install,
6
- proc {install},
7
- 'Creates all nessisary hosts and config files'
6
+ proc { install },
7
+ 'Creates all necessary hosts and config files'
8
8
  action :uninstall,
9
- proc {uninstall},
10
- 'Cleans up files generated by the installer'
9
+ proc { uninstall },
10
+ 'Cleans up files generated by the installer'
11
11
 
12
12
  def initialize(*args)
13
13
  super
@@ -17,7 +17,7 @@ module TapeBoxer
17
17
 
18
18
  def install
19
19
  File.open('.gitignore', 'r+') { |f| f.puts '.tape' unless f.read =~/^\.tape$/ }
20
- mkdir 'roles'
20
+ mkdir tapefiles_dir
21
21
  if fe_app? && !rails_app?
22
22
  puts '🔎 JS/HTML app detected'.pink
23
23
  copy_static_app_examples
@@ -25,14 +25,28 @@ module TapeBoxer
25
25
  puts '🔎 Rails app detected'.pink
26
26
  copy_basic_examples
27
27
  end
28
- copy_example 'templates/base/hosts.example', 'hosts'
29
- mkdir 'dev_keys'
28
+ create_roles_dir
29
+ create_inventory_file
30
+ create_ssh_keys_dir
30
31
  print 'Are you going to use vagrant? (y/n): '
31
32
  if gets.chomp == 'y'
32
33
  copy_example 'Vagrantfile', 'Vagrantfile'
33
34
  end
34
35
  end
35
36
 
37
+ def create_roles_dir
38
+ mkdir "#{tapefiles_dir}/roles"
39
+ `touch #{tapefiles_dir}/roles/.keep`
40
+ end
41
+
42
+ def create_ssh_keys_dir
43
+ mkdir "#{tapefiles_dir}/dev_keys"
44
+ end
45
+
46
+ def create_inventory_file
47
+ copy_example 'templates/base/hosts.example', "#{tapefiles_dir}/hosts"
48
+ end
49
+
36
50
  def fe_app?
37
51
  !Dir["#{local_dir}/gulpfile.*"].empty?
38
52
  end
@@ -42,25 +56,43 @@ module TapeBoxer
42
56
  end
43
57
 
44
58
  def copy_static_app_examples
45
- copy_example 'templates/static_html/omnibox.example.yml', 'omnibox.yml'
46
- copy_example 'templates/static_html/deploy.example.yml', 'deploy.yml'
47
- copy_example 'templates/static_html/tape_vars.example.yml', 'tape_vars.yml'
59
+ copy_example(
60
+ 'templates/static_html/omnibox.example.yml',
61
+ "#{tapefiles_dir}/omnibox.yml"
62
+ )
63
+ copy_example(
64
+ 'templates/static_html/deploy.example.yml',
65
+ "#{tapefiles_dir}/deploy.yml"
66
+ )
67
+ copy_example(
68
+ 'templates/static_html/tape_vars.example.yml',
69
+ "#{tapefiles_dir}/tape_vars.yml"
70
+ )
48
71
  end
49
72
 
50
73
  def copy_basic_examples
51
- copy_example 'templates/base/omnibox.example.yml', 'omnibox.yml'
52
- copy_example 'templates/base/deploy.example.yml', 'deploy.yml'
53
- copy_example 'templates/base/tape_vars.example.yml', 'tape_vars.yml'
74
+ copy_example(
75
+ 'templates/base/omnibox.example.yml',
76
+ "#{tapefiles_dir}/omnibox.yml"
77
+ )
78
+ copy_example(
79
+ 'templates/base/deploy.example.yml',
80
+ "#{tapefiles_dir}/deploy.yml"
81
+ )
82
+ copy_example(
83
+ 'templates/base/tape_vars.example.yml',
84
+ "#{tapefiles_dir}/tape_vars.yml"
85
+ )
54
86
  end
55
87
 
56
88
  def uninstall
57
- rm 'omnibox.yml'
58
- rm 'deploy.yml'
59
- rm 'tape_vars.yml'
60
- rm 'roles'
61
- rm 'hosts'
62
- rm 'dev_keys'
63
- rm 'Vagrantfile'
89
+ rm "#{tapefiles_dir}/omnibox.yml"
90
+ rm "#{tapefiles_dir}/deploy.yml"
91
+ rm "#{tapefiles_dir}/tape_vars.yml"
92
+ rm "#{tapefiles_dir}/roles"
93
+ rm "#{tapefiles_dir}/hosts"
94
+ rm "#{tapefiles_dir}/dev_keys"
95
+ rm "Vagrantfile"
64
96
  end
65
97
 
66
98
  def rm(file)
@@ -70,7 +102,7 @@ module TapeBoxer
70
102
  end
71
103
 
72
104
  def mkdir(name)
73
- print "#{name}: "
105
+ print "#{Pathname.new(name).basename}: "
74
106
  begin
75
107
  FileUtils.mkdir name
76
108
  success
@@ -82,17 +114,13 @@ module TapeBoxer
82
114
  end
83
115
  end
84
116
 
85
- def touch(file)
86
- File.new "#{local_dir}/#{file}", 'w'
87
- end
88
-
89
117
  def copy_example(file, cp_file)
90
- print "#{cp_file}: "
118
+ print "#{Pathname.new(cp_file).basename}: "
91
119
  begin
92
- if File.exists?("#{local_dir}/#{cp_file}")
120
+ if File.exist?("#{cp_file}")
93
121
  exists
94
122
  else
95
- FileUtils.cp("#{tape_dir}/#{file}", "#{local_dir}/#{cp_file}")
123
+ FileUtils.cp("#{tape_dir}/#{file}", "#{cp_file}")
96
124
  success
97
125
  end
98
126
  rescue Exception => e
data/lib/tape.rb CHANGED
@@ -78,6 +78,14 @@ module TapeBoxer
78
78
  def local_dir
79
79
  Dir.pwd
80
80
  end
81
+
82
+ def tapefiles_dir
83
+ local_dir + '/taperole'
84
+ end
85
+
86
+ def tapecfg_dir
87
+ local_dir + '/.tape'
88
+ end
81
89
  end
82
90
  end
83
91
 
data/requirements.yml CHANGED
@@ -10,7 +10,10 @@
10
10
  - src: https://github.com/ANXS/postgresql
11
11
  name: ANXS.postgresql
12
12
 
13
- - src: leonelgalan.node
14
- version: '0.2'
13
+ - src: williamyeh.nodejs
15
14
 
16
15
  - src: bennojoy.memcached
16
+
17
+ - src: jnv.mosh
18
+
19
+ - src: tersmitten.htop
@@ -2,4 +2,4 @@
2
2
  dependencies:
3
3
  - role: bennojoy.memcached
4
4
  - role: zzet.rbenv
5
- - role: leonelgalan.node
5
+ - role: williamyeh.nodejs
@@ -1,5 +1,5 @@
1
- - name: stop unicorns
2
- service: name=unicorn_{{app_name}} state=stopped
1
+ - name: stop everything
2
+ command: bash -lc "monit stop all"
3
3
 
4
4
  - name: Reset DB
5
5
  command: chdir={{ be_app_path }}
@@ -11,4 +11,4 @@
11
11
  when: db_reset.stderr
12
12
 
13
13
  - name: start unicorns
14
- service: name=unicorn_{{app_name}} state=started
14
+ command: bash -lc "monit start all"
@@ -9,11 +9,12 @@
9
9
  command: "cp /root/.ssh/authorized_keys /home/{{ deployer_user.name }}/.ssh/authorized_keys"
10
10
 
11
11
  - name: Ensure devs keys are present
12
- authorized_key: key="{{ lookup('file', local_dir + '/' + item) }}"
12
+ authorized_key: key=
13
13
  manage_dir=yes
14
14
  state=present
15
15
  user=deployer
16
- with_items: dev_key_files
16
+ with_fileglob:
17
+ - "{{tapefiles_dir}}/dev_keys/*"
17
18
 
18
19
  - name: Ensure DO pubkey is present
19
20
  authorized_key: key="{{ lookup('file', 'id_rsa_digital_ocean.pub') }}"