summaryrefslogtreecommitdiffstats
path: root/standalone/src/main/assembly
diff options
context:
space:
mode:
authorKeguang He <hekeguang@chinamobile.com>2022-08-16 02:56:06 +0000
committerGerrit Code Review <gerrit@onap.org>2022-08-16 02:56:06 +0000
commit2e204b53fe1b47503fcc336cf19c6a74437d9c06 (patch)
tree4421e7f544eb7ca5b774a956894525a2f008cb80 /standalone/src/main/assembly
parent96fad0c1841ab4eac0865bdb556e6e5b272dd2f7 (diff)
parent70dc46866c2b854b1daef3cd4a684265bde4af45 (diff)
Merge "change application.properties $ standalone for separate postgres"
Diffstat (limited to 'standalone/src/main/assembly')
-rw-r--r--standalone/src/main/assembly/Dockerfile44
-rw-r--r--standalone/src/main/assembly/bin/docker-env-config.sh39
-rw-r--r--standalone/src/main/assembly/bin/run.sh11
-rw-r--r--standalone/src/main/assembly/resources/bin/initDB.sh59
-rw-r--r--standalone/src/main/assembly/resources/dbscripts/postgres/uui_create_db.sql26
-rw-r--r--standalone/src/main/assembly/resources/dbscripts/postgres/uui_create_table.sql224
-rw-r--r--standalone/src/main/assembly/resources/dbscripts/postgres/uui_init_data.sql35
7 files changed, 5 insertions, 433 deletions
diff --git a/standalone/src/main/assembly/Dockerfile b/standalone/src/main/assembly/Dockerfile
index 06c035c0..5524911f 100644
--- a/standalone/src/main/assembly/Dockerfile
+++ b/standalone/src/main/assembly/Dockerfile
@@ -1,45 +1,9 @@
FROM nexus3.onap.org:10001/onap/integration-java11:9.0.0
MAINTAINER "Lu Ji" <lu.ji3@zte.com.cn>
-# Expose the Usecase-UI backend port and postgreSQL port
+# Expose the Usecase-UI backend port
EXPOSE 8082
-# set env parameters
-ENV PG_HOME=/usr/share/postgresql \
- PG_VERSION=13.4 \
- PG_VAR_LIB=/var/lib/postgresql \
- PG_USR_LIB=/usr/lib/postgresql \
- PG_LOGDIR=/var/log/postgresql
-
-#Install PostgreSQL as user root, Common users do not have permission to perform the installation
-USER root
-RUN apk update && apk add postgresql && apk add bash
-
-# Adjust PostgreSQL configuration
-RUN cp ${PG_HOME}/pg_hba.conf.sample ${PG_HOME}/pg_hba.conf && \
- echo "host all all 0.0.0.0/0 md5" >> ${PG_HOME}/pg_hba.conf && \
- cp ${PG_HOME}/postgresql.conf.sample ${PG_HOME}/postgresql.conf && \
- cp ${PG_HOME}/pg_ident.conf.sample ${PG_HOME}/pg_ident.conf && \
- echo "listen_addresses='*'" >> ${PG_HOME}/postgresql.conf && \
- echo "data_directory = '/usr/share/postgresql/data'" >> ${PG_HOME}/postgresql.conf && \
- echo "hba_file = '/usr/share/postgresql/pg_hba.conf'" >> ${PG_HOME}/postgresql.conf && \
- echo "ident_file = '/usr/share/postgresql/pg_ident.conf'" >> ${PG_HOME}/postgresql.conf && \
- mkdir ${PG_HOME}/data && \
- mkdir /run/postgresql && \
- chown -R postgres:postgres ${PG_HOME} && \
- chown -R postgres:postgres /run/postgresql
-
-#init databases,Use the non-root user
-USER postgres
-RUN initdb -D /usr/share/postgresql/data
-
-USER root
-# Add VOLUMEs to allow backup of config, logs and databases
-VOLUME ["${PG_HOME}", "${PG_VAR_LIB}", "${PG_LOGDIR}"]
-
-# Set the default command to run postgreSQL when starting the container
-# CMD ["${PG_USR_LIB}/${PG_VERSION}/bin/postgres", "-D", "${PG_VAR_LIB}/${PG_VERSION}/main", "-c", "config_file=${PG_HOME}/${PG_VERSION}/main/postgresql.conf"]
-
#Configure Java SDK
ENV CLASSPATH .:${JAVA_HOME}/lib:${JRE_HOME}/lib
@@ -47,8 +11,8 @@ ENV CLASSPATH .:${JAVA_HOME}/lib:${JRE_HOME}/lib
RUN mkdir /home/uui
WORKDIR /home/uui
ADD usecase-ui-server-*-linux64.tar.gz /home/uui/
+RUN addgroup -S uui && adduser -S uui -G uui && chown -R uui:uui /home/uui
-RUN source /home/uui/bin/docker-env-config.sh
-USER postgres
+USER uui
WORKDIR /home/uui
-ENTRYPOINT /home/uui/bin/run.sh
+ENTRYPOINT /home/uui/bin/run.sh \ No newline at end of file
diff --git a/standalone/src/main/assembly/bin/docker-env-config.sh b/standalone/src/main/assembly/bin/docker-env-config.sh
deleted file mode 100644
index 8e583b10..00000000
--- a/standalone/src/main/assembly/bin/docker-env-config.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-#
-# Copyright 2020 CMCC Corporation.
-#
-# 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.
-#
-
-main_path="/home/uui"
-
-add_user() {
- #useradd postgres
- echo "add_user postgres..."
- chown -R postgres:postgres $main_path
-}
-
-modify_owner() {
- dbScript="$main_path/resources/bin/initDB.sh"
- chmod 755 $dbScript
- chown -R postgres:postgres /var/run/postgresql
- chown -R postgres:postgres $PG_HOME
- chown -R postgres:postgres $PG_VAR_LIB
- chown -R postgres:postgres $PG_USR_LIB
- chown -R postgres:postgres $PG_LOGDIR
- chmod -R 0700 $PG_HOME
- echo "modify files owner..."
-}
-
-add_user
-modify_owner
diff --git a/standalone/src/main/assembly/bin/run.sh b/standalone/src/main/assembly/bin/run.sh
index 42249fa4..faa079ef 100644
--- a/standalone/src/main/assembly/bin/run.sh
+++ b/standalone/src/main/assembly/bin/run.sh
@@ -18,15 +18,6 @@
main_path="/home/uui"
echo @main_path@ $main_path
-echo "Starting postgreSQL..."
-#service postgresql start
-postmaster -D /usr/share/postgresql/data &
-sleep 10
-
-echo "usecase-ui database init script start..."
-dbScript="$main_path/resources/bin/initDB.sh"
-source $dbScript 127.0.0.1 5432 postgres uui
-echo "usecase-ui database init script finished normally..."
JAVA_PATH="$JAVA_HOME/bin/java"
JAVA_OPTS="-Xms50m -Xmx128m"
@@ -37,4 +28,4 @@ jar_path="$main_path/usecase-ui-server.jar"
echo @jar_path@ $jar_path
echo "Starting usecase-ui-server..."
-$JAVA_PATH $JAVA_OPTS -classpath $jar_path -jar $jar_path
+$JAVA_PATH $JAVA_OPTS -classpath $jar_path -jar $jar_path $SPRING_OPTS
diff --git a/standalone/src/main/assembly/resources/bin/initDB.sh b/standalone/src/main/assembly/resources/bin/initDB.sh
deleted file mode 100644
index ff5d4152..00000000
--- a/standalone/src/main/assembly/resources/bin/initDB.sh
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2019 CMCC, Inc. and others. All rights reserved.
-#
-# 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.
-#
-
-echo "setting database init parameters"
-main_path="/home/uui"
-host=$1
-port=$2
-user_pg=$3
-user_uui=$4
-
-echo "setting postgres database password"
-#su - $user_pg <<EOF
-psql --command "alter user $user_pg with password '$user_pg';"
-#EOF
-
-echo "start create usecase-ui database..."
-dbscripts_path="$main_path/resources/dbscripts/postgres"
-psql "host=$host port=$port user=$user_pg password=$user_pg dbname=$user_pg" -f $dbscripts_path/uui_create_db.sql
-sql_result=$?
-if [ $sql_result -ne 0 ]; then
- echo "failed to create usecase-ui database!"
- exit 1
-else
- echo "usecase-ui database created successfully!"
-fi
-
-echo "start create usecase-ui tables..."
-psql "host=$host port=$port user=$user_uui password=$user_uui dbname=$user_uui" -f $dbscripts_path/uui_create_table.sql
-sql_result=$?
-if [ $sql_result -ne 0 ]; then
- echo "failed to create usecase-ui table!"
- exit 1
-else
- echo "usecase-ui tables created successfully!"
-fi
-
-echo "start insert initial data into uui-server database..."
-psql "host=$host port=$port user=$user_uui password=$user_uui dbname=$user_uui" -f $dbscripts_path/uui_init_data.sql
-sql_result=$?
-if [ $sql_result -ne 0 ]; then
- echo "failed to insert initial data!"
- exit 1
-else
- echo "usecase-ui database initial data import succeed!"
-fi
diff --git a/standalone/src/main/assembly/resources/dbscripts/postgres/uui_create_db.sql b/standalone/src/main/assembly/resources/dbscripts/postgres/uui_create_db.sql
deleted file mode 100644
index 49e9e593..00000000
--- a/standalone/src/main/assembly/resources/dbscripts/postgres/uui_create_db.sql
+++ /dev/null
@@ -1,26 +0,0 @@
---
--- Copyright (C) 2019 CMCC, Inc. and others. All rights reserved.
---
--- 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.
---
-
--- create uui user
-create user "uui" with password 'uui' nocreatedb;
-
--- create uui database
-drop database if exists uui;
-create database uui with owner uui template template0 encoding 'UTF8';
-
--- grant uui create uui user
-grant all privileges on database uui to uui;
-grant all privileges on database uui to postgres;
diff --git a/standalone/src/main/assembly/resources/dbscripts/postgres/uui_create_table.sql b/standalone/src/main/assembly/resources/dbscripts/postgres/uui_create_table.sql
deleted file mode 100644
index 4e43e20d..00000000
--- a/standalone/src/main/assembly/resources/dbscripts/postgres/uui_create_table.sql
+++ /dev/null
@@ -1,224 +0,0 @@
---
--- Copyright (C) 2019 CMCC, Inc. and others. All rights reserved.
---
--- 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.
---
-
--- ----------------------------
--- Table structure for "alarms_additionalinformation"
--- ----------------------------
-DROP TABLE IF EXISTS alarms_additionalinformation;
-CREATE TABLE alarms_additionalinformation(
- id serial,
- "header_id" varchar(50) NOT NULL,
- "name" varchar(100) DEFAULT NULL,
- "value" varchar(100) DEFAULT NULL,
- "source_id" varchar(100) DEFAULT NULL,
- "start_epoch_microsec" varchar(100) DEFAULT NULL,
- "last_epoch_microsec" varchar(100) DEFAULT NULL,
- CONSTRAINT alarms_additionalinformation_pk PRIMARY KEY (id)
-) WITH ( OIDS = FALSE);
-
--- ----------------------------
--- Table structure for "alarms_commoneventheader"
--- ----------------------------
-DROP TABLE IF EXISTS alarms_commoneventheader;
-CREATE TABLE alarms_commoneventheader (
- "id" varchar(50) NOT NULL,
- "version" varchar(100) DEFAULT NULL,
- "event_name" varchar(100) DEFAULT NULL,
- "domain" varchar(100) DEFAULT NULL,
- "event_id" varchar(100) DEFAULT NULL,
- "event_type" varchar(100) DEFAULT NULL,
- "nfc_naming_code" varchar(100) DEFAULT NULL,
- "nf_naming_code" varchar(100) DEFAULT NULL,
- "source_id" varchar(100) DEFAULT NULL,
- "source_name" varchar(100) DEFAULT NULL,
- "reporting_entity_id" varchar(100) DEFAULT NULL,
- "reporting_entity_name" varchar(100) DEFAULT NULL,
- "priority" varchar(50) DEFAULT NULL,
- "start_epoch_microsec" varchar(100) DEFAULT NULL,
- "last_epoch_microsec" varchar(100) DEFAULT NULL,
- "start_epoch_microsec_cleared" varchar(100) DEFAULT NULL,
- "last_epoch_microsec_cleared" varchar(100) DEFAULT NULL,
- "sequence" varchar(100) DEFAULT NULL,
- "fault_fields_version" varchar(100) DEFAULT NULL,
- "event_servrity" varchar(100) DEFAULT NULL,
- "event_source_type" varchar(100) DEFAULT NULL,
- "event_category" varchar(100) DEFAULT NULL,
- "alarm_condition" varchar(100) DEFAULT NULL,
- "specific_problem" varchar(100) DEFAULT NULL,
- "vf_status" varchar(100) DEFAULT NULL,
- "alarm_interfacea" varchar(100) DEFAULT NULL,
- "status" varchar(50) DEFAULT NULL,
- CONSTRAINT alarms_commoneventheader_pk PRIMARY KEY (id)
-) WITH ( OIDS = FALSE );
-
--- ----------------------------
--- Table structure for "performance_additionalinformation"
--- ----------------------------
-DROP TABLE IF EXISTS performance_additionalinformation;
-CREATE TABLE performance_additionalinformation (
- id serial,
- "header_id" varchar(50) NOT NULL,
- "name" varchar(100) DEFAULT NULL,
- "value" varchar(100) DEFAULT NULL,
- "source_id" varchar(100) DEFAULT NULL,
- "start_epoch_microsec" varchar(100) DEFAULT NULL,
- "last_epoch_microsec" varchar(100) DEFAULT NULL,
- CONSTRAINT performance_additionalinformation_pk PRIMARY KEY (id)
-) WITH ( OIDS = FALSE );
-
--- ----------------------------
--- Table structure for "performance_commoneventheader"
--- ----------------------------
-DROP TABLE IF EXISTS performance_commoneventheader;
-CREATE TABLE performance_commoneventheader (
- "id" varchar(50) NOT NULL,
- "version" varchar(100) DEFAULT NULL,
- "event_name" varchar(100) DEFAULT NULL,
- "domain" varchar(100) DEFAULT NULL,
- "event_id" varchar(100) DEFAULT NULL,
- "event_type" varchar(100) DEFAULT NULL,
- "nfc_naming_code" varchar(100) DEFAULT NULL,
- "nf_namingcode" varchar(100) DEFAULT NULL,
- "source_id" varchar(100) DEFAULT NULL,
- "source_name" varchar(100) DEFAULT NULL,
- "reporting_entity_id" varchar(100) DEFAULT NULL,
- "reporting_entity_name" varchar(100) DEFAULT NULL,
- "priority" varchar(50) DEFAULT NULL,
- "start_epoch_microsec" varchar(100) DEFAULT NULL,
- "last_epoch_microsec" varchar(100) DEFAULT NULL,
- "sequence" varchar(100) DEFAULT NULL,
- "measurements_for_vf_scaling_version" varchar(100) DEFAULT NULL,
- "measurement_interval" varchar(100) DEFAULT NULL,
- CONSTRAINT performance_commoneventheader_pk PRIMARY KEY (id)
-) WITH (OIDS = FALSE);
-
--- ----------------------------
--- Table structure for service_instances
--- ----------------------------
-DROP TABLE IF EXISTS service_instances;
-CREATE TABLE service_instances (
- "id" varchar(50) NOT NULL,
- "service_instance_id" varchar(100) NOT NULL,
- "customer_id" varchar(50) NOT NULL,
- "service_type" varchar(50) NOT NULL,
- "usecase_type" varchar(50) NOT NULL,
- "uuid" varchar(100),
- "invariant_uuid" varchar(100),
- CONSTRAINT service_instances_pk PRIMARY KEY (service_instance_id)
-);
-
--- ----------------------------
--- Table structure for service_instance_operations
--- ----------------------------
-DROP TABLE IF EXISTS service_instance_operations;
-CREATE TABLE service_instance_operations (
- "service_instance_id" varchar(100) NOT NULL,
- "operation_id" varchar(100) NOT NULL,
- "operation_type" varchar(50) NOT NULL,
- "operation_progress" varchar(50) NOT NULL,
- "operation_result" varchar(100) DEFAULT NULL,
- "start_time" varchar(100) NOT NULL,
- "end_time" varchar(100),
- CONSTRAINT service_instance_operations_pk PRIMARY KEY (service_instance_id, operation_id)
-);
-
--- ----------------------------
--- Table structure for sort_master
--- ----------------------------
-DROP TABLE IF EXISTS sort_master;
-CREATE TABLE sort_master (
- "sort_type" varchar(50) NOT NULL,
- "sort_code" varchar(10) NOT NULL,
- "sort_value" varchar(100) NOT NULL,
- "language" varchar(50) NOT NULL,
- CONSTRAINT sort_master_pk PRIMARY KEY (sort_type, sort_code, language)
-);
-
--- ----------------------------
--- Table structure for sort_master
--- ----------------------------
-DROP TABLE IF EXISTS instance_performance;
-CREATE TABLE instance_performance
-(
- id serial not null
- constraint instance_performance_pk
- primary key,
- job_id varchar(36),
- resource_instance_id varchar(36),
- bandwidth numeric,
- date timestamp,
- max_bandwidth numeric
-);
-
--- ----------------------------
--- Table structure for ccvpn_instance
--- ----------------------------
-DROP TABLE IF EXISTS ccvpn_instance;
-CREATE TABLE ccvpn_instance
-(
- id serial not null
- constraint ccvpn_instance_pk
- primary key,
- instance_id varchar(16),
- job_id varchar(36),
- progress integer,
- status char default 0,
- resource_instance_id varchar(36),
- name varchar(255),
- cloud_point_name varchar(255),
- access_point_one_name varchar(255),
- access_point_one_band_width integer,
- line_num varchar(64),
- delete_state integer default 0,
- protect_status integer default 0,
- protection_cloud_point_name varchar(255),
- protection_type varchar(255)
-);
-
--- ----------------------------
--- Table structure for intent_model
--- ----------------------------
-DROP TABLE IF EXISTS intent_model;
-create table intent_model
-(
- id serial not null
- constraint intent_model_pk
- primary key,
- model_name varchar(100) default NULL::character varying,
- file_path varchar(500) default NULL::character varying,
- create_time varchar(100) default NULL::character varying,
- size numeric(10, 3),
- active integer,
- model_type integer default 0
-);
-
--- ----------------------------
--- Table structure for intent_instance
--- ----------------------------
-DROP TABLE IF EXISTS intent_instance;
-create table intent_instance
-(
- id serial not null
- constraint intent_instance_pk
- primary key,
- intent_name varchar(50),
- intent_source integer,
- customer varchar(50),
- intent_content text,
- intent_config text,
- business_instance_id varchar(50),
- business_instance varchar(255)
-);
diff --git a/standalone/src/main/assembly/resources/dbscripts/postgres/uui_init_data.sql b/standalone/src/main/assembly/resources/dbscripts/postgres/uui_init_data.sql
deleted file mode 100644
index b2e68eb3..00000000
--- a/standalone/src/main/assembly/resources/dbscripts/postgres/uui_init_data.sql
+++ /dev/null
@@ -1,35 +0,0 @@
---
--- Copyright (C) 2019 CMCC, Inc. and others. All rights reserved.
---
--- 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.
---
-
--- ----------------------------
--- import initial data for sort_master
--- ----------------------------
-INSERT INTO sort_master (sort_type, sort_code, sort_value, language) VALUES ('operationType', '1001', 'Creating', 'en');
-INSERT INTO sort_master (sort_type, sort_code, sort_value, language) VALUES ('operationType', '1002', 'Deleting', 'en');
-INSERT INTO sort_master (sort_type, sort_code, sort_value, language) VALUES ('operationType', '1003', 'Scaling', 'en');
-INSERT INTO sort_master (sort_type, sort_code, sort_value, language) VALUES ('operationType', '1004', 'Healing', 'en');
-INSERT INTO sort_master (sort_type, sort_code, sort_value, language) VALUES ('operationType', '1005', 'Updating', 'en');
-INSERT INTO sort_master (sort_type, sort_code, sort_value, language) VALUES ('operationType', '1001', '创建', 'cn');
-INSERT INTO sort_master (sort_type, sort_code, sort_value, language) VALUES ('operationType', '1002', '删除', 'cn');
-INSERT INTO sort_master (sort_type, sort_code, sort_value, language) VALUES ('operationType', '1003', '缩扩容', 'cn');
-INSERT INTO sort_master (sort_type, sort_code, sort_value, language) VALUES ('operationType', '1004', '自愈', 'cn');
-INSERT INTO sort_master (sort_type, sort_code, sort_value, language) VALUES ('operationType', '1005', '更新', 'cn');
-INSERT INTO sort_master (sort_type, sort_code, sort_value, language) VALUES ('operationResult', '2001', 'Successful', 'en');
-INSERT INTO sort_master (sort_type, sort_code, sort_value, language) VALUES ('operationResult', '2002', 'Failed', 'en');
-INSERT INTO sort_master (sort_type, sort_code, sort_value, language) VALUES ('operationResult', '2003', 'In Progress', 'en');
-INSERT INTO sort_master (sort_type, sort_code, sort_value, language) VALUES ('operationResult', '2001', '成功', 'cn');
-INSERT INTO sort_master (sort_type, sort_code, sort_value, language) VALUES ('operationResult', '2002', '失败', 'cn');
-INSERT INTO sort_master (sort_type, sort_code, sort_value, language) VALUES ('operationResult', '2003', '执行中', 'cn');