diff options
author | Ben David, Elad (eb7504) <elad.ben.david@intl.att.com> | 2019-11-03 16:19:16 +0200 |
---|---|---|
committer | Ben David, Elad (eb7504) <eb7504@intl.att.com> | 2019-11-03 16:20:50 +0200 |
commit | ee64a64fb0705422c18608304e63a505d10d8ba1 (patch) | |
tree | 35ba3084b83dbdd8a616e30707e12e1baf98abdc | |
parent | 781c7486078cbc6d9f8d7c9763c3d7592e8b089b (diff) |
Handle onboard ALTER tables to support upgrade
Change-Id: I6c96aecccf00a3b02bf07cf172ff752b69d3cc94
Issue-ID: SDC-2640
Signed-off-by: Ben David, Elad (eb7504) <eb7504@intl.att.com>
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | openecomp-be/dist/sdc-onboard-backend-docker/pom.xml | 221 | ||||
-rw-r--r-- | openecomp-be/dist/sdc-onboard-db-init-docker/artifacts/Dockerfile | 2 | ||||
-rw-r--r-- | openecomp-be/dist/sdc-onboard-db-init-docker/pom.xml | 15 | ||||
-rw-r--r-- | openecomp-be/tools/install/database/alter_tables.cql | 1 | ||||
-rw-r--r-- | openecomp-be/tools/install/database/init_schemas.cql | 4 |
6 files changed, 130 insertions, 117 deletions
diff --git a/.gitignore b/.gitignore index 1775301fb5..51d111f2c9 100644 --- a/.gitignore +++ b/.gitignore @@ -271,4 +271,6 @@ asdctool/test-output/* asdctool/report_delete_1538046694389.json asdctool/report_test_1538046722484.json -/ajcore*.txt
\ No newline at end of file +/ajcore*.txt +**/.factorypath + diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/pom.xml b/openecomp-be/dist/sdc-onboard-backend-docker/pom.xml index e3f5801266..924f8e2f47 100644 --- a/openecomp-be/dist/sdc-onboard-backend-docker/pom.xml +++ b/openecomp-be/dist/sdc-onboard-backend-docker/pom.xml @@ -18,7 +18,12 @@ <properties> <docker.image.name>sdc-onboard-backend</docker.image.name> + <docker.registry>nexus3.onap.org:10001</docker.registry> + <docker.password>docker</docker.password> + <docker.username>docker</docker.username> + <docker.namespace>onap</docker.namespace> </properties> + <build> <plugins> <plugin> @@ -51,115 +56,117 @@ <plugin> <artifactId>maven-resources-plugin</artifactId> <version>3.0.2</version> - <executions> - <execution> - <id>copy-resources-war</id> - <phase>verify</phase> - <goals> - <goal>copy-resources</goal> - </goals> - <configuration> - <outputDirectory>${project.basedir}/artifacts</outputDirectory> - <resources> - <resource> - <directory> - ${project.parent.basedir}/../../openecomp-be/tools/swagger-ui/target/api-docs - </directory> - <includes> - <include>api-docs.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> - <resource> - <directory> - ${project.parent.basedir}/../../openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-worker/src/main/resources - </directory> - <includes> - <include>onboarding_configuration.yaml</include> - </includes> - </resource> - <resource> - <directory> - ${project.parent.basedir}/../../catalog-be/src/main/resources/config - </directory> - <includes> - <include>logback.xml</include> - </includes> - </resource> - </resources> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>io.fabric8</groupId> - <artifactId>docker-maven-plugin</artifactId> + <executions> + <execution> + <id>copy-resources-war</id> + <phase>verify</phase> + <goals> + <goal>copy-resources</goal> + </goals> <configuration> - <apiVersion>1.23</apiVersion> - <registry>nexus3.onap.org:10001</registry> - <authConfig> - <pull> - <username>docker</username> - <password>docker</password> - </pull> - </authConfig> - <images> + <outputDirectory>${project.basedir}/artifacts</outputDirectory> + <resources> + <resource> + <directory> + ${project.parent.basedir}/../../openecomp-be/tools/swagger-ui/target/api-docs + </directory> + <includes> + <include>api-docs.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> + <resource> + <directory> + ${project.parent.basedir}/../../openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-worker/src/main/resources + </directory> + <includes> + <include>onboarding_configuration.yaml</include> + </includes> + </resource> + <resource> + <directory> + ${project.parent.basedir}/../../catalog-be/src/main/resources/config + </directory> + <includes> + <include>logback.xml</include> + </includes> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>io.fabric8</groupId> + <artifactId>docker-maven-plugin</artifactId> + <configuration> + <apiVersion>1.23</apiVersion> + <registry>${docker.registry}</registry> + <authConfig> + <pull> + <username>${docker.username}</username> + <password>${docker.password}</password> + </pull> + </authConfig> + <images> - <!-- Build backend image --> - <image> - <name>onap/${docker.image.name}</name> - <alias>${docker.image.name}</alias> - <build> - <cleanup>try</cleanup> - <dockerFileDir>${project.basedir}/artifacts</dockerFileDir> - <tags> - <tag>${docker.tag}</tag> - <tag>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest</tag> - </tags> - </build> - </image> - </images> + <!-- Build backend image --> + <image> + <name>${docker.namespace}/${docker.image.name}</name> + <alias>${docker.image.name}</alias> + <build> + <cleanup>try</cleanup> + <dockerFileDir>${project.basedir}/artifacts</dockerFileDir> + <tags> + <tag>${docker.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>${docker.namespace}/${docker.image.name}</image> </configuration> - <executions> - <execution> - <id>clean-images</id> - <phase>pre-clean</phase> - <goals> - <goal>remove</goal> - </goals> - <configuration> - <removeAll>true</removeAll> - <image>onap/${docker.image.name}</image> - </configuration> - </execution> + </execution> + + <execution> + <id>generate-images</id> + <phase>install</phase> + <goals> + <goal>build</goal> + </goals> + </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>${docker.namespace}/${docker.image.name}</image> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> - <execution> - <id>push-images</id> - <phase>deploy</phase> - <goals> - <goal>push</goal> - </goals> - <configuration> - <image>onap/${docker.image.name}</image> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> -</project>
\ No newline at end of file diff --git a/openecomp-be/dist/sdc-onboard-db-init-docker/artifacts/Dockerfile b/openecomp-be/dist/sdc-onboard-db-init-docker/artifacts/Dockerfile index 526ab95024..76e1d2b154 100644 --- a/openecomp-be/dist/sdc-onboard-db-init-docker/artifacts/Dockerfile +++ b/openecomp-be/dist/sdc-onboard-db-init-docker/artifacts/Dockerfile @@ -4,6 +4,8 @@ COPY init_keyspaces.cql /root/ COPY init_schemas.cql /root/ +COPY alter_tables.cql /root/ + COPY startup.sh /root/ RUN chmod 770 /root/startup.sh diff --git a/openecomp-be/dist/sdc-onboard-db-init-docker/pom.xml b/openecomp-be/dist/sdc-onboard-db-init-docker/pom.xml index 05d83776dc..c2cafd71d8 100644 --- a/openecomp-be/dist/sdc-onboard-db-init-docker/pom.xml +++ b/openecomp-be/dist/sdc-onboard-db-init-docker/pom.xml @@ -18,7 +18,12 @@ <properties> <docker.image.name>sdc-onboard-cassandra-init</docker.image.name> + <docker.namespace>onap</docker.namespace> + <docker.password>docker</docker.password> + <docker.username>docker</docker.username> + <docker.registry>nexus3.onap.org:10001</docker.registry> </properties> + <build> <plugins> <plugin> @@ -57,15 +62,15 @@ <registry>nexus3.onap.org:10001</registry> <authConfig> <pull> - <username>docker</username> - <password>docker</password> + <username>${docker.username}</username> + <password>${docker.password}</password> </pull> </authConfig> <images> <!-- Build backend image --> <image> - <name>onap/${docker.image.name}</name> + <name>${docker.namespace}/${docker.image.name}</name> <alias>${docker.image.name}</alias> <build> <cleanup>try</cleanup> @@ -87,7 +92,7 @@ </goals> <configuration> <removeAll>true</removeAll> - <image>onap/${docker.image.name}</image> + <image>${docker.namespace}/${docker.image.name}</image> </configuration> </execution> @@ -106,7 +111,7 @@ <goal>push</goal> </goals> <configuration> - <image>onap/${docker.image.name}</image> + <image>${docker.namespace}/${docker.image.name}</image> </configuration> </execution> </executions> diff --git a/openecomp-be/tools/install/database/alter_tables.cql b/openecomp-be/tools/install/database/alter_tables.cql new file mode 100644 index 0000000000..9363a036f9 --- /dev/null +++ b/openecomp-be/tools/install/database/alter_tables.cql @@ -0,0 +1 @@ +ALTER TABLE dox.package_details ADD RESOURCE_TYPE text; diff --git a/openecomp-be/tools/install/database/init_schemas.cql b/openecomp-be/tools/install/database/init_schemas.cql index 8458c6fa1e..0569a12f65 100644 --- a/openecomp-be/tools/install/database/init_schemas.cql +++ b/openecomp-be/tools/install/database/init_schemas.cql @@ -39,10 +39,6 @@ INSERT INTO application_config (namespace,key,value) VALUES ('vsp.schemaTemplate INSERT INTO application_config (namespace,key,value) VALUES ('vsp.schemaTemplates', 'questionnaire.vsp', '{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "general": { "type": "object", "properties": { "affinityData": { "type": "string", "enum": [ "", "Affinity", "Anti Affinity", "None" ], "default": "" }, "availability": { "type": "object", "properties": { "useAvailabilityZonesForHighAvailability": { "type": "boolean", "default": false } }, "additionalProperties": false }, "regionsData": { "type": "object", "properties": { "multiRegion": { "type": "boolean", "default": false }, "regions": { "type": "array", "items": { "type": "string", "enum": [ "", "Alphareta", "Birmingham", "Dallas", "Fairfield CA", "Hayward CA", "Lisle", "Mission", "San Diego", "Secaucus" ], "default": "" } } }, "additionalProperties": false }, "storageDataReplication": { "type": "object", "properties": { "storageReplicationAcrossRegion": { "type": "boolean", "default": false }, "storageReplicationSize": { "type": "number", "minimum": 0, "maximum": 100, "exclusiveMaximum": true }, "storageReplicationFrequency": { "type": "number", "minimum": 5 }, "storageReplicationSource": { "type": "string", "maxLength": 300 }, "storageReplicationDestination": { "type": "string", "maxLength": 300 } }, "additionalProperties": false } }, "additionalProperties": false } }, "additionalProperties": false }'); INSERT INTO application_config (namespace,key,value) VALUES ('vsp.monitoring', 'compute.ceilometer', '{ "ceilometerMetricList": [ { "name": "instance", "type": "Gauge", "unit": "instance", "category": "compute", "description": "Existence of instance" }, { "name": "memory", "type": "Gauge", "unit": "MB", "category": "compute", "description": "Volume of RAM allocated to the instance" }, { "name": "memory.usage", "type": "Gauge", "unit": "MB", "category": "compute", "description": "Volume of RAM used by the instance from the amount of its allocated memory" }, { "name": "memory.resident", "type": "Gauge", "unit": "MB", "category": "compute", "description": "Volume of RAM used by the instance on the physical machine" }, { "name": "cpu", "type": "Cumulative", "unit": "ns", "category": "compute", "description": "CPU time used" }, { "name": "cpu_util", "type": "Gauge", "unit": "%", "category": "compute", "description": "Average CPU utilization" }, { "name": "cpu.delta", "type": "Delta", "unit": "ns", "category": "compute", "description": "CPU time used since previous datapoint" }, { "name": "vcpus", "type": "Gauge", "unit": "vcpu", "category": "compute", "description": "Number of virtual CPUs allocated to the instance" }, { "name": "disk.latency", "type": "Gauge", "unit": "ms", "category": "disk", "description": "Average disk latency" }, { "name": "disk.iops", "type": "Gauge", "unit": "count/s", "category": "disk", "description": "Average disk iops" }, { "name": "disk.device.latency", "type": "Gauge", "unit": "ms", "category": "disk", "description": "Average disk latency per device" }, { "name": "disk.device.iops", "type": "Gauge", "unit": "count/s", "category": "disk", "description": "Average disk iops per device" }, { "name": "disk.capacity", "type": "Gauge", "unit": "B", "category": "disk", "description": "The amount of disk that the instance can see" }, { "name": "disk.allocation", "type": "Gauge", "unit": "B", "category": "disk", "description": "The amount of disk occupied by the instance on the host machine" }, { "name": "disk.usage", "type": "Gauge", "unit": "B", "category": "disk", "description": "The physical size in bytes of the image container on the host" }, { "name": "disk.device.capacity", "type": "Gauge", "unit": "B", "category": "disk", "description": "The amount of disk per device that the instance can see" }, { "name": "disk.device.allocation", "type": "Gauge", "unit": "B", "category": "disk", "description": "The amount of disk per device occupied by the instance on the host machine" }, { "name": "disk.device.usage", "type": "Gauge", "unit": "B", "category": "disk", "description": "The physical size in bytes of the image container on the host per device" }, { "name": "disk.device.read.requests", "type": "Cumulative", "unit": "request", "category": "disk", "description": "Number of read requests" }, { "name": "disk.device.read.requests.rate", "type": "Gauge", "unit": "request/s", "category": "disk", "description": "Average rate of read requests" }, { "name": "disk.device.write.requests", "type": "Cumulative", "unit": "request", "category": "disk", "description": "Number of write requests" }, { "name": "disk.device.write.requests.rate", "type": "Gauge", "unit": "request/s", "category": "disk", "description": "Average rate of write requests" }, { "name": "disk.device.read.bytes", "type": "Cumulative", "unit": "B", "category": "disk", "description": "Volume of reads" }, { "name": "disk.device.read.bytes.rate", "type": "Gauge", "unit": "B/s", "category": "disk", "description": "Average rate of reads" }, { "name": "disk.device.write.bytes", "type": "Cumulative", "unit": "B", "category": "disk", "description": "Volume of writes" }, { "name": "disk.device.write.bytes.rate", "type": "Gauge", "unit": "B/s", "category": "disk", "description": "Average rate of writes" }, { "name": "disk.write.requests", "type": "Cumulative", "unit": "request", "category": "compute", "description": "Number of write requests" }, { "name": "disk.write.requests.rate", "type": "Gauge", "unit": "request/s", "category": "compute", "description": "Average rate of write requests" }, { "name": "disk.read.bytes", "type": "Cumulative", "unit": "B", "category": "compute", "description": "Volume of reads" }, { "name": "disk.read.bytes.rate", "type": "Gauge", "unit": "B/s", "category": "compute", "description": "Average rate of reads" }, { "name": "disk.write.bytes", "type": "Cumulative", "unit": "B", "category": "compute", "description": "Volume of writes" }, { "name": "disk.write.bytes.rate", "type": "Gauge", "unit": "B/s", "category": "compute", "description": "Average rate of writes" }, { "name": "disk.read.requests", "type": "Cumulative", "unit": "request", "category": "compute", "description": "Number of read requests" }, { "name": "disk.root.size", "type": "Gauge", "unit": "GB", "category": "compute", "description": "Size of root disk" }, { "name": "disk.ephemeral.size", "type": "Gauge", "unit": "GB", "category": "compute", "description": "Size of ephemeral disk" } ] }'); INSERT INTO application_config (namespace,key,value) VALUES ('vsp.monitoring', 'port.ceilometer', '{ "ceilometerMetricList": [ { "name": "network.incoming.bytes", "type": "Cumulative", "unit": "B", "category": "network", "description": "Number of incoming bytes" }, { "name": "network.incoming.bytes.rate", "type": "Gauge", "unit": "B/s", "category": "network", "description": "Average rate of incoming bytes" }, { "name": "network.outgoing.bytes", "type": "Cumulative", "unit": "B", "category": "network", "description": "Number of outgoing bytes" }, { "name": "network.outgoing.bytes.rate", "type": "Gauge", "unit": "B/s", "category": "network", "description": "Average rate of outgoing bytes" }, { "name": "network.incoming.packets", "type": "Cumulative", "unit": "packet", "category": "network", "description": "Number of incoming packets" }, { "name": "network.incoming.packets.rate", "type": "Gauge", "unit": "packet/s", "category": "network", "description": "Average rate of incoming packets" }, { "name": "network.outpoing.packets", "type": "Cumulative", "unit": "packet", "category": "network", "description": "Number of outgoing packets" }, { "name": "network.outgoing.packets.rate", "type": "Gauge", "unit": "packet/s", "category": "network", "description": "Average rate of outgoing packets" } ] }'); ---temporary solution for schema update as cassandra doesn't support ALTER IF NOT EXISTS(CASSANDRA-14706), --- should be updated when ticket implemented --- or removed when not required, e.g. schema update strategy changed -ALTER TABLE package_details ADD RESOURCE_TYPE text; USE zusammen_dox; CREATE TABLE IF NOT EXISTS item (item_id text primary key, item_info text, creation_time timestamp, modification_time timestamp); CREATE TABLE IF NOT EXISTS version (space text, item_id text, version_id text,base_version_id text,info text,relations text,creation_time timestamp,modification_time timestamp ,PRIMARY KEY (( space, item_id ), version_id)); |