smartmachine 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (229) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.rdoc +0 -0
  3. data/README.rdoc +87 -0
  4. data/bin/buildpacker +8 -0
  5. data/bin/prereceiver +8 -0
  6. data/bin/smartmachine +81 -0
  7. data/bin/smartrunner +28 -0
  8. data/lib/smart_machine.rb +24 -0
  9. data/lib/smart_machine/apps.rb +14 -0
  10. data/lib/smart_machine/apps/app.rb +182 -0
  11. data/lib/smart_machine/apps/rails.rb +250 -0
  12. data/lib/smart_machine/base.rb +11 -0
  13. data/lib/smart_machine/boot.rb +31 -0
  14. data/lib/smart_machine/buildpacker.rb +106 -0
  15. data/lib/smart_machine/credentials.rb +126 -0
  16. data/lib/smart_machine/docker.rb +144 -0
  17. data/lib/smart_machine/engine.rb +82 -0
  18. data/lib/smart_machine/engine/Dockerfile +27 -0
  19. data/lib/smart_machine/engine/buildpacks/rails/Dockerfile +21 -0
  20. data/lib/smart_machine/gem_version.rb +17 -0
  21. data/lib/smart_machine/grids.rb +15 -0
  22. data/lib/smart_machine/grids/elasticsearch.rb +97 -0
  23. data/lib/smart_machine/grids/elasticsearch/.keep +0 -0
  24. data/lib/smart_machine/grids/minio.rb +77 -0
  25. data/lib/smart_machine/grids/minio/.keep +0 -0
  26. data/lib/smart_machine/grids/mysql.rb +66 -0
  27. data/lib/smart_machine/grids/mysql/docker-entrypoint-initdb.d/.keep +0 -0
  28. data/lib/smart_machine/grids/nginx.rb +137 -0
  29. data/lib/smart_machine/grids/nginx/.keep +0 -0
  30. data/lib/smart_machine/grids/prereceiver.rb +170 -0
  31. data/lib/smart_machine/grids/prereceiver/Dockerfile +20 -0
  32. data/lib/smart_machine/grids/prereceiver/fcgiwrap/APKBUILD +49 -0
  33. data/lib/smart_machine/grids/prereceiver/fcgiwrap/fcgiwrap.confd +6 -0
  34. data/lib/smart_machine/grids/prereceiver/fcgiwrap/fcgiwrap.initd +43 -0
  35. data/lib/smart_machine/grids/prereceiver/fcgiwrap/fcgiwrap.pre-install +7 -0
  36. data/lib/smart_machine/grids/prereceiver/fcgiwrap/packages/main/x86_64/APKINDEX.tar.gz +0 -0
  37. data/lib/smart_machine/grids/prereceiver/fcgiwrap/packages/main/x86_64/fcgiwrap-1.1.1-r4.apk +0 -0
  38. data/lib/smart_machine/grids/prereceiver/fcgiwrap/packages/main/x86_64/fcgiwrap-doc-1.1.1-r4.apk +0 -0
  39. data/lib/smart_machine/grids/prereceiver/fcgiwrap/packages/main/x86_64/fcgiwrap-openrc-1.1.1-r4.apk +0 -0
  40. data/lib/smart_machine/grids/redis.rb +58 -0
  41. data/lib/smart_machine/grids/redis/.keep +0 -0
  42. data/lib/smart_machine/grids/solr.rb +99 -0
  43. data/lib/smart_machine/grids/solr/config/.keep +0 -0
  44. data/lib/smart_machine/grids/solr/config/README.txt +77 -0
  45. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/contractions_ca.txt +8 -0
  46. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/contractions_fr.txt +15 -0
  47. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/contractions_ga.txt +5 -0
  48. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/contractions_it.txt +23 -0
  49. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/hyphenations_ga.txt +5 -0
  50. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stemdict_nl.txt +6 -0
  51. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stoptags_ja.txt +420 -0
  52. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_ar.txt +125 -0
  53. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_bg.txt +193 -0
  54. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_ca.txt +220 -0
  55. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_cz.txt +172 -0
  56. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_da.txt +110 -0
  57. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_de.txt +294 -0
  58. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_el.txt +78 -0
  59. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_en.txt +54 -0
  60. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_es.txt +356 -0
  61. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_eu.txt +99 -0
  62. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_fa.txt +313 -0
  63. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_fi.txt +97 -0
  64. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_fr.txt +186 -0
  65. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_ga.txt +110 -0
  66. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_gl.txt +161 -0
  67. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_hi.txt +235 -0
  68. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_hu.txt +211 -0
  69. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_hy.txt +46 -0
  70. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_id.txt +359 -0
  71. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_it.txt +303 -0
  72. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_ja.txt +127 -0
  73. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_lv.txt +172 -0
  74. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_nl.txt +119 -0
  75. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_no.txt +194 -0
  76. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_pt.txt +253 -0
  77. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_ro.txt +233 -0
  78. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_ru.txt +243 -0
  79. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_sv.txt +133 -0
  80. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_th.txt +119 -0
  81. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/stopwords_tr.txt +212 -0
  82. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/lang/userdict_ja.txt +29 -0
  83. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/managed-schema +1007 -0
  84. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/params.json +20 -0
  85. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/protwords.txt +21 -0
  86. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/solrconfig.xml +1355 -0
  87. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/stopwords.txt +14 -0
  88. data/lib/smart_machine/grids/solr/config/configsets/_default/conf/synonyms.txt +29 -0
  89. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/_rest_managed.json +1 -0
  90. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/_schema_analysis_stopwords_english.json +38 -0
  91. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/_schema_analysis_synonyms_english.json +11 -0
  92. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/clustering/carrot2/README.txt +11 -0
  93. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/clustering/carrot2/kmeans-attributes.xml +19 -0
  94. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/clustering/carrot2/lingo-attributes.xml +24 -0
  95. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/clustering/carrot2/stc-attributes.xml +19 -0
  96. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/currency.xml +67 -0
  97. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/elevate.xml +42 -0
  98. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/contractions_ca.txt +8 -0
  99. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/contractions_fr.txt +15 -0
  100. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/contractions_ga.txt +5 -0
  101. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/contractions_it.txt +23 -0
  102. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/hyphenations_ga.txt +5 -0
  103. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stemdict_nl.txt +6 -0
  104. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stoptags_ja.txt +420 -0
  105. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_ar.txt +125 -0
  106. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_bg.txt +193 -0
  107. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_ca.txt +220 -0
  108. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_ckb.txt +136 -0
  109. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_cz.txt +172 -0
  110. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_da.txt +110 -0
  111. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_de.txt +294 -0
  112. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_el.txt +78 -0
  113. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_en.txt +54 -0
  114. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_es.txt +356 -0
  115. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_eu.txt +99 -0
  116. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_fa.txt +313 -0
  117. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_fi.txt +97 -0
  118. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_fr.txt +186 -0
  119. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_ga.txt +110 -0
  120. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_gl.txt +161 -0
  121. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_hi.txt +235 -0
  122. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_hu.txt +211 -0
  123. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_hy.txt +46 -0
  124. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_id.txt +359 -0
  125. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_it.txt +303 -0
  126. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_ja.txt +127 -0
  127. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_lv.txt +172 -0
  128. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_nl.txt +119 -0
  129. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_no.txt +194 -0
  130. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_pt.txt +253 -0
  131. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_ro.txt +233 -0
  132. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_ru.txt +243 -0
  133. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_sv.txt +133 -0
  134. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_th.txt +119 -0
  135. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/stopwords_tr.txt +212 -0
  136. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/lang/userdict_ja.txt +29 -0
  137. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/managed-schema +1187 -0
  138. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/mapping-FoldToASCII.txt +3813 -0
  139. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/mapping-ISOLatin1Accent.txt +246 -0
  140. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/params.json +11 -0
  141. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/protwords.txt +21 -0
  142. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/solrconfig.xml +1616 -0
  143. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/spellings.txt +2 -0
  144. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/stopwords.txt +14 -0
  145. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/synonyms.txt +29 -0
  146. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/update-script.js +53 -0
  147. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/README.txt +101 -0
  148. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/VM_global_library.vm +186 -0
  149. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/browse.vm +33 -0
  150. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/cluster.vm +19 -0
  151. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/cluster_results.vm +31 -0
  152. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/debug.vm +28 -0
  153. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/did_you_mean.vm +11 -0
  154. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/error.vm +11 -0
  155. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/facet_fields.vm +24 -0
  156. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/facet_pivot.vm +12 -0
  157. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/facet_queries.vm +12 -0
  158. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/facet_ranges.vm +23 -0
  159. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/facets.vm +10 -0
  160. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/footer.vm +43 -0
  161. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/head.vm +37 -0
  162. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/header.vm +7 -0
  163. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/hit.vm +25 -0
  164. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/hit_grouped.vm +43 -0
  165. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/hit_plain.vm +25 -0
  166. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/join_doc.vm +20 -0
  167. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/jquery.autocomplete.css +48 -0
  168. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/jquery.autocomplete.js +763 -0
  169. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/layout.vm +24 -0
  170. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/main.css +231 -0
  171. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/mime_type_lists.vm +68 -0
  172. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/pagination_bottom.vm +22 -0
  173. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/pagination_top.vm +29 -0
  174. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/product_doc.vm +32 -0
  175. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/query.vm +42 -0
  176. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/query_form.vm +64 -0
  177. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/query_group.vm +43 -0
  178. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/query_spatial.vm +75 -0
  179. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/results_list.vm +22 -0
  180. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/richtext_doc.vm +153 -0
  181. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/suggest.vm +8 -0
  182. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/velocity/tabs.vm +50 -0
  183. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/xslt/example.xsl +132 -0
  184. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/xslt/example_atom.xsl +67 -0
  185. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/xslt/example_rss.xsl +66 -0
  186. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/xslt/luke.xsl +337 -0
  187. data/lib/smart_machine/grids/solr/config/configsets/sample_techproducts_configs/conf/xslt/updateXml.xsl +70 -0
  188. data/lib/smart_machine/grids/solr/config/configsets/sunspot/conf/_rest_managed.json +1 -0
  189. data/lib/smart_machine/grids/solr/config/configsets/sunspot/conf/admin-extra.html +31 -0
  190. data/lib/smart_machine/grids/solr/config/configsets/sunspot/conf/currency.xml +67 -0
  191. data/lib/smart_machine/grids/solr/config/configsets/sunspot/conf/elevate.xml +36 -0
  192. data/lib/smart_machine/grids/solr/config/configsets/sunspot/conf/lang/stopwords_en.txt +54 -0
  193. data/lib/smart_machine/grids/solr/config/configsets/sunspot/conf/mapping-ISOLatin1Accent.txt +246 -0
  194. data/lib/smart_machine/grids/solr/config/configsets/sunspot/conf/protwords.txt +21 -0
  195. data/lib/smart_machine/grids/solr/config/configsets/sunspot/conf/schema.xml +278 -0
  196. data/lib/smart_machine/grids/solr/config/configsets/sunspot/conf/scripts.conf +24 -0
  197. data/lib/smart_machine/grids/solr/config/configsets/sunspot/conf/solrconfig.xml +632 -0
  198. data/lib/smart_machine/grids/solr/config/configsets/sunspot/conf/spellings.txt +2 -0
  199. data/lib/smart_machine/grids/solr/config/configsets/sunspot/conf/synonyms.txt +29 -0
  200. data/lib/smart_machine/grids/solr/config/lib/.keep +0 -0
  201. data/lib/smart_machine/grids/solr/config/solr.xml +53 -0
  202. data/lib/smart_machine/grids/solr/config/zoo.cfg +31 -0
  203. data/lib/smart_machine/grids/solr/docker-entrypoint-initdb.d/.keep +0 -0
  204. data/lib/smart_machine/grids/solr/sunspot/conf/schema.xml +278 -0
  205. data/lib/smart_machine/grids/solr/sunspot/conf/solrconfig.xml +632 -0
  206. data/lib/smart_machine/logger.rb +35 -0
  207. data/lib/smart_machine/machine.rb +192 -0
  208. data/lib/smart_machine/ssh.rb +43 -0
  209. data/lib/smart_machine/sync.rb +108 -0
  210. data/lib/smart_machine/templates/dotsmartmachine/apps/containers/.keep +0 -0
  211. data/lib/smart_machine/templates/dotsmartmachine/apps/repositories/.keep +0 -0
  212. data/lib/smart_machine/templates/dotsmartmachine/config/environment.rb +18 -0
  213. data/lib/smart_machine/templates/dotsmartmachine/config/users.yml +4 -0
  214. data/lib/smart_machine/templates/dotsmartmachine/grids/elasticsearch/data/.keep +0 -0
  215. data/lib/smart_machine/templates/dotsmartmachine/grids/elasticsearch/logs/.keep +0 -0
  216. data/lib/smart_machine/templates/dotsmartmachine/grids/minio/data/.keep +0 -0
  217. data/lib/smart_machine/templates/dotsmartmachine/grids/mysql/data/.keep +0 -0
  218. data/lib/smart_machine/templates/dotsmartmachine/grids/nginx/certificates/.keep +0 -0
  219. data/lib/smart_machine/templates/dotsmartmachine/grids/nginx/fastcgi.conf +11 -0
  220. data/lib/smart_machine/templates/dotsmartmachine/grids/nginx/htpasswd/.keep +0 -0
  221. data/lib/smart_machine/templates/dotsmartmachine/grids/nginx/nginx.tmpl +373 -0
  222. data/lib/smart_machine/templates/dotsmartmachine/grids/prereceiver/pre-receive +17 -0
  223. data/lib/smart_machine/templates/dotsmartmachine/grids/redis/data/.keep +0 -0
  224. data/lib/smart_machine/templates/dotsmartmachine/grids/solr/solr/.keep +0 -0
  225. data/lib/smart_machine/templates/dotsmartmachine/tmp/.keep +0 -0
  226. data/lib/smart_machine/user.rb +38 -0
  227. data/lib/smart_machine/version.rb +10 -0
  228. metadata +297 -12
  229. data/README.md +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67c3eb74e67e5c8dac9368f7e4d166a4852d5f7066ec049918649586938e0965
