aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--deployment/zip/src/main/release/bin/oclip-service.sh4
-rw-r--r--deployment/zip/src/main/release/conf/oclip-grpc-server.properties16
-rw-r--r--deployment/zip/src/main/release/conf/oclip.service22
-rw-r--r--grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java7
-rw-r--r--grpc/grpc-server/src/main/resources/oclip-grpc-server.properties3
5 files changed, 50 insertions, 2 deletions
diff --git a/deployment/zip/src/main/release/bin/oclip-service.sh b/deployment/zip/src/main/release/bin/oclip-service.sh
new file mode 100644
index 00000000..897a6052
--- /dev/null
+++ b/deployment/zip/src/main/release/bin/oclip-service.sh
@@ -0,0 +1,4 @@
+#! /bin/bash
+
+export OPEN_CLI_HOME=/opt/oclip
+$OPEN_CLI_HOME/bin/oclip-grpc-server.sh
diff --git a/deployment/zip/src/main/release/conf/oclip-grpc-server.properties b/deployment/zip/src/main/release/conf/oclip-grpc-server.properties
new file mode 100644
index 00000000..c7454394
--- /dev/null
+++ b/deployment/zip/src/main/release/conf/oclip-grpc-server.properties
@@ -0,0 +1,16 @@
+# Copyright 2018 Huawei Technologies Co., Ltd.
+#
+# 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.
+
+oclip.grpc_server_port=50051
+oclip.grpc_server_host=localhost \ No newline at end of file
diff --git a/deployment/zip/src/main/release/conf/oclip.service b/deployment/zip/src/main/release/conf/oclip.service
new file mode 100644
index 00000000..1492ac0d
--- /dev/null
+++ b/deployment/zip/src/main/release/conf/oclip.service
@@ -0,0 +1,22 @@
+#
+#systemd file: /etc/systemd/system/oclip.service
+#
+[Unit]
+Description=Open CLI Platform gRPC service
+
+[Service]
+#User=ubuntu
+
+#change this to your workspace
+WorkingDirectory=/opt/oclip
+
+#path to executable.
+ExecStart=/opt/oclip/bin/oclip-service.sh
+
+#SuccessExitStatus=143
+#TimeoutStopSec=10
+#Restart=on-failure
+#RestartSec=5
+
+[Install]
+WantedBy=multi-user.target
diff --git a/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java b/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java
index afbd7682..0c2f00b5 100644
--- a/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java
+++ b/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java
@@ -55,6 +55,7 @@ public class OpenInterfaceGrpcServer {
private static final String CONF_FILE = "oclip-grpc-server.properties";
private static final String CONF_SERVER_PORT = "oclip.grpc_server_port";
+ private static final String CONF_SERVER_HOST = "oclip.grpc_server_host";
static {
OnapCommandConfig.addProperties(CONF_FILE);
@@ -64,6 +65,10 @@ public class OpenInterfaceGrpcServer {
private void start(String portArg) throws IOException {
/* The port on which the server should run */
int port = Integer.parseInt(portArg == null ? OnapCommandConfig.getPropertyValue(CONF_SERVER_PORT) : portArg);
+ String host = OnapCommandConfig.getPropertyValue(CONF_SERVER_HOST);
+ if (host == null) {
+ host = InetAddress.getLocalHost().getHostAddress().trim();
+ }
server = ServerBuilder.forPort(port)
.addService(new OpenInterfaceGrpcImpl())
.build()
@@ -71,7 +76,7 @@ public class OpenInterfaceGrpcServer {
logger.info("Server started, listening on " + port);
try {
- OnapCommandRegistrar.getRegistrar().setHost(InetAddress.getLocalHost().getHostAddress().trim());
+ OnapCommandRegistrar.getRegistrar().setHost(host);
OnapCommandRegistrar.getRegistrar().setPort(port);
} catch (OnapCommandException e) {
//Never Occurs
diff --git a/grpc/grpc-server/src/main/resources/oclip-grpc-server.properties b/grpc/grpc-server/src/main/resources/oclip-grpc-server.properties
index 972fdebb..c7454394 100644
--- a/grpc/grpc-server/src/main/resources/oclip-grpc-server.properties
+++ b/grpc/grpc-server/src/main/resources/oclip-grpc-server.properties
@@ -12,4 +12,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-oclip.grpc_server_port=50051 \ No newline at end of file
+oclip.grpc_server_port=50051
+oclip.grpc_server_host=localhost \ No newline at end of file