From ee64a64fb0705422c18608304e63a505d10d8ba1 Mon Sep 17 00:00:00 2001 From: "Ben David, Elad (eb7504)" Date: Sun, 3 Nov 2019 16:19:16 +0200 Subject: Handle onboard ALTER tables to support upgrade Change-Id: I6c96aecccf00a3b02bf07cf172ff752b69d3cc94 Issue-ID: SDC-2640 Signed-off-by: Ben David, Elad (eb7504) --- .../dist/sdc-onboard-backend-docker/pom.xml | 221 +++++++++++---------- .../artifacts/Dockerfile | 2 + .../dist/sdc-onboard-db-init-docker/pom.xml | 15 +- .../tools/install/database/alter_tables.cql | 1 + .../tools/install/database/init_schemas.cql | 4 - 5 files changed, 127 insertions(+), 116 deletions(-) create mode 100644 openecomp-be/tools/install/database/alter_tables.cql (limited to 'openecomp-be') 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 @@ sdc-onboard-backend + nexus3.onap.org:10001 + docker + docker + onap + @@ -51,115 +56,117 @@ maven-resources-plugin 3.0.2 - - - copy-resources-war - verify - - copy-resources - - - ${project.basedir}/artifacts - - - - ${project.parent.basedir}/../../openecomp-be/tools/swagger-ui/target/api-docs - - - api-docs.war - - - - - ${project.parent.basedir}/../../openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/target - - - onboarding-be-${project.version}.war - - - - - ${project.parent.basedir}/../../openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-worker/src/main/resources - - - onboarding_configuration.yaml - - - - - ${project.parent.basedir}/../../catalog-be/src/main/resources/config - - - logback.xml - - - - - - - - - io.fabric8 - docker-maven-plugin + + + copy-resources-war + verify + + copy-resources + - 1.23 - nexus3.onap.org:10001 - - - docker - docker - - - + ${project.basedir}/artifacts + + + + ${project.parent.basedir}/../../openecomp-be/tools/swagger-ui/target/api-docs + + + api-docs.war + + + + + ${project.parent.basedir}/../../openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/target + + + onboarding-be-${project.version}.war + + + + + ${project.parent.basedir}/../../openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-worker/src/main/resources + + + onboarding_configuration.yaml + + + + + ${project.parent.basedir}/../../catalog-be/src/main/resources/config + + + logback.xml + + + + + + + + + + io.fabric8 + docker-maven-plugin + + 1.23 + ${docker.registry} + + + ${docker.username} + ${docker.password} + + + - - - onap/${docker.image.name} - ${docker.image.name} - - try - ${project.basedir}/artifacts - - ${docker.tag} - ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest - - - - + + + ${docker.namespace}/${docker.image.name} + ${docker.image.name} + + try + ${project.basedir}/artifacts + + ${docker.tag} + ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest + + + + + + + + clean-images + pre-clean + + remove + + + true + ${docker.namespace}/${docker.image.name} - - - clean-images - pre-clean - - remove - - - true - onap/${docker.image.name} - - + + + + generate-images + install + + build + + - - generate-images - install - - build - - + + push-images + deploy + + push + + + ${docker.namespace}/${docker.image.name} + + + + + + + - - push-images - deploy - - push - - - onap/${docker.image.name} - - - - - - - \ 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 @@ sdc-onboard-cassandra-init + onap + docker + docker + nexus3.onap.org:10001 + @@ -57,15 +62,15 @@ nexus3.onap.org:10001 - docker - docker + ${docker.username} + ${docker.password} - onap/${docker.image.name} + ${docker.namespace}/${docker.image.name} ${docker.image.name} try @@ -87,7 +92,7 @@ true - onap/${docker.image.name} + ${docker.namespace}/${docker.image.name} @@ -106,7 +111,7 @@ push - onap/${docker.image.name} + ${docker.namespace}/${docker.image.name} 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)); -- cgit 1.2.3-korg