4
- data.tar.gz: 45d22a409f14db62858e0781da682c42df50260debc5b3536e7e7097dedcec47
3
+ metadata.gz: b3ee76cffa4f2e68ce10d0cf6e2ab0734520ab901fd4cd37dc53b6e15a1690a9
4
+ data.tar.gz: 9c48ce88369327fb8914ece890b48349bb27b389b1f71e384bb7611869ac3a9b
5
5
  SHA512:
6
- metadata.gz: 42800c476312a609b3df9ed46b1615db12abe2c9ccdee693e7b11d09912ca7d9b333c141b0e22c3cdf111202d93042967f07fb21188dde4d03e22da8d9ecd262
7
- data.tar.gz: 15c13da59c777ee62fbe2364d7a0f5bff6a12aca0d527bb18fd4618bef236ed899b89733b52d1157ea31f4216924d5c8a90bbff9849095c5bb3141a0127a1c37
6
+ metadata.gz: c629d1bcf0900c3278fb21e9c794cee97f6f8842a9eadc411d13c4c606ffaa2b9e2ba4f2cc303dc79622e9bbf252e4cecaad72a39033f15747d22e7f972aee8b
7
+ data.tar.gz: 9bd5b57762ee72afad778b0883b6a96b430fa334784912e0e91502b9ea61b29befc687fc7bc4ee0bc39b2f7568c484d0fcf353764543f3afb34529b2c7ffc925
data/CHANGELOG.rdoc ADDED
File without changes
data/README.rdoc ADDED
@@ -0,0 +1,87 @@
1
+ = SmartMachine
2
+
3
+ Git push should deploy.
4
+
5
+ SmartMachine is a full-stack deployment framework for rails optimized for admin programmer happiness and peaceful administration. It encourages natural simplicity by favoring convention over configuration.
6
+
7
+ Deploy your Rails apps to your own server with - git push production master
8
+
9
+
10
+ == How it Works
11
+
12
+ After you run the below commands, you get.
13
+ 1. Setup of basic best practices of setting up and securing a VPS server.
14
+ 2. Setup and installation of Docker.
15
+ 3. Setup and installation of docker based Mysql, Solr, Nginx, App Prereceiver.
16
+ 4. Deployment of your Rails apps to your own server with - git push production master
17
+
18
+
19
+ == Setup a New Machine - Ubuntu 18.04 LTS
20
+
21
+ 1. Getting Started with Linode:
22
+
23
+ https://www.linode.com/docs/getting-started/
24
+
25
+ 2. How to Secure Your Server:
26
+
27
+ https://www.linode.com/docs/security/securing-your-server/
28
+
29
+
30
+ == Install SmartMachine
31
+
32
+ 1. Install Ruby:
33
+
34
+ $ sudo apt-get install ruby-full
35
+
36
+ 2. Add gem executables to PATH (remember to check ruby version in the path):
37
+
38
+ $ echo 'export PATH="$PATH:$HOME/.gem/ruby/2.5.0/bin"' >> ~/.bashrc && source ~/.bashrc
39
+
40
+ 3. Install smartmachine for current user:
41
+
42
+ $ gem install smartmachine --user-install
43
+
44
+ 4. Initialize smartmachine:
45
+
46
+ $ smartmachine init
47
+
48
+
49
+ == TODO - Setup Machine
50
+ 1. Getting Started and Securing your Server:
51
+
52
+ $ smartmachine machine install
53
+
54
+
55
+ == Install Docker
56
+
57
+ 1. Run docker install command:
58
+
59
+ $ smartmachine docker install
60
+
61
+ 2. Add UFW rules for Docker as specified at the end of installation.
62
+
63
+
64
+ == Starting Grids as per Choice
65
+
66
+ 1. Start mysql grid:
67
+
68
+ $ smartmachine grids mysql up
69
+
70
+ 2. Start solr grid:
71
+
72
+ $ smartmachine grids solr up
73
+
74
+ 3. Start nginx grid:
75
+
76
+ $ smartmachine grids nginx up
77
+
78
+ 4. Start prereceiver grid:
79
+
80
+ $ smartmachine grids prereceiver up
81
+
82
+
83
+ == TODO - Creating New App
84
+
85
+ 1. Creating a new bare app on the server:
86
+
87
+ $ smartmachine apps create <USERNAME> <APPNAME>
data/bin/buildpacker ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'smart_machine'
4
+
5
+ if ARGV[0] == 'pack'
6
+ buildpacker = SmartMachine::Buildpacker.new
7
+ buildpacker.pack
8
+ end
data/bin/prereceiver ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'smart_machine'
4
+
5
+ if ARGV[0] == 'prereceive'
6
+ raise "Please provide appname, username, oldrev, newrev and refname" unless ARGV[1] && ARGV[2] && ARGV[3] && ARGV[4] && ARGV[5]
7
+ SmartMachine::Grids::Prereceiver.prereceive(ARGV[1], ARGV[2], ARGV[3], ARGV[4], ARGV[5])
8
+ end
data/bin/smartmachine ADDED
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "smart_machine"
4
+
5
+ command = ARGV.shift
6
+
7
+ machine = SmartMachine::Machine.new
8
+
9
+ case command
10
+ when "new"
11
+ machine.create ARGV
12
+ return
13
+
14
+ when "--init-local"
15
+ machine.init_local ARGV
16
+ return
17
+
18
+ when "--version"
19
+ puts "SmartMachine #{SmartMachine.version}"
20
+ return
21
+
22
+ when "--help"
23
+ puts "Help: Specify a valid smartmachine command to execute. Are you in the correct directory to run this command?"
24
+ return
25
+
26
+ when "runner"
27
+ exec "smartrunner #{ARGV.join(' ')}"
28
+ return
29
+
30
+ end
31
+
32
+ if machine.in_local_machine_dir?
33
+ case command
34
+ when "credentials:edit"
35
+ credentials = SmartMachine::Credentials.new
36
+ credentials.edit
37
+
38
+ when "environment:edit"
39
+ system("#{ENV['EDITOR']} config/environment.rb")
40
+
41
+ when "users:edit"
42
+ system("#{ENV['EDITOR']} config/users.yml")
43
+
44
+ when "ssh"
45
+ machine.ssh
46
+
47
+ when "install"
48
+ machine.installer ARGV.unshift("install")
49
+
50
+ when "update"
51
+ machine.installer ARGV.unshift("update")
52
+
53
+ when "uninstall"
54
+ machine.installer ARGV.unshift("uninstall")
55
+
56
+ when "apps"
57
+ machine.apps ARGV
58
+
59
+ when "grids"
60
+ machine.grids ARGV
61
+ return
62
+
63
+ when "ps"
64
+ machine.ps ARGV
65
+ return
66
+
67
+ when "logs"
68
+ machine.logs ARGV
69
+ return
70
+
71
+ when "sync"
72
+ sync = SmartMachine::Sync.new
73
+ sync.run
74
+
75
+ else
76
+ exec "smartmachine --help"
77
+
78
+ end
79
+ else
80
+ exec "smartmachine --help"
81
+ end
data/bin/smartrunner ADDED
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "smart_machine"
4
+
5
+ command = ARGV.shift
6
+
7
+ machine = SmartMachine::Machine.new
8
+
9
+ case command
10
+ when "grids"
11
+ grids = SmartMachine::Grids.new
12
+ grids.run ARGV
13
+
14
+ when "apps"
15
+ grids = SmartMachine::Apps.new
16
+ grids.run ARGV
17
+
18
+ when "buildpacker"
19
+ action = ARGV.shift
20
+ buildpacker = SmartMachine::Buildpacker.new
21
+ buildpacker.public_send(action, *ARGV)
22
+
23
+ when "prereceiver"
24
+ action = ARGV.shift
25
+ prereceiver = SmartMachine::Grids::Prereceiver.new
26
+ prereceiver.public_send(action, *ARGV)
27
+
28
+ end
@@ -0,0 +1,24 @@
1
+ require "ostruct"
2
+ require "yaml"
3
+
4
+ # The main SmartMachine driver
5
+ module SmartMachine
6
+ def self.config
7
+ @@config ||= OpenStruct.new
8
+ end
9
+
10
+ def self.credentials
11
+ @@credentials ||= OpenStruct.new(SmartMachine::Credentials.new.config)
12
+ end
13
+ end
14
+
15
+ require 'smart_machine/version'
16
+
17
+ SmartMachine.config.root_path = File.expand_path('../..', __FILE__)
18
+ SmartMachine.config.user_home_path = File.expand_path('~')
19
+ if File.exist?("#{SmartMachine.config.user_home_path}/.smartmachine/config/environment.rb")
20
+ require "#{SmartMachine.config.user_home_path}/.smartmachine/config/environment"
21
+ end
22
+
23
+ require 'smart_machine/base'
24
+ require 'smart_machine/boot'
@@ -0,0 +1,14 @@
1
+ # The main SmartMachine Apps
2
+ module SmartMachine
3
+ class Apps < SmartMachine::Base
4
+ def run(*args)
5
+ args.flatten!
6
+
7
+ action = args.shift
8
+
9
+ raise "invalid action on the app" unless ['create', 'destroy', 'start', 'stop'].include? action
10
+
11
+ Object.const_get("SmartMachine::Apps::App").public_send(action, *args)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,182 @@
1
+ # The main SmartMachine App driver
2
+ module SmartMachine
3
+ class Apps
4
+ class App < SmartMachine::Base
5
+ def initialize
6
+ end
7
+
8
+ # Creating App!
9
+ #
10
+ # Example:
11
+ # >> SmartMachine::Apps::Rails.create
12
+ # => Creation Complete
13
+ #
14
+ # Arguments:
15
+ # appname => (String)
16
+ # username => (String)
17
+ def self.create(*args)
18
+ args.flatten!
19
+ appname = args.empty? ? '' : args.shift
20
+ username = args.empty? ? '' : args.shift
21
+
22
+ raise "Please provide appname and username" if appname.empty? || username.empty?
23
+
24
+ if SmartMachine::Docker.running?
25
+ repository_path = "#{SmartMachine.config.user_home_path}/.smartmachine/apps/repositories/#{appname}.git"
26
+ container_path = "#{SmartMachine.config.user_home_path}/.smartmachine/apps/containers/#{appname}"
27
+ print "-----> Creating Application ... "
28
+
29
+ # Checking if app with given name already exists
30
+ if Dir.exist?(repository_path)
31
+ puts "failed. App with name '#{appname}' already exists."
32
+ exit
33
+ end
34
+
35
+ # Creating Directories
36
+ FileUtils.mkdir_p(repository_path)
37
+ FileUtils.mkdir_p(container_path)
38
+
39
+ # Initializing bare repo and pre-receive
40
+ Dir.chdir(repository_path) do
41
+ %x[git init --bare]
42
+ %x[chmod +x #{SmartMachine.config.user_home_path}/.smartmachine/grids/prereceiver/pre-receive]
43
+ %x[ln -s #{SmartMachine.config.user_home_path}/.smartmachine/grids/prereceiver/pre-receive #{repository_path}/hooks/pre-receive]
44
+ puts "done"
45
+ end
46
+
47
+ # Creating Environment File
48
+ if File.exist?("#{SmartMachine.config.user_home_path}/.smartmachine/config/environment.rb")
49
+ require "#{SmartMachine.config.user_home_path}/.smartmachine/config/environment"
50
+ end
51
+ unless File.exist? "#{container_path}/env"
52
+ print "-----> Creating App Environment ... "
53
+ page = <<~HEREDOC
54
+ ## System
55
+ USERNAME=#{username}
56
+ KEEP_RELEASES=3
57
+
58
+ ## Docker
59
+ VIRTUAL_HOST=#{appname}.#{SmartMachine.config.apps_domain}
60
+ LETSENCRYPT_HOST=#{appname}.#{SmartMachine.config.apps_domain}
61
+ LETSENCRYPT_EMAIL=#{SmartMachine.config.sysadmin_email}
62
+ LETSENCRYPT_TEST=false
63
+ HEREDOC
64
+ puts "done" if system("echo '#{page}' > #{container_path}/env")
65
+ end
66
+ end
67
+ end
68
+
69
+ def self.destroy(*args)
70
+ args.flatten!
71
+ appname = args.empty? ? '' : args.shift
72
+
73
+ raise "Please provide appname" if appname.empty?
74
+
75
+ if SmartMachine::Docker.running?
76
+ # Stopping & Removing old container
77
+ self.stop(appname)
78
+
79
+ # Destroying Directories
80
+ print "-----> Deleting App #{appname} ... "
81
+ repository_path = "#{SmartMachine.config.user_home_path}/.smartmachine/apps/repositories/#{appname}.git"
82
+ container_path = "#{SmartMachine.config.user_home_path}/.smartmachine/apps/containers/#{appname}"
83
+ FileUtils.rm_r(repository_path)
84
+ FileUtils.rm_r(container_path)
85
+ puts "done"
86
+ end
87
+ end
88
+
89
+ def self.start(*args)
90
+ args.flatten!
91
+ appname = args.empty? ? '' : args.shift
92
+ app_version = args.empty? ? 0 : args.shift.to_i
93
+
94
+ raise "Please provide appname" if appname.empty?
95
+
96
+ logger.formatter = proc do |severity, datetime, progname, message|
97
+ severity_text = { "DEBUG" => "\u{1f527} #{severity}:", "INFO" => " \u{276f}", "WARN" => "\u{2757} #{severity}:",
98
+ "ERROR" => "\u{274c} #{severity}:", "FATAL" => "\u{2b55} #{severity}:", "UNKNOWN" => "\u{2753} #{severity}:"
99
+ }
100
+ "\t\t\t\t#{severity_text[severity]} #{message}\n"
101
+ end
102
+
103
+ if SmartMachine::Docker.running?
104
+ container_path = "#{SmartMachine.config.user_home_path}/.smartmachine/apps/containers/#{appname}"
105
+
106
+ Dir.chdir("#{container_path}/releases") do
107
+ # Getting App Version
108
+ if app_version == 0
109
+ app_versions = Dir.glob('*').select { |f| File.directory? f }.sort
110
+ app_version = app_versions.last
111
+ end
112
+ container_path_with_version = "#{container_path}/releases/#{app_version}"
113
+
114
+ logger.info "Launching Application ..."
115
+
116
+ app = SmartMachine::Apps::Rails.new
117
+ app.start(appname, container_path, container_path_with_version)
118
+ end
119
+ end
120
+
121
+ logger.formatter = nil
122
+ end
123
+
124
+ def self.stop(*args)
125
+ args.flatten!
126
+ appname = args.empty? ? '' : args.shift
127
+
128
+ raise "Please provide appname" if appname.empty?
129
+
130
+ container_name = appname
131
+
132
+ if SmartMachine::Docker.running?
133
+ container_id = `docker ps -a -q --filter='name=^#{container_name}$'`.chomp
134
+ unless container_id.empty?
135
+ logger.debug "Stopping & Removing container #{container_name} ..."
136
+ if system("docker stop #{container_name} && docker rm #{container_name}", out: File::NULL)
137
+ logger.debug "Stopped & Removed container #{container_name} ..."
138
+ end
139
+ else
140
+ logger.debug "Container '#{container_name}' does not exist to stop."
141
+ end
142
+ end
143
+ end
144
+
145
+ def self.clean_up(container_path)
146
+ env_vars = SmartMachine::Apps::App.get_env_vars(container_path)
147
+ return unless env_vars
148
+
149
+ logger.info "Cleaning up ..."
150
+
151
+ # Clean up very old versions
152
+ Dir.chdir("#{container_path}/releases") do
153
+ app_versions = Dir.glob('*').select { |f| File.directory? f }.sort
154
+ destroy_count = app_versions.count - env_vars['KEEP_RELEASES'].to_i
155
+ if destroy_count > 0
156
+ logger.debug "Deleting older application releases ..."
157
+ destroy_count.times do
158
+ FileUtils.rm_r(File.join(Dir.pwd, app_versions.shift))
159
+ end
160
+ end
161
+ end
162
+ end
163
+
164
+ def self.get_env_vars(container_path)
165
+ unless File.exist? "#{container_path}/env"
166
+ logger.fatal "Environment could not be loaded ... Failed."
167
+ return false
168
+ end
169
+
170
+ env_vars = {}
171
+ File.open("#{container_path}/env").each_line do |line|
172
+ line.chomp!
173
+ next if line.empty? || line.start_with?('#')
174
+ key, value = line.split "="
175
+ env_vars[key] = value
176
+ end
177
+
178
+ env_vars
179
+ end
180
+ end
181
+ end
182
+ end