smartcloud 0.2.0.beta2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/bin/buildpacker +2 -2
- data/bin/prereceiver +8 -0
- data/bin/smartcloud +70 -25
- data/lib/smartcloud.rb +3 -9
- data/lib/smartcloud/apps/app.rb +182 -0
- data/lib/smartcloud/apps/rails.rb +240 -0
- data/lib/smartcloud/base.rb +1 -0
- data/lib/smartcloud/boot.rb +10 -4
- data/lib/smartcloud/buildpacker.rb +75 -0
- data/lib/smartcloud/credentials.rb +127 -0
- data/lib/smartcloud/engine.rb +16 -4
- data/lib/smartcloud/engine/Dockerfile +12 -8
- data/lib/smartcloud/{grids/grid-runner → engine}/buildpacks/rails/Dockerfile +3 -13
- data/lib/smartcloud/grids/{grid-buildpacker → grid-nginx}/.keep +0 -0
- data/lib/smartcloud/grids/{grid-runner → grid-prereceiver}/Dockerfile +1 -18
- data/lib/smartcloud/grids/{grid-runner → grid-prereceiver}/fcgiwrap/APKBUILD +0 -0
- data/lib/smartcloud/grids/{grid-runner → grid-prereceiver}/fcgiwrap/fcgiwrap.confd +0 -0
- data/lib/smartcloud/grids/{grid-runner → grid-prereceiver}/fcgiwrap/fcgiwrap.initd +0 -0
- data/lib/smartcloud/grids/{grid-runner → grid-prereceiver}/fcgiwrap/fcgiwrap.pre-install +0 -0
- data/lib/smartcloud/grids/{grid-runner → grid-prereceiver}/fcgiwrap/packages/main/x86_64/APKINDEX.tar.gz +0 -0
- data/lib/smartcloud/grids/{grid-runner → grid-prereceiver}/fcgiwrap/packages/main/x86_64/fcgiwrap-1.1.1-r4.apk +0 -0
- data/lib/smartcloud/grids/{grid-runner → grid-prereceiver}/fcgiwrap/packages/main/x86_64/fcgiwrap-doc-1.1.1-r4.apk +0 -0
- data/lib/smartcloud/grids/{grid-runner → grid-prereceiver}/fcgiwrap/packages/main/x86_64/fcgiwrap-openrc-1.1.1-r4.apk +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-buildpacker → grids/grid-redmine}/.keep +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-runner/apps/containers → grids/grid-solr/config}/.keep +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/README.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/contractions_ca.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/contractions_fr.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/contractions_ga.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/contractions_it.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/hyphenations_ga.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stemdict_nl.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stoptags_ja.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_ar.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_bg.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_ca.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_cz.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_da.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_de.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_el.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_en.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_es.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_eu.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_fa.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_fi.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_fr.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_ga.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_gl.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_hi.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_hu.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_hy.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_id.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_it.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_ja.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_lv.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_nl.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_no.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_pt.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_ro.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_ru.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_sv.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_th.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/stopwords_tr.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/lang/userdict_ja.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/managed-schema +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/params.json +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/protwords.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/solrconfig.xml +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/stopwords.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/_default/conf/synonyms.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/_rest_managed.json +0 -0
- 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
- 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
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/clustering/carrot2/README.txt +0 -0
- 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
- 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
- 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
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/currency.xml +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/elevate.xml +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/contractions_ca.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/contractions_fr.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/contractions_ga.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/contractions_it.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/hyphenations_ga.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stemdict_nl.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stoptags_ja.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_ar.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_bg.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_ca.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_ckb.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_cz.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_da.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_de.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_el.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_en.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_es.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_eu.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_fa.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_fi.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_fr.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_ga.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_gl.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_hi.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_hu.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_hy.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_id.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_it.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_ja.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_lv.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_nl.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_no.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_pt.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_ro.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_ru.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_sv.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_th.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/stopwords_tr.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/lang/userdict_ja.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/managed-schema +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/mapping-FoldToASCII.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/mapping-ISOLatin1Accent.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/params.json +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/protwords.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/solrconfig.xml +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/spellings.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/stopwords.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/synonyms.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/update-script.js +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/README.txt +0 -0
- 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
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/browse.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/cluster.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/cluster_results.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/debug.vm +0 -0
- 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
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/error.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/facet_fields.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/facet_pivot.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/facet_queries.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/facet_ranges.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/facets.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/footer.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/head.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/header.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/hit.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/hit_grouped.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/hit_plain.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/join_doc.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/jquery.autocomplete.css +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/jquery.autocomplete.js +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/layout.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/main.css +0 -0
- 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
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/pagination_bottom.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/pagination_top.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/product_doc.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/query.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/query_form.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/query_group.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/query_spatial.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/results_list.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/richtext_doc.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/suggest.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/velocity/tabs.vm +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/xslt/example.xsl +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/xslt/example_atom.xsl +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/xslt/example_rss.xsl +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/xslt/luke.xsl +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sample_techproducts_configs/conf/xslt/updateXml.xsl +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sunspot/conf/_rest_managed.json +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sunspot/conf/admin-extra.html +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sunspot/conf/currency.xml +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sunspot/conf/elevate.xml +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sunspot/conf/lang/stopwords_en.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sunspot/conf/mapping-ISOLatin1Accent.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sunspot/conf/protwords.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sunspot/conf/schema.xml +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sunspot/conf/scripts.conf +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sunspot/conf/solrconfig.xml +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sunspot/conf/spellings.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/configsets/sunspot/conf/synonyms.txt +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-runner/apps/repositories → grids/grid-solr/config/lib}/.keep +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/solr.xml +0 -0
- data/lib/smartcloud/{templates/dotsmartcloud/grids/grid-solr/data → grids/grid-solr/config}/zoo.cfg +0 -0
- data/lib/smartcloud/grids/mysql.rb +7 -4
- data/lib/smartcloud/grids/nginx.rb +3 -3
- data/lib/smartcloud/grids/prereceiver.rb +131 -0
- data/lib/smartcloud/grids/redmine.rb +56 -0
- data/lib/smartcloud/grids/solr.rb +5 -7
- data/lib/smartcloud/machine.rb +105 -58
- data/lib/smartcloud/templates/dotsmartcloud/{grids/grid-solr/data → apps/containers}/.keep +0 -0
- data/lib/smartcloud/templates/dotsmartcloud/{grids/grid-solr/data/lib → apps/repositories}/.keep +0 -0
- data/lib/smartcloud/templates/dotsmartcloud/bin/smartcloud.sh +2 -2
- data/lib/smartcloud/templates/dotsmartcloud/config/environment.rb +1 -1
- data/lib/smartcloud/templates/dotsmartcloud/config/users.yml +1 -1
- data/lib/smartcloud/{grids → templates/dotsmartcloud/grids}/grid-nginx/fastcgi.conf +1 -1
- data/lib/smartcloud/{grids → templates/dotsmartcloud/grids}/grid-nginx/nginx.tmpl +0 -0
- data/lib/smartcloud/templates/dotsmartcloud/grids/{grid-runner → grid-prereceiver}/pre-receive +1 -1
- data/lib/smartcloud/templates/dotsmartcloud/grids/grid-redmine/files/.keep +0 -0
- data/lib/smartcloud/templates/dotsmartcloud/grids/grid-solr/solr/.keep +0 -0
- data/lib/smartcloud/user.rb +2 -2
- data/lib/smartcloud/version.rb +13 -0
- metadata +224 -184
- data/bin/runner +0 -20
- data/lib/smartcloud/grids/buildpacker.rb +0 -122
- data/lib/smartcloud/grids/runner.rb +0 -398
- data/lib/smartcloud/templates/dotsmartcloud/config/credentials.yml +0 -6
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,122 +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
|
-
if File.exist? "tmp/smartcloud/packed"
|
21
|
-
begin
|
22
|
-
pid = File.read('tmp/smartcloud/packed').to_i
|
23
|
-
Process.kill('QUIT', pid)
|
24
|
-
rescue Errno::ESRCH # No such process
|
25
|
-
end
|
26
|
-
exec "bundle", "exec", "puma", "--config", "config/puma.rb"
|
27
|
-
else
|
28
|
-
return unless bundle_install?
|
29
|
-
return unless precompile_assets?
|
30
|
-
return unless test_web_server?
|
31
|
-
|
32
|
-
exit 0
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
# Perform bundle install
|
37
|
-
def bundle_install?
|
38
|
-
logger.info "Performing bundle install ..."
|
39
|
-
|
40
|
-
set_logger_formatter_tabs
|
41
|
-
exit_status = nil
|
42
|
-
Open3.popen2e("bundle", "install", "--deployment", "--clean") do |stdin, stdout_and_stderr, wait_thr|
|
43
|
-
stdout_and_stderr.each { |line| logger.info "#{line}" }
|
44
|
-
exit_status = wait_thr.value.success?
|
45
|
-
end
|
46
|
-
set_logger_formatter_arrow
|
47
|
-
|
48
|
-
if exit_status
|
49
|
-
return true
|
50
|
-
else
|
51
|
-
logger.error "Could not complete bundle install."
|
52
|
-
return false
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
# Perform pre-compiling of assets
|
57
|
-
def precompile_assets?
|
58
|
-
logger.info "Installing Javascript dependencies & pre-compiling assets ..."
|
59
|
-
|
60
|
-
set_logger_formatter_tabs
|
61
|
-
exit_status = nil
|
62
|
-
Open3.popen2e("bundle", "exec", "rails", "assets:precompile") do |stdin, stdout_and_stderr, wait_thr|
|
63
|
-
stdout_and_stderr.each { |line| logger.info "#{line}" }
|
64
|
-
exit_status = wait_thr.value.success?
|
65
|
-
end
|
66
|
-
set_logger_formatter_arrow
|
67
|
-
|
68
|
-
if exit_status
|
69
|
-
return true
|
70
|
-
else
|
71
|
-
logger.error "Could not install Javascript dependencies or pre-compile assets."
|
72
|
-
return false
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
# Perform testing of web server
|
77
|
-
def test_web_server?
|
78
|
-
logger.info "Setting up Web Server ..."
|
79
|
-
|
80
|
-
# tmp folder
|
81
|
-
FileUtils.mkdir_p("tmp/smartcloud")
|
82
|
-
FileUtils.rm_f("tmp/smartcloud/packed")
|
83
|
-
|
84
|
-
# Spawn Process
|
85
|
-
pid = Process.spawn("bundle", "exec", "puma", "--config", "config/puma.rb", out: File::NULL)
|
86
|
-
Process.detach(pid)
|
87
|
-
|
88
|
-
# Sleep
|
89
|
-
sleep 5
|
90
|
-
|
91
|
-
# Check PID running
|
92
|
-
status = nil
|
93
|
-
begin
|
94
|
-
Process.kill(0, pid)
|
95
|
-
system("echo '#{pid}' > tmp/smartcloud/packed")
|
96
|
-
status = true
|
97
|
-
rescue Errno::ESRCH # No such process
|
98
|
-
logger.info "Web Server could not start"
|
99
|
-
status = false
|
100
|
-
end
|
101
|
-
|
102
|
-
# Return status
|
103
|
-
return status
|
104
|
-
end
|
105
|
-
|
106
|
-
def set_logger_formatter_arrow
|
107
|
-
logger.formatter = proc do |severity, datetime, progname, message|
|
108
|
-
severity_text = { "DEBUG" => "\u{1f527} #{severity}:", "INFO" => " \u{276f}", "WARN" => "\u{2757} #{severity}:",
|
109
|
-
"ERROR" => "\u{274c} #{severity}:", "FATAL" => "\u{2b55} #{severity}:", "UNKNOWN" => "\u{2753} #{severity}:"
|
110
|
-
}
|
111
|
-
"\t\t\t\t#{severity_text[severity]} #{message}\n"
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
def set_logger_formatter_tabs
|
116
|
-
logger.formatter = proc do |severity, datetime, progname, message|
|
117
|
-
"\t\t\t\t #{message}"
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
@@ -1,398 +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 '^MALLOC_ARENA_MAX=' #{env_path} || echo '# MALLOC_ARENA_MAX=2' >> #{env_path}")
|
297
|
-
system("grep -q '^RAILS_ENV=' #{env_path} || echo 'RAILS_ENV=production' >> #{env_path}")
|
298
|
-
system("grep -q '^RACK_ENV=' #{env_path} || echo 'RACK_ENV=production' >> #{env_path}")
|
299
|
-
system("grep -q '^RAILS_LOG_TO_STDOUT=' #{env_path} || echo 'RAILS_LOG_TO_STDOUT=enabled' >> #{env_path}")
|
300
|
-
system("grep -q '^RAILS_SERVE_STATIC_FILES=' #{env_path} || echo 'RAILS_SERVE_STATIC_FILES=enabled' >> #{env_path}")
|
301
|
-
system("grep -q '^LANG=' #{env_path} || echo 'LANG=en_US.UTF-8' >> #{env_path}")
|
302
|
-
system("grep -q '^RAILS_MASTER_KEY=' #{env_path} || echo 'RAILS_MASTER_KEY=yourmasterkey' >> #{env_path}")
|
303
|
-
logger.warn "Please set your RAILS_MASTER_KEY env var for this rails app." if system("grep -q '^RAILS_MASTER_KEY=yourmasterkey' #{env_path}")
|
304
|
-
|
305
|
-
# Setup app folders. If this is not created then docker will create it while running the container,
|
306
|
-
# but the folder will have root user assigned instead of the current user.
|
307
|
-
FileUtils.mkdir_p("#{container_path}/app/vendor/bundle")
|
308
|
-
FileUtils.mkdir_p("#{container_path}/app/public")
|
309
|
-
FileUtils.mkdir_p("#{container_path}/app/node_modules")
|
310
|
-
|
311
|
-
# Creating & Starting container
|
312
|
-
container_id = `docker ps -a -q --filter='name=^#{appname}_1$' --filter='status=running'`.chomp
|
313
|
-
new_container = container_id.empty? ? "#{appname}_1" : "#{appname}_2"
|
314
|
-
old_container = container_id.empty? ? "#{appname}_2" : "#{appname}_1"
|
315
|
-
|
316
|
-
self.stop_app("#{new_container}")
|
317
|
-
if system("docker create \
|
318
|
-
--name='#{new_container}' \
|
319
|
-
--env-file='#{container_path}/env' \
|
320
|
-
--expose='3000' \
|
321
|
-
--volume='#{Smartcloud.config.user_home_path}/.smartcloud/config:#{Smartcloud.config.user_home_path}/.smartcloud/config' \
|
322
|
-
--volume='#{container_path_with_version}:/app' \
|
323
|
-
--volume='#{container_path}/app/vendor/bundle:/app/vendor/bundle' \
|
324
|
-
--volume='#{container_path}/app/public:/app/public' \
|
325
|
-
--volume='#{container_path}/app/node_modules:/app/node_modules' \
|
326
|
-
--restart='always' \
|
327
|
-
--init \
|
328
|
-
--network='nginx-network' \
|
329
|
-
smartcloud/buildpacks/rails", out: File::NULL)
|
330
|
-
|
331
|
-
system("docker network connect solr-network #{new_container}")
|
332
|
-
system("docker network connect mysql-network #{new_container}")
|
333
|
-
|
334
|
-
if system("docker start --attach #{new_container}")
|
335
|
-
logger.debug "Starting Web Server ..."
|
336
|
-
if system("docker start #{new_container}", out: File::NULL)
|
337
|
-
sleep 5
|
338
|
-
logger.info "Web Server started successfully."
|
339
|
-
self.stop_app(old_container)
|
340
|
-
self.clean_up(container_path)
|
341
|
-
logger.info "Launched Application ... Success."
|
342
|
-
exit 10
|
343
|
-
end
|
344
|
-
else
|
345
|
-
self.stop_app("#{new_container}")
|
346
|
-
end
|
347
|
-
end
|
348
|
-
end
|
349
|
-
|
350
|
-
def self.clean_up(container_path)
|
351
|
-
logger.info "Cleaning up ..."
|
352
|
-
|
353
|
-
# Clean up very old versions
|
354
|
-
Dir.chdir("#{container_path}/releases") do
|
355
|
-
app_versions = Dir.glob('*').select { |f| File.directory? f }.sort
|
356
|
-
destroy_count = app_versions.count - ENV['KEEP_RELEASES'].to_i
|
357
|
-
if destroy_count > 0
|
358
|
-
logger.debug "Deleting older application releases ..."
|
359
|
-
destroy_count.times do
|
360
|
-
FileUtils.rm_r(File.join(Dir.pwd, app_versions.shift))
|
361
|
-
end
|
362
|
-
end
|
363
|
-
end
|
364
|
-
end
|
365
|
-
|
366
|
-
def self.load_container_env_vars(container_path)
|
367
|
-
unless File.exist? "#{container_path}/env"
|
368
|
-
logger.fatal "Environment could not be loaded ... Failed."
|
369
|
-
return false
|
370
|
-
end
|
371
|
-
|
372
|
-
File.open("#{container_path}/env").each_line do |line|
|
373
|
-
line.chomp!
|
374
|
-
next if line.empty? || line.start_with?('#')
|
375
|
-
key, value = line.split "="
|
376
|
-
ENV[key] = value
|
377
|
-
end
|
378
|
-
|
379
|
-
true
|
380
|
-
end
|
381
|
-
|
382
|
-
# Stop Container
|
383
|
-
def self.stop_container(container_name)
|
384
|
-
if Smartcloud::Docker.running?
|
385
|
-
container_id = `docker ps -a -q --filter='name=^#{container_name}$'`.chomp
|
386
|
-
unless container_id.empty?
|
387
|
-
logger.debug "Stopping & Removing container #{container_name} ..."
|
388
|
-
if system("docker stop #{container_name} && docker rm #{container_name}", out: File::NULL)
|
389
|
-
logger.debug "Stopped & Removed container #{container_name} ..."
|
390
|
-
end
|
391
|
-
else
|
392
|
-
logger.debug "Container '#{container_name}' does not exist to stop."
|
393
|
-
end
|
394
|
-
end
|
395
|
-
end
|
396
|
-
end
|
397
|
-
end
|
398
|
-
end
|