smartcloud 0.0.210 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (213) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -3
  3. data/bin/buildpacker +2 -2
  4. data/bin/prereceiver +8 -0
  5. data/bin/smartcloud +68 -62
  6. data/lib/smartcloud.rb +7 -0
  7. data/lib/smartcloud/apps/app.rb +182 -0
  8. data/lib/smartcloud/apps/rails.rb +240 -0
  9. data/lib/smartcloud/base.rb +1 -0
  10. data/lib/smartcloud/boot.rb +11 -80
  11. data/lib/smartcloud/buildpacker.rb +75 -0
  12. data/lib/smartcloud/credentials.rb +127 -0
  13. data/lib/smartcloud/docker.rb +41 -25
  14. data/lib/smartcloud/engine.rb +39 -30
  15. data/lib/smartcloud/engine/Dockerfile +18 -18
  16. data/lib/smartcloud/{grids/grid-runner → engine}/buildpacks/rails/Dockerfile +3 -14
  17. data/lib/smartcloud/grids/{grid-buildpacker → grid-nginx}/.keep +0 -0
  18. data/lib/smartcloud/grids/{grid-runner → grid-prereceiver}/Dockerfile +1 -18
  19. data/lib/smartcloud/grids/{grid-runner → grid-prereceiver}/fcgiwrap/APKBUILD +0 -0
  20. data/lib/smartcloud/grids/{grid-runner → grid-prereceiver}/fcgiwrap/fcgiwrap.confd +0 -0
  21. data/lib/smartcloud/grids/{grid-runner → grid-prereceiver}/fcgiwrap/fcgiwrap.initd +0 -0
  22. data/lib/smartcloud/grids/{grid-runner → grid-prereceiver}/fcgiwrap/fcgiwrap.pre-install +0 -0
  23. data/lib/smartcloud/grids/{grid-runner → grid-prereceiver}/fcgiwrap/packages/main/x86_64/APKINDEX.tar.gz +0 -0
  24. data/lib/smartcloud/grids/{grid-runner → grid-prereceiver}/fcgiwrap/packages/main/x86_64/fcgiwrap-1.1.1-r4.apk +0 -0
  25. data/lib/smartcloud/grids/{grid-runner → grid-prereceiver}/fcgiwrap/packages/main/x86_64/fcgiwrap-doc-1.1.1-r4.apk +0 -0
  26. data/lib/smartcloud/grids/{grid-runner → grid-prereceiver}/fcgiwrap/packages/main/x86_64/fcgiwrap-openrc-1.1.1-r4.apk +0 -0
  27. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-buildpacker → grids/grid-redmine}/.keep +0 -0
  28. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-runner/apps/containers → grids/grid-solr/config}/.keep +0 -0
  29. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/README.txt +0 -0
  30. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/contractions_ca.txt +0 -0
  31. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/contractions_fr.txt +0 -0
  32. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/contractions_ga.txt +0 -0
  33. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/contractions_it.txt +0 -0
  34. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/hyphenations_ga.txt +0 -0
  35. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stemdict_nl.txt +0 -0
  36. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stoptags_ja.txt +0 -0
  37. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_ar.txt +0 -0
  38. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_bg.txt +0 -0
  39. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_ca.txt +0 -0
  40. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_cz.txt +0 -0
  41. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_da.txt +0 -0
  42. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_de.txt +0 -0
  43. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_el.txt +0 -0
  44. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_en.txt +0 -0
  45. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_es.txt +0 -0
  46. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_eu.txt +0 -0
  47. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_fa.txt +0 -0
  48. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_fi.txt +0 -0
  49. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_fr.txt +0 -0
  50. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_ga.txt +0 -0
  51. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_gl.txt +0 -0
  52. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_hi.txt +0 -0
  53. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_hu.txt +0 -0
  54. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_hy.txt +0 -0
  55. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_id.txt +0 -0
  56. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_it.txt +0 -0
  57. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_ja.txt +0 -0
  58. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_lv.txt +0 -0
  59. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_nl.txt +0 -0
  60. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_no.txt +0 -0
  61. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_pt.txt +0 -0
  62. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_ro.txt +0 -0
  63. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_ru.txt +0 -0
  64. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_sv.txt +0 -0
  65. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_th.txt +0 -0
  66. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_tr.txt +0 -0
  67. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/userdict_ja.txt +0 -0
  68. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/managed-schema +0 -0
  69. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/params.json +0 -0
  70. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/protwords.txt +0 -0
  71. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/solrconfig.xml +0 -0
  72. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/stopwords.txt +0 -0
  73. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/synonyms.txt +0 -0
  74. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/_rest_managed.json +0 -0
  75. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/_schema_analysis_stopwords_english.json +0 -0
  76. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/_schema_analysis_synonyms_english.json +0 -0
  77. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/clustering/carrot2/README.txt +0 -0
  78. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/clustering/carrot2/kmeans-attributes.xml +0 -0
  79. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/clustering/carrot2/lingo-attributes.xml +0 -0
  80. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/clustering/carrot2/stc-attributes.xml +0 -0
  81. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/currency.xml +0 -0
  82. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/elevate.xml +0 -0
  83. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/contractions_ca.txt +0 -0
  84. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/contractions_fr.txt +0 -0
  85. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/contractions_ga.txt +0 -0
  86. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/contractions_it.txt +0 -0
  87. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/hyphenations_ga.txt +0 -0
  88. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stemdict_nl.txt +0 -0
  89. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stoptags_ja.txt +0 -0
  90. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_ar.txt +0 -0
  91. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_bg.txt +0 -0
  92. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_ca.txt +0 -0
  93. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_ckb.txt +0 -0
  94. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_cz.txt +0 -0
  95. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_da.txt +0 -0
  96. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_de.txt +0 -0
  97. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_el.txt +0 -0
  98. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_en.txt +0 -0
  99. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_es.txt +0 -0
  100. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_eu.txt +0 -0
  101. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_fa.txt +0 -0
  102. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_fi.txt +0 -0
  103. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_fr.txt +0 -0
  104. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_ga.txt +0 -0
  105. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_gl.txt +0 -0
  106. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_hi.txt +0 -0
  107. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_hu.txt +0 -0
  108. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_hy.txt +0 -0
  109. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_id.txt +0 -0
  110. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_it.txt +0 -0
  111. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_ja.txt +0 -0
  112. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_lv.txt +0 -0
  113. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_nl.txt +0 -0
  114. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_no.txt +0 -0
  115. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_pt.txt +0 -0
  116. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_ro.txt +0 -0
  117. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_ru.txt +0 -0
  118. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_sv.txt +0 -0
  119. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_th.txt +0 -0
  120. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_tr.txt +0 -0
  121. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/userdict_ja.txt +0 -0
  122. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/managed-schema +0 -0
  123. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/mapping-FoldToASCII.txt +0 -0
  124. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/mapping-ISOLatin1Accent.txt +0 -0
  125. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/params.json +0 -0
  126. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/protwords.txt +0 -0
  127. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/solrconfig.xml +0 -0
  128. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/spellings.txt +0 -0
  129. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/stopwords.txt +0 -0
  130. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/synonyms.txt +0 -0
  131. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/update-script.js +0 -0
  132. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/README.txt +0 -0
  133. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/VM_global_library.vm +0 -0
  134. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/browse.vm +0 -0
  135. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/cluster.vm +0 -0
  136. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/cluster_results.vm +0 -0
  137. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/debug.vm +0 -0
  138. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/did_you_mean.vm +0 -0
  139. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/error.vm +0 -0
  140. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/facet_fields.vm +0 -0
  141. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/facet_pivot.vm +0 -0
  142. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/facet_queries.vm +0 -0
  143. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/facet_ranges.vm +0 -0
  144. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/facets.vm +0 -0
  145. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/footer.vm +0 -0
  146. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/head.vm +0 -0
  147. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/header.vm +0 -0
  148. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/hit.vm +0 -0
  149. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/hit_grouped.vm +0 -0
  150. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/hit_plain.vm +0 -0
  151. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/join_doc.vm +0 -0
  152. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/jquery.autocomplete.css +0 -0
  153. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/jquery.autocomplete.js +0 -0
  154. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/layout.vm +0 -0
  155. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/main.css +0 -0
  156. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/mime_type_lists.vm +0 -0
  157. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/pagination_bottom.vm +0 -0
  158. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/pagination_top.vm +0 -0
  159. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/product_doc.vm +0 -0
  160. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/query.vm +0 -0
  161. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/query_form.vm +0 -0
  162. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/query_group.vm +0 -0
  163. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/query_spatial.vm +0 -0
  164. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/results_list.vm +0 -0
  165. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/richtext_doc.vm +0 -0
  166. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/suggest.vm +0 -0
  167. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/tabs.vm +0 -0
  168. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/xslt/example.xsl +0 -0
  169. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/xslt/example_atom.xsl +0 -0
  170. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/xslt/example_rss.xsl +0 -0
  171. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/xslt/luke.xsl +0 -0
  172. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/xslt/updateXml.xsl +0 -0
  173. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sunspot/conf/_rest_managed.json +0 -0
  174. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sunspot/conf/admin-extra.html +0 -0
  175. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sunspot/conf/currency.xml +0 -0
  176. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sunspot/conf/elevate.xml +0 -0
  177. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sunspot/conf/lang/stopwords_en.txt +0 -0
  178. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sunspot/conf/mapping-ISOLatin1Accent.txt +0 -0
  179. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sunspot/conf/protwords.txt +0 -0
  180. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sunspot/conf/schema.xml +0 -0
  181. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sunspot/conf/scripts.conf +0 -0
  182. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sunspot/conf/solrconfig.xml +0 -0
  183. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sunspot/conf/spellings.txt +0 -0
  184. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sunspot/conf/synonyms.txt +0 -0
  185. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-runner/apps/repositories → grids/grid-solr/config/lib}/.keep +0 -0
  186. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/solr.xml +0 -0
  187. data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/zoo.cfg +0 -0
  188. data/lib/smartcloud/grids/mysql.rb +11 -5
  189. data/lib/smartcloud/grids/nginx.rb +7 -4
  190. data/lib/smartcloud/grids/prereceiver.rb +131 -0
  191. data/lib/smartcloud/grids/redmine.rb +57 -0
  192. data/lib/smartcloud/grids/solr.rb +17 -10
  193. data/lib/smartcloud/machine.rb +170 -20
  194. data/lib/smartcloud/ssh.rb +43 -0
  195. data/lib/smartcloud/templates/dotsmartcloud/{grids/grid-solr/data → apps/containers}/.keep +0 -0
  196. data/lib/smartcloud/templates/dotsmartcloud/{grids/grid-solr/data/lib → apps/repositories}/.keep +0 -0
  197. data/lib/smartcloud/templates/dotsmartcloud/bin/smartcloud.sh +9 -0
  198. data/lib/smartcloud/templates/dotsmartcloud/config/environment.rb +5 -3
  199. data/lib/smartcloud/templates/dotsmartcloud/config/users.yml +4 -0
  200. data/lib/smartcloud/{grids → templates/dotsmartcloud/grids}/grid-nginx/fastcgi.conf +1 -1
  201. data/lib/smartcloud/{grids → templates/dotsmartcloud/grids}/grid-nginx/nginx.tmpl +0 -0
  202. data/lib/smartcloud/templates/dotsmartcloud/grids/{grid-runner → grid-prereceiver}/pre-receive +1 -1
  203. data/lib/smartcloud/templates/dotsmartcloud/grids/grid-redmine/files/.keep +0 -0
  204. data/lib/smartcloud/templates/dotsmartcloud/grids/grid-solr/solr/.keep +0 -0
  205. data/lib/smartcloud/templates/dotsmartcloud/tmp/.keep +0 -0
  206. data/lib/smartcloud/user.rb +11 -45
  207. data/lib/smartcloud/version.rb +13 -0
  208. metadata +228 -185
  209. data/bin/runner +0 -20
  210. data/lib/smartcloud/grids/buildpacker.rb +0 -96
  211. data/lib/smartcloud/grids/runner.rb +0 -405
  212. data/lib/smartcloud/templates/dotsmartcloud/grids/grid-nginx/users.yml +0 -1
  213. data/lib/smartcloud/templates/machine/config/machine.yml +0 -5
