smartcloud 0.0.208 → 0.2.1
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 +68 -62
- data/lib/smartcloud.rb +7 -0
- 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 +11 -80
- data/lib/smartcloud/buildpacker.rb +75 -0
- data/lib/smartcloud/credentials.rb +127 -0
- data/lib/smartcloud/docker.rb +41 -25
- data/lib/smartcloud/engine.rb +39 -30
- data/lib/smartcloud/engine/Dockerfile +18 -18
- data/lib/smartcloud/{grids/grid-runner → engine}/buildpacks/rails/Dockerfile +3 -14
- 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 +11 -5
- data/lib/smartcloud/grids/nginx.rb +7 -4
- data/lib/smartcloud/grids/prereceiver.rb +131 -0
- data/lib/smartcloud/grids/redmine.rb +56 -0
- data/lib/smartcloud/grids/solr.rb +17 -10
- data/lib/smartcloud/machine.rb +170 -20
- data/lib/smartcloud/ssh.rb +43 -0
- 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 +9 -0
- data/lib/smartcloud/templates/dotsmartcloud/config/environment.rb +5 -3
- data/lib/smartcloud/templates/dotsmartcloud/config/users.yml +4 -0
- 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/templates/dotsmartcloud/tmp/.keep +0 -0
- data/lib/smartcloud/user.rb +11 -45
- data/lib/smartcloud/version.rb +13 -0
- metadata +228 -185
- data/bin/runner +0 -20
- data/lib/smartcloud/grids/buildpacker.rb +0 -96
- data/lib/smartcloud/grids/runner.rb +0 -404
- data/lib/smartcloud/templates/dotsmartcloud/grids/grid-nginx/users.yml +0 -1
- data/lib/smartcloud/templates/machine/config/machine.yml +0 -5
data/lib/smartcloud/base.rb
CHANGED
data/lib/smartcloud/boot.rb
CHANGED
@@ -1,96 +1,27 @@
|
|
1
|
-
require 'securerandom'
|
2
|
-
require "tempfile"
|
3
|
-
|
4
1
|
# The main Smartcloud Boot driver
|
5
2
|
module Smartcloud
|
6
3
|
class Boot < Smartcloud::Base
|
7
4
|
def initialize
|
8
5
|
end
|
9
|
-
|
10
|
-
def self.init
|
11
|
-
# Copy Template for dotsmartcloud
|
12
|
-
unless self.initialized?
|
13
|
-
puts "Initializing Smartcloud ...\n\n"
|
14
|
-
|
15
|
-
begin
|
16
|
-
print "Enter top-level apps domain to be used for subdomains of your apps. [Recommended: yourdomain.com]: "
|
17
|
-
config_apps_domain = STDIN.gets.chomp
|
18
|
-
raise if config_apps_domain.empty?
|
19
|
-
rescue
|
20
|
-
retry
|
21
|
-
end
|
22
|
-
|
23
|
-
begin
|
24
|
-
print "Enter sysadmin email id. [Recommended: admin@#{config_apps_domain}]: "
|
25
|
-
config_sysadmin_email = STDIN.gets.chomp
|
26
|
-
raise if config_sysadmin_email.empty?
|
27
|
-
rescue
|
28
|
-
retry
|
29
|
-
end
|
30
|
-
|
31
|
-
begin
|
32
|
-
print "Enter username for your git grid user. [Recommended: git@#{config_apps_domain}]: "
|
33
|
-
username = STDIN.gets.chomp
|
34
|
-
raise if username.empty?
|
35
|
-
rescue
|
36
|
-
retry
|
37
|
-
end
|
38
|
-
|
39
|
-
print "Enter password for your git grid user. (leave blank to generate automatically) [Recommended: Minimum 8 characters with numbers and symbols]: "
|
40
|
-
password = STDIN.gets.chomp
|
41
|
-
if password.empty?
|
42
|
-
password = SecureRandom.base64(8)
|
43
|
-
end
|
44
|
-
|
45
|
-
# Copy dotsmartcloud template to user home directory
|
46
|
-
FileUtils.cp_r("#{Smartcloud.config.root_path}/lib/smartcloud/templates/dotsmartcloud", "#{Smartcloud.config.user_home_path}/.smartcloud")
|
47
|
-
|
48
|
-
# modifying environment.rb file
|
49
|
-
tempFile = Tempfile.new("#{Smartcloud.config.user_home_path}/.smartcloud/config/environmentTemp.rb")
|
50
|
-
File.open("#{Smartcloud.config.user_home_path}/.smartcloud/config/environment.rb", "r").each_line do |line|
|
51
|
-
if line =~ /Smartcloud.config.apps_domain/
|
52
|
-
tempFile.puts "Smartcloud.config.apps_domain = \"#{config_apps_domain}\""
|
53
|
-
elsif line =~ /Smartcloud.config.git_domain/
|
54
|
-
tempFile.puts "Smartcloud.config.git_domain = \"git.#{config_apps_domain}\""
|
55
|
-
elsif line =~ /Smartcloud.config.sysadmin_email/
|
56
|
-
tempFile.puts "Smartcloud.config.sysadmin_email = \"#{config_sysadmin_email}\""
|
57
|
-
else
|
58
|
-
tempFile.puts line
|
59
|
-
end
|
60
|
-
end
|
61
|
-
tempFile.close
|
62
|
-
FileUtils.mv(tempFile.path, "#{Smartcloud.config.user_home_path}/.smartcloud/config/environment.rb")
|
63
|
-
|
64
|
-
# Reload the updated environment.rb file as it is required by methods below
|
65
|
-
require "#{Smartcloud.config.user_home_path}/.smartcloud/config/environment.rb"
|
66
|
-
|
67
|
-
# creating user for git grid at config.git_domain
|
68
|
-
Smartcloud::User.create(Smartcloud.config.git_domain, username, password)
|
69
|
-
|
70
|
-
puts "\nIMPORTANT NOTE: Please ensure that the required top-level apps domain '#{Smartcloud.config.apps_domain}' and git domain '#{Smartcloud.config.git_domain}' is pointing to this server using DNS Records before proceeding."
|
71
|
-
puts "IMPORTANT NOTE: Your git grid password is #{password} for username #{username}"
|
72
|
-
|
73
|
-
puts "\nInitializing Smartcloud ... done"
|
74
|
-
else
|
75
|
-
puts "Already Initialized. Please go to #{Smartcloud.config.user_home_path}/.smartcloud/config to make configuration changes."
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
def self.initialized?
|
80
|
-
Dir.exist? "#{Smartcloud.config.user_home_path}/.smartcloud"
|
81
|
-
end
|
82
6
|
end
|
83
7
|
end
|
84
8
|
|
9
|
+
require 'smartcloud/credentials'
|
10
|
+
|
11
|
+
require 'smartcloud/ssh'
|
85
12
|
require 'smartcloud/machine'
|
86
13
|
|
87
|
-
require 'smartcloud/engine'
|
88
14
|
require 'smartcloud/docker'
|
15
|
+
require 'smartcloud/engine'
|
16
|
+
require 'smartcloud/buildpacker'
|
89
17
|
|
90
18
|
require 'smartcloud/user'
|
91
19
|
|
92
20
|
require 'smartcloud/grids/mysql'
|
93
|
-
require 'smartcloud/grids/solr'
|
94
|
-
require 'smartcloud/grids/buildpacker'
|
95
|
-
require 'smartcloud/grids/runner'
|
96
21
|
require 'smartcloud/grids/nginx'
|
22
|
+
require 'smartcloud/grids/prereceiver'
|
23
|
+
require 'smartcloud/grids/redmine'
|
24
|
+
require 'smartcloud/grids/solr'
|
25
|
+
|
26
|
+
require 'smartcloud/apps/app'
|
27
|
+
require 'smartcloud/apps/rails'
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'open3'
|
2
|
+
|
3
|
+
module Smartcloud
|
4
|
+
class Buildpacker < Smartcloud::Base
|
5
|
+
def initialize
|
6
|
+
end
|
7
|
+
|
8
|
+
def install
|
9
|
+
self.uninstall
|
10
|
+
unless system("docker image inspect smartcloud/buildpacks/rails", [:out, :err] => File::NULL)
|
11
|
+
print "-----> Creating image smartcloud/buildpacks/rails ... "
|
12
|
+
if system("docker image build -t smartcloud/buildpacks/rails \
|
13
|
+
--build-arg USER_UID=`id -u` \
|
14
|
+
--build-arg USER_NAME=`id -un` \
|
15
|
+
#{Smartcloud.config.root_path}/lib/smartcloud/engine/buildpacks/rails", out: File::NULL)
|
16
|
+
puts "done"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def uninstall
|
22
|
+
if system("docker image inspect smartcloud/buildpacks/rails", [:out, :err] => File::NULL)
|
23
|
+
print "-----> Removing image smartcloud/buildpacks/rails ... "
|
24
|
+
if system("docker image rm smartcloud/buildpacks/rails", out: File::NULL)
|
25
|
+
puts "done"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def pack
|
31
|
+
if File.exist? "bin/rails"
|
32
|
+
rails = Smartcloud::Apps::Rails.new
|
33
|
+
rails.pack
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# These swapfile methods can be used (after required modification), when you need to make swapfile for more memory.
|
38
|
+
# def self.create_swapfile
|
39
|
+
# # Creating swapfile for bundler to work properly
|
40
|
+
# unless system("sudo swapon -s | grep -ci '/swapfile'", out: File::NULL)
|
41
|
+
# print "-----> Creating swap swapfile ... "
|
42
|
+
# system("sudo install -o root -g root -m 0600 /dev/null /swapfile", out: File::NULL)
|
43
|
+
# system("sudo dd if=/dev/zero of=/swapfile bs=1k count=2048k", [:out, :err] => File::NULL)
|
44
|
+
# system("sudo mkswap /swapfile", out: File::NULL)
|
45
|
+
# system("sudo sh -c 'echo \"/swapfile none swap sw 0 0\" >> /etc/fstab'", out: File::NULL)
|
46
|
+
# system("echo 10 | sudo tee /proc/sys/vm/swappiness", out: File::NULL)
|
47
|
+
# system("sudo sed -i '/^vm.swappiness = /d' /etc/sysctl.conf", out: File::NULL)
|
48
|
+
# system("echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf", out: File::NULL)
|
49
|
+
# puts "done"
|
50
|
+
#
|
51
|
+
# print "-----> Starting swap swapfile ... "
|
52
|
+
# if system("sudo swapon /swapfile", out: File::NULL)
|
53
|
+
# puts "done"
|
54
|
+
# end
|
55
|
+
# end
|
56
|
+
# end
|
57
|
+
#
|
58
|
+
# def self.destroy_swapfile
|
59
|
+
# if system("sudo swapon -s | grep -ci '/swapfile'", out: File::NULL)
|
60
|
+
# print "-----> Stopping swap swapfile ... "
|
61
|
+
# if system("sudo swapoff /swapfile", out: File::NULL)
|
62
|
+
# system("sudo sed -i '/^vm.swappiness = /d' /etc/sysctl.conf", out: File::NULL)
|
63
|
+
# system("echo 60 | sudo tee /proc/sys/vm/swappiness", out: File::NULL)
|
64
|
+
# puts "done"
|
65
|
+
#
|
66
|
+
# print "-----> Removing swap swapfile ... "
|
67
|
+
# system("sudo sed -i '/^\\/swapfile/d' /etc/fstab", out: File::NULL)
|
68
|
+
# if system("sudo rm /swapfile", out: File::NULL)
|
69
|
+
# puts "done"
|
70
|
+
# end
|
71
|
+
# end
|
72
|
+
# end
|
73
|
+
# end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
require "pathname"
|
2
|
+
require "tmpdir"
|
3
|
+
require "active_support/message_encryptor"
|
4
|
+
require "active_support/core_ext/hash/keys"
|
5
|
+
|
6
|
+
# The main Smartcloud Credentials driver
|
7
|
+
module Smartcloud
|
8
|
+
class Credentials < Smartcloud::Base
|
9
|
+
|
10
|
+
CIPHER = "aes-256-gcm"
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
end
|
14
|
+
|
15
|
+
def create
|
16
|
+
write_key
|
17
|
+
write credentials_template
|
18
|
+
end
|
19
|
+
|
20
|
+
def edit
|
21
|
+
content_path = Pathname.new "config/credentials.yml.enc"
|
22
|
+
tmp_file = "#{Process.pid}.#{content_path.basename.to_s.chomp('.enc')}"
|
23
|
+
tmp_path = Pathname.new File.join(Dir.tmpdir, tmp_file)
|
24
|
+
contents = read
|
25
|
+
tmp_path.binwrite contents
|
26
|
+
|
27
|
+
system("#{ENV['EDITOR']} #{tmp_path}")
|
28
|
+
|
29
|
+
updated_contents = tmp_path.binread
|
30
|
+
|
31
|
+
if updated_contents != contents
|
32
|
+
write(updated_contents)
|
33
|
+
puts "File encrypted and saved."
|
34
|
+
else
|
35
|
+
puts "File contents were not changed."
|
36
|
+
end
|
37
|
+
ensure
|
38
|
+
FileUtils.rm(tmp_path) if tmp_path&.exist?
|
39
|
+
end
|
40
|
+
|
41
|
+
def read_key
|
42
|
+
read_env_key || read_key_file || handle_missing_key
|
43
|
+
end
|
44
|
+
|
45
|
+
def config
|
46
|
+
@config ||= deserialize(read).deep_symbolize_keys
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def credentials_template
|
52
|
+
<<~YAML
|
53
|
+
machine:
|
54
|
+
hostname: #{SecureRandom.hex(8)}
|
55
|
+
host: 122.122.122.122
|
56
|
+
port: 22
|
57
|
+
root_password: #{SecureRandom.hex(16)}
|
58
|
+
username: #{SecureRandom.hex(8)}
|
59
|
+
password: #{SecureRandom.hex(16)}
|
60
|
+
|
61
|
+
mysql:
|
62
|
+
port: 3306
|
63
|
+
root_password: #{SecureRandom.hex(16)}
|
64
|
+
username: #{SecureRandom.hex(8)}
|
65
|
+
password: #{SecureRandom.hex(16)}
|
66
|
+
database_name: #{SecureRandom.hex(4)}_production
|
67
|
+
|
68
|
+
redmine:
|
69
|
+
admin_username: admin
|
70
|
+
admin_password: #{SecureRandom.hex(16)}
|
71
|
+
secret_key_base: #{SecureRandom.hex(64)}
|
72
|
+
database_host: mysql
|
73
|
+
database_port: 3306
|
74
|
+
database_username: #{SecureRandom.hex(8)}_redmine
|
75
|
+
database_password: #{SecureRandom.hex(16)}
|
76
|
+
database_name: #{SecureRandom.hex(4)}_redmine_production
|
77
|
+
# plugins_migrate: true
|
78
|
+
YAML
|
79
|
+
end
|
80
|
+
|
81
|
+
def read
|
82
|
+
decrypt IO.binread "config/credentials.yml.enc"
|
83
|
+
end
|
84
|
+
|
85
|
+
def write(contents)
|
86
|
+
IO.binwrite "config/credentials.yml.enc.tmp", encrypt(contents)
|
87
|
+
FileUtils.mv "config/credentials.yml.enc.tmp", "config/credentials.yml.enc"
|
88
|
+
end
|
89
|
+
|
90
|
+
def encrypt(contents)
|
91
|
+
encryptor.encrypt_and_sign contents
|
92
|
+
end
|
93
|
+
|
94
|
+
def decrypt(contents)
|
95
|
+
encryptor.decrypt_and_verify contents
|
96
|
+
end
|
97
|
+
|
98
|
+
def encryptor
|
99
|
+
@encryptor ||= ActiveSupport::MessageEncryptor.new([ read_key ].pack("H*"), cipher: CIPHER)
|
100
|
+
end
|
101
|
+
|
102
|
+
def create_key
|
103
|
+
SecureRandom.hex(ActiveSupport::MessageEncryptor.key_len(CIPHER))
|
104
|
+
end
|
105
|
+
|
106
|
+
def write_key
|
107
|
+
IO.binwrite "config/master.key.tmp", create_key
|
108
|
+
FileUtils.mv "config/master.key.tmp", "config/master.key"
|
109
|
+
end
|
110
|
+
|
111
|
+
def read_env_key
|
112
|
+
ENV['SMARTCLOUD_MASTER_KEY']
|
113
|
+
end
|
114
|
+
|
115
|
+
def read_key_file
|
116
|
+
IO.binread("config/master.key").strip if File.file?("config/master.key")
|
117
|
+
end
|
118
|
+
|
119
|
+
def handle_missing_key
|
120
|
+
raise "Missing SMARTCLOUD_MASTER_KEY. Please add SMARTCLOUD_MASTER_KEY to your environment."
|
121
|
+
end
|
122
|
+
|
123
|
+
def deserialize(config)
|
124
|
+
YAML.load(config).presence || {}
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
data/lib/smartcloud/docker.rb
CHANGED
@@ -13,22 +13,31 @@ module Smartcloud
|
|
13
13
|
# Arguments:
|
14
14
|
# none
|
15
15
|
def self.install
|
16
|
+
ssh = Smartcloud::SSH.new
|
17
|
+
|
16
18
|
puts "-----> Installing Docker"
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
commands = [
|
20
|
+
"sudo apt-get -y update",
|
21
|
+
"sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common",
|
22
|
+
"curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -",
|
23
|
+
"sudo apt-key fingerprint 0EBFCD88",
|
24
|
+
"sudo add-apt-repository \"deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable\"",
|
25
|
+
"sudo apt-get -y update",
|
26
|
+
"sudo apt-get -y install docker-ce",
|
27
|
+
"sudo usermod -aG docker $USER",
|
28
|
+
"docker run --rm hello-world",
|
29
|
+
"docker rmi hello-world"
|
30
|
+
]
|
31
|
+
ssh.run commands
|
26
32
|
|
27
33
|
puts "-----> Installing Docker Compose"
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
34
|
+
commands = [
|
35
|
+
"sudo curl -L --fail https://github.com/docker/compose/releases/download/1.24.0/run.sh -o /usr/local/bin/docker-compose",
|
36
|
+
"sudo chmod +x /usr/local/bin/docker-compose",
|
37
|
+
"docker-compose --version",
|
38
|
+
"sudo curl -L https://raw.githubusercontent.com/docker/compose/1.24.0/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose"
|
39
|
+
]
|
40
|
+
ssh.run commands
|
32
41
|
|
33
42
|
self.add_ufw_rules
|
34
43
|
|
@@ -44,12 +53,17 @@ module Smartcloud
|
|
44
53
|
# Arguments:
|
45
54
|
# none
|
46
55
|
def self.uninstall
|
56
|
+
ssh = Smartcloud::SSH.new
|
57
|
+
|
47
58
|
puts "-----> Uninstalling Docker Compose"
|
48
|
-
|
59
|
+
ssh.run "sudo rm /usr/local/bin/docker-compose"
|
49
60
|
|
50
61
|
puts "-----> Uninstalling Docker"
|
51
|
-
|
52
|
-
|
62
|
+
commands = [
|
63
|
+
"sudo apt-get purge docker-ce",
|
64
|
+
"sudo rm -rf /var/lib/docker"
|
65
|
+
]
|
66
|
+
ssh.run commands
|
53
67
|
|
54
68
|
self.remove_ufw_rules
|
55
69
|
|
@@ -57,15 +71,6 @@ module Smartcloud
|
|
57
71
|
puts "-----> You must delete any edited configuration files manually."
|
58
72
|
end
|
59
73
|
|
60
|
-
def self.running?
|
61
|
-
if system("docker info", [:out, :err] => File::NULL)
|
62
|
-
true
|
63
|
-
else
|
64
|
-
puts "Error: Docker daemon is not running. Have you installed docker? Please ensure docker daemon is running and try again."
|
65
|
-
false
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
74
|
def self.add_ufw_rules
|
70
75
|
puts '-----> Add the following rules to the end of the file /etc/ufw/after.rules and reload ufw using - sudo ufw reload'
|
71
76
|
puts '# BEGIN UFW AND DOCKER
|
@@ -116,5 +121,16 @@ module Smartcloud
|
|
116
121
|
# system("sed '/^# BEGIN UFW AND DOCKER/,/^# END UFW AND DOCKER/d' '/etc/ufw/after.rules'")
|
117
122
|
# system("sudo ufw reload")
|
118
123
|
end
|
124
|
+
|
125
|
+
# Below methods are non ssh methods and should be executed on the server only.
|
126
|
+
|
127
|
+
def self.running?
|
128
|
+
if system("docker info", [:out, :err] => File::NULL)
|
129
|
+
true
|
130
|
+
else
|
131
|
+
puts "Error: Docker daemon is not running. Have you installed docker? Please ensure docker daemon is running and try again."
|
132
|
+
false
|
133
|
+
end
|
134
|
+
end
|
119
135
|
end
|
120
136
|
end
|
data/lib/smartcloud/engine.rb
CHANGED
@@ -4,35 +4,44 @@ module Smartcloud
|
|
4
4
|
def initialize
|
5
5
|
end
|
6
6
|
|
7
|
-
def
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
#
|
17
|
-
|
18
|
-
|
19
|
-
#
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
7
|
+
def install
|
8
|
+
self.uninstall
|
9
|
+
|
10
|
+
Smartcloud::User.create_htpasswd_files
|
11
|
+
|
12
|
+
ssh = Smartcloud::SSH.new
|
13
|
+
machine = Smartcloud::Machine.new
|
14
|
+
|
15
|
+
system("mkdir -p ./tmp/engine")
|
16
|
+
system("cp #{Smartcloud.config.root_path}/lib/smartcloud/engine/Dockerfile ./tmp/engine/Dockerfile")
|
17
|
+
|
18
|
+
gem_file_path = File.expand_path("../../cache/smartcloud-#{Smartcloud.version}.gem", Smartcloud.config.root_path)
|
19
|
+
system("cp #{gem_file_path} ./tmp/engine/smartcloud-#{Smartcloud.version}.gem")
|
20
|
+
|
21
|
+
machine.sync first_sync: true
|
22
|
+
|
23
|
+
puts "-----> Creating image smartcloud ... "
|
24
|
+
ssh.run "docker image build -t smartcloud \
|
25
|
+
--build-arg SMARTCLOUD_MASTER_KEY=#{Smartcloud::Credentials.new.read_key} \
|
26
|
+
--build-arg SMARTCLOUD_VERSION=#{Smartcloud.version} \
|
27
|
+
--build-arg USER_NAME=`id -un` \
|
28
|
+
--build-arg USER_UID=`id -u` \
|
29
|
+
--build-arg DOCKER_GID=`getent group docker | cut -d: -f3` \
|
30
|
+
~/.smartcloud/tmp/engine"
|
31
|
+
|
32
|
+
puts "-----> Adding smartcloud to PATH ... "
|
33
|
+
ssh.run "chmod +x ~/.smartcloud/bin/smartcloud.sh && sudo ln -sf ~/.smartcloud/bin/smartcloud.sh /usr/local/bin/smartcloud"
|
34
|
+
system("rm ./tmp/engine/Dockerfile")
|
35
|
+
system("rm ./tmp/engine/smartcloud-#{Smartcloud.version}.gem")
|
36
|
+
|
37
|
+
machine.sync
|
38
|
+
end
|
39
|
+
|
40
|
+
def uninstall
|
41
|
+
ssh = Smartcloud::SSH.new
|
42
|
+
|
43
|
+
ssh.run "sudo rm /usr/local/bin/smartcloud"
|
44
|
+
ssh.run "docker rmi smartcloud"
|
36
45
|
end
|
37
46
|
end
|
38
|
-
end
|
47
|
+
end
|