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
File without changes
@@ -0,0 +1,66 @@
1
+ # The main SmartMachine Grids Mysql driver
2
+ module SmartMachine
3
+ class Grids
4
+ class Mysql < SmartMachine::Base
5
+ def initialize
6
+ end
7
+
8
+ def up(*args)
9
+ args.flatten!
10
+ exposed = args.empty? ? '' : args.shift
11
+
12
+ if SmartMachine::Docker.running?
13
+ # Creating networks
14
+ unless system("docker network inspect mysql-network", [:out, :err] => File::NULL)
15
+ print "-----> Creating network mysql-network ... "
16
+ if system("docker network create mysql-network", out: File::NULL)
17
+ puts "done"
18
+ end
19
+ end
20
+
21
+ # Creating & Starting containers
22
+ print "-----> Creating container mysql ... "
23
+ if system("docker create \
24
+ --name='mysql' \
25
+ --env MYSQL_ROOT_PASSWORD=#{SmartMachine.credentials.mysql[:root_password]} \
26
+ --env MYSQL_USER=#{SmartMachine.credentials.mysql[:username]} \
27
+ --env MYSQL_PASSWORD=#{SmartMachine.credentials.mysql[:password]} \
28
+ --env MYSQL_DATABASE=#{SmartMachine.credentials.mysql[:database_name]} \
29
+ --user `id -u`:`id -g` \
30
+ #{"--publish='#{SmartMachine.credentials.mysql[:port]}:#{SmartMachine.credentials.mysql[:port]}'" if exposed == '--exposed'} \
31
+ --volume='#{SmartMachine.config.user_home_path}/.smartmachine/grids/mysql/data:/var/lib/mysql' \
32
+ --restart='always' \
33
+ --network='mysql-network' \
34
+ mysql:8.0.18", out: File::NULL)
35
+
36
+ puts "done"
37
+ print "-----> Starting container mysql ... "
38
+ if system("docker start mysql", out: File::NULL)
39
+ puts "done"
40
+ end
41
+ end
42
+ end
43
+ end
44
+
45
+ def down
46
+ if SmartMachine::Docker.running?
47
+ # Stopping & Removing containers - in reverse order
48
+ print "-----> Stopping container mysql ... "
49
+ if system("docker stop 'mysql'", out: File::NULL)
50
+ puts "done"
51
+ print "-----> Removing container mysql ... "
52
+ if system("docker rm 'mysql'", out: File::NULL)
53
+ puts "done"
54
+ end
55
+ end
56
+
57
+ # Removing networks
58
+ print "-----> Removing network mysql-network ... "
59
+ if system("docker network rm mysql-network", out: File::NULL)
60
+ puts "done"
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,137 @@
1
+ # The main SmartMachine Grids Nginx driver
2
+ module SmartMachine
3
+ class Grids
4
+ class Nginx < SmartMachine::Base
5
+ def initialize
6
+ end
7
+
8
+ def up(*args)
9
+ args.flatten!
10
+ exposed = args.empty? ? '' : args.shift
11
+
12
+ if SmartMachine::Docker.running?
13
+ # Creating volumes
14
+ print "-----> Creating volume nginx-confd ... "
15
+ if system("docker volume create nginx-confd", out: File::NULL)
16
+ puts "done"
17
+ end
18
+
19
+ print "-----> Creating volume nginx-vhost ... "
20
+ if system("docker volume create nginx-vhost", out: File::NULL)
21
+ puts "done"
22
+ end
23
+
24
+ print "-----> Creating volume nginx-shtml ... "
25
+ if system("docker volume create nginx-shtml", out: File::NULL)
26
+ puts "done"
27
+ end
28
+
29
+ # Creating networks
30
+ unless system("docker network inspect nginx-network", [:out, :err] => File::NULL)
31
+ print "-----> Creating network nginx-network ... "
32
+ if system("docker network create nginx-network", out: File::NULL)
33
+ puts "done"
34
+ end
35
+ end
36
+
37
+ # Creating & Starting containers
38
+ print "-----> Creating container nginx ... "
39
+ if system("docker create \
40
+ --name='nginx' \
41
+ #{"--publish='80:80' --publish='443:443'" if exposed == '--exposed'} \
42
+ --volume='nginx-confd:/etc/nginx/conf.d/' \
43
+ --volume='nginx-vhost:/etc/nginx/vhost.d/' \
44
+ --volume='nginx-shtml:/usr/share/nginx/html' \
45
+ --volume='#{SmartMachine.config.user_home_path}/.smartmachine/grids/nginx/certificates:/etc/nginx/certs' \
46
+ --volume='#{SmartMachine.config.user_home_path}/.smartmachine/grids/nginx/fastcgi.conf:/etc/nginx/fastcgi.conf:ro' \
47
+ --volume='#{SmartMachine.config.user_home_path}/.smartmachine/grids/nginx/htpasswd:/etc/nginx/htpasswd:ro' \
48
+ --restart='always' \
49
+ --network='nginx-network' \
50
+ nginx:alpine", out: File::NULL)
51
+
52
+ puts "done"
53
+ print "-----> Starting container nginx ... "
54
+ if system("docker start nginx", out: File::NULL)
55
+ puts "done"
56
+ end
57
+ end
58
+
59
+ print "-----> Creating container nginx-gen ... "
60
+ if system("docker create \
61
+ --name='nginx-gen' \
62
+ --volumes-from nginx \
63
+ --volume='#{SmartMachine.config.user_home_path}/.smartmachine/grids/nginx/nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro' \
64
+ --volume='/var/run/docker.sock:/tmp/docker.sock:ro' \
65
+ --restart='always' \
66
+ --network='nginx-network' \
67
+ jwilder/docker-gen \
68
+ -notify-sighup nginx -watch /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf", out: File::NULL)
69
+
70
+ puts "done"
71
+ print "-----> Starting container nginx-gen ... "
72
+ if system("docker start nginx-gen", out: File::NULL)
73
+ puts "done"
74
+ end
75
+ end
76
+
77
+ print "-----> Creating container nginx-letsencrypt ... "
78
+ if system("docker create \
79
+ --name='nginx-letsencrypt' \
80
+ --env NGINX_PROXY_CONTAINER=nginx \
81
+ --env NGINX_DOCKER_GEN_CONTAINER=nginx-gen \
82
+ --env DEFAULT_EMAIL=#{SmartMachine.config.sysadmin_email} \
83
+ --volumes-from nginx \
84
+ --volume='/var/run/docker.sock:/var/run/docker.sock:ro' \
85
+ --restart='always' \
86
+ --network='nginx-network' \
87
+ jrcs/letsencrypt-nginx-proxy-companion", out: File::NULL)
88
+
89
+ puts "done"
90
+ print "-----> Starting container nginx-letsencrypt ... "
91
+ if system("docker start nginx-letsencrypt", out: File::NULL)
92
+ puts "done"
93
+ end
94
+ end
95
+ end
96
+ end
97
+
98
+ def down
99
+ if SmartMachine::Docker.running?
100
+ # Stopping & Removing containers - in reverse order
101
+ print "-----> Stopping container nginx-letsencrypt ... "
102
+ if system("docker stop 'nginx-letsencrypt'", out: File::NULL)
103
+ puts "done"
104
+ print "-----> Removing container nginx-letsencrypt ... "
105
+ if system("docker rm 'nginx-letsencrypt'", out: File::NULL)
106
+ puts "done"
107
+ end
108
+ end
109
+
110
+ print "-----> Stopping container nginx-gen ... "
111
+ if system("docker stop 'nginx-gen'", out: File::NULL)
112
+ puts "done"
113
+ print "-----> Removing container nginx-gen ... "
114
+ if system("docker rm 'nginx-gen'", out: File::NULL)
115
+ puts "done"
116
+ end
117
+ end
118
+
119
+ print "-----> Stopping container nginx ... "
120
+ if system("docker stop 'nginx'", out: File::NULL)
121
+ puts "done"
122
+ print "-----> Removing container nginx ... "
123
+ if system("docker rm 'nginx'", out: File::NULL)
124
+ puts "done"
125
+ end
126
+ end
127
+
128
+ # Removing networks
129
+ print "-----> Removing network nginx-network ... "
130
+ if system("docker network rm nginx-network", out: File::NULL)
131
+ puts "done"
132
+ end
133
+ end
134
+ end
135
+ end
136
+ end
137
+ end
File without changes
@@ -0,0 +1,170 @@
1
+ # The main SmartMachine Grids Git driver
2
+ module SmartMachine
3
+ class Grids
4
+ class Prereceiver < SmartMachine::Base
5
+
6
+ def initialize
7
+ end
8
+
9
+ def install
10
+ puts "-----> Installing Prereceiver"
11
+
12
+ ssh = SmartMachine::SSH.new
13
+ commands = ["smartmachine runner prereceiver create"]
14
+ ssh.run commands
15
+
16
+ puts "-----> Prereceiver Installation Complete"
17
+ end
18
+
19
+ def uninstall
20
+ puts "-----> Uninstalling Prereceiver"
21
+
22
+ ssh = SmartMachine::SSH.new
23
+ commands = ["smartmachine runner prereceiver destroy"]
24
+ ssh.run commands
25
+
26
+ puts "-----> Prereceiver Uninstallation Complete"
27
+ end
28
+
29
+ def update
30
+ uninstall
31
+ install
32
+ end
33
+
34
+ def create
35
+ unless system("docker image inspect #{prereceiver_image_name}", [:out, :err] => File::NULL)
36
+ print "-----> Creating image #{prereceiver_image_name} ... "
37
+ if system("docker image build -t #{prereceiver_image_name} \
38
+ --build-arg SMARTMACHINE_VERSION=#{SmartMachine.version} \
39
+ #{SmartMachine.config.root_path}/lib/smart_machine/grids/prereceiver", out: File::NULL)
40
+ puts "done"
41
+
42
+ up
43
+ end
44
+ end
45
+ end
46
+
47
+ def destroy
48
+ down
49
+
50
+ if system("docker image inspect #{prereceiver_image_name}", [:out, :err] => File::NULL)
51
+ print "-----> Removing image #{prereceiver_image_name} ... "
52
+ if system("docker image rm #{prereceiver_image_name}", out: File::NULL)
53
+ puts "done"
54
+ end
55
+ end
56
+ end
57
+
58
+ def up
59
+ if SmartMachine::Docker.running?
60
+ if system("docker image inspect #{prereceiver_image_name}", [:out, :err] => File::NULL) && system("docker image inspect #{buildpacker_image_name}", [:out, :err] => File::NULL)
61
+ print "-----> Creating container prereceiver with image #{prereceiver_image_name} ... "
62
+ if system("docker create \
63
+ --name='prereceiver' \
64
+ --env VIRTUAL_PROTO=fastcgi \
65
+ --env VIRTUAL_HOST=#{SmartMachine.config.git_domain} \
66
+ --env LETSENCRYPT_HOST=#{SmartMachine.config.git_domain} \
67
+ --env LETSENCRYPT_EMAIL=#{SmartMachine.config.sysadmin_email} \
68
+ --env LETSENCRYPT_TEST=#{SmartMachine.config.letsencrypt_test} \
69
+ --env GIT_PROJECT_ROOT=#{SmartMachine.config.user_home_path}/.smartmachine/apps/repositories \
70
+ --env GIT_HTTP_EXPORT_ALL="" \
71
+ --user `id -u` \
72
+ --workdir /home/`id -un`/.smartmachine/apps \
73
+ --expose='9000' \
74
+ --volume='#{SmartMachine.config.user_home_path}/.smartmachine/config:#{SmartMachine.config.user_home_path}/.smartmachine/config' \
75
+ --volume='#{SmartMachine.config.user_home_path}/.smartmachine/apps:#{SmartMachine.config.user_home_path}/.smartmachine/apps' \
76
+ --volume='#{SmartMachine.config.user_home_path}/.smartmachine/grids/prereceiver:#{SmartMachine.config.user_home_path}/.smartmachine/grids/prereceiver' \
77
+ --volume='/var/run/docker.sock:/var/run/docker.sock:ro' \
78
+ --restart='always' \
79
+ --network='nginx-network' \
80
+ #{prereceiver_image_name}", out: File::NULL)
81
+ puts "done"
82
+
83
+ print "-----> Starting container prereceiver with image #{prereceiver_image_name} ... "
84
+ if system("docker start prereceiver", out: File::NULL)
85
+ puts "done"
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
91
+
92
+ def down
93
+ if SmartMachine::Docker.running?
94
+ # Stopping & Removing containers - in reverse order
95
+ if system("docker inspect -f '{{.State.Running}}' 'prereceiver'", [:out, :err] => File::NULL)
96
+ print "-----> Stopping container prereceiver with image #{prereceiver_image_name} ... "
97
+ if system("docker stop 'prereceiver'", out: File::NULL)
98
+ puts "done"
99
+
100
+ print "-----> Removing container prereceiver with image #{prereceiver_image_name} ... "
101
+ if system("docker rm 'prereceiver'", out: File::NULL)
102
+ puts "done"
103
+ end
104
+ end
105
+ else
106
+ puts "-----> Container 'prereceiver' is currently not running."
107
+ end
108
+ end
109
+ end
110
+
111
+ def self.prereceive(appname, username, oldrev, newrev, refname)
112
+ logger.formatter = proc do |severity, datetime, progname, message|
113
+ severity_text = { "DEBUG" => "\u{1f527} #{severity}:", "INFO" => " \u{276f}", "WARN" => "\u{2757} #{severity}:",
114
+ "ERROR" => "\u{274c} #{severity}:", "FATAL" => "\u{2b55} #{severity}:", "UNKNOWN" => "\u{2753} #{severity}:"
115
+ }
116
+ "\t\t\t\t#{severity_text[severity]} #{message}\n"
117
+ end
118
+
119
+ # Load vars and environment
120
+ container_path = "#{SmartMachine.config.user_home_path}/.smartmachine/apps/containers/#{appname}"
121
+ env_vars = SmartMachine::Apps::App.get_env_vars(container_path)
122
+ return unless env_vars
123
+
124
+ # Verify the user and ensure the user is correct and has access to this repository
125
+ unless env_vars['USERNAME'] == username
126
+ logger.error "Unauthorized."
127
+ return
128
+ end
129
+
130
+ # Only run this script for the master branch. You can remove this
131
+ # if block if you wish to run it for others as well.
132
+ if refname == "refs/heads/master"
133
+ logger.info "Loading Application ..."
134
+
135
+ # Note: There should be no space between + and " in version.
136
+ # Note: date will be UTC date until timezone has been changed.
137
+ version = `date +"%Y%m%d%H%M%S"`.chomp!
138
+ container_path_with_version = "#{container_path}/releases/#{version}"
139
+
140
+ unless Dir.exist? container_path_with_version
141
+ FileUtils.mkdir_p(container_path_with_version)
142
+ if system("git archive #{newrev} | tar -x -C #{container_path_with_version}")
143
+ # Start App
144
+ SmartMachine::Apps::App.start(appname)
145
+ else
146
+ logger.fatal "Could not extract new app version ... Failed."
147
+ return
148
+ end
149
+ else
150
+ logger.fatal "This version name already exists ... Failed."
151
+ return
152
+ end
153
+ else
154
+ # Allow the push to complete for all other branches normally.
155
+ exit 10
156
+ end
157
+
158
+ logger.formatter = nil
159
+ end
160
+
161
+ def buildpacker_image_name
162
+ Buildpacker.new.buildpacker_image_name
163
+ end
164
+
165
+ def prereceiver_image_name
166
+ "smartmachine/prereceiver:#{SmartMachine.version}"
167
+ end
168
+ end
169
+ end
170
+ end
@@ -0,0 +1,20 @@
1
+ ARG SMARTMACHINE_VERSION
2
+
3
+ FROM smartmachine:$SMARTMACHINE_VERSION
4
+ LABEL maintainer="Timeboard <hello@timeboard.me>"
5
+
6
+ # FCGI Essentials
7
+ # --- IMPORTANT NOTE: This is custom built fcgiwrap package for alpine linux to account for NO_BUFFERING option.
8
+ # --- Original fcgiwrap: https://github.com/gnosek/fcgiwrap
9
+ # --- Custom fcgiwrap: https://github.com/notr1ch/fcgiwrap
10
+ COPY fcgiwrap /root/apk-packages/fcgiwrap
11
+ RUN apk add fcgiwrap --repository /root/apk-packages/fcgiwrap/packages/main --allow-untrusted && \
12
+ rm -rf /root/apk-packages
13
+ RUN apk add --update coreutils && \
14
+ apk add --update util-linux && \
15
+ apk add --update git && \
16
+ apk add --update git-daemon && \
17
+ apk add --update spawn-fcgi && \
18
+ rm -rf /var/cache/apk/*
19
+
20
+ CMD ["spawn-fcgi", "-n", "-p", "9000", "/usr/bin/fcgiwrap", "-f"]
@@ -0,0 +1,49 @@
1
+ # Contributor: Eivind Uggedal <eu@eju.no>
2
+ # Maintainer: Natanael Copa <ncopa@alpinelinux.org>
3
+ pkgname=fcgiwrap
4
+ #pkgver=1.1.0
5
+ pkgver=1.1.1
6
+ #pkgrel=3
7
+ pkgrel=4
8
+ pkgdesc="Simple server for running CGI applications over FastCGI"
9
+ # This url has been changed to add no_buffering feature for fcgiwrap where has not been currently merged by gnosek
10
+ #url="https://github.com/gnosek/fcgiwrap"
11
+ url="https://github.com/notr1ch/fcgiwrap"
12
+ arch="all"
13
+ license="MIT"
14
+ pkgusers="fcgiwrap"
15
+ pkggroups="www-data"
16
+ install="$pkgname.pre-install"
17
+ makedepends="$depends_dev autoconf libtool automake fcgi-dev"
18
+ subpackages="$pkgname-doc $pkgname-openrc"
19
+ # This source has been changed to add no_buffering feature for fcgiwrap where has not been currently merged by gnosek. Please note the use of master branch instead of $pkgver.
20
+ #source="$pkgname-$pkgver.tar.gz::https://github.com/gnosek/$pkgname/archive/$pkgver.tar.gz
21
+ source="$pkgname-$pkgver.tar.gz::https://github.com/notr1ch/$pkgname/archive/master.tar.gz
22
+ $pkgname.initd
23
+ $pkgname.confd"
24
+
25
+ #builddir="$srcdir/$pkgname-$pkgver"
26
+ builddir="$srcdir/$pkgname-master"
27
+
28
+ build() {
29
+ cd "$builddir"
30
+ autoreconf --install
31
+ CFLAGS="$CFLAGS -Wno-implicit-fallthrough" \
32
+ ./configure --prefix=/usr \
33
+ --mandir=/share/man \
34
+ --sbindir=/bin
35
+ make
36
+ }
37
+
38
+ package() {
39
+ cd "$builddir"
40
+ install -d -m2775 -o fcgiwrap -g www-data "$pkgdir"/run/fcgiwrap
41
+ make DESTDIR="$pkgdir" install
42
+ install -Dm755 $srcdir/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
43
+ install -Dm644 $srcdir/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
44
+ }
45
+
46
+
47
+ sha512sums="4ffacd247f48ff0827531da1e9fbf19262d51827668d90cde1ec30ea23139cdf6f45a3b2a955a2a3b8e9ddbc85e7e4fa4dd18217e71288441c8cabdff5c24846 fcgiwrap-1.1.1.tar.gz
48
+ 0dbf5f4387e5dc5de6e9bd6d98247e175f1a7943fe1d04ea916881b1269fd0b62abfafac91f8c0dd2f4dc9c71118195ba9dd7cf9bb5e3d93e6e711ec7d770453 fcgiwrap.initd
49
+ 893e9afa92c20c9d0dab68fffc806a1be1f2e28a7e73bbb497316386a9ee083be4bad68a90f660e489311a9812a512b50fb0edb8b9c49b12f6cd266ba53b01a6 fcgiwrap.confd"