data/bin/runner DELETED
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'smartcloud'
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
- Smartcloud::Grids::Runner.prereceive_app(ARGV[1], ARGV[2], ARGV[3], ARGV[4], ARGV[5])
8
- elsif ARGV[0] == 'apps'
9
- raise "Please provide appname" unless ARGV[2]
10
- if ARGV[1] == 'create'
11
- raise "Please provide username" unless ARGV[3]
12
- Smartcloud::Grids::Runner.create_app(ARGV[2], ARGV[3])
13
- elsif ARGV[1] == 'start'
14
- Smartcloud::Grids::Runner.start_app(ARGV[2])
15
- elsif ARGV[1] == 'stop'
16
- Smartcloud::Grids::Runner.stop_app(ARGV[2])
17
- elsif ARGV[1] == 'destroy'
18
- Smartcloud::Grids::Runner.destroy_app(ARGV[2])
19
- end
20
- end
@@ -1,96 +0,0 @@
1
- require 'open3'
2
-
3
- module Smartcloud
4
- module Grids
5
- class Buildpacker < Smartcloud::Base
6
- def initialize
7
- end
8
-
9
- def pack
10
- set_logger_formatter_arrow
11
-
12
- pack_rails if File.exist? "bin/rails"
13
-
14
- logger.error "Could not continue ... Launch Failed."
15
- logger.formatter = nil
16
- exit 1
17
- end
18
-
19
- def pack_rails
20
- return unless bundle_install?
21
- return unless precompile_assets?
22
- return unless start_web_server?
23
-
24
- exit 0
25
- end
26
-
27
- # Perform bundle install
28
- def bundle_install?
29
- logger.info "Performing bundle install ..."
30
-
31
- set_logger_formatter_tabs
32
- exit_status = nil
33
- Open3.popen2e("bundle", "install", "--deployment", "--clean") do |stdin, stdout_and_stderr, wait_thr|
34
- stdout_and_stderr.each { |line| logger.info "#{line}" }
35
- exit_status = wait_thr.value.success?
36
- end
37
- set_logger_formatter_arrow
38
-
39
- if exit_status
40
- return true
41
- else
42
- logger.error "Could not complete bundle install."
43
- return false
44
- end
45
- end
46
-
47
- # Perform pre-compiling of assets
48
- def precompile_assets?
49
- logger.info "Installing Javascript dependencies & pre-compiling assets ..."
50
-
51
- set_logger_formatter_tabs
52
- exit_status = nil
53
- Open3.popen2e("bundle", "exec", "rails", "assets:precompile") do |stdin, stdout_and_stderr, wait_thr|
54
- stdout_and_stderr.each { |line| logger.info "#{line}" }
55
- exit_status = wait_thr.value.success?
56
- end
57
- set_logger_formatter_arrow
58
-
59
- if exit_status
60
- return true
61
- else
62
- logger.error "Could not install Javascript dependencies or pre-compile assets."
63
- return false
64
- end
65
- end
66
-
67
- # Perform starting of web server
68
- def start_web_server?
69
- logger.debug "Starting Web Server ..."
70
-
71
- # Remove server.pid if it exists
72
- FileUtils.rm("tmp/pids/server.pid") if File.exist? "tmp/pids/server.pid"
73
-
74
- # if system("god -c Godfile -D")
75
- return true
76
- # end
77
- # return false
78
- end
79
-
80
- def set_logger_formatter_arrow
81
- logger.formatter = proc do |severity, datetime, progname, message|
82
- severity_text = { "DEBUG" => "\u{1f527} #{severity}:", "INFO" => " \u{276f}", "WARN" => "\u{2757} #{severity}:",
83
- "ERROR" => "\u{274c} #{severity}:", "FATAL" => "\u{2b55} #{severity}:", "UNKNOWN" => "\u{2753} #{severity}:"
84
- }
85
- "\t\t\t\t#{severity_text[severity]} #{message}\n"
86
- end
87
- end
88
-
89
- def set_logger_formatter_tabs
90
- logger.formatter = proc do |severity, datetime, progname, message|
91
- "\t\t\t\t #{message}"
92
- end
93
- end
94
- end
95
- end
96
- end
@@ -1,405 +0,0 @@
1
- # The main Smartcloud Grids Git driver
2
- module Smartcloud
3
- module Grids
4
- class Runner < Smartcloud::Base
5
-
6
- def initialize
7
- end
8
-
9
- def self.up
10
- if Smartcloud::Docker.running?
11
- # Creating swapfile
12
- # self.create_swapfile
13
-
14
- # Creating images
15
- self.create_images
16
-
17
- # Creating & Starting containers
18
- if system("docker image inspect smartcloud/runner", [:out, :err] => File::NULL) && system("docker image inspect smartcloud/buildpacks/rails", [:out, :err] => File::NULL)
19
- print "-----> Creating container runner ... "
20
- if system("docker create \
21
- --name='runner' \
22
- --env VIRTUAL_PROTO=fastcgi \
23
- --env VIRTUAL_HOST=#{Smartcloud.config.git_domain} \
24
- --env LETSENCRYPT_HOST=#{Smartcloud.config.git_domain} \
25
- --env LETSENCRYPT_EMAIL=#{Smartcloud.config.sysadmin_email} \
26
- --env LETSENCRYPT_TEST=#{Smartcloud.config.letsencrypt_test} \
27
- --env GIT_PROJECT_ROOT=#{Smartcloud.config.user_home_path}/.smartcloud/grids/grid-runner/apps/repositories \
28
- --env GIT_HTTP_EXPORT_ALL="" \
29
- --expose='9000' \
30
- --volume='#{Smartcloud.config.user_home_path}/.smartcloud/config:#{Smartcloud.config.user_home_path}/.smartcloud/config' \
31
- --volume='#{Smartcloud.config.user_home_path}/.smartcloud/grids/grid-runner:#{Smartcloud.config.user_home_path}/.smartcloud/grids/grid-runner' \
32
- --volume='/var/run/docker.sock:/var/run/docker.sock' \
33
- --restart='always' \
34
- --network='nginx-network' \
35
- smartcloud/runner", out: File::NULL)
36
- puts "done"
37
-
38
- print "-----> Starting container runner ... "
39
- if system("docker start runner", out: File::NULL)
40
- puts "done"
41
- end
42
- end
43
- end
44
- end
45
- end
46
-
47
- def self.down
48
- if Smartcloud::Docker.running?
49
- # Stopping & Removing containers - in reverse order
50
- if system("docker inspect -f '{{.State.Running}}' 'runner'", [:out, :err] => File::NULL)
51
- print "-----> Stopping container runner ... "
52
- if system("docker stop 'runner'", out: File::NULL)
53
- puts "done"
54
-
55
- print "-----> Removing container runner ... "
56
- if system("docker rm 'runner'", out: File::NULL)
57
- puts "done"
58
- end
59
- end
60
- else
61
- puts "-----> Container 'runner' is currently not running."
62
- end
63
-
64
- # Removing images
65
- self.destroy_images
66
-
67
- # Removing swapfile
68
- # self.destroy_swapfile
69
- end
70
- end
71
-
72
- def self.create_swapfile
73
- # Creating swapfile for bundler to work properly
74
- unless system("sudo swapon -s | grep -ci '/swapfile'", out: File::NULL)
75
- print "-----> Creating swap swapfile ... "
76
- system("sudo install -o root -g root -m 0600 /dev/null /swapfile", out: File::NULL)
77
- system("sudo dd if=/dev/zero of=/swapfile bs=1k count=2048k", [:out, :err] => File::NULL)
78
- system("sudo mkswap /swapfile", out: File::NULL)
79
- system("sudo sh -c 'echo \"/swapfile none swap sw 0 0\" >> /etc/fstab'", out: File::NULL)
80
- system("echo 10 | sudo tee /proc/sys/vm/swappiness", out: File::NULL)
81
- system("sudo sed -i '/^vm.swappiness = /d' /etc/sysctl.conf", out: File::NULL)
82
- system("echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf", out: File::NULL)
83
- puts "done"
84
-
85
- print "-----> Starting swap swapfile ... "
86
- if system("sudo swapon /swapfile", out: File::NULL)
87
- puts "done"
88
- end
89
- end
90
- end
91
-
92
- def self.destroy_swapfile
93
- if system("sudo swapon -s | grep -ci '/swapfile'", out: File::NULL)
94
- print "-----> Stopping swap swapfile ... "
95
- if system("sudo swapoff /swapfile", out: File::NULL)
96
- system("sudo sed -i '/^vm.swappiness = /d' /etc/sysctl.conf", out: File::NULL)
97
- system("echo 60 | sudo tee /proc/sys/vm/swappiness", out: File::NULL)
98
- puts "done"
99
-
100
- print "-----> Removing swap swapfile ... "
101
- system("sudo sed -i '/^\\/swapfile/d' /etc/fstab", out: File::NULL)
102
- if system("sudo rm /swapfile", out: File::NULL)
103
- puts "done"
104
- end
105
- end
106
- end
107
- end
108
-
109
- def self.create_images
110
- unless system("docker image inspect smartcloud/runner", [:out, :err] => File::NULL)
111
- print "-----> Creating image smartcloud/runner ... "
112
- if system("docker image build -t smartcloud/runner \
113
- --build-arg USER_NAME=`id -un` \
114
- --build-arg USER_UID=`id -u` \
115
- --build-arg DOCKER_GID=`getent group docker | cut -d: -f3` \
116
- #{Smartcloud.config.root_path}/lib/smartcloud/grids/grid-runner", out: File::NULL)
117
- puts "done"
118
- end
119
- end
120
-
121
- unless system("docker image inspect smartcloud/buildpacks/rails", [:out, :err] => File::NULL)
122
- print "-----> Creating image smartcloud/buildpacks/rails ... "
123
- if system("docker image build -t smartcloud/buildpacks/rails \
124
- --build-arg USER_UID=`id -u` \
125
- --build-arg USER_NAME=`id -un` \
126
- #{Smartcloud.config.root_path}/lib/smartcloud/grids/grid-runner/buildpacks/rails", out: File::NULL)
127
- puts "done"
128
- end
129
- end
130
- end
131
-
132
- def self.destroy_images
133
- if system("docker image inspect smartcloud/buildpacks/rails", [:out, :err] => File::NULL)
134
- print "-----> Removing image smartcloud/buildpacks/rails ... "
135
- if system("docker image rm smartcloud/buildpacks/rails", out: File::NULL)
136
- puts "done"
137
- end
138
- end
139
-
140
- if system("docker image inspect smartcloud/runner", [:out, :err] => File::NULL)
141
- print "-----> Removing image smartcloud/runner ... "
142
- if system("docker image rm smartcloud/runner", out: File::NULL)
143
- puts "done"
144
- end
145
- end
146
- end
147
-
148
- # Creating App!
149
- #
150
- # Example:
151
- # >> Apps.create
152
- # => Creation Complete
153
- #
154
- # Arguments:
155
- # appname => (String)
156
- # username => (String)
157
- def self.create_app(appname, username)
158
- if Smartcloud::Docker.running?
159
- repository_path = "#{Smartcloud.config.user_home_path}/.smartcloud/grids/grid-runner/apps/repositories/#{appname}.git"
160
- container_path = "#{Smartcloud.config.user_home_path}/.smartcloud/grids/grid-runner/apps/containers/#{appname}"
161
- print "-----> Creating Application ... "
162
-
163
- # Checking if app with given name already exists
164
- if Dir.exist?(repository_path)
165
- puts "failed. App with name '#{appname}' already exists."
166
- exit
167
- end
168
-
169
- # Creating Directories
170
- FileUtils.mkdir_p(repository_path)
171
- FileUtils.mkdir_p(container_path)
172
-
173
- # Initializing bare repo and pre-receive
174
- Dir.chdir(repository_path) do
175
- %x[git init --bare]
176
- %x[chmod +x #{Smartcloud.config.user_home_path}/.smartcloud/grids/grid-runner/pre-receive]
177
- %x[ln -s #{Smartcloud.config.user_home_path}/.smartcloud/grids/grid-runner/pre-receive #{repository_path}/hooks/pre-receive]
178
- puts "done"
179
- end
180
-
181
- # Creating Environment File
182
- if File.exist?("#{Smartcloud.config.user_home_path}/.smartcloud/config/environment.rb")
183
- require "#{Smartcloud.config.user_home_path}/.smartcloud/config/environment"
184
- end
185
- unless File.exist? "#{container_path}/env"
186
- print "-----> Creating App Environment ... "
187
- page = <<~HEREDOC
188
- ## System
189
- USERNAME=#{username}
190
- KEEP_RELEASES=3
191
-
192
- ## Docker
193
- VIRTUAL_HOST=#{appname}.#{Smartcloud.config.apps_domain}
194
- LETSENCRYPT_HOST=#{appname}.#{Smartcloud.config.apps_domain}
195
- LETSENCRYPT_EMAIL=#{Smartcloud.config.sysadmin_email}
196
- LETSENCRYPT_TEST=false
197
- HEREDOC
198
- puts "done" if system("echo '#{page}' > #{container_path}/env")
199
- end
200
- end
201
- end
202
-
203
- def self.destroy_app(appname)
204
- if Smartcloud::Docker.running?
205
- # Stopping & Removing old container
206
- self.stop_app(appname)
207
-
208
- # Destroying Directories
209
- print "-----> Deleting App #{appname} ... "
210
- repository_path = "#{Smartcloud.config.user_home_path}/.smartcloud/grids/grid-runner/apps/repositories/#{appname}.git"
211
- container_path = "#{Smartcloud.config.user_home_path}/.smartcloud/grids/grid-runner/apps/containers/#{appname}"
212
- FileUtils.rm_r(repository_path)
213
- FileUtils.rm_r(container_path)
214
- puts "done"
215
- end
216
- end
217
-
218
- def self.prereceive_app(appname, username, oldrev, newrev, refname)
219
- logger.formatter = proc do |severity, datetime, progname, message|
220
- severity_text = { "DEBUG" => "\u{1f527} #{severity}:", "INFO" => " \u{276f}", "WARN" => "\u{2757} #{severity}:",
221
- "ERROR" => "\u{274c} #{severity}:", "FATAL" => "\u{2b55} #{severity}:", "UNKNOWN" => "\u{2753} #{severity}:"
222
- }
223
- "\t\t\t\t#{severity_text[severity]} #{message}\n"
224
- end
225
-
226
- # Load vars and environment
227
- container_path = "#{Smartcloud.config.user_home_path}/.smartcloud/grids/grid-runner/apps/containers/#{appname}"
228
- return unless self.load_container_env_vars(container_path)
229
-
230
- # Verify the user and ensure the user is correct and has access to this repository
231
- unless ENV['USERNAME'] == username
232
- logger.error "Unauthorized."
233
- return
234
- end
235
-
236
- # Only run this script for the master branch. You can remove this
237
- # if block if you wish to run it for others as well.
238
- if refname == "refs/heads/master"
239
- logger.info "Loading Application ..."
240
-
241
- # Note: There should be no space between + and " in version.
242
- # Note: date will be UTC date until timezone has been changed.
243
- version = `date +"%Y%m%d%H%M%S"`.chomp!
244
- container_path_with_version = "#{container_path}/releases/#{version}"
245
-
246
- unless Dir.exist? container_path_with_version
247
- FileUtils.mkdir_p(container_path_with_version)
248
- if system("git archive #{newrev} | tar -x -C #{container_path_with_version}")
249
- # Start App
250
- self.start_app(appname)
251
- else
252
- logger.fatal "Could not extract new app version ... Failed."
253
- return
254
- end
255
- else
256
- logger.fatal "This version name already exists ... Failed."
257
- return
258
- end
259
- end
260
-
261
- logger.formatter = nil
262
- end
263
-
264
- def self.start_app(appname, app_version = 0)
265
- if Smartcloud::Docker.running?
266
- container_path = "#{Smartcloud.config.user_home_path}/.smartcloud/grids/grid-runner/apps/containers/#{appname}"
267
-
268
- Dir.chdir("#{container_path}/releases") do
269
- # Getting App Version
270
- if app_version == 0
271
- app_versions = Dir.glob('*').select { |f| File.directory? f }.sort
272
- app_version = app_versions.last
273
- end
274
- container_path_with_version = "#{container_path}/releases/#{app_version}"
275
-
276
- # Launching Application
277
- logger.info "Launching Application ..."
278
- if File.exist? "#{container_path_with_version}/bin/rails"
279
- # Starting Rails App
280
- self.start_app_rails(appname, container_path, container_path_with_version)
281
- end
282
- end
283
- end
284
- end
285
-
286
- def self.stop_app(appname)
287
- self.stop_container(appname)
288
- end
289
-
290
- def self.start_app_rails(appname, container_path, container_path_with_version)
291
- logger.info "Ruby on Rails application detected."
292
-
293
- # Setup rails env
294
- env_path = "#{container_path}/env"
295
- system("grep -q '^## Rails' #{env_path} || echo '## Rails' >> #{env_path}")
296
- system("grep -q '^RAILS_ENV=' #{env_path} || echo 'RAILS_ENV=production' >> #{env_path}")
297
- system("grep -q '^RACK_ENV=' #{env_path} || echo 'RACK_ENV=production' >> #{env_path}")
298
- system("grep -q '^RAILS_LOG_TO_STDOUT=' #{env_path} || echo 'RAILS_LOG_TO_STDOUT=enabled' >> #{env_path}")
299
- system("grep -q '^RAILS_SERVE_STATIC_FILES=' #{env_path} || echo 'RAILS_SERVE_STATIC_FILES=enabled' >> #{env_path}")
300
- system("grep -q '^LANG=' #{env_path} || echo 'LANG=en_US.UTF-8' >> #{env_path}")
301
- system("grep -q '^RAILS_MASTER_KEY=' #{env_path} || echo 'RAILS_MASTER_KEY=yourmasterkey' >> #{env_path}")
302
- logger.warn "Please set your RAILS_MASTER_KEY env var for this rails app." if system("grep -q '^RAILS_MASTER_KEY=yourmasterkey' #{env_path}")
303
-
304
- # Setup app folders. If this is not created then docker will create it while running the container,
305
- # but the folder will have root user assigned instead of the current user.
306
- FileUtils.mkdir_p("#{container_path}/app/vendor/bundle")
307
- FileUtils.mkdir_p("#{container_path}/app/public")
308
- FileUtils.mkdir_p("#{container_path}/app/node_modules")
309
-
310
- # Setup Godfile
311
- unless File.exist? "#{container_path_with_version}/Godfile"
312
- logger.warn "Godfile not detected. Adding a default Godfile. It is recommended to add your own Godfile."
313
- page = <<~"HEREDOC"
314
- God.watch do |w|
315
- w.name = "web"
316
- w.start = "bundle exec puma -C config/puma.rb"
317
- w.behavior(:clean_pid_file)
318
- w.keepalive
319
- end
320
- HEREDOC
321
- system("echo '#{page}' > #{container_path_with_version}/Godfile")
322
- end
323
-
324
- # Creating & Starting container
325
- container_id = `docker ps -a -q --filter='name=^#{appname}_1$' --filter='status=running'`.chomp
326
- new_container = container_id.empty? ? "#{appname}_1" : "#{appname}_2"
327
- old_container = container_id.empty? ? "#{appname}_2" : "#{appname}_1"
328
-
329
- self.stop_app("#{new_container}")
330
- if system("docker create \
331
- --name='#{new_container}' \
332
- --env-file='#{container_path}/env' \
333
- --expose='5000' \
334
- --volume='#{Smartcloud.config.user_home_path}/.smartcloud/config:#{Smartcloud.config.user_home_path}/.smartcloud/config' \
335
- --volume='#{container_path_with_version}:/app' \
336
- --volume='#{container_path}/app/vendor/bundle:/app/vendor/bundle' \
337
- --volume='#{container_path}/app/public:/app/public' \
338
- --volume='#{container_path}/app/node_modules:/app/node_modules' \
339
- --restart='always' \
340
- --network='nginx-network' \
341
- smartcloud/buildpacks/rails", out: File::NULL)
342
-
343
- system("docker network connect solr-network #{new_container}")
344
- system("docker network connect mysql-network #{new_container}")
345
-
346
- if system("docker start --attach #{new_container}")
347
- self.stop_app(old_container)
348
- self.clean_up(container_path)
349
- logger.info "Launched Application ... Success."
350
- exit 10
351
- else
352
- self.stop_app("#{new_container}")
353
- end
354
- end
355
- end
356
-
357
- def self.clean_up(container_path)
358
- logger.info "Cleaning up ..."
359
-
360
- # Clean up very old versions
361
- Dir.chdir("#{container_path}/releases") do
362
- app_versions = Dir.glob('*').select { |f| File.directory? f }.sort
363
- destroy_count = app_versions.count - ENV['KEEP_RELEASES'].to_i
364
- if destroy_count > 0
365
- logger.debug "Deleting older application releases ..."
366
- destroy_count.times do
367
- FileUtils.rm_r(File.join(Dir.pwd, app_versions.shift))
368
- end
369
- end
370
- end
371
- end
372
-
373
- def self.load_container_env_vars(container_path)
374
- unless File.exist? "#{container_path}/env"
375
- logger.fatal "Environment could not be loaded ... Failed."
376
- return false
377
- end
378
-
379
- File.open("#{container_path}/env").each_line do |line|
380
- line.chomp!
381
- next if line.empty? || line.start_with?('#')
382
- key, value = line.split "="
383
- ENV[key] = value
384
- end
385
-
386
- true
387
- end
388
-
389
- # Stop Container
390
- def self.stop_container(container_name)
391
- if Smartcloud::Docker.running?
392
- container_id = `docker ps -a -q --filter='name=^#{container_name}$'`.chomp
393
- unless container_id.empty?
394
- logger.debug "Stopping & Removing container #{container_name} ..."
395
- if system("docker stop #{container_name} && docker rm #{container_name}", out: File::NULL)
396
- logger.debug "Stopped & Removed container #{container_name} ..."
397
- end
398
- else
399
- logger.debug "Container '#{container_name}' does not exist to stop."
400
- end
401
- end
402
- end
403
- end
404
- end
405
- end