diff options
author | Yuli Shlosberg <ys9693@att.com> | 2018-02-15 12:04:46 +0200 |
---|---|---|
committer | Yuli Shlosberg <ys9693@att.com> | 2018-02-21 17:28:40 +0200 |
commit | 958c32d2d7a3e5cbd9bc672645cdeb95a49b719a (patch) | |
tree | 1ba5b0d1dbece6daa5618a005d6281bbd5c7c1dc | |
parent | 4cc47ac3abe00eda7c04b9955e56dafc819e2657 (diff) |
OOM Alignment BE,FE,KBN
Change-Id: I8ff609a6be919d5709ce95af5a6a903aeb7afc43
Issue-ID: SDC-918
Signed-off-by: Yuli Shlosberg <ys9693@att.com>
111 files changed, 2023 insertions, 3528 deletions
diff --git a/.gitignore b/.gitignore index 1ba0e6fbb1..e765d09bdd 100644 --- a/.gitignore +++ b/.gitignore @@ -164,11 +164,13 @@ openecomp-be/tools/swagger-ui/api-docs/api.html openecomp-be/tools/swagger-ui/api-docs/api.json openecomp-ui/node/* sdc-os-chef/.idea/* -sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/Artifact-Generator.properties -sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/ecomp-error-configuration.yaml -sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/error-configuration.yaml -sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/logback.xml -sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-normatives/files/default/normatives.tar.gz + +catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/Artifact-Generator.properties +catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/ecomp-error-configuration.yaml +catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/error-configuration.yaml +catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/logback.xml +catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/files/default/normatives.tar.gz + sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/attributes/default.rb sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/files/default/SDC-*.zip sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/files/default/sdctool.tar @@ -220,3 +222,5 @@ sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/testSuites/* /asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/files/default/* /asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/attributes/default.rb /openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/vsp_* + + diff --git a/catalog-be/pom.xml b/catalog-be/pom.xml index fe0cef7827..1b2a92ddbf 100644 --- a/catalog-be/pom.xml +++ b/catalog-be/pom.xml @@ -1,708 +1,758 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <artifactId>catalog-be</artifactId> - <packaging>war</packaging> - - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>sdc-main</artifactId> - <version>1.2.0-SNAPSHOT</version> - </parent> - - <properties> - <swagger-ui-version>2.1.0-M2</swagger-ui-version> - </properties> - - <dependencies> - <!--JSON and YAML Parsing--> - <dependency> - <groupId>com.fasterxml.jackson.dataformat</groupId> - <artifactId>jackson-dataformat-yaml</artifactId> - <version>${jackson.yaml.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - <version>${jackson.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-core</artifactId> - <version>${jackson.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-annotations</artifactId> - <version>${jackson.annotations.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.glassfish.jersey.media</groupId> - <artifactId>jersey-media-multipart</artifactId> - <version>${jersey-bom.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>security-utils</artifactId> - <version>${project.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>com.tinkerpop.blueprints</groupId> - <artifactId>blueprints-sail-graph</artifactId> - <version>2.5.0</version> - <optional>true</optional> - <exclusions> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>com.tinkerpop.blueprints</groupId> - <artifactId>blueprints-graph-sail</artifactId> - <version>2.5.0</version> - <optional>true</optional> - </dependency> - - <!-- Swagger Dependencies Start --> - <dependency> - <groupId>io.swagger</groupId> - <artifactId>swagger-jersey2-jaxrs</artifactId> - <scope>compile</scope> - <version>1.5.15</version> - </dependency> - <!-- Swagger Dependencies End --> - - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>common-app-api</artifactId> - <version>${project.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.openecomp.sdc.be</groupId> - <artifactId>common-be</artifactId> - <version>${project.version}</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.openecomp.sdc.be</groupId> - <artifactId>catalog-dao</artifactId> - <version>${project.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.openecomp.sdc.be</groupId> - <artifactId>catalog-model</artifactId> - <version>${project.version}</version> - <scope>compile</scope> - </dependency> - - <!-- slf4j + logback --> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <version>${slf4j-api.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <artifactId>catalog-be</artifactId> + <packaging>war</packaging> + + <parent> + <groupId>org.openecomp.sdc</groupId> + <artifactId>sdc-main</artifactId> + <version>1.2.0-SNAPSHOT</version> + </parent> + + <properties> + <swagger-ui-version>2.1.0-M2</swagger-ui-version> + </properties> + + <dependencies> + <!--JSON and YAML Parsing--> + <dependency> + <groupId>com.fasterxml.jackson.dataformat</groupId> + <artifactId>jackson-dataformat-yaml</artifactId> + <version>${jackson.yaml.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>${jackson.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + <version>${jackson.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + <version>${jackson.annotations.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.glassfish.jersey.media</groupId> + <artifactId>jersey-media-multipart</artifactId> + <version>${jersey-bom.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.openecomp.sdc</groupId> + <artifactId>security-utils</artifactId> + <version>${project.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>com.tinkerpop.blueprints</groupId> + <artifactId>blueprints-sail-graph</artifactId> + <version>2.5.0</version> + <optional>true</optional> + <exclusions> + <exclusion> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>com.tinkerpop.blueprints</groupId> + <artifactId>blueprints-graph-sail</artifactId> + <version>2.5.0</version> + <optional>true</optional> + </dependency> + + <!-- Swagger Dependencies Start --> + <dependency> + <groupId>io.swagger</groupId> + <artifactId>swagger-jersey2-jaxrs</artifactId> + <scope>compile</scope> + <version>1.5.15</version> + </dependency> + <!-- Swagger Dependencies End --> + + <dependency> + <groupId>org.openecomp.sdc</groupId> + <artifactId>common-app-api</artifactId> + <version>${project.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.openecomp.sdc.be</groupId> + <artifactId>common-be</artifactId> + <version>${project.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.openecomp.sdc.be</groupId> + <artifactId>catalog-dao</artifactId> + <version>${project.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.openecomp.sdc.be</groupId> + <artifactId>catalog-model</artifactId> + <version>${project.version}</version> + <scope>compile</scope> + </dependency> + + <!-- slf4j + logback --> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>${slf4j-api.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> <version>${logback.version}</version> - <scope>compile</scope> - </dependency> + <scope>compile</scope> + </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-core</artifactId> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-core</artifactId> <version>${logback.version}</version> - <scope>compile</scope> - </dependency> + <scope>compile</scope> + </dependency> - <!-- Snake Yaml --> - <dependency> - <groupId>org.yaml</groupId> - <artifactId>snakeyaml</artifactId> + <!-- Snake Yaml --> + <dependency> + <groupId>org.yaml</groupId> + <artifactId>snakeyaml</artifactId> <version>${snakeyaml.version}</version> - <scope>compile</scope> - </dependency> - - <!-- File changes listener --> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-jci-core</artifactId> - <version>${commons-jci-core.version}</version> - <scope>compile</scope> - </dependency> - - <!-- Gson --> - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - <version>${gson.version}</version> - <scope>compile</scope> - </dependency> - - <!-- jersey --> - <dependency> - <groupId>org.glassfish.jersey.media</groupId> - <artifactId>jersey-media-json-jackson</artifactId> - <version>${jersey-bom.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.glassfish.jersey.containers</groupId> - <artifactId>jersey-container-servlet-core</artifactId> - <version>${jersey-bom.version}</version> - <scope>compile</scope> - </dependency> - - <!-- http client --> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> + <scope>compile</scope> + </dependency> + + <!-- File changes listener --> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-jci-core</artifactId> + <version>${commons-jci-core.version}</version> + <scope>compile</scope> + </dependency> + + <!-- Gson --> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <version>${gson.version}</version> + <scope>compile</scope> + </dependency> + + <!-- jersey --> + <dependency> + <groupId>org.glassfish.jersey.media</groupId> + <artifactId>jersey-media-json-jackson</artifactId> + <version>${jersey-bom.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.glassfish.jersey.containers</groupId> + <artifactId>jersey-container-servlet-core</artifactId> + <version>${jersey-bom.version}</version> + <scope>compile</scope> + </dependency> + + <!-- http client --> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> <version>${httpclient.version}</version> - <scope>compile</scope> - </dependency> + <scope>compile</scope> + </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpcore</artifactId> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpcore</artifactId> <version>${httpcore.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - <version>${commons-logging}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>commons-codec</groupId> - <artifactId>commons-codec</artifactId> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + <version>${commons-logging}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> <version>${commons-codec}</version> - <scope>compile</scope> - </dependency> - <!-- http client END --> + <scope>compile</scope> + </dependency> + <!-- http client END --> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> <version>${servlet-api.version}</version> - <scope>provided</scope> - </dependency> - - <dependency> - <groupId>org.eclipse.jgit</groupId> - <artifactId>org.eclipse.jgit</artifactId> - <version>3.4.1.201406201815-r</version> - </dependency> - - <!-- spring - used by A4C --> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-core</artifactId> - <version>${spring.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-context</artifactId> - <version>${spring.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-web</artifactId> - <version>${spring.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-webmvc</artifactId> - <version>${spring.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-aop</artifactId> - <version>${spring.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-beans</artifactId> - <version>${spring.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-expression</artifactId> - <version>${spring.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.codehaus.groovy</groupId> - <artifactId>groovy-all</artifactId> - <version>${groovy.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.codehaus.janino</groupId> - <artifactId>janino</artifactId> - <version>${janino.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.codehaus.janino</groupId> - <artifactId>commons-compiler</artifactId> - <version>${janino.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - <version>${guava.version}</version> - <scope>compile</scope> - </dependency> - - <!-- TITAN --> - <dependency> - <groupId>com.thinkaurelius.titan</groupId> - <artifactId>titan-core</artifactId> - <version>${titan.version}</version> - <scope>compile</scope> - <exclusions> - <exclusion> - <groupId>org.json</groupId> - <artifactId>json</artifactId> - </exclusion> - <exclusion> - <artifactId>slf4j-log4j12</artifactId> - <groupId>org.slf4j</groupId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>org.openecomp.sdc.sdc-titan-cassandra</groupId> - <artifactId>sdc-titan-cassandra</artifactId> - <version>${titan.version}</version> - <scope>compile</scope> - <exclusions> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - </exclusion> - <exclusion> - <groupId>io.netty</groupId> - <artifactId>netty-all</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - <version>${lang3.version}</version> - <scope>compile</scope> - </dependency> - <!-- TITAN END --> - - <dependency> - <groupId>com.googlecode.json-simple</groupId> - <artifactId>json-simple</artifactId> - <version>${json-simple.version}</version> - <scope>compile</scope> - - </dependency> - - <dependency> - <groupId>org.elasticsearch</groupId> - <artifactId>elasticsearch</artifactId> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.eclipse.jgit</groupId> + <artifactId>org.eclipse.jgit</artifactId> + <version>3.4.1.201406201815-r</version> + </dependency> + + <!-- spring - used by A4C --> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + <version>${spring.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + <version>${spring.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + <version>${spring.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-webmvc</artifactId> + <version>${spring.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-aop</artifactId> + <version>${spring.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-beans</artifactId> + <version>${spring.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-expression</artifactId> + <version>${spring.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.codehaus.groovy</groupId> + <artifactId>groovy-all</artifactId> + <version>${groovy.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.codehaus.janino</groupId> + <artifactId>janino</artifactId> + <version>${janino.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.codehaus.janino</groupId> + <artifactId>commons-compiler</artifactId> + <version>${janino.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>${guava.version}</version> + <scope>compile</scope> + </dependency> + + <!-- TITAN --> + <dependency> + <groupId>com.thinkaurelius.titan</groupId> + <artifactId>titan-core</artifactId> + <version>${titan.version}</version> + <scope>compile</scope> + <exclusions> + <exclusion> + <groupId>org.json</groupId> + <artifactId>json</artifactId> + </exclusion> + <exclusion> + <artifactId>slf4j-log4j12</artifactId> + <groupId>org.slf4j</groupId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.openecomp.sdc.sdc-titan-cassandra</groupId> + <artifactId>sdc-titan-cassandra</artifactId> + <version>${titan.version}</version> + <scope>compile</scope> + <exclusions> + <exclusion> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + </exclusion> + <exclusion> + <groupId>io.netty</groupId> + <artifactId>netty-all</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>${lang3.version}</version> + <scope>compile</scope> + </dependency> + <!-- TITAN END --> + + <dependency> + <groupId>com.googlecode.json-simple</groupId> + <artifactId>json-simple</artifactId> + <version>${json-simple.version}</version> + <scope>compile</scope> + + </dependency> + + <dependency> + <groupId>org.elasticsearch</groupId> + <artifactId>elasticsearch</artifactId> <version>${elastic-search.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.elasticsearch.plugin</groupId> - <artifactId>shield</artifactId> - <version>${elastic-search.version}</version> - <scope>compile</scope> - </dependency> - <!-- functional java --> - <dependency> - <groupId>org.functionaljava</groupId> - <artifactId>functionaljava</artifactId> - <version>${functionaljava.version}</version> - <scope>compile</scope> - </dependency> - - <!-- Aspects --> - <dependency> - <groupId>com.jcabi</groupId> - <artifactId>jcabi-aspects</artifactId> - <version>${jcabi.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>aspectjrt</artifactId> - <version>${aspectjrt.version}</version> - <scope>compile</scope> - </dependency> - - <!-- CAMBRIA CLIENT for U-EB --> - <dependency> - <groupId>com.att.nsa</groupId> - <artifactId>cambriaClient</artifactId> - <version>0.0.1</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>com.att.nsa</groupId> - <artifactId>saClientLibrary</artifactId> - <version>0.0.1</version> - <scope>compile</scope> - <exclusions> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>org.json</groupId> - <artifactId>json</artifactId> - <version>20131018</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.apache.tinkerpop</groupId> - <artifactId>tinkergraph-gremlin</artifactId> - <version>3.0.1-incubating</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.apache.tinkerpop</groupId> - <artifactId>gremlin-groovy</artifactId> - <version>3.0.1-incubating</version> - <scope>compile</scope> - </dependency> - - <!-- CASSANDRA --> - <dependency> - <groupId>com.datastax.cassandra</groupId> - <artifactId>cassandra-driver-core</artifactId> - <version>${cassandra.driver.version}</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>com.datastax.cassandra</groupId> - <artifactId>cassandra-driver-mapping</artifactId> - <version>${cassandra.driver.version}</version> - <scope>compile</scope> - </dependency> - <!-- CASSANDRA END --> - - <!-- Inserted for ECOMP Portal Integration --> - <dependency> - <groupId>org.openecomp.ecompsdkos</groupId> - <artifactId>epsdk-fw</artifactId> - <version>${ecomp.version}</version> - <scope>compile</scope> - <exclusions> - <exclusion> - <groupId>com.att.nsa</groupId> - <artifactId>cambriaClient</artifactId> - </exclusion> - <exclusion> - <artifactId>slf4j-log4j12</artifactId> - <groupId>org.slf4j</groupId> - </exclusion> - </exclusions> - </dependency> - - <!--Artifact Generator--> - <dependency> - <groupId>org.openecomp.sdc.common</groupId> - <artifactId>openecomp-sdc-artifact-generator-api</artifactId> - <version>${artifact-generator-api.version}</version> - <scope>compile</scope> - <exclusions> - <exclusion> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>org.openecomp.sdc.common</groupId> - <artifactId>openecomp-sdc-artifact-generator-core</artifactId> - <version>${artifact-generator-core.version}</version> - <scope>compile</scope> - <exclusions> - <exclusion> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>org.openecomp.sdc.common</groupId> - <artifactId>openecomp-common-lib</artifactId> - <version>${dox-common-lib.version}</version> - <type>pom</type> - <exclusions> - <exclusion> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </exclusion> - </exclusions> - </dependency> - - <!--Jetty Proxy--> - <dependency> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-proxy</artifactId> - <version>${jetty.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-servlets</artifactId> - <version>${jetty.version}</version> - <scope>compile</scope> - </dependency> - <!-- System metrics --> - <dependency> - <groupId>org.fusesource</groupId> - <artifactId>sigar</artifactId> - <version>${sigar.version}</version> - <scope>compile</scope> - </dependency> - - <!-- TEST --> - <dependency> - <groupId>org.glassfish.jersey.test-framework.providers</groupId> - <artifactId>jersey-test-framework-provider-bundle</artifactId> - <version>${jersey-bom.version}</version> - <type>pom</type> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-servlet</artifactId> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.elasticsearch.plugin</groupId> + <artifactId>shield</artifactId> + <version>${elastic-search.version}</version> + <scope>compile</scope> + </dependency> + <!-- functional java --> + <dependency> + <groupId>org.functionaljava</groupId> + <artifactId>functionaljava</artifactId> + <version>${functionaljava.version}</version> + <scope>compile</scope> + </dependency> + + <!-- Aspects --> + <dependency> + <groupId>com.jcabi</groupId> + <artifactId>jcabi-aspects</artifactId> + <version>${jcabi.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>aspectjrt</artifactId> + <version>${aspectjrt.version}</version> + <scope>compile</scope> + </dependency> + + <!-- CAMBRIA CLIENT for U-EB --> + <dependency> + <groupId>com.att.nsa</groupId> + <artifactId>cambriaClient</artifactId> + <version>0.0.1</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>com.att.nsa</groupId> + <artifactId>saClientLibrary</artifactId> + <version>0.0.1</version> + <scope>compile</scope> + <exclusions> + <exclusion> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.json</groupId> + <artifactId>json</artifactId> + <version>20131018</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tinkerpop</groupId> + <artifactId>tinkergraph-gremlin</artifactId> + <version>3.0.1-incubating</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.apache.tinkerpop</groupId> + <artifactId>gremlin-groovy</artifactId> + <version>3.0.1-incubating</version> + <scope>compile</scope> + </dependency> + + <!-- CASSANDRA --> + <dependency> + <groupId>com.datastax.cassandra</groupId> + <artifactId>cassandra-driver-core</artifactId> + <version>${cassandra.driver.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>com.datastax.cassandra</groupId> + <artifactId>cassandra-driver-mapping</artifactId> + <version>${cassandra.driver.version}</version> + <scope>compile</scope> + </dependency> + <!-- CASSANDRA END --> + + <!-- Inserted for ECOMP Portal Integration --> + <dependency> + <groupId>org.openecomp.ecompsdkos</groupId> + <artifactId>epsdk-fw</artifactId> + <version>${ecomp.version}</version> + <scope>compile</scope> + <exclusions> + <exclusion> + <groupId>com.att.nsa</groupId> + <artifactId>cambriaClient</artifactId> + </exclusion> + <exclusion> + <artifactId>slf4j-log4j12</artifactId> + <groupId>org.slf4j</groupId> + </exclusion> + </exclusions> + </dependency> + + <!--Artifact Generator--> + <dependency> + <groupId>org.openecomp.sdc.common</groupId> + <artifactId>openecomp-sdc-artifact-generator-api</artifactId> + <version>${artifact-generator-api.version}</version> + <scope>compile</scope> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.openecomp.sdc.common</groupId> + <artifactId>openecomp-sdc-artifact-generator-core</artifactId> + <version>${artifact-generator-core.version}</version> + <scope>compile</scope> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.openecomp.sdc.common</groupId> + <artifactId>openecomp-common-lib</artifactId> + <version>${dox-common-lib.version}</version> + <type>pom</type> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> + </dependency> + + <!--Jetty Proxy--> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-proxy</artifactId> + <version>${jetty.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-servlets</artifactId> + <version>${jetty.version}</version> + <scope>compile</scope> + </dependency> + <!-- System metrics --> + <dependency> + <groupId>org.fusesource</groupId> + <artifactId>sigar</artifactId> + <version>${sigar.version}</version> + <scope>compile</scope> + </dependency> + + <!-- TEST --> + <dependency> + <groupId>org.glassfish.jersey.test-framework.providers</groupId> + <artifactId>jersey-test-framework-provider-bundle</artifactId> + <version>${jersey-bom.version}</version> + <type>pom</type> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-servlet</artifactId> <version>${jetty.version}</version> - <scope>test</scope> - </dependency> + <scope>test</scope> + </dependency> - <dependency> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-webapp</artifactId> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-webapp</artifactId> <version>${jetty.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>${junit.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <version>${mockito.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>${junit.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <version>${mockito.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> <version>${assertj.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-test</artifactId> - <version>${spring.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-tx</artifactId> - <version>${spring.version}</version> - <scope>test</scope> - </dependency> - </dependencies> - - <build> - - <finalName>${project.artifactId}-${project.version}</finalName> - - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-war-plugin</artifactId> - <version>2.6</version> - <configuration> - <packagingExcludes>WEB-INF\lib\slf4j-log4j*.jar, - WEB-INF/classes/elasticsearch.yml, - WEB-INF/classes/portal.properties</packagingExcludes> - <archive> - <manifestEntries> - <SDC-Version>${project.version}</SDC-Version> - </manifestEntries> - <manifest> - <addDefaultImplementationEntries>true</addDefaultImplementationEntries> - <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries> - </manifest> - </archive> - - <webResources> - <resource> - <directory>src/main/resources</directory> - <directory>src/main/resources/swagger</directory> - </resource> - </webResources> - <attachClasses>true</attachClasses> - </configuration> - </plugin> - - <plugin> - <groupId>com.jcabi</groupId> - <artifactId>jcabi-maven-plugin</artifactId> - <version>${jcabi.plugin.version}</version> - <executions> - <execution> - <goals> - <goal>ajc</goal> - </goals> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-assembly-plugin</artifactId> - <executions> - <execution> - <id>normatives</id> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - <configuration> - <finalName>normatives</finalName> - <appendAssemblyId>false</appendAssemblyId> - <descriptor>${project.basedir}/normatives.xml</descriptor> - </configuration> - </execution> - </executions> - </plugin> - - </plugins> - - <pluginManagement> - <plugins> - <!--This plugin's configuration is used to store Eclipse m2e settings - only. It has no influence on the Maven build itself. --> - <plugin> - <groupId>org.eclipse.m2e</groupId> - <artifactId>lifecycle-mapping</artifactId> - <version>1.0.0</version> - <configuration> - <lifecycleMappingMetadata> - <pluginExecutions> - <pluginExecution> - <pluginExecutionFilter> - <groupId>com.googlecode.maven-download-plugin</groupId> - <artifactId>download-maven-plugin</artifactId> - <versionRange>[1.2.1,)</versionRange> - <goals> - <goal>wget</goal> - </goals> - </pluginExecutionFilter> - <action> - <ignore></ignore> - </action> - </pluginExecution> - - <pluginExecution> - <pluginExecutionFilter> - <groupId>com.jcabi</groupId> - <artifactId>jcabi-maven-plugin</artifactId> - <versionRange>[0.0,)</versionRange> - <goals> - <goal>ajc</goal> - </goals> - </pluginExecutionFilter> - <action> - <execute /> - </action> - </pluginExecution> - - </pluginExecutions> - </lifecycleMappingMetadata> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-deploy-plugin</artifactId> - <version>2.7</version> - <configuration> - <skip>true</skip> - </configuration> - </plugin> - </plugins> - </pluginManagement> - <!-- Swagger Plugins End --> - </build> - - <profiles> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-test</artifactId> + <version>${spring.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-tx</artifactId> + <version>${spring.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + + <finalName>${project.artifactId}-${project.version}</finalName> + + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <version>2.6</version> + <configuration> + <packagingExcludes>WEB-INF\lib\slf4j-log4j*.jar, + WEB-INF/classes/elasticsearch.yml, + WEB-INF/classes/portal.properties + </packagingExcludes> + <archive> + <manifestEntries> + <SDC-Version>${project.version}</SDC-Version> + </manifestEntries> + <manifest> + <addDefaultImplementationEntries>true</addDefaultImplementationEntries> + <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries> + </manifest> + </archive> + + <webResources> + <resource> + <directory>src/main/resources</directory> + <directory>src/main/resources/swagger</directory> + </resource> + </webResources> + <attachClasses>true</attachClasses> + </configuration> + </plugin> + + <plugin> + <groupId>com.jcabi</groupId> + <artifactId>jcabi-maven-plugin</artifactId> + <version>${jcabi.plugin.version}</version> + <executions> + <execution> + <goals> + <goal>ajc</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <id>normatives</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + <configuration> + <finalName>normatives</finalName> + <appendAssemblyId>false</appendAssemblyId> + <descriptor>${project.basedir}/normatives.xml</descriptor> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-clean-plugin</artifactId> + <version>3.0.0</version> + <executions> + <execution> + <id>clean.sdc.backend.folder</id> + <phase>clean</phase> + <goals> + <goal>clean</goal> + </goals> + <configuration> + <filesets> + <!-- static configuration files --> + <fileset> + <directory> + ${project.parent.basedir}/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default + </directory> + <followSymlinks>false</followSymlinks> + <includes> + <include>Artifact-Generator.properties</include> + <include>error-configuration.yaml</include> + <include>ecomp-error-configuration.yaml</include> + <include>logback.xml</include> + </includes> + </fileset> + <!-- BE WAR's --> + <fileset> + <directory>${project.parent.basedir}/catalog-be/sdc-backend</directory> + <followSymlinks>false</followSymlinks> + <includes> + <include>*.war</include> + </includes> + </fileset> + <fileset> + <directory> + ${project.basedir}/sdc-backend-init/chef-repo/cookbooks/sdc-normatives/files/default + </directory> + <followSymlinks>false</followSymlinks> + <includes> + <include>normatives.tar.gz</include> + </includes> + </fileset> + + + </filesets> + </configuration> + </execution> + </executions> + </plugin> + + </plugins> + + <pluginManagement> + <plugins> + <!--This plugin's configuration is used to store Eclipse m2e settings + only. It has no influence on the Maven build itself. --> + <plugin> + <groupId>org.eclipse.m2e</groupId> + <artifactId>lifecycle-mapping</artifactId> + <version>1.0.0</version> + <configuration> + <lifecycleMappingMetadata> + <pluginExecutions> + <pluginExecution> + <pluginExecutionFilter> + <groupId>com.googlecode.maven-download-plugin</groupId> + <artifactId>download-maven-plugin</artifactId> + <versionRange>[1.2.1,)</versionRange> + <goals> + <goal>wget</goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore></ignore> + </action> + </pluginExecution> + + <pluginExecution> + <pluginExecutionFilter> + <groupId>com.jcabi</groupId> + <artifactId>jcabi-maven-plugin</artifactId> + <versionRange>[0.0,)</versionRange> + <goals> + <goal>ajc</goal> + </goals> + </pluginExecutionFilter> + <action> + <execute/> + </action> + </pluginExecution> + + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-deploy-plugin</artifactId> + <version>2.7</version> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + </plugins> + </pluginManagement> + <!-- Swagger Plugins End --> + </build> + + <profiles> <profile> <id>catalog</id> <activation> @@ -710,8 +760,201 @@ </activation> <build> - <finalName>${project.artifactId}-${project.version}</finalName> + <finalName>${project.artifactId}-${project.version}</finalName> </build> </profile> - </profiles> + <profile> + <id>docker-staging</id> + <properties> + <docker.tag>${project.version}-STAGING-${maven.build.timestamp}</docker.tag> + <docker.latest.tag>${project.version}-STAGING-latest</docker.latest.tag> + </properties> + </profile> + + <profile> + <id>docker</id> + <activation> + <activeByDefault>false</activeByDefault> + </activation> + <build> + <plugins> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <version>3.0.2</version> + <executions> + <execution> + <id>copy-resources-apidocs</id> + <phase>verify</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${basedir}/sdc-backend</outputDirectory> + <resources> + <resource> + <directory> + ${project.parent.basedir}/openecomp-be/tools/swagger-ui/api-docs + </directory> + <includes> + <include>api-docs.war</include> + </includes> + </resource> + </resources> + </configuration> + </execution> + + <execution> + <id>copy-static-configuration-files</id> + <phase>verify</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${project.parent.basedir}/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default</outputDirectory> + <resources> + <resource> + <directory>${project.parent.basedir}/catalog-be/src/main/resources/config</directory> + <includes> + <include>Artifact-Generator.properties</include> + <include>error-configuration.yaml</include> + <include>ecomp-error-configuration.yaml</include> + <include>logback.xml</include> + </includes> + </resource> + </resources> + </configuration> + </execution> + + <execution> + <id>copy-resources-be</id> + <phase>verify</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${basedir}/sdc-backend</outputDirectory> + <resources> + <resource> + <directory>${project.parent.basedir}/catalog-be/target</directory> + <includes> + <include>catalog-be-${project.version}.war</include> + </includes> + </resource> + <resource> + <directory> + ${project.parent.basedir}/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/target + </directory> + <includes> + <include>onboarding-be-${project.version}.war</include> + </includes> + </resource> + </resources> + </configuration> + </execution> + <execution> + <id>copy-normatives</id> + <phase>verify</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/files/default</outputDirectory> + <resources> + <resource> + <directory>${project.parent.basedir}/catalog-be/target</directory> + <includes> + <include>normatives.tar.gz</include> + </includes> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>io.fabric8</groupId> + <artifactId>docker-maven-plugin</artifactId> + <version>0.23.0</version> + + <configuration> + <verbose>true</verbose> + <apiVersion>1.23</apiVersion> + <registry>nexus3.onap.org:10001</registry> + <authConfig> + <pull> + <username>docker</username> + <password>docker</password> + </pull> + </authConfig> + <images> + + <!-- Build backend image --> + <image> + <name>onap/sdc-backend</name> + <alias>sdc-backend</alias> + <build> + <cleanup>try</cleanup> + <dockerFileDir>${project.basedir}/sdc-backend</dockerFileDir> + <tags> + <tag>${docker.tag}</tag> + <tag>${docker.latest.tag}</tag> + <tag>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest</tag> + </tags> + </build> + </image> + <!-- Build backend-init image --> + <image> + <name>onap/sdc-backend-init</name> + <alias>sdc-backend-init</alias> + <build> + <cleanup>try</cleanup> + <dockerFileDir>${project.basedir}/sdc-backend-init</dockerFileDir> + <tags> + <tag>${docker.tag}</tag> + <tag>${docker.latest.tag}</tag> + <tag>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest</tag> + </tags> + </build> + </image> + </images> + </configuration> + <executions> + <execution> + <id>clean-images</id> + <phase>pre-clean</phase> + <goals> + <goal>remove</goal> + </goals> + <configuration> + <removeAll>true</removeAll> + <image>onap/sdc-backend,onap/sdc-backend-init</image> + </configuration> + </execution> + + <execution> + <id>generate-images</id> + <phase>install</phase> + <goals> + <goal>build</goal> + </goals> + </execution> + + <execution> + <id>push-images</id> + <phase>deploy</phase> + <goals> + <goal>push</goal> + </goals> + <configuration> + <image>onap/sdc-backend,onap/sdc-backend-init</image> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + + + </profiles> </project> diff --git a/catalog-be/sdc-backend-init/Dockerfile b/catalog-be/sdc-backend-init/Dockerfile new file mode 100644 index 0000000000..d9f0237620 --- /dev/null +++ b/catalog-be/sdc-backend-init/Dockerfile @@ -0,0 +1,11 @@ +FROM onap/base_sdc-python:1.2.0-SNAPSHOT-latest + +COPY chef-solo /root/chef-solo/ + +COPY chef-repo/cookbooks /root/chef-solo/cookbooks/ + +COPY startup.sh /root/ + +RUN chmod 770 /root/startup.sh + +ENTRYPOINT [ "/root/startup.sh" ] diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-normatives/attributes/default.rb b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/attributes/default.rb index 792d600548..792d600548 100644 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-normatives/attributes/default.rb +++ b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/attributes/default.rb diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-normatives/files/default/get-pip.py b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/files/default/get-pip.py index 87ee652f53..87ee652f53 100644 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-normatives/files/default/get-pip.py +++ b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/files/default/get-pip.py diff --git a/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/files/default/normatives.tar.gz b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/files/default/normatives.tar.gz Binary files differnew file mode 100644 index 0000000000..873c8e00ce --- /dev/null +++ b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/files/default/normatives.tar.gz diff --git a/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/1_create_consumer_and_user.rb b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/1_create_consumer_and_user.rb new file mode 100644 index 0000000000..ee794c2fa6 --- /dev/null +++ b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/1_create_consumer_and_user.rb @@ -0,0 +1,33 @@ +template "/tmp/user.py" do + source "user.py.erb" + sensitive true + mode 0755 + variables({ + :be_ip => node['Nodes']['BE'] + }) +end + +bash "excuting-create_user" do + code <<-EOH + python /tmp/user.py + rc=$? + if [[ $rc != 0 ]]; then exit $rc; fi + EOH +end + +template "/tmp/consumers.py" do + source "consumers.py.erb" + sensitive true + mode 0755 + variables({ + :be_ip => node['Nodes']['BE'] + }) +end + +bash "excuting-consumers" do + code <<-EOH + python /tmp/consumers.py + rc=$? + if [[ $rc != 0 ]]; then exit $rc; fi + EOH +end diff --git a/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/2_check_Backend.rb b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/2_check_Backend.rb new file mode 100644 index 0000000000..397930d9dd --- /dev/null +++ b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/2_check_Backend.rb @@ -0,0 +1,16 @@ +template "/tmp/check_Backend_Health.py" do + source "check_Backend_Health.py.erb" + sensitive true + mode 0755 + variables({ + :be_ip => node['Nodes']['BE'] + }) +end + +bash "excuting-check_Backend_Health" do + code <<-EOH + python /tmp/check_Backend_Health.py + rc=$? + if [[ $rc != 0 ]]; then exit $rc; fi + EOH +end
\ No newline at end of file diff --git a/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/3_import_Normatives.rb b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/3_import_Normatives.rb new file mode 100644 index 0000000000..09a8882d48 --- /dev/null +++ b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/3_import_Normatives.rb @@ -0,0 +1,32 @@ +cookbook_file "/tmp/normatives.tar.gz" do + source "normatives.tar.gz" + end + +be_ip=node['Nodes'][:BE] + +bash "excuting-import_Normatives" do + code <<-EOH + set -x + cd /tmp + tar xvfz /tmp/normatives.tar.gz + cd /tmp/normatives/scripts/import/tosca/ + /bin/chmod +x *.py + + # executing the normatives + # add --debug=true to the importNormativeAll.py arguments to enable debug + + check_normative="/tmp/check_normative.out" + curl -s -X GET -H "Content-Type: application/json;charset=UTF-8" -H "USER_ID: jh0003" -H "X-ECOMP-RequestID: cbe744a0-037b-458f-aab5-df6e543c4090" "http://#{be_ip}:8080/sdc2/rest/v1/screen" > ${check_normative} + + resources_len=`cat ${check_normative}| jq '.["resources"]|length'` + if [ $resources_len -eq 0 ] ; then + python importONAPNormativeAll.py -i #{be_ip} > /var/lib/jetty/logs/importNormativeAll.log + rc=$? + if [[ $rc != 0 ]]; then exit $rc; fi + else + python upgradeONAPNormative.py -i #{be_ip} > /var/lib/jetty/logs/upgradeNormative.log + rc=$? + if [[ $rc != 0 ]]; then exit $rc; fi + fi + EOH +end diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-normatives/files/default/check_Backend_Health.py b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/templates/default/check_Backend_Health.py.erb index c6ebcdc4f1..b1132c0aeb 100644 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-normatives/files/default/check_Backend_Health.py +++ b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/templates/default/check_Backend_Health.py.erb @@ -4,6 +4,8 @@ import subprocess import time from datetime import datetime +BE_IP="<%= @be_ip %>" + class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' @@ -19,20 +21,16 @@ class bcolors: # Functions ############################## def checkBackend(): - command="curl -s -o /dev/null -I -w \"%{http_code}\" -i http://localhost:8080/sdc2/rest/v1/user/jh0003" + command="curl -s -o /dev/null -I -w \"%{http_code}\" -i http://" + BE_IP + ":8080/sdc2/rest/v1/user/jh0003" proc = subprocess.Popen( command , shell=True , stdout=subprocess.PIPE ) (out, err) = proc.communicate() result = out.strip() return result - - - ############################## # Main ############################## -beStat=0 for i in range(1,10): myResult = checkBackend() @@ -47,5 +45,4 @@ for i in range(1,10): if beStat == 0: print '[ERROR]: ' + time.strftime('%Y/%m/%d %H:%M:%S') + bcolors.FAIL + 'Backend is DOWN :-(' + bcolors.ENDC - exit() - + exit()
\ No newline at end of file diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/consumers.py b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/templates/default/consumers.py.erb index 2b9d50296c..8a91c637bb 100644 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/consumers.py +++ b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/templates/default/consumers.py.erb @@ -4,6 +4,8 @@ import subprocess import time from datetime import datetime +BE_IP="<%= @be_ip %>" + class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' @@ -19,7 +21,7 @@ class bcolors: # Functions ############################## def checkBackend(): - command="curl -s -o /dev/null -I -w \"%{http_code}\" -i http://localhost:8080/sdc2/rest/v1/user/jh0003" + command="curl -s -o /dev/null -I -w \"%{http_code}\" -i http://" + BE_IP + ":8080/sdc2/rest/v1/user/jh0003" proc = subprocess.Popen( command , shell=True , stdout=subprocess.PIPE ) (out, err) = proc.communicate() @@ -28,7 +30,7 @@ def checkBackend(): def checkConsumer(consumerName): - command="curl -s -o /dev/null -I -w \"%{http_code}\" -i -H \"Accept: application/json; charset=UTF-8\" -H \"Content-Type: application/json\" -H \"USER_ID: jh0003\" http://localhost:8080/sdc2/rest/v1/consumers/" + consumerName + command="curl -s -o /dev/null -I -w \"%{http_code}\" -i -H \"Accept: application/json; charset=UTF-8\" -H \"Content-Type: application/json\" -H \"USER_ID: jh0003\" http://" + BE_IP + ":8080/sdc2/rest/v1/consumers/" + consumerName proc = subprocess.Popen( command , shell=True , stdout=subprocess.PIPE ) (out, err) = proc.communicate() @@ -38,7 +40,7 @@ def checkConsumer(consumerName): def createConsumer( consumerName, consumerSalt, consumerPass ): print '[INFO] ' + consumerName - command="curl -s -o /dev/null -w \"%{http_code}\" -X POST -i -H \"Accept: application/json; charset=UTF-8\" -H \"Content-Type: application/json\" -H \"USER_ID: jh0003\" http://localhost:8080/sdc2/rest/v1/consumers/ -d '{\"consumerName\": '" + consumerName + "', \"consumerSalt\": '" + consumerSalt + "',\"consumerPassword\": '" + consumerPass + "'}'" + command="curl -s -o /dev/null -w \"%{http_code}\" -X POST -i -H \"Accept: application/json; charset=UTF-8\" -H \"Content-Type: application/json\" -H \"USER_ID: jh0003\" http://" + BE_IP + ":8080/sdc2/rest/v1/consumers/ -d '{\"consumerName\": '" + consumerName + "', \"consumerSalt\": '" + consumerSalt + "',\"consumerPassword\": '" + consumerPass + "'}'" proc = subprocess.Popen( command , shell=True , stdout=subprocess.PIPE) diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/user.py b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/templates/default/user.py.erb index cb230e2068..83ecf904df 100644 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/user.py +++ b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/templates/default/user.py.erb @@ -4,6 +4,8 @@ import subprocess import time from datetime import datetime +BE_IP="<%= @be_ip %>" + class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' @@ -19,7 +21,7 @@ class bcolors: # Functions ############################## def checkBackend(): - command="curl -s -o /dev/null -I -w \"%{http_code}\" -i http://localhost:8080/sdc2/rest/v1/user/jh0003" + command="curl -s -o /dev/null -I -w \"%{http_code}\" -i -H \"Accept: application/json; charset=UTF-8\" -H \"Content-Type: application/json\" -H \"USER_ID: jh0003\" http://" + BE_IP + ":8080/sdc2/rest/v1/user/jh0003" proc = subprocess.Popen( command , shell=True , stdout=subprocess.PIPE ) (out, err) = proc.communicate() @@ -28,7 +30,7 @@ def checkBackend(): def checkUser(userName): - command="curl -s -o /dev/null -I -w \"%{http_code}\" -i -H \"Accept: application/json; charset=UTF-8\" -H \"Content-Type: application/json\" -H \"USER_ID: jh0003\" http://localhost:8080/sdc2/rest/v1/user/" + userName + command="curl -s -o /dev/null -I -w \"%{http_code}\" -i -H \"Accept: application/json; charset=UTF-8\" -H \"Content-Type: application/json\" -H \"USER_ID: jh0003\" http://" + BE_IP + ":8080/sdc2/rest/v1/user/" + userName proc = subprocess.Popen( command , shell=True , stdout=subprocess.PIPE ) (out, err) = proc.communicate() @@ -40,7 +42,7 @@ def checkUser(userName): def createUser( firstName, lastName, userId , email_dom , role ): print '[INFO] create first:[' + firstName + '], last:[' + lastName + '], Id:[' + userId + '], email:[' + userId + '@' + email_dom + '], role:[' + role +']' - command="curl -s -o /dev/null -w \"%{http_code}\" -X POST -i -H \"Accept: application/json; charset=UTF-8\" -H \"Content-Type: application/json\" -H \"USER_ID: jh0003\" http://localhost:8080/sdc2/rest/v1/user/ -d '{\"firstName\": '" + firstName + "', \"lastName\": '" + lastName + "',\"userId\": '" + userId + "',\"email\": '" + userId + "@" + email_dom + "',\"role\": '" + role + "'}'" + command="curl -s -o /dev/null -w \"%{http_code}\" -X POST -i -H \"Accept: application/json; charset=UTF-8\" -H \"Content-Type: application/json\" -H \"USER_ID: jh0003\" http://" + BE_IP + ":8080/sdc2/rest/v1/user/ -d '{\"firstName\": '" + firstName + "', \"lastName\": '" + lastName + "',\"userId\": '" + userId + "',\"email\": '" + userId + "@" + email_dom + "',\"role\": '" + role + "'}'" proc = subprocess.Popen( command , shell=True , stdout=subprocess.PIPE) (out, err) = proc.communicate() diff --git a/sdc-os-chef/sdc-backend/chef-solo/LICENSE b/catalog-be/sdc-backend-init/chef-solo/LICENSE index 11069edd79..11069edd79 100644 --- a/sdc-os-chef/sdc-backend/chef-solo/LICENSE +++ b/catalog-be/sdc-backend-init/chef-solo/LICENSE diff --git a/sdc-os-chef/sdc-backend/chef-solo/README.md b/catalog-be/sdc-backend-init/chef-solo/README.md index ddb0fda830..ddb0fda830 100644 --- a/sdc-os-chef/sdc-backend/chef-solo/README.md +++ b/catalog-be/sdc-backend-init/chef-solo/README.md diff --git a/sdc-os-chef/sdc-backend/chef-solo/chefignore b/catalog-be/sdc-backend-init/chef-solo/chefignore index ba30af6cff..ba30af6cff 100644 --- a/sdc-os-chef/sdc-backend/chef-solo/chefignore +++ b/catalog-be/sdc-backend-init/chef-solo/chefignore diff --git a/sdc-os-chef/sdc-backend/chef-solo/cookbooks/README.md b/catalog-be/sdc-backend-init/chef-solo/cookbooks/README.md index 86ea46bfbb..86ea46bfbb 100644 --- a/sdc-os-chef/sdc-backend/chef-solo/cookbooks/README.md +++ b/catalog-be/sdc-backend-init/chef-solo/cookbooks/README.md diff --git a/sdc-os-chef/sdc-backend/chef-solo/data_bags/README.md b/catalog-be/sdc-backend-init/chef-solo/data_bags/README.md index 0c15a391fa..0c15a391fa 100644 --- a/sdc-os-chef/sdc-backend/chef-solo/data_bags/README.md +++ b/catalog-be/sdc-backend-init/chef-solo/data_bags/README.md diff --git a/sdc-os-chef/sdc-backend/chef-solo/environments/README.md b/catalog-be/sdc-backend-init/chef-solo/environments/README.md index 50ac48db2b..50ac48db2b 100644 --- a/sdc-os-chef/sdc-backend/chef-solo/environments/README.md +++ b/catalog-be/sdc-backend-init/chef-solo/environments/README.md diff --git a/sdc-os-chef/sdc-backend/chef-solo/normatives.json b/catalog-be/sdc-backend-init/chef-solo/importNormatives.json index f5c9276e2e..f5c9276e2e 100644 --- a/sdc-os-chef/sdc-backend/chef-solo/normatives.json +++ b/catalog-be/sdc-backend-init/chef-solo/importNormatives.json diff --git a/catalog-be/sdc-backend-init/chef-solo/importNormatives.rb b/catalog-be/sdc-backend-init/chef-solo/importNormatives.rb new file mode 100644 index 0000000000..2693926c4b --- /dev/null +++ b/catalog-be/sdc-backend-init/chef-solo/importNormatives.rb @@ -0,0 +1,16 @@ +root = File.absolute_path(File.dirname(__FILE__)) +file_cache_path root +cookbook_path root + '/cookbooks' +json_attribs root + '/importNormatives.json' +checksum_path root + '/checksums' +data_bag_path root + '/data_bags' +environment_path root + '/environments' +file_backup_path root + '/backup' +file_cache_path root + '/cache' +log_level :info +log_location STDOUT +rest_timeout 300 +role_path root + '/roles' +syntax_check_cache_path +umask 0022 +verbose_logging nil diff --git a/sdc-os-chef/sdc-backend/chef-solo/roles/README.md b/catalog-be/sdc-backend-init/chef-solo/roles/README.md index b0ee0b4d21..b0ee0b4d21 100644 --- a/sdc-os-chef/sdc-backend/chef-solo/roles/README.md +++ b/catalog-be/sdc-backend-init/chef-solo/roles/README.md diff --git a/catalog-be/sdc-backend-init/chef-solo/roles/catalog-be-setup.json b/catalog-be/sdc-backend-init/chef-solo/roles/catalog-be-setup.json new file mode 100644 index 0000000000..8a8e12da9d --- /dev/null +++ b/catalog-be/sdc-backend-init/chef-solo/roles/catalog-be-setup.json @@ -0,0 +1,21 @@ +{ + "name": "catalog-be", + "description": "Installation application - catalogBE", + "json_class": "Chef::Role", + "default_attributes": { + + }, + "override_attributes": { + + }, + "chef_type": "role", + "run_list": [ + "recipe[sdc-catalog-be-setup::1_create_consumer_and_user]", + "recipe[sdc-catalog-be-setup::2_check_Backend]", + "recipe[sdc-catalog-be-setup::3_import_Normatives]" + + ], + "env_run_lists": { + } +} + diff --git a/catalog-be/sdc-backend-init/chef-solo/solo.json b/catalog-be/sdc-backend-init/chef-solo/solo.json new file mode 100644 index 0000000000..3ae51db12d --- /dev/null +++ b/catalog-be/sdc-backend-init/chef-solo/solo.json @@ -0,0 +1,4 @@ +{ + "run_list": [ "role[catalog-be-setup]" ] +} + diff --git a/sdc-os-chef/sdc-backend/chef-solo/solo.rb b/catalog-be/sdc-backend-init/chef-solo/solo.rb index 06c1af4592..06c1af4592 100644 --- a/sdc-os-chef/sdc-backend/chef-solo/solo.rb +++ b/catalog-be/sdc-backend-init/chef-solo/solo.rb diff --git a/catalog-be/sdc-backend-init/chef-solo/upgradeNormatives.json b/catalog-be/sdc-backend-init/chef-solo/upgradeNormatives.json new file mode 100644 index 0000000000..f05c767f7c --- /dev/null +++ b/catalog-be/sdc-backend-init/chef-solo/upgradeNormatives.json @@ -0,0 +1,4 @@ +{ + "run_list": [ "recipe[sdc-normatives::upgrade_Normatives]" ] +} + diff --git a/catalog-be/sdc-backend-init/chef-solo/upgradeNormatives.rb b/catalog-be/sdc-backend-init/chef-solo/upgradeNormatives.rb new file mode 100644 index 0000000000..4172431c8b --- /dev/null +++ b/catalog-be/sdc-backend-init/chef-solo/upgradeNormatives.rb @@ -0,0 +1,16 @@ +root = File.absolute_path(File.dirname(__FILE__)) +file_cache_path root +cookbook_path root + '/cookbooks' +json_attribs root + '/upgradeNormatives.json' +checksum_path root + '/checksums' +data_bag_path root + '/data_bags' +environment_path root + '/environments' +file_backup_path root + '/backup' +file_cache_path root + '/cache' +log_level :info +log_location STDOUT +rest_timeout 300 +role_path root + '/roles' +syntax_check_cache_path +umask 0022 +verbose_logging nil diff --git a/catalog-be/sdc-backend-init/startup.sh b/catalog-be/sdc-backend-init/startup.sh new file mode 100644 index 0000000000..867ec94b31 --- /dev/null +++ b/catalog-be/sdc-backend-init/startup.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +cd /root/chef-solo +chef-solo -c solo.rb -E ${ENVNAME} +rc=$? +if [[ $rc != 0 ]]; then exit $rc; fi diff --git a/sdc-os-chef/sdc-backend/Dockerfile b/catalog-be/sdc-backend/Dockerfile index a7b1aa20b1..a7b1aa20b1 100644 --- a/sdc-os-chef/sdc-backend/Dockerfile +++ b/catalog-be/sdc-backend/Dockerfile diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/attributes/default.rb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/attributes/default.rb index 4287ca8617..4287ca8617 100644 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/attributes/default.rb +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/attributes/default.rb diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/keystore b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/keystore Binary files differindex c4083931dc..c4083931dc 100644 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/keystore +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/keystore diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_1_cleanup_jettydir.rb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_1_cleanup_jettydir.rb new file mode 100644 index 0000000000..1de29548f3 --- /dev/null +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_1_cleanup_jettydir.rb @@ -0,0 +1,24 @@ +directory "BE_tempdir_creation" do + path "#{ENV['JETTY_BASE']}/temp" + owner 'jetty' + group 'jetty' + mode '0755' + action :create +end + +directory "BE_create_config_dir" do + path "#{ENV['JETTY_BASE']}/config" + owner 'jetty' + group 'jetty' + mode '0755' + action :create +end + + +directory "BE_create_catalog-be" do + path "#{ENV['JETTY_BASE']}/config/catalog-be" + owner 'jetty' + group 'jetty' + mode '0755' + action :create +end diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb index fde367da7c..fd7e2f8c5f 100644 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb @@ -1,8 +1,7 @@ -jetty_base="/var/lib/jetty" replication_factor=1 template "titan.properties" do - path "/#{jetty_base}/config/catalog-be/titan.properties" + path "#{ENV['JETTY_BASE']}/config/catalog-be/titan.properties" source "BE-titan.properties.erb" owner "jetty" group "jetty" @@ -19,13 +18,13 @@ end template "catalog-be-config" do - path "/#{jetty_base}/config/catalog-be/configuration.yaml" + path "#{ENV['JETTY_BASE']}/config/catalog-be/configuration.yaml" source "BE-configuration.yaml.erb" owner "jetty" group "jetty" mode "0755" variables({ - :catalog_ip => node['HOST_IP'], + :catalog_ip => node['Nodes']['BE'], :catalog_port => node['BE'][:http_port], :ssl_port => node['BE'][:https_port], :cassandra_ip => node['Nodes']['CS'], @@ -42,7 +41,7 @@ end template "distribution-engine-configuration" do - path "/#{jetty_base}/config/catalog-be/distribution-engine-configuration.yaml" + path "#{ENV['JETTY_BASE']}/config/catalog-be/distribution-engine-configuration.yaml" source "BE-distribution-engine-configuration.yaml.erb" owner "jetty" group "jetty" @@ -51,7 +50,7 @@ end cookbook_file "ArtifactGenerator" do - path "/#{jetty_base}/config/catalog-be/Artifact-Generator.properties" + path "#{ENV['JETTY_BASE']}/config/catalog-be/Artifact-Generator.properties" source "Artifact-Generator.properties" owner "jetty" group "jetty" diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_3_locate_keystore.rb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_3_locate_keystore.rb index 148eaaf4d3..b09ec2610f 100644 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_3_locate_keystore.rb +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_3_locate_keystore.rb @@ -1,14 +1,13 @@ -jetty_base="/var/lib/jetty" directory "Jetty_etcdir_creation" do - path "/#{jetty_base}/etc" + path "#{ENV['JETTY_BASE']}/etc" owner 'jetty' group 'jetty' mode '0755' action :create end -cookbook_file "/#{jetty_base}/etc/keystore" do +cookbook_file "#{ENV['JETTY_BASE']}/etc/keystore" do source "keystore" owner "jetty" group "jetty" diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_jetty_Modules.rb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_jetty_Modules.rb new file mode 100644 index 0000000000..ece1066f55 --- /dev/null +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_jetty_Modules.rb @@ -0,0 +1,17 @@ +bash "create-jetty-modules" do +cwd "#{ENV['JETTY_BASE']}" +code <<-EOH + cd "#{ENV['JETTY_BASE']}" + java -jar "#{ENV['JETTY_HOME']}"/start.jar --add-to-start=deploy + java -jar "#{ENV['JETTY_HOME']}"/start.jar --add-to-startd=http,https,logging,setuid +EOH +end + +template "ssl-ini" do + path "#{ENV['JETTY_BASE']}/start.d/ssl.ini" + source "ssl-ini.erb" + owner "jetty" + group "jetty" + mode "0755" + variables :BE_https_port => "#{node['BE'][:https_port]}" +end diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_setup_elasticsearch.rb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_setup_elasticsearch.rb index 39fc5af883..29715177be 100644 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_setup_elasticsearch.rb +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_setup_elasticsearch.rb @@ -1,8 +1,7 @@ clusterName = node['elasticsearch'][:cluster_name]+node.chef_environment -node_name = node[:hostname] template "elasticsearch.yml-config" do - path "/var/lib/jetty/config/elasticsearch.yml" + path "#{ENV['JETTY_BASE']}/config/elasticsearch.yml" source "BE-elasticsearch.yml.erb" owner "jetty" group "jetty" diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_portal_properties.rb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_portal_properties.rb index 8c57de6caf..912ddf7dc0 100644 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_portal_properties.rb +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_portal_properties.rb @@ -1,5 +1,5 @@ template "template portal.properties" do - path "/var/lib/jetty/resources/portal.properties" + path "#{ENV['JETTY_BASE']}/resources/portal.properties" source "BE-portal.properties.erb" owner "jetty" group "jetty" diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_logback.rb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_logback.rb index 2dfc4f1089..f5bf61725a 100644 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_logback.rb +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_logback.rb @@ -1,4 +1,4 @@ -cookbook_file "/var/lib/jetty/config/catalog-be/logback.xml" do +cookbook_file "#{ENV['JETTY_BASE']}/config/catalog-be/logback.xml" do source "logback.xml" mode 0755 owner "jetty" diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_errors_config.rb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_errors_config.rb index 684d730709..49cf3c3d1a 100644 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_errors_config.rb +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_errors_config.rb @@ -1,11 +1,11 @@ -cookbook_file "/var/lib/jetty/config/catalog-be/ecomp-error-configuration.yaml" do +cookbook_file "#{ENV['JETTY_BASE']}/config/catalog-be/ecomp-error-configuration.yaml" do source "ecomp-error-configuration.yaml" mode 0755 owner "jetty" group "jetty" end -cookbook_file "/var/lib/jetty/config/catalog-be/error-configuration.yaml" do +cookbook_file "#{ENV['JETTY_BASE']}/config/catalog-be/error-configuration.yaml" do source "error-configuration.yaml" mode 0755 owner "jetty" diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_9_prepareProbeFile.rb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_9_prepareProbeFile.rb new file mode 100644 index 0000000000..14d08be94c --- /dev/null +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_9_prepareProbeFile.rb @@ -0,0 +1,5 @@ +template "/var/lib/ready-probe.sh" do + source "ready-probe.sh.erb" + sensitive true + mode 0755 +end
\ No newline at end of file diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb index 825dd54061..825dd54061 100644 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-distribution-engine-configuration.yaml.erb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-distribution-engine-configuration.yaml.erb index 3491035fcf..3491035fcf 100644 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-distribution-engine-configuration.yaml.erb +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-distribution-engine-configuration.yaml.erb diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-elasticsearch.yml.erb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-elasticsearch.yml.erb index 611285ea3f..611285ea3f 100644 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-elasticsearch.yml.erb +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-elasticsearch.yml.erb diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-onboarding-configuration.yaml.erb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-onboarding-configuration.yaml.erb index 4646661dfb..4646661dfb 100644 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-onboarding-configuration.yaml.erb +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-onboarding-configuration.yaml.erb diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-portal.properties.erb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-portal.properties.erb index 4f23cb827f..4f23cb827f 100644 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-portal.properties.erb +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-portal.properties.erb diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-titan.properties.erb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-titan.properties.erb index cf885e62bb..cf885e62bb 100644 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-titan.properties.erb +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-titan.properties.erb diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/ready-probe.sh.erb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/ready-probe.sh.erb new file mode 100644 index 0000000000..5239e9bdef --- /dev/null +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/ready-probe.sh.erb @@ -0,0 +1,11 @@ +#!/bin/bash + +health_Check_http_code=$(curl --max-time 5 -o /dev/null -w '%{http_code}' http://localhost:8080/sdc2/rest/healthCheck) +if [[ "$health_Check_http_code" -eq 500 ]]; then + exit 200 +else + exit $health_Check_http_code +fi + + + diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/ssl-ini.erb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/ssl-ini.erb index adfc0d0ce2..adfc0d0ce2 100644 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/ssl-ini.erb +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/ssl-ini.erb diff --git a/sdc-os-chef/sdc-frontend/chef-solo/LICENSE b/catalog-be/sdc-backend/chef-solo/LICENSE index 11069edd79..11069edd79 100644 --- a/sdc-os-chef/sdc-frontend/chef-solo/LICENSE +++ b/catalog-be/sdc-backend/chef-solo/LICENSE diff --git a/sdc-os-chef/sdc-frontend/chef-solo/README.md b/catalog-be/sdc-backend/chef-solo/README.md index ddb0fda830..ddb0fda830 100644 --- a/sdc-os-chef/sdc-frontend/chef-solo/README.md +++ b/catalog-be/sdc-backend/chef-solo/README.md diff --git a/sdc-os-chef/sdc-frontend/chef-solo/chefignore b/catalog-be/sdc-backend/chef-solo/chefignore index ba30af6cff..ba30af6cff 100644 --- a/sdc-os-chef/sdc-frontend/chef-solo/chefignore +++ b/catalog-be/sdc-backend/chef-solo/chefignore diff --git a/sdc-os-chef/sdc-frontend/chef-solo/cookbooks/README.md b/catalog-be/sdc-backend/chef-solo/cookbooks/README.md index 86ea46bfbb..86ea46bfbb 100644 --- a/sdc-os-chef/sdc-frontend/chef-solo/cookbooks/README.md +++ b/catalog-be/sdc-backend/chef-solo/cookbooks/README.md diff --git a/sdc-os-chef/sdc-frontend/chef-solo/data_bags/README.md b/catalog-be/sdc-backend/chef-solo/data_bags/README.md index 0c15a391fa..0c15a391fa 100644 --- a/sdc-os-chef/sdc-frontend/chef-solo/data_bags/README.md +++ b/catalog-be/sdc-backend/chef-solo/data_bags/README.md diff --git a/sdc-os-chef/sdc-frontend/chef-solo/environments/README.md b/catalog-be/sdc-backend/chef-solo/environments/README.md index 50ac48db2b..50ac48db2b 100644 --- a/sdc-os-chef/sdc-frontend/chef-solo/environments/README.md +++ b/catalog-be/sdc-backend/chef-solo/environments/README.md diff --git a/sdc-os-chef/sdc-frontend/chef-solo/roles/README.md b/catalog-be/sdc-backend/chef-solo/roles/README.md index b0ee0b4d21..b0ee0b4d21 100644 --- a/sdc-os-chef/sdc-frontend/chef-solo/roles/README.md +++ b/catalog-be/sdc-backend/chef-solo/roles/README.md diff --git a/sdc-os-chef/sdc-backend/chef-solo/roles/catalog-be.json b/catalog-be/sdc-backend/chef-solo/roles/catalog-be.json index 220eee7c92..b8fe325e64 100644 --- a/sdc-os-chef/sdc-backend/chef-solo/roles/catalog-be.json +++ b/catalog-be/sdc-backend/chef-solo/roles/catalog-be.json @@ -17,7 +17,8 @@ "recipe[sdc-catalog-be::BE_5_setup_elasticsearch]", "recipe[sdc-catalog-be::BE_6_setup_portal_properties]", "recipe[sdc-catalog-be::BE_7_logback]", - "recipe[sdc-catalog-be::BE_8_errors_config]" + "recipe[sdc-catalog-be::BE_8_errors_config]", + "recipe[sdc-catalog-be::BE_9_prepareProbeFile]" ], "env_run_lists": { } diff --git a/sdc-os-chef/sdc-backend/chef-solo/solo.json b/catalog-be/sdc-backend/chef-solo/solo.json index ce096b3931..ce096b3931 100644 --- a/sdc-os-chef/sdc-backend/chef-solo/solo.json +++ b/catalog-be/sdc-backend/chef-solo/solo.json diff --git a/sdc-os-chef/sdc-frontend/chef-solo/solo.rb b/catalog-be/sdc-backend/chef-solo/solo.rb index 06c1af4592..06c1af4592 100644 --- a/sdc-os-chef/sdc-frontend/chef-solo/solo.rb +++ b/catalog-be/sdc-backend/chef-solo/solo.rb diff --git a/catalog-be/sdc-backend/startup.sh b/catalog-be/sdc-backend/startup.sh new file mode 100644 index 0000000000..92d029d5c0 --- /dev/null +++ b/catalog-be/sdc-backend/startup.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +JAVA_OPTIONS=" ${JAVA_OPTIONS} -Dconfig.home=${JETTY_BASE}/config -Dlog.home=${JETTY_BASE}/logs -Dlogback.configurationFile=${JETTY_BASE}/config/catalog-be/logback.xml -Dconfiguration.yaml=${JETTY_BASE}/config/catalog-be/configuration.yaml -Dartifactgenerator.config=${JETTY_BASE}/config/catalog-be/Artifact-Generator.properties -Donboarding_configuration.yaml=${JETTY_BASE}/config/onboarding-be/onboarding_configuration.yaml" + +cd /root/chef-solo +chef-solo -c solo.rb -E ${ENVNAME} + +cd /var/lib/jetty +/docker-entrypoint.sh & + +while true; do sleep 2; done + + + diff --git a/catalog-fe/pom.xml b/catalog-fe/pom.xml index cc3be33ea3..360d5b28ed 100644 --- a/catalog-fe/pom.xml +++ b/catalog-fe/pom.xml @@ -1,5 +1,5 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>catalog-fe</artifactId> @@ -44,14 +44,14 @@ <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> - <version>${logback.version}</version> + <version>${logback.version}</version> <scope>compile</scope> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> - <version>${logback.version}</version> + <version>${logback.version}</version> <scope>compile</scope> </dependency> @@ -93,7 +93,7 @@ <dependency> <groupId>org.glassfish.jersey.containers</groupId> <artifactId>jersey-container-servlet</artifactId> - <version>${jersey-bom.version}</version> + <version>${jersey-bom.version}</version> <scope>compile</scope> </dependency> @@ -150,21 +150,21 @@ <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> - <version>${httpclient.version}</version> + <version>${httpclient.version}</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpcore</artifactId> - <version>${httpcore.version}</version> + <version>${httpcore.version}</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpmime</artifactId> - <version>${httpclient.version}</version> + <version>${httpclient.version}</version> <!--<version>4.3.2</version>--> <scope>compile</scope> </dependency> @@ -179,7 +179,7 @@ <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> - <version>${commons-codec}</version> + <version>${commons-codec}</version> <scope>compile</scope> </dependency> <!-- http client END --> @@ -187,7 +187,7 @@ <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> - <version>${servlet-api.version}</version> + <version>${servlet-api.version}</version> <scope>provided</scope> </dependency> @@ -218,7 +218,7 @@ <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> - <version>${guava.version}</version> + <version>${guava.version}</version> <scope>compile</scope> </dependency> @@ -239,7 +239,7 @@ <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> - <version>${lang3.version}</version> + <version>${lang3.version}</version> <scope>compile</scope> </dependency> @@ -280,14 +280,14 @@ <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-servlet</artifactId> - <version>${jetty.version}</version> + <version>${jetty.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-webapp</artifactId> - <version>${jetty.version}</version> + <version>${jetty.version}</version> <scope>test</scope> </dependency> @@ -323,11 +323,11 @@ </webResources> </configuration> </plugin> - + <plugin> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> - <version>${jetty.version}</version> + <version>${jetty.version}</version> <!--<version>9.0.6.v20130930</version>--> <configuration> <contextPath>/</contextPath> @@ -360,11 +360,37 @@ </execution> </executions> </plugin> + <plugin> + <artifactId>maven-clean-plugin</artifactId> + <version>3.0.0</version> + <executions> + <execution> + <id>clean.catalog.fe.folder</id> + <phase>clean</phase> + <goals> + <goal>clean</goal> + </goals> + <configuration> + <filesets> + <!-- FE WAR's --> + <fileset> + <directory>${project.parent.basedir}/catalog-fe/sdc-frontend/</directory> + <followSymlinks>false</followSymlinks> + <includes> + <include>*.war</include> + </includes> + </fileset> + </filesets> + </configuration> + </execution> + </executions> + </plugin> + </plugins> <pluginManagement> <plugins> - <!--This plugin's configuration is used to store Eclipse m2e settings + <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. --> <plugin> <groupId>org.eclipse.m2e</groupId> @@ -401,15 +427,131 @@ </build> <profiles> - <profile> - <id>catalog</id> - <activation> - <activeByDefault>false</activeByDefault> - </activation> - - <build> - <finalName>${project.artifactId}-${project.version}</finalName> - </build> - </profile> + <profile> + <id>catalog</id> + <activation> + <activeByDefault>false</activeByDefault> + </activation> + + <build> + <finalName>${project.artifactId}-${project.version}</finalName> + </build> + </profile> + <profile> + <id>docker-staging</id> + <properties> + <docker.tag>${project.version}-STAGING-${maven.build.timestamp}</docker.tag> + <docker.latest.tag>${project.version}-STAGING-latest</docker.latest.tag> + </properties> + </profile> + + <profile> + <id>docker</id> + <activation> + <activeByDefault>false</activeByDefault> + </activation> + <build> + <plugins> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <version>3.0.2</version> + <executions> + <execution> + <id>copy-resources-fe</id> + <phase>verify</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${basedir}/sdc-frontend</outputDirectory> + <resources> + <resource> + <directory>${project.parent.basedir}/catalog-fe/target</directory> + <includes> + <include>catalog-fe-${project.version}.war</include> + </includes> + </resource> + <resource> + <directory>${project.parent.basedir}/openecomp-ui/target</directory> + <includes> + <include>onboarding-fe-${project.version}.war</include> + </includes> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>io.fabric8</groupId> + <artifactId>docker-maven-plugin</artifactId> + <version>0.23.0</version> + + <configuration> + <verbose>true</verbose> + <apiVersion>1.23</apiVersion> + <registry>nexus3.onap.org:10001</registry> + <authConfig> + <pull> + <username>docker</username> + <password>docker</password> + </pull> + </authConfig> + <images> + + + <!-- Build frontend image --> + <image> + <name>onap/sdc-frontend</name> + <alias>sdc-frontend</alias> + <build> + <cleanup>try</cleanup> + <dockerFileDir>${project.basedir}/sdc-frontend</dockerFileDir> + <tags> + <tag>${docker.tag}</tag> + <tag>${docker.latest.tag}</tag> + <tag>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest</tag> + </tags> + </build> + </image> + </images> + </configuration> + <executions> + <execution> + <id>clean-images</id> + <phase>pre-clean</phase> + <goals> + <goal>remove</goal> + </goals> + <configuration> + <removeAll>true</removeAll> + <image>onap/sdc-frontend</image> + </configuration> + </execution> + + <execution> + <id>generate-images</id> + <phase>install</phase> + <goals> + <goal>build</goal> + </goals> + </execution> + + <execution> + <id>push-images</id> + <phase>deploy</phase> + <goals> + <goal>push</goal> + </goals> + <configuration> + <image>onap/sdc-frontend</image> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> </project> diff --git a/sdc-os-chef/sdc-frontend/Dockerfile b/catalog-fe/sdc-frontend/Dockerfile index 2f9b3d1184..2f9b3d1184 100644 --- a/sdc-os-chef/sdc-frontend/Dockerfile +++ b/catalog-fe/sdc-frontend/Dockerfile diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/attributes/default.rb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/attributes/default.rb index 6e9bbe36f5..6e9bbe36f5 100644 --- a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/attributes/default.rb +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/attributes/default.rb diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/files/default/FE-ecomp-error-configuration.yaml b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/files/default/FE-ecomp-error-configuration.yaml index 8982b2424f..8982b2424f 100644 --- a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/files/default/FE-ecomp-error-configuration.yaml +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/files/default/FE-ecomp-error-configuration.yaml diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/files/default/FE-logback.xml b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/files/default/FE-logback.xml index 2f793f386b..2f793f386b 100644 --- a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/files/default/FE-logback.xml +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/files/default/FE-logback.xml diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/files/default/FE-rest-configuration.yaml b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/files/default/FE-rest-configuration.yaml index ecedafea56..ecedafea56 100644 --- a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/files/default/FE-rest-configuration.yaml +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/files/default/FE-rest-configuration.yaml diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/files/default/keystore b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/files/default/keystore Binary files differindex c4083931dc..c4083931dc 100644 --- a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/files/default/keystore +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/files/default/keystore diff --git a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_1_cleanup_jettydir.rb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_1_cleanup_jettydir.rb new file mode 100644 index 0000000000..7449518f87 --- /dev/null +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_1_cleanup_jettydir.rb @@ -0,0 +1,33 @@ +directory "FE_tempdir_creation" do + path "#{ENV['JETTY_BASE']}/temp" + owner 'jetty' + group 'jetty' + mode '0755' + action :create +end + +directory "FE_create_config_dir" do + path "#{ENV['JETTY_BASE']}/config" + owner 'jetty' + group 'jetty' + mode '0755' + action :create +end + + +directory "FE_create_catalog-fe" do + path "#{ENV['JETTY_BASE']}/config/catalog-fe" + owner 'jetty' + group 'jetty' + mode '0755' + action :create +end + + +directory "FE_create_catalog-fe" do + path "#{ENV['JETTY_BASE']}/config/onboarding-fe" + owner 'jetty' + group 'jetty' + mode '0755' + action :create +end
\ No newline at end of file diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_2_setup_configuration.rb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_2_setup_configuration.rb index 9e5953c394..abefd28588 100644 --- a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_2_setup_configuration.rb +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_2_setup_configuration.rb @@ -1,23 +1,20 @@ -jetty_base="/var/lib/jetty" - - template "catalog-fe-config" do - path "#{jetty_base}/config/catalog-fe/configuration.yaml" + path "#{ENV['JETTY_BASE']}/config/catalog-fe/configuration.yaml" source "FE-configuration.yaml.erb" owner "jetty" group "jetty" mode "0755" variables({ - :fe_host_ip => node['HOST_IP'], - :be_host_ip => node['HOST_IP'], - :kb_host_ip => node['HOST_IP'], + :fe_host_ip => node['Nodes']['FE'], + :be_host_ip => node['Nodes']['BE'], + :kb_host_ip => node['Nodes']['KB'], :catalog_port => node['BE'][:http_port], :ssl_port => node['BE'][:https_port] }) end template "plugins-fe-config" do - path "#{jetty_base}/config/catalog-fe/plugins-configuration.yaml" + path "#{ENV['JETTY_BASE']}/config/catalog-fe/plugins-configuration.yaml" source "FE-plugins-configuration.yaml.erb" owner "jetty" group "jetty" @@ -32,13 +29,13 @@ end template "onboarding-fe-config" do - path "#{jetty_base}/config/onboarding-fe/onboarding_configuration.yaml" + path "#{ENV['JETTY_BASE']}/config/onboarding-fe/onboarding_configuration.yaml" source "FE-onboarding-configuration.yaml.erb" owner "jetty" group "jetty" mode "0755" variables({ - :catalog_ip => node['HOST_IP'], + :catalog_ip => node['Nodes']['BE'], :catalog_port => node['BE'][:http_port], :ssl_port => node['BE'][:https_port] }) diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_3_errors_config.rb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_3_errors_config.rb index 278c3bb35d..54dee2ef26 100644 --- a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_3_errors_config.rb +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_3_errors_config.rb @@ -1,4 +1,4 @@ -cookbook_file "/var/lib/jetty/config/catalog-fe/ecomp-error-configuration.yaml" do +cookbook_file "#{ENV['JETTY_BASE']}/config/catalog-fe/ecomp-error-configuration.yaml" do source "FE-ecomp-error-configuration.yaml" mode 0755 owner "jetty" diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_4_logback.rb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_4_logback.rb index 674febb47a..67c511408c 100644 --- a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_4_logback.rb +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_4_logback.rb @@ -1,4 +1,4 @@ -cookbook_file "/var/lib/jetty/config/catalog-fe/logback.xml" do +cookbook_file "#{ENV['JETTY_BASE']}/config/catalog-fe/logback.xml" do source "FE-logback.xml" mode 0755 owner "jetty" diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_5_rest_configuration.rb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_5_rest_configuration.rb index 710286a8dd..cf7575c546 100644 --- a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_5_rest_configuration.rb +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_5_rest_configuration.rb @@ -1,4 +1,4 @@ -cookbook_file "/var/lib/jetty/config/catalog-fe/rest-configuration-info.yaml" do +cookbook_file "#{ENV['JETTY_BASE']}/config/catalog-fe/rest-configuration-info.yaml" do source "FE-rest-configuration.yaml" mode 0755 owner "jetty" diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_6_locate_keystore.rb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_6_locate_keystore.rb index bdf0d37b28..12af1fff21 100644 --- a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_6_locate_keystore.rb +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_6_locate_keystore.rb @@ -1,14 +1,12 @@ -jetty_base="/var/lib/jetty" - directory "Jetty_etcdir_creation" do - path "/#{jetty_base}/etc" + path "#{ENV['JETTY_BASE']}/etc" owner 'jetty' group 'jetty' mode '0755' action :create end -cookbook_file "/#{jetty_base}/etc/keystore" do +cookbook_file "#{ENV['JETTY_BASE']}/etc/keystore" do source "keystore" owner "jetty" group "jetty" diff --git a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_7_create_jetty_modules.rb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_7_create_jetty_modules.rb new file mode 100644 index 0000000000..32b121eefd --- /dev/null +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_7_create_jetty_modules.rb @@ -0,0 +1,41 @@ +bash "create-jetty-modules" do +cwd "#{ENV['JETTY_BASE']}" +code <<-EOH + cd "#{ENV['JETTY_BASE']}" + java -jar "#{ENV['JETTY_HOME']}"/start.jar --add-to-start=deploy + java -jar "#{ENV['JETTY_HOME']}"/start.jar --add-to-startd=http,https,logging,setuid +EOH +end + + + +template "FE-http-ini" do + path "#{ENV['JETTY_BASE']}/start.d/http.ini" + source "FE-http-ini.erb" + owner "jetty" + group "jetty" + mode "0755" + variables :FE_http_port => "#{node['FE'][:http_port]}" +end + + +template "FE-https-ini" do + path "#{ENV['JETTY_BASE']}/start.d/https.ini" + source "FE-https-ini.erb" + owner "jetty" + group "jetty" + mode "0755" + variables :FE_https_port => "#{node['FE'][:https_port]}" +end + + +template "ssl-ini" do + path "#{ENV['JETTY_BASE']}/start.d/ssl.ini" + source "ssl-ini.erb" + owner "jetty" + group "jetty" + mode "0755" + variables :https_port => "#{node['FE'][:https_port]}" +end + + diff --git a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_8_prepareProbeFile.rb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_8_prepareProbeFile.rb new file mode 100644 index 0000000000..14d08be94c --- /dev/null +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_8_prepareProbeFile.rb @@ -0,0 +1,5 @@ +template "/var/lib/ready-probe.sh" do + source "ready-probe.sh.erb" + sensitive true + mode 0755 +end
\ No newline at end of file diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-configuration.yaml.erb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-configuration.yaml.erb index ea2d9033ab..ea2d9033ab 100644 --- a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-configuration.yaml.erb +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-configuration.yaml.erb diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-http-ini.erb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-http-ini.erb index 233a6b8852..233a6b8852 100644 --- a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-http-ini.erb +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-http-ini.erb diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-https-ini.erb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-https-ini.erb index d2542fc360..d2542fc360 100644 --- a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-https-ini.erb +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-https-ini.erb diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-onboarding-configuration.yaml.erb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-onboarding-configuration.yaml.erb index 71ed876ee7..71ed876ee7 100644 --- a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-onboarding-configuration.yaml.erb +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-onboarding-configuration.yaml.erb diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-plugins-configuration.yaml.erb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-plugins-configuration.yaml.erb index a21a7abbe5..a21a7abbe5 100644 --- a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-plugins-configuration.yaml.erb +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-plugins-configuration.yaml.erb diff --git a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/ready-probe.sh.erb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/ready-probe.sh.erb new file mode 100644 index 0000000000..b5cbb149dd --- /dev/null +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/ready-probe.sh.erb @@ -0,0 +1,8 @@ +#!/bin/bash + +health_Check_http_code=$(curl --max-time 5 -o /dev/null -w '%{http_code}' http://localhost:8181/sdc1/rest/healthCheck) +if [[ "$health_Check_http_code" -eq 500 ]]; then + exit 200 +else + exit $health_Check_http_code +fi
\ No newline at end of file diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/ssl-ini.erb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/ssl-ini.erb index effbfa7918..effbfa7918 100644 --- a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/ssl-ini.erb +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/ssl-ini.erb diff --git a/catalog-fe/sdc-frontend/chef-solo/LICENSE b/catalog-fe/sdc-frontend/chef-solo/LICENSE new file mode 100644 index 0000000000..11069edd79 --- /dev/null +++ b/catalog-fe/sdc-frontend/chef-solo/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/catalog-fe/sdc-frontend/chef-solo/README.md b/catalog-fe/sdc-frontend/chef-solo/README.md new file mode 100644 index 0000000000..ddb0fda830 --- /dev/null +++ b/catalog-fe/sdc-frontend/chef-solo/README.md @@ -0,0 +1,37 @@ +Deprecated +========== + +Use of this repository is deprecated. We recommend using the `chef generate repo` command that comes with [ChefDK](http://downloads.chef.io/chef-dk/). + +Overview +======== + +Every Chef installation needs a Chef Repository. This is the place where cookbooks, roles, config files and other artifacts for managing systems with Chef will live. We strongly recommend storing this repository in a version control system such as Git and treat it like source code. + +While we prefer Git, and make this repository available via GitHub, you are welcome to download a tar or zip archive and use your favorite version control system to manage the code. + +Repository Directories +====================== + +This repository contains several directories, and each directory contains a README file that describes what it is for in greater detail, and how to use it for managing your systems with Chef. + +* `cookbooks/` - Cookbooks you download or create. +* `data_bags/` - Store data bags and items in .json in the repository. +* `roles/` - Store roles in .rb or .json in the repository. +* `environments/` - Store environments in .rb or .json in the repository. + +Configuration +============= + +The repository contains a knife configuration file. + +* .chef/knife.rb + +The knife configuration file `.chef/knife.rb` is a repository specific configuration file for knife. If you're using Hosted Chef, you can download one for your organization from the management console. If you're using the Open Source Chef Server, you can generate a new one with `knife configure`. For more information about configuring Knife, see the Knife documentation. + +https://docs.chef.io/knife.html + +Next Steps +========== + +Read the README file in each of the subdirectories for more information about what goes in those directories. diff --git a/catalog-fe/sdc-frontend/chef-solo/chefignore b/catalog-fe/sdc-frontend/chef-solo/chefignore new file mode 100644 index 0000000000..ba30af6cff --- /dev/null +++ b/catalog-fe/sdc-frontend/chef-solo/chefignore @@ -0,0 +1,11 @@ +# Put files/directories that should be ignored in this file. +# Lines that start with '# ' are comments. + +# emacs +*~ + +# vim +*.sw[a-z] + +# subversion +*/.svn/* diff --git a/catalog-fe/sdc-frontend/chef-solo/cookbooks/README.md b/catalog-fe/sdc-frontend/chef-solo/cookbooks/README.md new file mode 100644 index 0000000000..86ea46bfbb --- /dev/null +++ b/catalog-fe/sdc-frontend/chef-solo/cookbooks/README.md @@ -0,0 +1,54 @@ +This directory contains the cookbooks used to configure systems in your infrastructure with Chef. + +Knife needs to be configured to know where the cookbooks are located with the `cookbook_path` setting. If this is not set, then several cookbook operations will fail to work properly. + + cookbook_path ["./cookbooks"] + +This setting tells knife to look for the cookbooks directory in the present working directory. This means the knife cookbook subcommands need to be run in the `chef-repo` directory itself. To make sure that the cookbooks can be found elsewhere inside the repository, use an absolute path. This is a Ruby file, so something like the following can be used: + + current_dir = File.dirname(__FILE__) + cookbook_path ["#{current_dir}/../cookbooks"] + +Which will set `current_dir` to the location of the knife.rb file itself (e.g. `~/chef-repo/.chef/knife.rb`). + +Configure knife to use your preferred copyright holder, email contact and license. Add the following lines to `.chef/knife.rb`. + + cookbook_copyright "Example, Com." + cookbook_email "cookbooks@example.com" + cookbook_license "apachev2" + +Supported values for `cookbook_license` are "apachev2", "mit","gplv2","gplv3", or "none". These settings are used to prefill comments in the default recipe, and the corresponding values in the metadata.rb. You are free to change the the comments in those files. + +Create new cookbooks in this directory with Knife. + + knife cookbook create COOKBOOK + +This will create all the cookbook directory components. You don't need to use them all, and can delete the ones you don't need. It also creates a README file, metadata.rb and default recipe. + +You can also download cookbooks directly from the Opscode Cookbook Site. There are two subcommands to help with this depending on what your preference is. + +The first and recommended method is to use a vendor branch if you're using Git. This is automatically handled with Knife. + + knife cookbook site install COOKBOOK + +This will: + +* Download the cookbook tarball from cookbooks.opscode.com. +* Ensure its on the git master branch. +* Checks for an existing vendor branch, and creates if it doesn't. +* Checks out the vendor branch (chef-vendor-COOKBOOK). +* Removes the existing (old) version. +* Untars the cookbook tarball it downloaded in the first step. +* Adds the cookbook files to the git index and commits. +* Creates a tag for the version downloaded. +* Checks out the master branch again. +* Merges the cookbook into master. +* Repeats the above for all the cookbooks dependencies, downloading them from the community site + +The last step will ensure that any local changes or modifications you have made to the cookbook are preserved, so you can keep your changes through upstream updates. + +If you're not using Git, use the site download subcommand to download the tarball. + + knife cookbook site download COOKBOOK + +This creates the COOKBOOK.tar.gz from in the current directory (e.g., `~/chef-repo`). We recommend following a workflow similar to the above for your version control tool. diff --git a/catalog-fe/sdc-frontend/chef-solo/data_bags/README.md b/catalog-fe/sdc-frontend/chef-solo/data_bags/README.md new file mode 100644 index 0000000000..0c15a391fa --- /dev/null +++ b/catalog-fe/sdc-frontend/chef-solo/data_bags/README.md @@ -0,0 +1,63 @@ +Data Bags +--------- + +This directory contains directories of the various data bags you create for your infrastructure. Each subdirectory corresponds to a data bag on the Chef Server, and contains JSON files of the items that go in the bag. + +First, create a directory for the data bag. + + mkdir data_bags/BAG + +Then create the JSON files for items that will go into that bag. + + $EDITOR data_bags/BAG/ITEM.json + +The JSON for the ITEM must contain a key named "id" with a value equal to "ITEM". For example, + + { + "id": "foo" + } + +Next, create the data bag on the Chef Server. + + knife data bag create BAG + +Then upload the items in the data bag's directory to the Chef Server. + + knife data bag from file BAG ITEM.json + + +Encrypted Data Bags +------------------- + +Added in Chef 0.10, encrypted data bags allow you to encrypt the contents of your data bags. The content of attributes will no longer be searchable. To use encrypted data bags, first you must have or create a secret key. + + openssl rand -base64 512 > secret_key + +You may use this secret_key to add items to a data bag during a create. + + knife data bag create --secret-file secret_key passwords mysql + +You may also use it when adding ITEMs from files, + + knife data bag create passwords + knife data bag from file passwords data_bags/passwords/mysql.json --secret-file secret_key + +The JSON for the ITEM must contain a key named "id" with a value equal to "ITEM" and the contents will be encrypted when uploaded. For example, + + { + "id": "mysql", + "password": "abc123" + } + +Without the secret_key, the contents are encrypted. + + knife data bag show passwords mysql + id: mysql + password: 2I0XUUve1TXEojEyeGsjhw== + +Use the secret_key to view the contents. + + knife data bag show passwords mysql --secret-file secret_key + id: mysql + password: abc123 + diff --git a/catalog-fe/sdc-frontend/chef-solo/environments/README.md b/catalog-fe/sdc-frontend/chef-solo/environments/README.md new file mode 100644 index 0000000000..50ac48db2b --- /dev/null +++ b/catalog-fe/sdc-frontend/chef-solo/environments/README.md @@ -0,0 +1,5 @@ +Requires Chef 0.10.0+. + +This directory is for Ruby DSL and JSON files for environments. For more information see the Chef wiki page: + +http://docs.chef.io/environments.html diff --git a/catalog-fe/sdc-frontend/chef-solo/roles/README.md b/catalog-fe/sdc-frontend/chef-solo/roles/README.md new file mode 100644 index 0000000000..b0ee0b4d21 --- /dev/null +++ b/catalog-fe/sdc-frontend/chef-solo/roles/README.md @@ -0,0 +1,16 @@ +Create roles here, in either the Role Ruby DSL (.rb) or JSON (.json) files. To install roles on the server, use knife. + +For example, create `roles/base_example.rb`: + + name "base_example" + description "Example base role applied to all nodes." + # List of recipes and roles to apply. Requires Chef 0.8, earlier versions use 'recipes()'. + #run_list() + # Attributes applied if the node doesn't have it set already. + #default_attributes() + # Attributes applied no matter what the node has set already. + #override_attributes() + +Then upload it to the Chef Server: + + knife role from file roles/base_example.rb diff --git a/sdc-os-chef/sdc-frontend/chef-solo/roles/catalog-fe.json b/catalog-fe/sdc-frontend/chef-solo/roles/catalog-fe.json index fdc99d0259..44bb56b5be 100644 --- a/sdc-os-chef/sdc-frontend/chef-solo/roles/catalog-fe.json +++ b/catalog-fe/sdc-frontend/chef-solo/roles/catalog-fe.json @@ -16,7 +16,8 @@ "recipe[sdc-catalog-fe::FE_4_logback]", "recipe[sdc-catalog-fe::FE_5_rest_configuration]", "recipe[sdc-catalog-fe::FE_6_locate_keystore]", - "recipe[sdc-catalog-fe::FE_7_create_jetty_modules]" + "recipe[sdc-catalog-fe::FE_7_create_jetty_modules]", + "recipe[sdc-catalog-fe::FE_8_prepareProbeFile]" ], "env_run_lists": { } diff --git a/sdc-os-chef/sdc-frontend/chef-solo/solo.json b/catalog-fe/sdc-frontend/chef-solo/solo.json index 09dd642e6f..09dd642e6f 100644 --- a/sdc-os-chef/sdc-frontend/chef-solo/solo.json +++ b/catalog-fe/sdc-frontend/chef-solo/solo.json diff --git a/sdc-os-chef/sdc-backend/chef-solo/normatives.rb b/catalog-fe/sdc-frontend/chef-solo/solo.rb index 12904507bd..06c1af4592 100644 --- a/sdc-os-chef/sdc-backend/chef-solo/normatives.rb +++ b/catalog-fe/sdc-frontend/chef-solo/solo.rb @@ -1,7 +1,7 @@ root = File.absolute_path(File.dirname(__FILE__)) file_cache_path root cookbook_path root + '/cookbooks' -json_attribs root + '/normatives.json' +json_attribs root + '/solo.json' checksum_path root + '/checksums' data_bag_path root + '/data_bags' environment_path root + '/environments' diff --git a/catalog-fe/sdc-frontend/startup.sh b/catalog-fe/sdc-frontend/startup.sh new file mode 100644 index 0000000000..d8f522d3e1 --- /dev/null +++ b/catalog-fe/sdc-frontend/startup.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +JAVA_OPTIONS=" ${JAVA_OPTIONS} -Dconfig.home=${JETTY_BASE}/config -Dlog.home=${JETTY_BASE}/logs -Dlogback.configurationFile=${JETTY_BASE}/config/catalog-fe/logback.xml -Dconfiguration.yaml=${JETTY_BASE}/config/catalog-fe/configuration.yaml -Donboarding_configuration.yaml=${JETTY_BASE}/config/onboarding-fe/onboarding_configuration.yaml" + +cd /root/chef-solo +chef-solo -c solo.rb -E ${ENVNAME} + +cd /var/lib/jetty +/docker-entrypoint.sh & + +while true; do sleep 2; done + diff --git a/sdc-os-chef/pom.xml b/sdc-os-chef/pom.xml index 7052e31176..c796b2d9dd 100644 --- a/sdc-os-chef/pom.xml +++ b/sdc-os-chef/pom.xml @@ -5,12 +5,12 @@ <artifactId>sdc-os-chef</artifactId> <packaging>pom</packaging> - + <parent> <groupId>org.openecomp.sdc</groupId> <artifactId>sdc-main</artifactId> - <version>1.2.0-SNAPSHOT</version> + <version>1.2.0-SNAPSHOT</version> </parent> @@ -28,40 +28,6 @@ </goals> <configuration> <filesets> - <!-- static configuration files --> - <fileset> - <directory>${project.parent.basedir}/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default</directory> - <followSymlinks>false</followSymlinks> - <includes> - <include>Artifact-Generator.properties</include> - <include>error-configuration.yaml</include> - <include>ecomp-error-configuration.yaml</include> - <include>logback.xml</include> - </includes> - </fileset> - <!-- BE WAR's --> - <fileset> - <directory>${project.parent.basedir}/sdc-os-chef/sdc-backend</directory> - <followSymlinks>false</followSymlinks> - <includes> - <include>*.war</include> - </includes> - </fileset> - <!-- FE WAR's --> - <fileset> - <directory>${project.parent.basedir}/sdc-os-chef/sdc-frontend/</directory> - <followSymlinks>false</followSymlinks> - <includes> - <include>*.war</include> - </includes> - </fileset> - <fileset> - <directory>${project.basedir}/sdc-backend/chef-repo/cookbooks/sdc-normatives/files/default</directory> - <followSymlinks>false</followSymlinks> - <includes> - <include>normatives.tar.gz</include> - </includes> - </fileset> <fileset> <directory>${project.basedir}/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/attributes/</directory> <followSymlinks>false</followSymlinks> @@ -74,8 +40,8 @@ <directory>${project.basedir}/sdc-sanity</directory> <followSymlinks>false</followSymlinks> <includes> - <include>*.jar</include> - </includes> + <include>*.jar</include> + </includes> </fileset> <!-- Sanity test suites --> <fileset> @@ -138,101 +104,6 @@ <version>3.0.2</version> <executions> <execution> - <id>copy-resources-apidocs</id> - <phase>validate</phase> - <goals> - <goal>copy-resources</goal> - </goals> - <configuration> - <outputDirectory>${basedir}/sdc-backend</outputDirectory> - <resources> - <resource> - <directory> - ${project.parent.basedir}/openecomp-be/tools/swagger-ui/api-docs - </directory> - <includes> - <include>api-docs.war</include> - </includes> - </resource> - </resources> - </configuration> - </execution> - - <execution> - <id>copy-static-configuration-files</id> - <phase>validate</phase> - <goals> - <goal>copy-resources</goal> - </goals> - <configuration> - <outputDirectory>${project.parent.basedir}/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default</outputDirectory> - <resources> - <resource> - <directory>${project.parent.basedir}/catalog-be/src/main/resources/config</directory> - <includes> - <include>Artifact-Generator.properties</include> - <include>error-configuration.yaml</include> - <include>ecomp-error-configuration.yaml</include> - <include>logback.xml</include> - </includes> - </resource> - </resources> - </configuration> - </execution> - - <execution> - <id>copy-resources-be</id> - <phase>validate</phase> - <goals> - <goal>copy-resources</goal> - </goals> - <configuration> - <outputDirectory>${basedir}/sdc-backend</outputDirectory> - <resources> - <resource> - <directory>${project.parent.basedir}/catalog-be/target</directory> - <includes> - <include>catalog-be-${project.version}.war</include> - </includes> - </resource> - <resource> - <directory> - ${project.parent.basedir}/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/target - </directory> - <includes> - <include>onboarding-be-${project.version}.war</include> - </includes> - </resource> - </resources> - </configuration> - </execution> - - <execution> - <id>copy-resources-fe</id> - <phase>validate</phase> - <goals> - <goal>copy-resources</goal> - </goals> - <configuration> - <outputDirectory>${basedir}/sdc-frontend</outputDirectory> - <resources> - <resource> - <directory>${project.parent.basedir}/catalog-fe/target</directory> - <includes> - <include>catalog-fe-${project.version}.war</include> - </includes> - </resource> - <resource> - <directory>${project.parent.basedir}/openecomp-ui/target</directory> - <includes> - <include>onboarding-fe-${project.version}.war</include> - </includes> - </resource> - </resources> - </configuration> - </execution> - - <execution> <id>copy-tests-suites</id> <phase>validate</phase> <goals> @@ -250,7 +121,7 @@ </resources> </configuration> </execution> - + <execution> <id>copy-resources-test-apis-ci</id> <phase>validate</phase> @@ -268,28 +139,10 @@ </resource> </resources> </configuration> - </execution> - <execution> - <id>copy-normatives</id> - <phase>validate</phase> - <goals> - <goal>copy-resources</goal> - </goals> - <configuration> - <outputDirectory>${project.parent.basedir}/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-normatives/files/default</outputDirectory> - <resources> - <resource> - <directory>${project.parent.basedir}/catalog-be/target</directory> - <includes> - <include>normatives.tar.gz</include> - </includes> - </resource> - </resources> - </configuration> - </execution> + </execution> </executions> </plugin> - + <plugin> <groupId>io.fabric8</groupId> <artifactId>docker-maven-plugin</artifactId> @@ -301,44 +154,14 @@ <registry>nexus3.onap.org:10001</registry> <authConfig> <pull> - <username>docker</username> - <password>docker</password> - </pull> - </authConfig> + <username>docker</username> + <password>docker</password> + </pull> + </authConfig> <images> - <!-- Build backend image --> - <image> - <name>onap/sdc-backend</name> - <alias>sdc-backend</alias> - <build> - <cleanup>try</cleanup> - <dockerFileDir>${project.basedir}/sdc-backend</dockerFileDir> - <tags> - <tag>${docker.tag}</tag> - <tag>${docker.latest.tag}</tag> - <tag>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest</tag> - </tags> - </build> - </image> - - <!-- Build frontend image --> - <image> - <name>onap/sdc-frontend</name> - <alias>sdc-frontend</alias> - <build> - <cleanup>try</cleanup> - <dockerFileDir>${project.basedir}/sdc-frontend</dockerFileDir> - <tags> - <tag>${docker.tag}</tag> - <tag>${docker.latest.tag}</tag> - <tag>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest</tag> - </tags> - </build> - </image> - <!-- Build init-elastic search image --> - <image> + <image> <name>onap/sdc-init-elasticsearch</name> <alias>sdc-init-elasticsearch</alias> <build> @@ -351,7 +174,7 @@ </tags> </build> </image> - + <!-- Build elastic search image --> <image> <name>onap/sdc-elasticsearch</name> @@ -423,7 +246,7 @@ </goals> <configuration> <removeAll>true</removeAll> - <image>onap/sdc-backend,onap/sdc-frontend,onap/sdc-init-elasticsearch,onap/sdc-elasticsearch,onap/sdc-kibana,onap/sdc-cassandra,onap/sdc-sanity</image> + <image>onap/sdc-init-elasticsearch,onap/sdc-elasticsearch,onap/sdc-kibana,onap/sdc-cassandra,onap/sdc-sanity</image> </configuration> </execution> @@ -442,7 +265,7 @@ <goal>push</goal> </goals> <configuration> - <image>onap/sdc-backend,onap/sdc-frontend,onap/sdc-init-elasticsearch,onap/sdc-elasticsearch,onap/sdc-kibana,onap/sdc-cassandra,onap/sdc-sanity</image> + <image>onap/sdc-init-elasticsearch,onap/sdc-elasticsearch,onap/sdc-kibana,onap/sdc-cassandra,onap/sdc-sanity</image> </configuration> </execution> </executions> diff --git a/sdc-os-chef/scripts/docker_run.sh b/sdc-os-chef/scripts/docker_run.sh index 5307a9cd7a..5da9a7ff4e 100755 --- a/sdc-os-chef/scripts/docker_run.sh +++ b/sdc-os-chef/scripts/docker_run.sh @@ -3,6 +3,10 @@ CS_PASSWORD="onap123#@!" SDC_USER="asdc_user" SDC_PASSWORD="Aa1234%^!" +JETTY_BASE="/var/lib/jetty" +BE_JAVA_OPTIONS="-Xdebug -agentlib:jdwp=transport=dt_socket,address=4000,server=y,suspend=n -Xmx2g -Xms2g" +FE_JAVA_OPTIONS="-Xdebug -agentlib:jdwp=transport=dt_socket,address=6000,server=y,suspend=n -Xmx512m -Xms512m" + function usage { echo "usage: docker_run.sh [ -r|--release <RELEASE-NAME> ] [ -e|--environment <ENV-NAME> ] [ -p|--port <Docker-hub-port>] [ -l|--local <Run-without-pull>] [ -t|--runTests <Run-with-sanityDocker>] [ -h|--help ]" @@ -11,11 +15,20 @@ function usage { function cleanup { echo "performing old dockers cleanup" - docker_ids=`docker ps -a | egrep -v "openecomp/sdc-simulator" | egrep "ecomp-nexus:${PORT}/sdc|sdc|Exit" | awk '{print $1}'` - for X in ${docker_ids} - do - docker rm -f ${X} - done + + if [ "$1" == "all" ] ; then + docker_ids=`docker ps -a | egrep -v "openecomp/sdc-simulator" | egrep "ecomp-nexus:${PORT}/sdc|sdc|Exit" | awk '{print $1}'` + for X in ${docker_ids} + do + docker rm -f ${X} + done + else + echo "performing $1 docker cleanup" + tmp=`docker ps -a -q --filter="name=$1"` + if [[ ! -z "$tmp" ]]; then + docker rm -f ${tmp} + fi + fi } @@ -36,6 +49,42 @@ fi } +function probe_be { + +be_stat=false +docker exec -it $1 /var/lib/ready-probe.sh > /dev/null 2>&1 +rc=$? +if [[ $rc == 200 ]]; then + echo DOCKER start finished in $2 seconds + be_stat=true +fi + +} + +function probe_fe { + +fe_stat=false +docker exec -it $1 /var/lib/ready-probe.sh > /dev/null 2>&1 +rc=$? +if [[ $rc == 200 ]]; then + echo DOCKER start finished in $2 seconds + fe_stat=true +fi + +} + +function probe_es { + +es_stat=false +health_Check_http_code=$(curl -o /dev/null -w '%{http_code}' http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=120s) +if [[ "$health_Check_http_code" -eq 200 ]] + then + echo DOCKER start finished in $2 seconds + es_stat=true + fi + +} + function probe_docker { match_result=false @@ -56,8 +105,17 @@ function monitor_docker { TIME=0 while [ "$TIME" -lt "$TIME_OUT" ]; do if [ "$1" == "sdc-cs" ]; then - probe_cs $1 $TIME - if [[ $cs_stat == true ]]; then break; fi + probe_cs $1 $TIME + if [[ $cs_stat == true ]]; then break; fi + elif [ "$1" == "sdc-es" ]; then + probe_es $1 $TIME + if [[ $es_stat == true ]]; then break; fi + elif [ "$1" == "sdc-BE" ]; then + probe_be $1 $TIME + if [[ $be_stat == true ]]; then break; fi + elif [ "$1" == "sdc-FE" ]; then + probe_fe $1 $TIME + if [[ $fe_stat == true ]]; then break; fi else probe_docker $1 $TIME if [[ $match_result == true ]]; then break; fi @@ -153,6 +211,11 @@ while [ $# -gt 0 ]; do -t | --runTests ) RUNTESTS=true; shift 1 ;; + # -d | --docker - The init specified docker + -d | --docker ) + shift 1 ; + DOCKER=$1; + shift 1 ;; # -h | --help - Display the help message with all the available run options -h | --help ) usage; @@ -170,10 +233,6 @@ done [ -f /opt/config/nexus_docker_repo.txt ] && NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) || NEXUS_DOCKER_REPO=nexus3.onap.org:${PORT} [ -f /opt/config/nexus_username.txt ] && docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO - -cleanup - - export IP=`ip route get 8.8.8.8 | awk '/src/{ print $7 }'` export PREFIX=${NEXUS_DOCKER_REPO}'/onap' @@ -183,42 +242,49 @@ fi echo "" + + +function sdc-es { + # Elastic-Search echo "docker run sdc-elasticsearch..." if [ ${LOCAL} = false ]; then echo "pulling code" docker pull ${PREFIX}/sdc-elasticsearch:${RELEASE} fi -docker run -dit --name sdc-es --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --memory 750m --env ES_JAVA_OPTS="-Xms512m -Xmx512m" --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --env ES_HEAP_SIZE=1024M --volume ${WORKSPACE}/data/ES:/usr/share/elasticsearch/data --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 9200:9200 --publish 9300:9300 ${PREFIX}/sdc-elasticsearch:${RELEASE} /bin/sh +docker run -dit --name sdc-es --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --env ES_JAVA_OPTS="-Xms512m -Xmx512m" --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --env ES_HEAP_SIZE=1024M --volume ${WORKSPACE}/data/ES:/usr/share/elasticsearch/data --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 9200:9200 --publish 9300:9300 ${PREFIX}/sdc-elasticsearch:${RELEASE} /bin/sh -elasticHealthCheck +echo "please wait while ES is starting..." +monitor_docker sdc-es +} +function sdc-init-es { # Init-Elastic-Search echo "docker run sdc-init-elasticsearch..." if [ ${LOCAL} = false ]; then echo "pulling code" docker pull ${PREFIX}/sdc-init-elasticsearch:${RELEASE} fi -docker run --name sdc-init-es --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --memory 750m --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments ${PREFIX}/sdc-init-elasticsearch:${RELEASE} +docker run --name sdc-init-es --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments ${PREFIX}/sdc-init-elasticsearch:${RELEASE} > /dev/null 2>&1 +rc=$? +if [[ $rc != 0 ]]; then exit $rc; fi -# Checking Elastic-Search-Init chef status -if [ ! $? -eq 0 ]; then - echo "Elastic-Search Initialization failed" - exit $? -fi +} +function sdc-cs { # Cassandra echo "docker run sdc-cassandra..." if [ ${LOCAL} = false ]; then docker pull ${PREFIX}/sdc-cassandra:${RELEASE} fi -docker run -dit --name sdc-cs --env RELEASE="${RELEASE}" --env CS_PASSWORD="${CS_PASSWORD}" --env ENVNAME="${DEP_ENV}" --env HOST_IP=${IP} --env JVM_OPTS="-Xms1024m -Xmx1024m" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/CS:/var/lib/cassandra --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 9042:9042 --publish 9160:9160 ${PREFIX}/sdc-cassandra:${RELEASE} /bin/sh +docker run -dit --name sdc-cs --env RELEASE="${RELEASE}" --env CS_PASSWORD="${CS_PASSWORD}" --env ENVNAME="${DEP_ENV}" --env HOST_IP=${IP} --env MAX_HEAP_SIZE="2024M" --env HEAP_NEWSIZE="512M" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/CS:/var/lib/cassandra --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 9042:9042 --publish 9160:9160 ${PREFIX}/sdc-cassandra:${RELEASE} /bin/sh echo "please wait while CS is starting..." monitor_docker sdc-cs +} - +function sdc-cs-init { # cassandra-init echo "docker run sdc-cassandra-init..." if [ ${LOCAL} = false ]; then @@ -227,19 +293,22 @@ fi docker run --name sdc-cs-init --env RELEASE="${RELEASE}" --env SDC_USER="${SDC_USER}" --env SDC_PASSWORD="${SDC_PASSWORD}" --env CS_PASSWORD="${CS_PASSWORD}" --env ENVNAME="${DEP_ENV}" --env HOST_IP=${IP} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/CS:/var/lib/cassandra --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --volume ${WORKSPACE}/data/CS-Init:/root/chef-solo/cache ${PREFIX}/sdc-cassandra-init:${RELEASE} > /dev/null 2>&1 rc=$? if [[ $rc != 0 ]]; then exit $rc; fi +} - +function sdc-kbn { # kibana echo "docker run sdc-kibana..." if [ ${LOCAL} = false ]; then docker pull ${PREFIX}/sdc-kibana:${RELEASE} +docker run --detach --name sdc-kbn --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 5601:5601 ${PREFIX}/sdc-kibana:${RELEASE} fi -docker run --detach --name sdc-kbn --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --memory 2g --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 5601:5601 ${PREFIX}/sdc-kibana:${RELEASE} +} -dir_perms +function sdc-BE { +dir_perms # Back-End echo "docker run sdc-backend..." if [ ${LOCAL} = false ]; then @@ -247,30 +316,41 @@ if [ ${LOCAL} = false ]; then else ADDITIONAL_ARGUMENTS=${DEBUG_PORT} fi -docker run --detach --name sdc-BE --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env http_proxy=${http_proxy} --env https_proxy=${https_proxy} --env no_proxy=${no_proxy} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --memory 4g --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/logs/BE/:/var/lib/jetty/logs --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 8443:8443 --publish 8080:8080 ${ADDITIONAL_ARGUMENTS} ${PREFIX}/sdc-backend:${RELEASE} - - +docker run --detach --name sdc-BE --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env http_proxy=${http_proxy} --env https_proxy=${https_proxy} --env no_proxy=${no_proxy} --env JAVA_OPTIONS="${BE_JAVA_OPTIONS}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/logs/BE/:/var/lib/jetty/logs --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 8443:8443 --publish 8080:8080 ${ADDITIONAL_ARGUMENTS} ${PREFIX}/sdc-backend:${RELEASE} echo "please wait while BE is starting..." monitor_docker sdc-BE +} +function sdc-BE-init { +dir_perms +# Back-End-Init +echo "docker run sdc-backend-init..." +if [ ${LOCAL} = false ]; then + docker pull ${PREFIX}/sdc-backend-init:${RELEASE} +fi +docker run --name sdc-BE-init --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/logs/BE/:/var/lib/jetty/logs --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments ${PREFIX}/sdc-backend-init:${RELEASE} > /dev/null 2>&1 +rc=$? +if [[ $rc != 0 ]]; then exit $rc; fi +} + +function sdc-FE { +dir_perms # Front-End echo "docker run sdc-frontend..." if [ ${LOCAL} = false ]; then docker pull ${PREFIX}/sdc-frontend:${RELEASE} fi -docker run --detach --name sdc-FE --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env http_proxy=${http_proxy} --env https_proxy=${https_proxy} --env no_proxy=${no_proxy} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/logs/FE/:/var/lib/jetty/logs --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 9443:9443 --publish 8181:8181 ${PREFIX}/sdc-frontend:${RELEASE} - - +docker run --detach --name sdc-FE --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env http_proxy=${http_proxy} --env https_proxy=${https_proxy} --env no_proxy=${no_proxy} --env JAVA_OPTIONS="${FE_JAVA_OPTIONS}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/logs/FE/:/var/lib/jetty/logs --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 9443:9443 --publish 8181:8181 ${PREFIX}/sdc-frontend:${RELEASE} echo "please wait while FE is starting....." monitor_docker sdc-FE +} -# healthCheck -healthCheck +function sdc-sanity { # sanityDocker if [[ (${RUNTESTS} = true) && (${healthCheck_http_code} == 200) ]]; then echo "docker run sdc-sanity..." @@ -280,8 +360,27 @@ if [[ (${RUNTESTS} = true) && (${healthCheck_http_code} == 200) ]]; then docker pull ${PREFIX}/sdc-sanity:${RELEASE} fi -docker run --detach --name sdc-sanity --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env http_proxy=${http_proxy} --env https_proxy=${https_proxy} --env no_proxy=${no_proxy} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --memory 1500m --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/logs/sdc-sanity/target:/var/lib/tests/target --volume ${WORKSPACE}/data/logs/sdc-sanity/ExtentReport:/var/lib/tests/ExtentReport --volume ${WORKSPACE}/data/logs/sdc-sanity/outputCsar:/var/lib/tests/outputCsar --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 9560:9560 ${PREFIX}/sdc-sanity:${RELEASE} +docker run --detach --name sdc-sanity --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env http_proxy=${http_proxy} --env https_proxy=${https_proxy} --env no_proxy=${no_proxy} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/logs/sdc-sanity/target:/var/lib/tests/target --volume ${WORKSPACE}/data/logs/sdc-sanity/ExtentReport:/var/lib/tests/ExtentReport --volume ${WORKSPACE}/data/logs/sdc-sanity/outputCsar:/var/lib/tests/outputCsar --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 9560:9560 ${PREFIX}/sdc-sanity:${RELEASE} echo "please wait while SANITY is starting....." monitor_docker sdc-sanity -fi
\ No newline at end of file +fi +} + +if [ -z "${DOCKER}" ]; then + cleanup all + sdc-es + sdc-init-es + sdc-cs + sdc-cs-init + sdc-kbn + sdc-BE + sdc-BE-init + sdc-FE +else + cleanup ${DOCKER} + ${DOCKER} +fi + +# healthCheck +healthCheck
\ No newline at end of file diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_1_cleanup_jettydir.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_1_cleanup_jettydir.rb deleted file mode 100644 index d989eb20bb..0000000000 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_1_cleanup_jettydir.rb +++ /dev/null @@ -1,48 +0,0 @@ -#directory "BE_tempdir_cleanup" do -# path "/var/lib/jetty/tempdir" -# recursive true -# action :delete -#end - - -directory "BE_tempdir_creation" do - path "/var/lib/jetty/temp" - owner 'jetty' - group 'jetty' - mode '0755' - action :create -end - - -#directory "BE_webapps_cleanup" do -# path "/var/lib/jetty/webapps" -# recursive true -# action :delete -#end - - -#directory "BE_webapps_creation" do -# path "/var/lib/jetty/webapps" -# owner 'jetty' -# group 'jetty' -# mode '0755' -# action :create -#end - - -directory "BE_create_config_dir" do - path "/var/lib/jetty/config" - owner 'jetty' - group 'jetty' - mode '0755' - action :create -end - - -directory "BE_create_catalog-be" do - path "/var/lib/jetty/config/catalog-be" - owner 'jetty' - group 'jetty' - mode '0755' - action :create -end diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_jetty_Modules.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_jetty_Modules.rb deleted file mode 100644 index 45055f95b8..0000000000 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_jetty_Modules.rb +++ /dev/null @@ -1,22 +0,0 @@ -jetty_base="/var/lib/jetty" -jetty_home="/usr/local/jetty" - -###### create Jetty modules -bash "create-jetty-modules" do -cwd "#{jetty_base}" -code <<-EOH - cd "#{jetty_base}" - java -jar "/#{jetty_home}"/start.jar --add-to-start=deploy - java -jar "/#{jetty_home}"/start.jar --add-to-startd=http,https,logging,setuid -EOH -not_if "ls /#{jetty_base}/start.d/https.ini" -end - -template "ssl-ini" do - path "/#{jetty_base}/start.d/ssl.ini" - source "ssl-ini.erb" - owner "jetty" - group "jetty" - mode "0755" - variables :BE_https_port => "#{node['BE'][:https_port]}" -end diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_Number_create_DMaaP_keys.rb-NotUsed b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_Number_create_DMaaP_keys.rb-NotUsed deleted file mode 100644 index 583dfff7b2..0000000000 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_Number_create_DMaaP_keys.rb-NotUsed +++ /dev/null @@ -1,34 +0,0 @@ -http_request 'create-DMaaP-apiKeys' do - action :post - url 'http://23.253.97.75:3904/apiKeys/create' - message ({:some => 'data'}.to_json) - headers({ - 'Content-Type' => 'application/json' - }) -end - - -selfEnviroment = node.chef_environment - -ruby_block "create-DMaaP-apiKeys" do - block do - sleep(15) - #tricky way to load this Chef::Mixin::ShellOut utilities - Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut) - curl_command = "https://es_admin:Aa123456@#{application_host}:9200/_cluster/health?pretty=true --insecure" - resp = Net::HTTP.get_response URI.parse(curl_command) - stat = JSON.parse(resp.read_body)['status'] - - case stat - when "green" - printf("\033[32m%s\n\033[0m", " ElasticSearch tests completed successfully.") - when "yellow" - printf("\033[33m%s\n\033[0m", " ElasticSearch tests completed successfully, with warnings") - when "red" - printf("\033[31m%s\n\033[0m", " ElasticSearch tests failed!!!") - end - end -end - -curl POST -d '{"email":"Grinberg.Moti","description":"New Api Key for ASDC OS"}' http://23.253.97.75:3904/apiKeys/create - diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_Number_import_Normatives.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_Number_import_Normatives.rb deleted file mode 100644 index 6e9b24133d..0000000000 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_Number_import_Normatives.rb +++ /dev/null @@ -1,16 +0,0 @@ -cookbook_file "/tmp/normatives.tar.gz" do - source "normatives.tar.gz" -end - -working_directory = "/tmp" - -bash "import-normatives" do - cwd "#{working_directory}" - code <<-EOH - tar xvfz /tmp/normatives.tar.gz - cd scripts/import/tosca/ - /bin/chmod +x importNormativeAll.py - python importNormativeAll.py - EOH -end - diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-normatives/recipes/check_Backend.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-normatives/recipes/check_Backend.rb deleted file mode 100644 index 00bb50ebd8..0000000000 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-normatives/recipes/check_Backend.rb +++ /dev/null @@ -1,19 +0,0 @@ -ruby_block "check_Backend_Health" do - block do - printf("\033[32m%s\n\033[0m", " executing BackEnd health-check, please wait...") - Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut) - curl_command = "http://localhost:8080/sdc2/rest/v1/user/jh0003" - resp = Net::HTTP.get_response URI.parse(curl_command) - stat = resp.code - - case stat - when '200' - printf("\033[32m%s\n\033[0m", " BackEnd is up.") - else - printf("\033[31mstat=[%s]\n\033[0m", stat) - printf("\033[31m%s\n\033[0m", " BackEnd is DOWN!!!") - end - end - retries 12 - retry_delay 5 -end diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-normatives/recipes/import_Normatives.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-normatives/recipes/import_Normatives.rb deleted file mode 100644 index 30de529cba..0000000000 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-normatives/recipes/import_Normatives.rb +++ /dev/null @@ -1,17 +0,0 @@ -cookbook_file "/tmp/normatives.tar.gz" do - source "normatives.tar.gz" -end - -working_directory = "/tmp" - -bash "import-normatives" do - cwd "#{working_directory}" - code <<-EOH - tar xvfz /tmp/normatives.tar.gz - cd normatives/scripts/import/tosca/ - /bin/chmod +x importNormativeAll.py -# add --debug=true to the importNormativeAll.py arguments to enable debug - python importONAPNormativeAll.py -i localhost > /var/lib/jetty/logs/importNormativeAll.log - EOH -end - diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-normatives/recipes/upgrade_Normatives.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-normatives/recipes/upgrade_Normatives.rb deleted file mode 100644 index b071810e9f..0000000000 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-normatives/recipes/upgrade_Normatives.rb +++ /dev/null @@ -1,17 +0,0 @@ -cookbook_file "/tmp/normatives.tar.gz" do - source "normatives.tar.gz" -end - -working_directory = "/tmp" - -bash "upgrade-normatives" do - cwd "#{working_directory}" - code <<-EOH - tar xvfz /tmp/normatives.tar.gz - cd normatives/scripts/import/tosca/ - /bin/chmod +x upgradeNormative.py importGroupTypes.py -# add --debug=true to the importNormativeAll.py arguments to enable debug - python upgradeONAPNormative.py -i localhost > /var/lib/jetty/logs/upgradeNormative.log - EOH -end - diff --git a/sdc-os-chef/sdc-backend/startup.sh b/sdc-os-chef/sdc-backend/startup.sh deleted file mode 100644 index 8e5926cdc4..0000000000 --- a/sdc-os-chef/sdc-backend/startup.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh - -export CHEFNAME=${ENVNAME} -# executing chef-solo for configuration -cd /root/chef-solo -echo "normal['HOST_IP'] = \"${HOST_IP}\"" > /root/chef-solo/cookbooks/sdc-catalog-be/attributes/default.rb -chef-solo -c solo.rb -E ${CHEFNAME} - -sed -i '/^set -e/aJAVA_OPTIONS=\"-Xdebug -agentlib:jdwp=transport=dt_socket,address=4000,server=y,suspend=n -XX:MaxPermSize=256m -Xmx1500m -Dconfig.home=${JETTY_BASE}\/config -Dlog.home=${JETTY_BASE}\/logs -Dlogback.configurationFile=${JETTY_BASE}\/config\/catalog-be\/logback.xml -Dconfiguration.yaml=${JETTY_BASE}\/config\/catalog-be\/configuration.yaml -Dartifactgenerator.config=${JETTY_BASE}\/config\/catalog-be\/Artifact-Generator.properties\ -Donboarding_configuration.yaml=${JETTY_BASE}\/config\/onboarding-be\/onboarding_configuration.yaml" ' /docker-entrypoint.sh -sed -i '/^set -e/aTMPDIR=${JETTY_BASE}\/temp' /docker-entrypoint.sh - -# executiong the jetty -cd /var/lib/jetty -/docker-entrypoint.sh & - -# add the consumers -cd /root/chef-solo -python /root/chef-solo/cookbooks/sdc-catalog-be/files/default/consumers.py & - -# add the user -python /root/chef-solo/cookbooks/sdc-catalog-be/files/default/user.py & - -# check if BackEnd is up -python /root/chef-solo/cookbooks/sdc-normatives/files/default/check_Backend_Health.py - -# executing the normatives -cd /root/chef-solo -check_normative="/tmp/check_normative.out" -curl -s -X GET -H "Content-Type: application/json;charset=UTF-8" -H "USER_ID: jh0003" -H "X-ECOMP-RequestID: cbe744a0-037b-458f-aab5-df6e543c4090" -H "Cache-Control: no-cache" -H "Postman-Token: af08ca1c-302f-1431-404f-ed84246e07c9" "http://localhost:8080/sdc2/rest/v1/screen" > ${check_normative} - -echo "normal['HOST_IP'] = \"${HOST_IP}\"" > /root/chef-solo/cookbooks/sdc-normatives/attributes/default.rb -resources_len=`cat ${check_normative}| jq '.["resources"]|length'` -if [ $resources_len -eq 0 ] ; then - chef-solo -c normatives.rb -else - sed -i "s/import/upgrade/g" normatives.json - chef-solo -c normatives.rb -fi - -echo "###### DOCKER STARTED #####" - -while true; do sleep 2; done - - - diff --git a/sdc-os-chef/sdc-cassandra/chef-install.sh b/sdc-os-chef/sdc-cassandra/chef-install.sh deleted file mode 100644 index 5a4be8ba18..0000000000 --- a/sdc-os-chef/sdc-cassandra/chef-install.sh +++ /dev/null @@ -1,707 +0,0 @@ -#!/bin/sh -# WARNING: REQUIRES /bin/sh -# -# - must run on /bin/sh on solaris 9 -# - must run on /bin/sh on AIX 6.x -# -# Copyright:: Copyright (c) 2010-2015 Chef Software, Inc. -# License:: Apache License, Version 2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# helpers.sh -############ -# This section has some helper functions to make life easier. -# -# Outputs: -# $tmp_dir: secure-ish temp directory that can be used during installation. -############ - -# Check whether a command exists - returns 0 if it does, 1 if it does not -exists() { - if command -v $1 >/dev/null 2>&1 - then - return 0 - else - return 1 - fi -} - -# Output the instructions to report bug about this script -report_bug() { - echo "Version: $version" - echo "" - echo "Please file a Bug Report at https://github.com/chef/omnitruck/issues/new" - echo "Alternatively, feel free to open a Support Ticket at https://www.chef.io/support/tickets" - echo "More Chef support resources can be found at https://www.chef.io/support" - echo "" - echo "Please include as many details about the problem as possible i.e., how to reproduce" - echo "the problem (if possible), type of the Operating System and its version, etc.," - echo "and any other relevant details that might help us with troubleshooting." - echo "" -} - -checksum_mismatch() { - echo "Package checksum mismatch!" - report_bug - exit 1 -} - -unable_to_retrieve_package() { - echo "Unable to retrieve a valid package!" - report_bug - echo "Metadata URL: $metadata_url" - if test "x$download_url" != "x"; then - echo "Download URL: $download_url" - fi - if test "x$stderr_results" != "x"; then - echo "\nDEBUG OUTPUT FOLLOWS:\n$stderr_results" - fi - exit 1 -} - -http_404_error() { - echo "Omnitruck artifact does not exist for version $version on platform $platform" - echo "" - echo "Either this means:" - echo " - We do not support $platform" - echo " - We do not have an artifact for $version" - echo "" - echo "This is often the latter case due to running a prerelease or RC version of chef" - echo "or a gem version which was only pushed to rubygems and not omnitruck." - echo "" - echo "You may be able to set your knife[:bootstrap_version] to the most recent stable" - echo "release of Chef to fix this problem (or the most recent stable major version number)." - echo "" - echo "In order to test the version parameter, adventurous users may take the Metadata URL" - echo "below and modify the '&v=<number>' parameter until you successfully get a URL that" - echo "does not 404 (e.g. via curl or wget). You should be able to use '&v=11' or '&v=12'" - echo "succesfully." - echo "" - echo "If you cannot fix this problem by setting the bootstrap_version, it probably means" - echo "that $platform is not supported." - echo "" - # deliberately do not call report_bug to suppress bug report noise. - echo "Metadata URL: $metadata_url" - if test "x$download_url" != "x"; then - echo "Download URL: $download_url" - fi - if test "x$stderr_results" != "x"; then - echo "\nDEBUG OUTPUT FOLLOWS:\n$stderr_results" - fi - exit 1 -} - -capture_tmp_stderr() { - # spool up /tmp/stderr from all the commands we called - if test -f "$tmp_dir/stderr"; then - output=`cat $tmp_dir/stderr` - stderr_results="${stderr_results}\nSTDERR from $1:\n\n$output\n" - rm $tmp_dir/stderr - fi -} - -# do_wget URL FILENAME -do_wget() { - echo "trying wget..." - wget --user-agent="User-Agent: mixlib-install/2.1.8" -O "$2" "$1" 2>$tmp_dir/stderr - rc=$? - # check for 404 - grep "ERROR 404" $tmp_dir/stderr 2>&1 >/dev/null - if test $? -eq 0; then - echo "ERROR 404" - http_404_error - fi - - # check for bad return status or empty output - if test $rc -ne 0 || test ! -s "$2"; then - capture_tmp_stderr "wget" - return 1 - fi - - return 0 -} - -# do_curl URL FILENAME -do_curl() { - echo "trying curl..." - curl -A "User-Agent: mixlib-install/2.1.8" --retry 5 -sL -D $tmp_dir/stderr "$1" > "$2" - rc=$? - # check for 404 - grep "404 Not Found" $tmp_dir/stderr 2>&1 >/dev/null - if test $? -eq 0; then - echo "ERROR 404" - http_404_error - fi - - # check for bad return status or empty output - if test $rc -ne 0 || test ! -s "$2"; then - capture_tmp_stderr "curl" - return 1 - fi - - return 0 -} - -# do_fetch URL FILENAME -do_fetch() { - echo "trying fetch..." - fetch --user-agent="User-Agent: mixlib-install/2.1.8" -o "$2" "$1" 2>$tmp_dir/stderr - # check for bad return status - test $? -ne 0 && return 1 - return 0 -} - -# do_perl URL FILENAME -do_perl() { - echo "trying perl..." - perl -e 'use LWP::Simple; getprint($ARGV[0]);' "$1" > "$2" 2>$tmp_dir/stderr - rc=$? - # check for 404 - grep "404 Not Found" $tmp_dir/stderr 2>&1 >/dev/null - if test $? -eq 0; then - echo "ERROR 404" - http_404_error - fi - - # check for bad return status or empty output - if test $rc -ne 0 || test ! -s "$2"; then - capture_tmp_stderr "perl" - return 1 - fi - - return 0 -} - -# do_python URL FILENAME -do_python() { - echo "trying python..." - python -c "import sys,urllib2; sys.stdout.write(urllib2.urlopen(urllib2.Request(sys.argv[1], headers={ 'User-Agent': 'mixlib-install/2.1.8' })).read())" "$1" > "$2" 2>$tmp_dir/stderr - rc=$? - # check for 404 - grep "HTTP Error 404" $tmp_dir/stderr 2>&1 >/dev/null - if test $? -eq 0; then - echo "ERROR 404" - http_404_error - fi - - # check for bad return status or empty output - if test $rc -ne 0 || test ! -s "$2"; then - capture_tmp_stderr "python" - return 1 - fi - return 0 -} - -# returns 0 if checksums match -do_checksum() { - if exists sha256sum; then - echo "Comparing checksum with sha256sum..." - checksum=`sha256sum $1 | awk '{ print $1 }'` - return `test "x$checksum" = "x$2"` - elif exists shasum; then - echo "Comparing checksum with shasum..." - checksum=`shasum -a 256 $1 | awk '{ print $1 }'` - return `test "x$checksum" = "x$2"` - else - echo "WARNING: could not find a valid checksum program, pre-install shasum or sha256sum in your O/S image to get valdation..." - return 0 - fi -} - -# do_download URL FILENAME -do_download() { - echo "downloading $1" - echo " to file $2" - - url=`echo $1` - if test "x$platform" = "xsolaris2"; then - if test "x$platform_version" = "x5.9" -o "x$platform_version" = "x5.10"; then - # solaris 9 lacks openssl, solaris 10 lacks recent enough credentials - your base O/S is completely insecure, please upgrade - url=`echo $url | sed -e 's/https/http/'` - fi - fi - - # we try all of these until we get success. - # perl, in particular may be present but LWP::Simple may not be installed - - if exists wget; then - do_wget $url $2 && return 0 - fi - - if exists curl; then - do_curl $url $2 && return 0 - fi - - if exists fetch; then - do_fetch $url $2 && return 0 - fi - - if exists perl; then - do_perl $url $2 && return 0 - fi - - if exists python; then - do_python $url $2 && return 0 - fi - - unable_to_retrieve_package -} - -# install_file TYPE FILENAME -# TYPE is "rpm", "deb", "solaris", "sh", etc. -install_file() { - echo "Installing $project $version" - case "$1" in - "rpm") - if test "x$platform" = "xnexus" || test "x$platform" = "xios_xr"; then - echo "installing with yum..." - yum install -yv "$2" - else - echo "installing with rpm..." - rpm -Uvh --oldpackage --replacepkgs "$2" - fi - ;; - "deb") - echo "installing with dpkg..." - dpkg -i "$2" - ;; - "bff") - echo "installing with installp..." - installp -aXYgd "$2" all - ;; - "solaris") - echo "installing with pkgadd..." - echo "conflict=nocheck" > $tmp_dir/nocheck - echo "action=nocheck" >> $tmp_dir/nocheck - echo "mail=" >> $tmp_dir/nocheck - pkgrm -a $tmp_dir/nocheck -n $project >/dev/null 2>&1 || true - pkgadd -G -n -d "$2" -a $tmp_dir/nocheck $project - ;; - "pkg") - echo "installing with installer..." - cd / && /usr/sbin/installer -pkg "$2" -target / - ;; - "dmg") - echo "installing dmg file..." - hdiutil detach "/Volumes/chef_software" >/dev/null 2>&1 || true - hdiutil attach "$2" -mountpoint "/Volumes/chef_software" - cd / && /usr/sbin/installer -pkg `find "/Volumes/chef_software" -name \*.pkg` -target / - hdiutil detach "/Volumes/chef_software" - ;; - "sh" ) - echo "installing with sh..." - sh "$2" - ;; - "p5p" ) - echo "installing p5p package..." - pkg install -g "$2" $project - ;; - *) - echo "Unknown filetype: $1" - report_bug - exit 1 - ;; - esac - if test $? -ne 0; then - echo "Installation failed" - report_bug - exit 1 - fi -} - -if test "x$TMPDIR" = "x"; then - tmp="/tmp" -else - tmp=$TMPDIR -fi -# secure-ish temp dir creation without having mktemp available (DDoS-able but not expliotable) -tmp_dir="$tmp/install.sh.$$" -(umask 077 && mkdir $tmp_dir) || exit 1 - -############ -# end of helpers.sh -############ - - -# script_cli_parameters.sh -############ -# This section reads the CLI parameters for the install script and translates -# them to the local parameters to be used later by the script. -# -# Outputs: -# $version: Requested version to be installed. -# $channel: Channel to install the product from -# $project: Project to be installed -# $cmdline_filename: Name of the package downloaded on local disk. -# $cmdline_dl_dir: Name of the directory downloaded package will be saved to on local disk. -############ - -# Defaults -channel="stable" -project="chef" - -while getopts pnv:c:f:P:d: opt -do - case "$opt" in - - v) version="$OPTARG";; - c) channel="$OPTARG";; - p) channel="current";; # compat for prerelease option - n) channel="current";; # compat for nightlies option - f) cmdline_filename="$OPTARG";; - P) project="$OPTARG";; - d) cmdline_dl_dir="$OPTARG";; - \?) # unknown flag - echo >&2 \ - "usage: $0 [-P project] [-c release_channel] [-v version] [-f filename | -d download_dir]" - exit 1;; - esac -done - -shift `expr $OPTIND - 1` - - -# platform_detection.sh -############ -# This section makes platform detection compatible with omnitruck on the system -# it runs. -# -# Outputs: -# $platform: Name of the platform. -# $platform_version: Version of the platform. -# $machine: System's architecture. -############ - -# -# Platform and Platform Version detection -# -# NOTE: This should now match ohai platform and platform_version matching. -# do not invented new platform and platform_version schemas, just make this behave -# like what ohai returns as platform and platform_version for the server. -# -# ALSO NOTE: Do not mangle platform or platform_version here. It is less error -# prone and more future-proof to do that in the server, and then all omnitruck clients -# will 'inherit' the changes (install.sh is not the only client of the omnitruck -# endpoint out there). -# - -machine=`uname -m` -os=`uname -s` - -if test -f "/etc/lsb-release" && grep -q DISTRIB_ID /etc/lsb-release && ! grep -q wrlinux /etc/lsb-release; then - platform=`grep DISTRIB_ID /etc/lsb-release | cut -d "=" -f 2 | tr '[A-Z]' '[a-z]'` - platform_version=`grep DISTRIB_RELEASE /etc/lsb-release | cut -d "=" -f 2` - - if test "$platform" = "\"cumulus linux\""; then - platform="cumulus_linux" - elif test "$platform" = "\"cumulus networks\""; then - platform="cumulus_networks" - fi - -elif test -f "/etc/debian_version"; then - platform="debian" - platform_version=`cat /etc/debian_version` -elif test -f "/etc/Eos-release"; then - # EOS may also contain /etc/redhat-release so this check must come first. - platform=arista_eos - platform_version=`awk '{print $4}' /etc/Eos-release` - machine="i386" -elif test -f "/etc/redhat-release"; then - platform=`sed 's/^\(.\+\) release.*/\1/' /etc/redhat-release | tr '[A-Z]' '[a-z]'` - platform_version=`sed 's/^.\+ release \([.0-9]\+\).*/\1/' /etc/redhat-release` - - # If /etc/redhat-release exists, we act like RHEL by default - if test "$platform" = "fedora"; then - # FIXME: stop remapping fedora to el - # FIXME: remove client side platform_version mangling and hard coded yolo - # Change platform version for use below. - platform_version="6.0" - fi - - if test "$platform" = "xenserver"; then - # Current XenServer 6.2 is based on CentOS 5, platform is not reset to "el" server should hanlde response - platform="xenserver" - else - # FIXME: use "redhat" - platform="el" - fi - -elif test -f "/etc/system-release"; then - platform=`sed 's/^\(.\+\) release.\+/\1/' /etc/system-release | tr '[A-Z]' '[a-z]'` - platform_version=`sed 's/^.\+ release \([.0-9]\+\).*/\1/' /etc/system-release | tr '[A-Z]' '[a-z]'` - # amazon is built off of fedora, so act like RHEL - if test "$platform" = "amazon linux ami"; then - # FIXME: remove client side platform_version mangling and hard coded yolo, and remapping to deprecated "el" - platform="el" - platform_version="6.0" - fi -# Apple OS X -elif test -f "/usr/bin/sw_vers"; then - platform="mac_os_x" - # Matching the tab-space with sed is error-prone - platform_version=`sw_vers | awk '/^ProductVersion:/ { print $2 }' | cut -d. -f1,2` - - # x86_64 Apple hardware often runs 32-bit kernels (see OHAI-63) - x86_64=`sysctl -n hw.optional.x86_64` - if test $x86_64 -eq 1; then - machine="x86_64" - fi -elif test -f "/etc/release"; then - machine=`/usr/bin/uname -p` - if grep -q SmartOS /etc/release; then - platform="smartos" - platform_version=`grep ^Image /etc/product | awk '{ print $3 }'` - else - platform="solaris2" - platform_version=`/usr/bin/uname -r` - fi -elif test -f "/etc/SuSE-release"; then - if grep -q 'Enterprise' /etc/SuSE-release; - then - platform="sles" - platform_version=`awk '/^VERSION/ {V = $3}; /^PATCHLEVEL/ {P = $3}; END {print V "." P}' /etc/SuSE-release` - else - platform="suse" - platform_version=`awk '/^VERSION =/ { print $3 }' /etc/SuSE-release` - fi -elif test "x$os" = "xFreeBSD"; then - platform="freebsd" - platform_version=`uname -r | sed 's/-.*//'` -elif test "x$os" = "xAIX"; then - platform="aix" - platform_version="`uname -v`.`uname -r`" - machine="powerpc" -elif test -f "/etc/os-release"; then - . /etc/os-release - if test "x$CISCO_RELEASE_INFO" != "x"; then - . $CISCO_RELEASE_INFO - fi - - platform=$ID - platform_version=$VERSION -fi - -if test "x$platform" = "x"; then - echo "Unable to determine platform version!" - report_bug - exit 1 -fi - -# -# NOTE: platform manging in the install.sh is DEPRECATED -# -# - install.sh should be true to ohai and should not remap -# platform or platform versions. -# -# - remapping platform and mangling platform version numbers is -# now the complete responsibility of the server-side endpoints -# - -major_version=`echo $platform_version | cut -d. -f1` -case $platform in - # FIXME: should remove this case statement completely - "el") - # FIXME: "el" is deprecated, should use "redhat" - platform_version=$major_version - ;; - "debian") - if test "x$major_version" = "x5"; then - # This is here for potential back-compat. - # We do not have 5 in versions we publish for anymore but we - # might have it for earlier versions. - platform_version="6" - else - platform_version=$major_version - fi - ;; - "freebsd") - platform_version=$major_version - ;; - "sles") - platform_version=$major_version - ;; - "suse") - platform_version=$major_version - ;; -esac - -# normalize the architecture we detected -case $machine in - "x86_64"|"amd64"|"x64") - machine="x86_64" - ;; - "i386"|"i86pc"|"x86"|"i686") - machine="i386" - ;; - "sparc"|"sun4u"|"sun4v") - machine="sparc" - ;; -esac - -if test "x$platform_version" = "x"; then - echo "Unable to determine platform version!" - report_bug - exit 1 -fi - -if test "x$platform" = "xsolaris2"; then - # hack up the path on Solaris to find wget, pkgadd - PATH=/usr/sfw/bin:/usr/sbin:$PATH - export PATH -fi - -echo "$platform $platform_version $machine" - -############ -# end of platform_detection.sh -############ - - -# fetch_metadata.sh -############ -# This section calls omnitruck to get the information about the build to be -# installed. -# -# Inputs: -# $channel: -# $project: -# $version: -# $platform: -# $platform_version: -# $machine: -# $tmp_dir: -# -# Outputs: -# $download_url: -# $sha256: -############ - -echo "Getting information for $project $channel $version for $platform..." - -metadata_filename="$tmp_dir/metadata.txt" -metadata_url="https://omnitruck-direct.chef.io/$channel/$project/metadata?v=$version&p=$platform&pv=$platform_version&m=$machine" - -do_download "$metadata_url" "$metadata_filename" - -cat "$metadata_filename" - -echo "" -# check that all the mandatory fields in the downloaded metadata are there -if grep '^url' $metadata_filename > /dev/null && grep '^sha256' $metadata_filename > /dev/null; then - echo "downloaded metadata file looks valid..." -else - echo "downloaded metadata file is corrupted or an uncaught error was encountered in downloading the file..." - # this generally means one of the download methods downloaded a 404 or something like that and then reported a successful exit code, - # and this should be fixed in the function that was doing the download. - report_bug - exit 1 -fi - -download_url=`awk '$1 == "url" { print $2 }' "$metadata_filename"` -sha256=`awk '$1 == "sha256" { print $2 }' "$metadata_filename"` - -############ -# end of fetch_metadata.sh -############ - - -# fetch_package.sh -############ -# This section fetchs a package from $download_url and verifies its metadata. -# -# Inputs: -# $download_url: -# $tmp_dir: -# Optional Inputs: -# $cmdline_filename: Name of the package downloaded on local disk. -# $cmdline_dl_dir: Name of the directory downloaded package will be saved to on local disk. -# -# Outputs: -# $download_filename: Name of the downloaded file on local disk. -# $filetype: Type of the file downloaded. -############ - -filename=`echo $download_url | sed -e 's/^.*\///'` -filetype=`echo $filename | sed -e 's/^.*\.//'` - -# use either $tmp_dir, the provided directory (-d) or the provided filename (-f) -if test "x$cmdline_filename" != "x"; then - download_filename="$cmdline_filename" -elif test "x$cmdline_dl_dir" != "x"; then - download_filename="$cmdline_dl_dir/$filename" -else - download_filename="$tmp_dir/$filename" -fi - -# ensure the parent directory where to download the installer always exists -download_dir=`dirname $download_filename` -(umask 077 && mkdir -p $download_dir) || exit 1 - -# check if we have that file locally available and if so verify the checksum -cached_file_available="false" -if test -f $download_filename; then - echo "$download_filename already exists, verifiying checksum..." - if do_checksum "$download_filename" "$sha256"; then - echo "checksum compare succeeded, using existing file!" - cached_file_available="true" - else - echo "checksum mismatch, downloading latest version of the file" - fi -fi - -# download if no local version of the file available -if test "x$cached_file_available" != "xtrue"; then - do_download "$download_url" "$download_filename" - do_checksum "$download_filename" "$sha256" || checksum_mismatch -fi - -############ -# end of fetch_package.sh -############ - - -# install_package.sh -############ -# Installs a package and removed the temp directory. -# -# Inputs: -# $download_filename: Name of the file to be installed. -# $filetype: Type of the file to be installed. -# $version: The version requested. Used only for warning user if not set. -############ - -if test "x$version" = "x"; then - echo - echo "WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING" - echo - echo "You are installing an omnibus package without a version pin. If you are installing" - echo "on production servers via an automated process this is DANGEROUS and you will" - echo "be upgraded without warning on new releases, even to new major releases." - echo "Letting the version float is only appropriate in desktop, test, development or" - echo "CI/CD environments." - echo - echo "WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING" - echo -fi - -install_file $filetype "$download_filename" - -if test "x$tmp_dir" != "x"; then - rm -r "$tmp_dir" -fi - -############ -# end of install_package.sh -############ diff --git a/sdc-os-chef/sdc-cassandra/startup.sh b/sdc-os-chef/sdc-cassandra/startup.sh index c583876e2d..c779e3796d 100755 --- a/sdc-os-chef/sdc-cassandra/startup.sh +++ b/sdc-os-chef/sdc-cassandra/startup.sh @@ -6,7 +6,7 @@ rc=$? if [[ $rc != 0 ]]; then exit $rc; fi echo "########### starting cassandra ###########" -# start cassandra + /docker-entrypoint.sh cassandra -f & chef-solo -c solo.rb -E ${ENVNAME} diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_1_cleanup_jettydir.rb b/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_1_cleanup_jettydir.rb deleted file mode 100644 index 25983700d2..0000000000 --- a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_1_cleanup_jettydir.rb +++ /dev/null @@ -1,57 +0,0 @@ -#directory "FE_tempdir_cleanup" do -# path "/var/lib/jetty/tempdir" -# recursive true -# action :delete -#end - - -directory "FE_tempdir_creation" do - path "/var/lib/jetty/temp" - owner 'jetty' - group 'jetty' - mode '0755' - action :create -end - - -#directory "FE_webapps_cleanup" do -# path "/var/lib/jetty/webapps" -# recursive true -# action :delete -#end - - -#directory "FE_webapps_creation" do -# path "/var/lib/jetty/webapps" -# owner 'jetty' -# group 'jetty' -# mode '0755' -# action :create -#end - - -directory "FE_create_config_dir" do - path "/var/lib/jetty/config" - owner 'jetty' - group 'jetty' - mode '0755' - action :create -end - - -directory "FE_create_catalog-fe" do - path "/var/lib/jetty/config/catalog-fe" - owner 'jetty' - group 'jetty' - mode '0755' - action :create -end - - -directory "FE_create_catalog-fe" do - path "/var/lib/jetty/config/onboarding-fe" - owner 'jetty' - group 'jetty' - mode '0755' - action :create -end
\ No newline at end of file diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_7_create_jetty_modules.rb b/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_7_create_jetty_modules.rb deleted file mode 100644 index 5497576f8f..0000000000 --- a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_7_create_jetty_modules.rb +++ /dev/null @@ -1,51 +0,0 @@ -jetty_base="/var/lib/jetty" -jetty_home="/usr/local/jetty" - -###### create Jetty modules -bash "create-jetty-modules" do -cwd "#{jetty_base}" -code <<-EOH - cd "#{jetty_base}" - java -jar "/#{jetty_home}"/start.jar --add-to-start=deploy - java -jar "/#{jetty_home}"/start.jar --add-to-startd=http,https,logging,setuid -EOH -not_if "ls /#{jetty_base}/start.d/https.ini" -end - - -###### configure Jetty modules -template "FE-http-ini" do - path "/#{jetty_base}/start.d/http.ini" - source "FE-http-ini.erb" - owner "jetty" - group "jetty" - mode "0755" - variables :FE_http_port => "#{node['FE'][:http_port]}" -end - - -template "FE-https-ini" do - path "/#{jetty_base}/start.d/https.ini" - source "FE-https-ini.erb" - owner "jetty" - group "jetty" - mode "0755" - variables :FE_https_port => "#{node['FE'][:https_port]}" -end - - -template "ssl-ini" do - path "/#{jetty_base}/start.d/ssl.ini" - source "ssl-ini.erb" - owner "jetty" - group "jetty" - mode "0755" - variables :https_port => "#{node['FE'][:https_port]}" -end - -bash "echo status" do - code <<-EOH - echo "###### DOCKER STARTED #####" - EOH -end - diff --git a/sdc-os-chef/sdc-frontend/startup.sh b/sdc-os-chef/sdc-frontend/startup.sh deleted file mode 100644 index 82aef0b352..0000000000 --- a/sdc-os-chef/sdc-frontend/startup.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -export CHEFNAME=${ENVNAME} -cd /root/chef-solo -echo "normal['HOST_IP'] = \"${HOST_IP}\"" > /root/chef-solo/cookbooks/sdc-catalog-fe/attributes/default.rb -chef-solo -c solo.rb -E ${CHEFNAME} - -sed -i '/^set -e/aJAVA_OPTIONS=\" -Xdebug -agentlib:jdwp=transport=dt_socket,address=6000,server=y,suspend=n -XX:MaxPermSize=256m -Xmx512m -Dconfig.home=${JETTY_BASE}\/config -Dlog.home=${JETTY_BASE}\/logs -Dlogback.configurationFile=${JETTY_BASE}\/config\/catalog-fe\/logback.xml -Dconfiguration.yaml=${JETTY_BASE}\/config\/catalog-fe\/configuration.yaml -Donboarding_configuration.yaml=${JETTY_BASE}\/config\/onboarding-fe\/onboarding_configuration.yaml\"' /docker-entrypoint.sh -sed -i '/^set -e/aTMPDIR=${JETTY_BASE}\/temp' /docker-entrypoint.sh - -cd /var/lib/jetty -/docker-entrypoint.sh - diff --git a/sdc-os-chef/sdc-init-elasticsearch/startup.sh b/sdc-os-chef/sdc-init-elasticsearch/startup.sh index 9a8cbc3394..47aba88ff2 100644 --- a/sdc-os-chef/sdc-init-elasticsearch/startup.sh +++ b/sdc-os-chef/sdc-init-elasticsearch/startup.sh @@ -2,5 +2,5 @@ cd /root/chef-solo/ chef-solo -c solo.rb -E ${ENVNAME} - -exit $?
\ No newline at end of file +rc=$? +if [[ $rc != 0 ]]; then exit $rc; fi diff --git a/sdc-os-chef/sdc-kibana/startup.sh b/sdc-os-chef/sdc-kibana/startup.sh index 0efa850fba..ad7f5f75da 100644 --- a/sdc-os-chef/sdc-kibana/startup.sh +++ b/sdc-os-chef/sdc-kibana/startup.sh @@ -1,8 +1,9 @@ #!/bin/sh -export CHEFNAME=${ENVNAME} cd /root/chef-solo -chef-solo -c solo.rb -E ${CHEFNAME} +chef-solo -c solo.rb -E ${ENVNAME} +rc=$? +if [[ $rc != 0 ]]; then exit $rc; fi /docker-entrypoint.sh kibana diff --git a/sdc-os-chef/sdc-sanity/chef-install.sh b/sdc-os-chef/sdc-sanity/chef-install.sh deleted file mode 100644 index 5a4be8ba18..0000000000 --- a/sdc-os-chef/sdc-sanity/chef-install.sh +++ /dev/null @@ -1,707 +0,0 @@ -#!/bin/sh -# WARNING: REQUIRES /bin/sh -# -# - must run on /bin/sh on solaris 9 -# - must run on /bin/sh on AIX 6.x -# -# Copyright:: Copyright (c) 2010-2015 Chef Software, Inc. -# License:: Apache License, Version 2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# helpers.sh -############ -# This section has some helper functions to make life easier. -# -# Outputs: -# $tmp_dir: secure-ish temp directory that can be used during installation. -############ - -# Check whether a command exists - returns 0 if it does, 1 if it does not -exists() { - if command -v $1 >/dev/null 2>&1 - then - return 0 - else - return 1 - fi -} - -# Output the instructions to report bug about this script -report_bug() { - echo "Version: $version" - echo "" - echo "Please file a Bug Report at https://github.com/chef/omnitruck/issues/new" - echo "Alternatively, feel free to open a Support Ticket at https://www.chef.io/support/tickets" - echo "More Chef support resources can be found at https://www.chef.io/support" - echo "" - echo "Please include as many details about the problem as possible i.e., how to reproduce" - echo "the problem (if possible), type of the Operating System and its version, etc.," - echo "and any other relevant details that might help us with troubleshooting." - echo "" -} - -checksum_mismatch() { - echo "Package checksum mismatch!" - report_bug - exit 1 -} - -unable_to_retrieve_package() { - echo "Unable to retrieve a valid package!" - report_bug - echo "Metadata URL: $metadata_url" - if test "x$download_url" != "x"; then - echo "Download URL: $download_url" - fi - if test "x$stderr_results" != "x"; then - echo "\nDEBUG OUTPUT FOLLOWS:\n$stderr_results" - fi - exit 1 -} - -http_404_error() { - echo "Omnitruck artifact does not exist for version $version on platform $platform" - echo "" - echo "Either this means:" - echo " - We do not support $platform" - echo " - We do not have an artifact for $version" - echo "" - echo "This is often the latter case due to running a prerelease or RC version of chef" - echo "or a gem version which was only pushed to rubygems and not omnitruck." - echo "" - echo "You may be able to set your knife[:bootstrap_version] to the most recent stable" - echo "release of Chef to fix this problem (or the most recent stable major version number)." - echo "" - echo "In order to test the version parameter, adventurous users may take the Metadata URL" - echo "below and modify the '&v=<number>' parameter until you successfully get a URL that" - echo "does not 404 (e.g. via curl or wget). You should be able to use '&v=11' or '&v=12'" - echo "succesfully." - echo "" - echo "If you cannot fix this problem by setting the bootstrap_version, it probably means" - echo "that $platform is not supported." - echo "" - # deliberately do not call report_bug to suppress bug report noise. - echo "Metadata URL: $metadata_url" - if test "x$download_url" != "x"; then - echo "Download URL: $download_url" - fi - if test "x$stderr_results" != "x"; then - echo "\nDEBUG OUTPUT FOLLOWS:\n$stderr_results" - fi - exit 1 -} - -capture_tmp_stderr() { - # spool up /tmp/stderr from all the commands we called - if test -f "$tmp_dir/stderr"; then - output=`cat $tmp_dir/stderr` - stderr_results="${stderr_results}\nSTDERR from $1:\n\n$output\n" - rm $tmp_dir/stderr - fi -} - -# do_wget URL FILENAME -do_wget() { - echo "trying wget..." - wget --user-agent="User-Agent: mixlib-install/2.1.8" -O "$2" "$1" 2>$tmp_dir/stderr - rc=$? - # check for 404 - grep "ERROR 404" $tmp_dir/stderr 2>&1 >/dev/null - if test $? -eq 0; then - echo "ERROR 404" - http_404_error - fi - - # check for bad return status or empty output - if test $rc -ne 0 || test ! -s "$2"; then - capture_tmp_stderr "wget" - return 1 - fi - - return 0 -} - -# do_curl URL FILENAME -do_curl() { - echo "trying curl..." - curl -A "User-Agent: mixlib-install/2.1.8" --retry 5 -sL -D $tmp_dir/stderr "$1" > "$2" - rc=$? - # check for 404 - grep "404 Not Found" $tmp_dir/stderr 2>&1 >/dev/null - if test $? -eq 0; then - echo "ERROR 404" - http_404_error - fi - - # check for bad return status or empty output - if test $rc -ne 0 || test ! -s "$2"; then - capture_tmp_stderr "curl" - return 1 - fi - - return 0 -} - -# do_fetch URL FILENAME -do_fetch() { - echo "trying fetch..." - fetch --user-agent="User-Agent: mixlib-install/2.1.8" -o "$2" "$1" 2>$tmp_dir/stderr - # check for bad return status - test $? -ne 0 && return 1 - return 0 -} - -# do_perl URL FILENAME -do_perl() { - echo "trying perl..." - perl -e 'use LWP::Simple; getprint($ARGV[0]);' "$1" > "$2" 2>$tmp_dir/stderr - rc=$? - # check for 404 - grep "404 Not Found" $tmp_dir/stderr 2>&1 >/dev/null - if test $? -eq 0; then - echo "ERROR 404" - http_404_error - fi - - # check for bad return status or empty output - if test $rc -ne 0 || test ! -s "$2"; then - capture_tmp_stderr "perl" - return 1 - fi - - return 0 -} - -# do_python URL FILENAME -do_python() { - echo "trying python..." - python -c "import sys,urllib2; sys.stdout.write(urllib2.urlopen(urllib2.Request(sys.argv[1], headers={ 'User-Agent': 'mixlib-install/2.1.8' })).read())" "$1" > "$2" 2>$tmp_dir/stderr - rc=$? - # check for 404 - grep "HTTP Error 404" $tmp_dir/stderr 2>&1 >/dev/null - if test $? -eq 0; then - echo "ERROR 404" - http_404_error - fi - - # check for bad return status or empty output - if test $rc -ne 0 || test ! -s "$2"; then - capture_tmp_stderr "python" - return 1 - fi - return 0 -} - -# returns 0 if checksums match -do_checksum() { - if exists sha256sum; then - echo "Comparing checksum with sha256sum..." - checksum=`sha256sum $1 | awk '{ print $1 }'` - return `test "x$checksum" = "x$2"` - elif exists shasum; then - echo "Comparing checksum with shasum..." - checksum=`shasum -a 256 $1 | awk '{ print $1 }'` - return `test "x$checksum" = "x$2"` - else - echo "WARNING: could not find a valid checksum program, pre-install shasum or sha256sum in your O/S image to get valdation..." - return 0 - fi -} - -# do_download URL FILENAME -do_download() { - echo "downloading $1" - echo " to file $2" - - url=`echo $1` - if test "x$platform" = "xsolaris2"; then - if test "x$platform_version" = "x5.9" -o "x$platform_version" = "x5.10"; then - # solaris 9 lacks openssl, solaris 10 lacks recent enough credentials - your base O/S is completely insecure, please upgrade - url=`echo $url | sed -e 's/https/http/'` - fi - fi - - # we try all of these until we get success. - # perl, in particular may be present but LWP::Simple may not be installed - - if exists wget; then - do_wget $url $2 && return 0 - fi - - if exists curl; then - do_curl $url $2 && return 0 - fi - - if exists fetch; then - do_fetch $url $2 && return 0 - fi - - if exists perl; then - do_perl $url $2 && return 0 - fi - - if exists python; then - do_python $url $2 && return 0 - fi - - unable_to_retrieve_package -} - -# install_file TYPE FILENAME -# TYPE is "rpm", "deb", "solaris", "sh", etc. -install_file() { - echo "Installing $project $version" - case "$1" in - "rpm") - if test "x$platform" = "xnexus" || test "x$platform" = "xios_xr"; then - echo "installing with yum..." - yum install -yv "$2" - else - echo "installing with rpm..." - rpm -Uvh --oldpackage --replacepkgs "$2" - fi - ;; - "deb") - echo "installing with dpkg..." - dpkg -i "$2" - ;; - "bff") - echo "installing with installp..." - installp -aXYgd "$2" all - ;; - "solaris") - echo "installing with pkgadd..." - echo "conflict=nocheck" > $tmp_dir/nocheck - echo "action=nocheck" >> $tmp_dir/nocheck - echo "mail=" >> $tmp_dir/nocheck - pkgrm -a $tmp_dir/nocheck -n $project >/dev/null 2>&1 || true - pkgadd -G -n -d "$2" -a $tmp_dir/nocheck $project - ;; - "pkg") - echo "installing with installer..." - cd / && /usr/sbin/installer -pkg "$2" -target / - ;; - "dmg") - echo "installing dmg file..." - hdiutil detach "/Volumes/chef_software" >/dev/null 2>&1 || true - hdiutil attach "$2" -mountpoint "/Volumes/chef_software" - cd / && /usr/sbin/installer -pkg `find "/Volumes/chef_software" -name \*.pkg` -target / - hdiutil detach "/Volumes/chef_software" - ;; - "sh" ) - echo "installing with sh..." - sh "$2" - ;; - "p5p" ) - echo "installing p5p package..." - pkg install -g "$2" $project - ;; - *) - echo "Unknown filetype: $1" - report_bug - exit 1 - ;; - esac - if test $? -ne 0; then - echo "Installation failed" - report_bug - exit 1 - fi -} - -if test "x$TMPDIR" = "x"; then - tmp="/tmp" -else - tmp=$TMPDIR -fi -# secure-ish temp dir creation without having mktemp available (DDoS-able but not expliotable) -tmp_dir="$tmp/install.sh.$$" -(umask 077 && mkdir $tmp_dir) || exit 1 - -############ -# end of helpers.sh -############ - - -# script_cli_parameters.sh -############ -# This section reads the CLI parameters for the install script and translates -# them to the local parameters to be used later by the script. -# -# Outputs: -# $version: Requested version to be installed. -# $channel: Channel to install the product from -# $project: Project to be installed -# $cmdline_filename: Name of the package downloaded on local disk. -# $cmdline_dl_dir: Name of the directory downloaded package will be saved to on local disk. -############ - -# Defaults -channel="stable" -project="chef" - -while getopts pnv:c:f:P:d: opt -do - case "$opt" in - - v) version="$OPTARG";; - c) channel="$OPTARG";; - p) channel="current";; # compat for prerelease option - n) channel="current";; # compat for nightlies option - f) cmdline_filename="$OPTARG";; - P) project="$OPTARG";; - d) cmdline_dl_dir="$OPTARG";; - \?) # unknown flag - echo >&2 \ - "usage: $0 [-P project] [-c release_channel] [-v version] [-f filename | -d download_dir]" - exit 1;; - esac -done - -shift `expr $OPTIND - 1` - - -# platform_detection.sh -############ -# This section makes platform detection compatible with omnitruck on the system -# it runs. -# -# Outputs: -# $platform: Name of the platform. -# $platform_version: Version of the platform. -# $machine: System's architecture. -############ - -# -# Platform and Platform Version detection -# -# NOTE: This should now match ohai platform and platform_version matching. -# do not invented new platform and platform_version schemas, just make this behave -# like what ohai returns as platform and platform_version for the server. -# -# ALSO NOTE: Do not mangle platform or platform_version here. It is less error -# prone and more future-proof to do that in the server, and then all omnitruck clients -# will 'inherit' the changes (install.sh is not the only client of the omnitruck -# endpoint out there). -# - -machine=`uname -m` -os=`uname -s` - -if test -f "/etc/lsb-release" && grep -q DISTRIB_ID /etc/lsb-release && ! grep -q wrlinux /etc/lsb-release; then - platform=`grep DISTRIB_ID /etc/lsb-release | cut -d "=" -f 2 | tr '[A-Z]' '[a-z]'` - platform_version=`grep DISTRIB_RELEASE /etc/lsb-release | cut -d "=" -f 2` - - if test "$platform" = "\"cumulus linux\""; then - platform="cumulus_linux" - elif test "$platform" = "\"cumulus networks\""; then - platform="cumulus_networks" - fi - -elif test -f "/etc/debian_version"; then - platform="debian" - platform_version=`cat /etc/debian_version` -elif test -f "/etc/Eos-release"; then - # EOS may also contain /etc/redhat-release so this check must come first. - platform=arista_eos - platform_version=`awk '{print $4}' /etc/Eos-release` - machine="i386" -elif test -f "/etc/redhat-release"; then - platform=`sed 's/^\(.\+\) release.*/\1/' /etc/redhat-release | tr '[A-Z]' '[a-z]'` - platform_version=`sed 's/^.\+ release \([.0-9]\+\).*/\1/' /etc/redhat-release` - - # If /etc/redhat-release exists, we act like RHEL by default - if test "$platform" = "fedora"; then - # FIXME: stop remapping fedora to el - # FIXME: remove client side platform_version mangling and hard coded yolo - # Change platform version for use below. - platform_version="6.0" - fi - - if test "$platform" = "xenserver"; then - # Current XenServer 6.2 is based on CentOS 5, platform is not reset to "el" server should hanlde response - platform="xenserver" - else - # FIXME: use "redhat" - platform="el" - fi - -elif test -f "/etc/system-release"; then - platform=`sed 's/^\(.\+\) release.\+/\1/' /etc/system-release | tr '[A-Z]' '[a-z]'` - platform_version=`sed 's/^.\+ release \([.0-9]\+\).*/\1/' /etc/system-release | tr '[A-Z]' '[a-z]'` - # amazon is built off of fedora, so act like RHEL - if test "$platform" = "amazon linux ami"; then - # FIXME: remove client side platform_version mangling and hard coded yolo, and remapping to deprecated "el" - platform="el" - platform_version="6.0" - fi -# Apple OS X -elif test -f "/usr/bin/sw_vers"; then - platform="mac_os_x" - # Matching the tab-space with sed is error-prone - platform_version=`sw_vers | awk '/^ProductVersion:/ { print $2 }' | cut -d. -f1,2` - - # x86_64 Apple hardware often runs 32-bit kernels (see OHAI-63) - x86_64=`sysctl -n hw.optional.x86_64` - if test $x86_64 -eq 1; then - machine="x86_64" - fi -elif test -f "/etc/release"; then - machine=`/usr/bin/uname -p` - if grep -q SmartOS /etc/release; then - platform="smartos" - platform_version=`grep ^Image /etc/product | awk '{ print $3 }'` - else - platform="solaris2" - platform_version=`/usr/bin/uname -r` - fi -elif test -f "/etc/SuSE-release"; then - if grep -q 'Enterprise' /etc/SuSE-release; - then - platform="sles" - platform_version=`awk '/^VERSION/ {V = $3}; /^PATCHLEVEL/ {P = $3}; END {print V "." P}' /etc/SuSE-release` - else - platform="suse" - platform_version=`awk '/^VERSION =/ { print $3 }' /etc/SuSE-release` - fi -elif test "x$os" = "xFreeBSD"; then - platform="freebsd" - platform_version=`uname -r | sed 's/-.*//'` -elif test "x$os" = "xAIX"; then - platform="aix" - platform_version="`uname -v`.`uname -r`" - machine="powerpc" -elif test -f "/etc/os-release"; then - . /etc/os-release - if test "x$CISCO_RELEASE_INFO" != "x"; then - . $CISCO_RELEASE_INFO - fi - - platform=$ID - platform_version=$VERSION -fi - -if test "x$platform" = "x"; then - echo "Unable to determine platform version!" - report_bug - exit 1 -fi - -# -# NOTE: platform manging in the install.sh is DEPRECATED -# -# - install.sh should be true to ohai and should not remap -# platform or platform versions. -# -# - remapping platform and mangling platform version numbers is -# now the complete responsibility of the server-side endpoints -# - -major_version=`echo $platform_version | cut -d. -f1` -case $platform in - # FIXME: should remove this case statement completely - "el") - # FIXME: "el" is deprecated, should use "redhat" - platform_version=$major_version - ;; - "debian") - if test "x$major_version" = "x5"; then - # This is here for potential back-compat. - # We do not have 5 in versions we publish for anymore but we - # might have it for earlier versions. - platform_version="6" - else - platform_version=$major_version - fi - ;; - "freebsd") - platform_version=$major_version - ;; - "sles") - platform_version=$major_version - ;; - "suse") - platform_version=$major_version - ;; -esac - -# normalize the architecture we detected -case $machine in - "x86_64"|"amd64"|"x64") - machine="x86_64" - ;; - "i386"|"i86pc"|"x86"|"i686") - machine="i386" - ;; - "sparc"|"sun4u"|"sun4v") - machine="sparc" - ;; -esac - -if test "x$platform_version" = "x"; then - echo "Unable to determine platform version!" - report_bug - exit 1 -fi - -if test "x$platform" = "xsolaris2"; then - # hack up the path on Solaris to find wget, pkgadd - PATH=/usr/sfw/bin:/usr/sbin:$PATH - export PATH -fi - -echo "$platform $platform_version $machine" - -############ -# end of platform_detection.sh -############ - - -# fetch_metadata.sh -############ -# This section calls omnitruck to get the information about the build to be -# installed. -# -# Inputs: -# $channel: -# $project: -# $version: -# $platform: -# $platform_version: -# $machine: -# $tmp_dir: -# -# Outputs: -# $download_url: -# $sha256: -############ - -echo "Getting information for $project $channel $version for $platform..." - -metadata_filename="$tmp_dir/metadata.txt" -metadata_url="https://omnitruck-direct.chef.io/$channel/$project/metadata?v=$version&p=$platform&pv=$platform_version&m=$machine" - -do_download "$metadata_url" "$metadata_filename" - -cat "$metadata_filename" - -echo "" -# check that all the mandatory fields in the downloaded metadata are there -if grep '^url' $metadata_filename > /dev/null && grep '^sha256' $metadata_filename > /dev/null; then - echo "downloaded metadata file looks valid..." -else - echo "downloaded metadata file is corrupted or an uncaught error was encountered in downloading the file..." - # this generally means one of the download methods downloaded a 404 or something like that and then reported a successful exit code, - # and this should be fixed in the function that was doing the download. - report_bug - exit 1 -fi - -download_url=`awk '$1 == "url" { print $2 }' "$metadata_filename"` -sha256=`awk '$1 == "sha256" { print $2 }' "$metadata_filename"` - -############ -# end of fetch_metadata.sh -############ - - -# fetch_package.sh -############ -# This section fetchs a package from $download_url and verifies its metadata. -# -# Inputs: -# $download_url: -# $tmp_dir: -# Optional Inputs: -# $cmdline_filename: Name of the package downloaded on local disk. -# $cmdline_dl_dir: Name of the directory downloaded package will be saved to on local disk. -# -# Outputs: -# $download_filename: Name of the downloaded file on local disk. -# $filetype: Type of the file downloaded. -############ - -filename=`echo $download_url | sed -e 's/^.*\///'` -filetype=`echo $filename | sed -e 's/^.*\.//'` - -# use either $tmp_dir, the provided directory (-d) or the provided filename (-f) -if test "x$cmdline_filename" != "x"; then - download_filename="$cmdline_filename" -elif test "x$cmdline_dl_dir" != "x"; then - download_filename="$cmdline_dl_dir/$filename" -else - download_filename="$tmp_dir/$filename" -fi - -# ensure the parent directory where to download the installer always exists -download_dir=`dirname $download_filename` -(umask 077 && mkdir -p $download_dir) || exit 1 - -# check if we have that file locally available and if so verify the checksum -cached_file_available="false" -if test -f $download_filename; then - echo "$download_filename already exists, verifiying checksum..." - if do_checksum "$download_filename" "$sha256"; then - echo "checksum compare succeeded, using existing file!" - cached_file_available="true" - else - echo "checksum mismatch, downloading latest version of the file" - fi -fi - -# download if no local version of the file available -if test "x$cached_file_available" != "xtrue"; then - do_download "$download_url" "$download_filename" - do_checksum "$download_filename" "$sha256" || checksum_mismatch -fi - -############ -# end of fetch_package.sh -############ - - -# install_package.sh -############ -# Installs a package and removed the temp directory. -# -# Inputs: -# $download_filename: Name of the file to be installed. -# $filetype: Type of the file to be installed. -# $version: The version requested. Used only for warning user if not set. -############ - -if test "x$version" = "x"; then - echo - echo "WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING" - echo - echo "You are installing an omnibus package without a version pin. If you are installing" - echo "on production servers via an automated process this is DANGEROUS and you will" - echo "be upgraded without warning on new releases, even to new major releases." - echo "Letting the version float is only appropriate in desktop, test, development or" - echo "CI/CD environments." - echo - echo "WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING" - echo -fi - -install_file $filetype "$download_filename" - -if test "x$tmp_dir" != "x"; then - rm -r "$tmp_dir" -fi - -############ -# end of install_package.sh -############ diff --git a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/setup_sanity.rb b/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/setup_sanity.rb deleted file mode 100644 index 7f0843d598..0000000000 --- a/sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/recipes/setup_sanity.rb +++ /dev/null @@ -1,68 +0,0 @@ -tests_path = "/tmp/sdc-tests/" -ci_test_suite = "sanity.xml" - - -bash "extract asdc-tests" do - code <<-EOH - [ ! -d /tmp/sdc-tests/ ] && mkdir -p /tmp/sdc-tests - cd /tmp/sdc-tests - rm -rf * - /bin/tar -xf /root/chef-solo/cookbooks/sdc-sanity/files/default/asdc-tests.tar --strip-components=1 -C /tmp/sdc-tests - chmod -R 755 /tmp/sdc-tests - EOH -end - - -template "sdc-yaml-config" do - path "/tmp/sdc-tests/conf/sdc.yaml" - source "sdc-sanity.yaml.erb" - owner "root" - group "root" - mode "0755" - variables ({ - :target_path => "#{tests_path}/target", - :catalogBE_ip => node['Nodes']['BE'], - :catalogBE_port => node['BE'][:http_port], - :webportal_ip => node['Nodes']['FE'], - :webportal_port => node['FE'][:http_port], - :titan_file => "/tmp/sdc-tests/conf/titan.properties", - :tests_path_ci => "#{tests_path}/CI/tests", - :components_path => "#{tests_path}/CI/components", - :importResourceConfigDir => "#{tests_path}/CI/importResource", - :importTypesDir => "#{tests_path}/CI/importTypesTest", - :importResourceTestsConfigDir => "#{tests_path}/CI/importResourceTests", - :ConfigurationFile => "#{tests_path}/conf/configuration.yaml", - :errorConfigurationFile => "#{tests_path}/conf/error-configuration.yaml", - :CASSANDRA_IP => node['Nodes']['CS'], - :CASSANDRA_PWD => node['cassandra'][:cassandra_password], - :CASSANDRA_USR => node['cassandra'][:cassandra_user] - }) -end - - -replication_factor=1 -template "titan.properties" do - path "/tmp/sdc-tests/conf/titan.properties" - source "BE-titan.properties.erb" - owner "root" - group "root" - mode "0755" - variables({ - :CASSANDRA_IP => node['Nodes']['CS'], - :CASSANDRA_PWD => node['cassandra'][:cassandra_password], - :CASSANDRA_USR => node['cassandra'][:cassandra_user], - :DC_NAME => "DC-"+node.chef_environment, - :rep_factor => replication_factor - }) -end - - -bash "run asdc ci sanity tests" do - cwd "#{tests_path}" - code <<-EOH - jar_file=`ls asdc-tests-*-jar-with-dependencies.jar` - ./startTest.sh $jar_file #{ci_test_suite} - echo "return code from startTest.sh = [$?]" - EOH - timeout 72000 -end diff --git a/utils/webseal-simulator/sdc-simulator/chef-install.sh b/utils/webseal-simulator/sdc-simulator/chef-install.sh deleted file mode 100644 index 5a4be8ba18..0000000000 --- a/utils/webseal-simulator/sdc-simulator/chef-install.sh +++ /dev/null @@ -1,707 +0,0 @@ -#!/bin/sh -# WARNING: REQUIRES /bin/sh -# -# - must run on /bin/sh on solaris 9 -# - must run on /bin/sh on AIX 6.x -# -# Copyright:: Copyright (c) 2010-2015 Chef Software, Inc. -# License:: Apache License, Version 2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# helpers.sh -############ -# This section has some helper functions to make life easier. -# -# Outputs: -# $tmp_dir: secure-ish temp directory that can be used during installation. -############ - -# Check whether a command exists - returns 0 if it does, 1 if it does not -exists() { - if command -v $1 >/dev/null 2>&1 - then - return 0 - else - return 1 - fi -} - -# Output the instructions to report bug about this script -report_bug() { - echo "Version: $version" - echo "" - echo "Please file a Bug Report at https://github.com/chef/omnitruck/issues/new" - echo "Alternatively, feel free to open a Support Ticket at https://www.chef.io/support/tickets" - echo "More Chef support resources can be found at https://www.chef.io/support" - echo "" - echo "Please include as many details about the problem as possible i.e., how to reproduce" - echo "the problem (if possible), type of the Operating System and its version, etc.," - echo "and any other relevant details that might help us with troubleshooting." - echo "" -} - -checksum_mismatch() { - echo "Package checksum mismatch!" - report_bug - exit 1 -} - -unable_to_retrieve_package() { - echo "Unable to retrieve a valid package!" - report_bug - echo "Metadata URL: $metadata_url" - if test "x$download_url" != "x"; then - echo "Download URL: $download_url" - fi - if test "x$stderr_results" != "x"; then - echo "\nDEBUG OUTPUT FOLLOWS:\n$stderr_results" - fi - exit 1 -} - -http_404_error() { - echo "Omnitruck artifact does not exist for version $version on platform $platform" - echo "" - echo "Either this means:" - echo " - We do not support $platform" - echo " - We do not have an artifact for $version" - echo "" - echo "This is often the latter case due to running a prerelease or RC version of chef" - echo "or a gem version which was only pushed to rubygems and not omnitruck." - echo "" - echo "You may be able to set your knife[:bootstrap_version] to the most recent stable" - echo "release of Chef to fix this problem (or the most recent stable major version number)." - echo "" - echo "In order to test the version parameter, adventurous users may take the Metadata URL" - echo "below and modify the '&v=<number>' parameter until you successfully get a URL that" - echo "does not 404 (e.g. via curl or wget). You should be able to use '&v=11' or '&v=12'" - echo "succesfully." - echo "" - echo "If you cannot fix this problem by setting the bootstrap_version, it probably means" - echo "that $platform is not supported." - echo "" - # deliberately do not call report_bug to suppress bug report noise. - echo "Metadata URL: $metadata_url" - if test "x$download_url" != "x"; then - echo "Download URL: $download_url" - fi - if test "x$stderr_results" != "x"; then - echo "\nDEBUG OUTPUT FOLLOWS:\n$stderr_results" - fi - exit 1 -} - -capture_tmp_stderr() { - # spool up /tmp/stderr from all the commands we called - if test -f "$tmp_dir/stderr"; then - output=`cat $tmp_dir/stderr` - stderr_results="${stderr_results}\nSTDERR from $1:\n\n$output\n" - rm $tmp_dir/stderr - fi -} - -# do_wget URL FILENAME -do_wget() { - echo "trying wget..." - wget --user-agent="User-Agent: mixlib-install/2.1.8" -O "$2" "$1" 2>$tmp_dir/stderr - rc=$? - # check for 404 - grep "ERROR 404" $tmp_dir/stderr 2>&1 >/dev/null - if test $? -eq 0; then - echo "ERROR 404" - http_404_error - fi - - # check for bad return status or empty output - if test $rc -ne 0 || test ! -s "$2"; then - capture_tmp_stderr "wget" - return 1 - fi - - return 0 -} - -# do_curl URL FILENAME -do_curl() { - echo "trying curl..." - curl -A "User-Agent: mixlib-install/2.1.8" --retry 5 -sL -D $tmp_dir/stderr "$1" > "$2" - rc=$? - # check for 404 - grep "404 Not Found" $tmp_dir/stderr 2>&1 >/dev/null - if test $? -eq 0; then - echo "ERROR 404" - http_404_error - fi - - # check for bad return status or empty output - if test $rc -ne 0 || test ! -s "$2"; then - capture_tmp_stderr "curl" - return 1 - fi - - return 0 -} - -# do_fetch URL FILENAME -do_fetch() { - echo "trying fetch..." - fetch --user-agent="User-Agent: mixlib-install/2.1.8" -o "$2" "$1" 2>$tmp_dir/stderr - # check for bad return status - test $? -ne 0 && return 1 - return 0 -} - -# do_perl URL FILENAME -do_perl() { - echo "trying perl..." - perl -e 'use LWP::Simple; getprint($ARGV[0]);' "$1" > "$2" 2>$tmp_dir/stderr - rc=$? - # check for 404 - grep "404 Not Found" $tmp_dir/stderr 2>&1 >/dev/null - if test $? -eq 0; then - echo "ERROR 404" - http_404_error - fi - - # check for bad return status or empty output - if test $rc -ne 0 || test ! -s "$2"; then - capture_tmp_stderr "perl" - return 1 - fi - - return 0 -} - -# do_python URL FILENAME -do_python() { - echo "trying python..." - python -c "import sys,urllib2; sys.stdout.write(urllib2.urlopen(urllib2.Request(sys.argv[1], headers={ 'User-Agent': 'mixlib-install/2.1.8' })).read())" "$1" > "$2" 2>$tmp_dir/stderr - rc=$? - # check for 404 - grep "HTTP Error 404" $tmp_dir/stderr 2>&1 >/dev/null - if test $? -eq 0; then - echo "ERROR 404" - http_404_error - fi - - # check for bad return status or empty output - if test $rc -ne 0 || test ! -s "$2"; then - capture_tmp_stderr "python" - return 1 - fi - return 0 -} - -# returns 0 if checksums match -do_checksum() { - if exists sha256sum; then - echo "Comparing checksum with sha256sum..." - checksum=`sha256sum $1 | awk '{ print $1 }'` - return `test "x$checksum" = "x$2"` - elif exists shasum; then - echo "Comparing checksum with shasum..." - checksum=`shasum -a 256 $1 | awk '{ print $1 }'` - return `test "x$checksum" = "x$2"` - else - echo "WARNING: could not find a valid checksum program, pre-install shasum or sha256sum in your O/S image to get valdation..." - return 0 - fi -} - -# do_download URL FILENAME -do_download() { - echo "downloading $1" - echo " to file $2" - - url=`echo $1` - if test "x$platform" = "xsolaris2"; then - if test "x$platform_version" = "x5.9" -o "x$platform_version" = "x5.10"; then - # solaris 9 lacks openssl, solaris 10 lacks recent enough credentials - your base O/S is completely insecure, please upgrade - url=`echo $url | sed -e 's/https/http/'` - fi - fi - - # we try all of these until we get success. - # perl, in particular may be present but LWP::Simple may not be installed - - if exists wget; then - do_wget $url $2 && return 0 - fi - - if exists curl; then - do_curl $url $2 && return 0 - fi - - if exists fetch; then - do_fetch $url $2 && return 0 - fi - - if exists perl; then - do_perl $url $2 && return 0 - fi - - if exists python; then - do_python $url $2 && return 0 - fi - - unable_to_retrieve_package -} - -# install_file TYPE FILENAME -# TYPE is "rpm", "deb", "solaris", "sh", etc. -install_file() { - echo "Installing $project $version" - case "$1" in - "rpm") - if test "x$platform" = "xnexus" || test "x$platform" = "xios_xr"; then - echo "installing with yum..." - yum install -yv "$2" - else - echo "installing with rpm..." - rpm -Uvh --oldpackage --replacepkgs "$2" - fi - ;; - "deb") - echo "installing with dpkg..." - dpkg -i "$2" - ;; - "bff") - echo "installing with installp..." - installp -aXYgd "$2" all - ;; - "solaris") - echo "installing with pkgadd..." - echo "conflict=nocheck" > $tmp_dir/nocheck - echo "action=nocheck" >> $tmp_dir/nocheck - echo "mail=" >> $tmp_dir/nocheck - pkgrm -a $tmp_dir/nocheck -n $project >/dev/null 2>&1 || true - pkgadd -G -n -d "$2" -a $tmp_dir/nocheck $project - ;; - "pkg") - echo "installing with installer..." - cd / && /usr/sbin/installer -pkg "$2" -target / - ;; - "dmg") - echo "installing dmg file..." - hdiutil detach "/Volumes/chef_software" >/dev/null 2>&1 || true - hdiutil attach "$2" -mountpoint "/Volumes/chef_software" - cd / && /usr/sbin/installer -pkg `find "/Volumes/chef_software" -name \*.pkg` -target / - hdiutil detach "/Volumes/chef_software" - ;; - "sh" ) - echo "installing with sh..." - sh "$2" - ;; - "p5p" ) - echo "installing p5p package..." - pkg install -g "$2" $project - ;; - *) - echo "Unknown filetype: $1" - report_bug - exit 1 - ;; - esac - if test $? -ne 0; then - echo "Installation failed" - report_bug - exit 1 - fi -} - -if test "x$TMPDIR" = "x"; then - tmp="/tmp" -else - tmp=$TMPDIR -fi -# secure-ish temp dir creation without having mktemp available (DDoS-able but not expliotable) -tmp_dir="$tmp/install.sh.$$" -(umask 077 && mkdir $tmp_dir) || exit 1 - -############ -# end of helpers.sh -############ - - -# script_cli_parameters.sh -############ -# This section reads the CLI parameters for the install script and translates -# them to the local parameters to be used later by the script. -# -# Outputs: -# $version: Requested version to be installed. -# $channel: Channel to install the product from -# $project: Project to be installed -# $cmdline_filename: Name of the package downloaded on local disk. -# $cmdline_dl_dir: Name of the directory downloaded package will be saved to on local disk. -############ - -# Defaults -channel="stable" -project="chef" - -while getopts pnv:c:f:P:d: opt -do - case "$opt" in - - v) version="$OPTARG";; - c) channel="$OPTARG";; - p) channel="current";; # compat for prerelease option - n) channel="current";; # compat for nightlies option - f) cmdline_filename="$OPTARG";; - P) project="$OPTARG";; - d) cmdline_dl_dir="$OPTARG";; - \?) # unknown flag - echo >&2 \ - "usage: $0 [-P project] [-c release_channel] [-v version] [-f filename | -d download_dir]" - exit 1;; - esac -done - -shift `expr $OPTIND - 1` - - -# platform_detection.sh -############ -# This section makes platform detection compatible with omnitruck on the system -# it runs. -# -# Outputs: -# $platform: Name of the platform. -# $platform_version: Version of the platform. -# $machine: System's architecture. -############ - -# -# Platform and Platform Version detection -# -# NOTE: This should now match ohai platform and platform_version matching. -# do not invented new platform and platform_version schemas, just make this behave -# like what ohai returns as platform and platform_version for the server. -# -# ALSO NOTE: Do not mangle platform or platform_version here. It is less error -# prone and more future-proof to do that in the server, and then all omnitruck clients -# will 'inherit' the changes (install.sh is not the only client of the omnitruck -# endpoint out there). -# - -machine=`uname -m` -os=`uname -s` - -if test -f "/etc/lsb-release" && grep -q DISTRIB_ID /etc/lsb-release && ! grep -q wrlinux /etc/lsb-release; then - platform=`grep DISTRIB_ID /etc/lsb-release | cut -d "=" -f 2 | tr '[A-Z]' '[a-z]'` - platform_version=`grep DISTRIB_RELEASE /etc/lsb-release | cut -d "=" -f 2` - - if test "$platform" = "\"cumulus linux\""; then - platform="cumulus_linux" - elif test "$platform" = "\"cumulus networks\""; then - platform="cumulus_networks" - fi - -elif test -f "/etc/debian_version"; then - platform="debian" - platform_version=`cat /etc/debian_version` -elif test -f "/etc/Eos-release"; then - # EOS may also contain /etc/redhat-release so this check must come first. - platform=arista_eos - platform_version=`awk '{print $4}' /etc/Eos-release` - machine="i386" -elif test -f "/etc/redhat-release"; then - platform=`sed 's/^\(.\+\) release.*/\1/' /etc/redhat-release | tr '[A-Z]' '[a-z]'` - platform_version=`sed 's/^.\+ release \([.0-9]\+\).*/\1/' /etc/redhat-release` - - # If /etc/redhat-release exists, we act like RHEL by default - if test "$platform" = "fedora"; then - # FIXME: stop remapping fedora to el - # FIXME: remove client side platform_version mangling and hard coded yolo - # Change platform version for use below. - platform_version="6.0" - fi - - if test "$platform" = "xenserver"; then - # Current XenServer 6.2 is based on CentOS 5, platform is not reset to "el" server should hanlde response - platform="xenserver" - else - # FIXME: use "redhat" - platform="el" - fi - -elif test -f "/etc/system-release"; then - platform=`sed 's/^\(.\+\) release.\+/\1/' /etc/system-release | tr '[A-Z]' '[a-z]'` - platform_version=`sed 's/^.\+ release \([.0-9]\+\).*/\1/' /etc/system-release | tr '[A-Z]' '[a-z]'` - # amazon is built off of fedora, so act like RHEL - if test "$platform" = "amazon linux ami"; then - # FIXME: remove client side platform_version mangling and hard coded yolo, and remapping to deprecated "el" - platform="el" - platform_version="6.0" - fi -# Apple OS X -elif test -f "/usr/bin/sw_vers"; then - platform="mac_os_x" - # Matching the tab-space with sed is error-prone - platform_version=`sw_vers | awk '/^ProductVersion:/ { print $2 }' | cut -d. -f1,2` - - # x86_64 Apple hardware often runs 32-bit kernels (see OHAI-63) - x86_64=`sysctl -n hw.optional.x86_64` - if test $x86_64 -eq 1; then - machine="x86_64" - fi -elif test -f "/etc/release"; then - machine=`/usr/bin/uname -p` - if grep -q SmartOS /etc/release; then - platform="smartos" - platform_version=`grep ^Image /etc/product | awk '{ print $3 }'` - else - platform="solaris2" - platform_version=`/usr/bin/uname -r` - fi -elif test -f "/etc/SuSE-release"; then - if grep -q 'Enterprise' /etc/SuSE-release; - then - platform="sles" - platform_version=`awk '/^VERSION/ {V = $3}; /^PATCHLEVEL/ {P = $3}; END {print V "." P}' /etc/SuSE-release` - else - platform="suse" - platform_version=`awk '/^VERSION =/ { print $3 }' /etc/SuSE-release` - fi -elif test "x$os" = "xFreeBSD"; then - platform="freebsd" - platform_version=`uname -r | sed 's/-.*//'` -elif test "x$os" = "xAIX"; then - platform="aix" - platform_version="`uname -v`.`uname -r`" - machine="powerpc" -elif test -f "/etc/os-release"; then - . /etc/os-release - if test "x$CISCO_RELEASE_INFO" != "x"; then - . $CISCO_RELEASE_INFO - fi - - platform=$ID - platform_version=$VERSION -fi - -if test "x$platform" = "x"; then - echo "Unable to determine platform version!" - report_bug - exit 1 -fi - -# -# NOTE: platform manging in the install.sh is DEPRECATED -# -# - install.sh should be true to ohai and should not remap -# platform or platform versions. -# -# - remapping platform and mangling platform version numbers is -# now the complete responsibility of the server-side endpoints -# - -major_version=`echo $platform_version | cut -d. -f1` -case $platform in - # FIXME: should remove this case statement completely - "el") - # FIXME: "el" is deprecated, should use "redhat" - platform_version=$major_version - ;; - "debian") - if test "x$major_version" = "x5"; then - # This is here for potential back-compat. - # We do not have 5 in versions we publish for anymore but we - # might have it for earlier versions. - platform_version="6" - else - platform_version=$major_version - fi - ;; - "freebsd") - platform_version=$major_version - ;; - "sles") - platform_version=$major_version - ;; - "suse") - platform_version=$major_version - ;; -esac - -# normalize the architecture we detected -case $machine in - "x86_64"|"amd64"|"x64") - machine="x86_64" - ;; - "i386"|"i86pc"|"x86"|"i686") - machine="i386" - ;; - "sparc"|"sun4u"|"sun4v") - machine="sparc" - ;; -esac - -if test "x$platform_version" = "x"; then - echo "Unable to determine platform version!" - report_bug - exit 1 -fi - -if test "x$platform" = "xsolaris2"; then - # hack up the path on Solaris to find wget, pkgadd - PATH=/usr/sfw/bin:/usr/sbin:$PATH - export PATH -fi - -echo "$platform $platform_version $machine" - -############ -# end of platform_detection.sh -############ - - -# fetch_metadata.sh -############ -# This section calls omnitruck to get the information about the build to be -# installed. -# -# Inputs: -# $channel: -# $project: -# $version: -# $platform: -# $platform_version: -# $machine: -# $tmp_dir: -# -# Outputs: -# $download_url: -# $sha256: -############ - -echo "Getting information for $project $channel $version for $platform..." - -metadata_filename="$tmp_dir/metadata.txt" -metadata_url="https://omnitruck-direct.chef.io/$channel/$project/metadata?v=$version&p=$platform&pv=$platform_version&m=$machine" - -do_download "$metadata_url" "$metadata_filename" - -cat "$metadata_filename" - -echo "" -# check that all the mandatory fields in the downloaded metadata are there -if grep '^url' $metadata_filename > /dev/null && grep '^sha256' $metadata_filename > /dev/null; then - echo "downloaded metadata file looks valid..." -else - echo "downloaded metadata file is corrupted or an uncaught error was encountered in downloading the file..." - # this generally means one of the download methods downloaded a 404 or something like that and then reported a successful exit code, - # and this should be fixed in the function that was doing the download. - report_bug - exit 1 -fi - -download_url=`awk '$1 == "url" { print $2 }' "$metadata_filename"` -sha256=`awk '$1 == "sha256" { print $2 }' "$metadata_filename"` - -############ -# end of fetch_metadata.sh -############ - - -# fetch_package.sh -############ -# This section fetchs a package from $download_url and verifies its metadata. -# -# Inputs: -# $download_url: -# $tmp_dir: -# Optional Inputs: -# $cmdline_filename: Name of the package downloaded on local disk. -# $cmdline_dl_dir: Name of the directory downloaded package will be saved to on local disk. -# -# Outputs: -# $download_filename: Name of the downloaded file on local disk. -# $filetype: Type of the file downloaded. -############ - -filename=`echo $download_url | sed -e 's/^.*\///'` -filetype=`echo $filename | sed -e 's/^.*\.//'` - -# use either $tmp_dir, the provided directory (-d) or the provided filename (-f) -if test "x$cmdline_filename" != "x"; then - download_filename="$cmdline_filename" -elif test "x$cmdline_dl_dir" != "x"; then - download_filename="$cmdline_dl_dir/$filename" -else - download_filename="$tmp_dir/$filename" -fi - -# ensure the parent directory where to download the installer always exists -download_dir=`dirname $download_filename` -(umask 077 && mkdir -p $download_dir) || exit 1 - -# check if we have that file locally available and if so verify the checksum -cached_file_available="false" -if test -f $download_filename; then - echo "$download_filename already exists, verifiying checksum..." - if do_checksum "$download_filename" "$sha256"; then - echo "checksum compare succeeded, using existing file!" - cached_file_available="true" - else - echo "checksum mismatch, downloading latest version of the file" - fi -fi - -# download if no local version of the file available -if test "x$cached_file_available" != "xtrue"; then - do_download "$download_url" "$download_filename" - do_checksum "$download_filename" "$sha256" || checksum_mismatch -fi - -############ -# end of fetch_package.sh -############ - - -# install_package.sh -############ -# Installs a package and removed the temp directory. -# -# Inputs: -# $download_filename: Name of the file to be installed. -# $filetype: Type of the file to be installed. -# $version: The version requested. Used only for warning user if not set. -############ - -if test "x$version" = "x"; then - echo - echo "WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING" - echo - echo "You are installing an omnibus package without a version pin. If you are installing" - echo "on production servers via an automated process this is DANGEROUS and you will" - echo "be upgraded without warning on new releases, even to new major releases." - echo "Letting the version float is only appropriate in desktop, test, development or" - echo "CI/CD environments." - echo - echo "WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING" - echo -fi - -install_file $filetype "$download_filename" - -if test "x$tmp_dir" != "x"; then - rm -r "$tmp_dir" -fi - -############ -# end of install_package.sh -############ |