Add systemd for oclip service 23/82023/2
authorKanagaraj Manickam <mkr1481@gmail.com>
Tue, 12 Mar 2019 11:29:07 +0000 (19:29 +0800)
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Tue, 12 Mar 2019 12:16:39 +0000 (20:16 +0800)
Issue-ID: CLI-129

Change-Id: I763afc46b31644700f10b3de191cf89463536aa4
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
deployment/docker/src/main/docker/Dockerfile
deployment/zip/src/main/release/bin/oclip-service.sh [new file with mode: 0644]
deployment/zip/src/main/release/conf/oclip-grpc-server.properties [new file with mode: 0644]
deployment/zip/src/main/release/conf/oclip.service [new file with mode: 0644]

index 22415d9..5e9eac2 100644 (file)
@@ -35,6 +35,7 @@ RUN apt-get update && apt-get install -y lighttpd git curl pandoc vim && \
     chmod +x  $OPEN_CLI_HOME/bin/oclip.sh  && \
     chmod +x  $OPEN_CLI_HOME/bin/oclip-rcli.sh  && \
     chmod +x  $OPEN_CLI_HOME/bin/oclip-grpc-server.sh  && \
+    chmod +x  $OPEN_CLI_HOME/bin/oclip-service.sh  && \
     ln  $OPEN_CLI_HOME/bin/oclip.sh /usr/sbin/oclip  && \
     ln  $OPEN_CLI_HOME/bin/oclip.sh /usr/sbin/onap  && \
     ln  $OPEN_CLI_HOME/bin/oclip-grpc-server.sh /usr/sbin/oclip-grpc  && \
@@ -47,12 +48,15 @@ RUN apt-get update && apt-get install -y lighttpd git curl pandoc vim && \
     if [ ! -d  /var/www-data/servers/open-cli/ ]; then mkdir -p /var/www-data/servers/open-cli/; fi  && \
     cp $OPEN_CLI_HOME/http/web/*.* /var/www-data/servers/open-cli/ && \
     cp $OPEN_CLI_HOME/http/lighttpd/10-proxy.conf /etc/lighttpd/conf-enabled/ && \
-    cp $OPEN_CLI_HOME/installer/cli-*.zip /var/www-data/servers/open-cli/oclip.zip
+    cp $OPEN_CLI_HOME/installer/cli-*.zip /var/www-data/servers/open-cli/oclip.zip  && \
+    cp $OPEN_CLI_HOME/conf/oclip.service /etc/systemd/system/oclip.service  && \
+    systemctl daemon-reload
+
 EXPOSE 80
 EXPOSE 8080
 EXPOSE 50051
 ENTRYPOINT if [ "$OPEN_CLI_MODE" = "daemon" ]; then service lighttpd start; gotty --permit-write --reconnect oclip; \
            elif [ "$OPEN_CLI_MODE" = "ocs-web" ]; then echo "****** OCLIP Web Command Server ******"; service lighttpd start; \
-           elif [ "$OPEN_CLI_MODE" = "ocs-grpc" ]; then echo "****** OCLIP gRPC Command Server ******"; oclip-grpc; \
+           elif [ "$OPEN_CLI_MODE" = "ocs-grpc" ]; then echo "****** OCLIP gRPC Command Server ******"; systemctl start oclip; \
            elif [ "$OPEN_CLI_MODE" = "occ" ]; then echo "****** OCLIP Web Command Console (OCC) ******"; gotty --permit-write --reconnect oclip; \
            else echo "****** OCLIP Command Shell******"; oclip -v && /bin/bash; fi
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 (file)
index 0000000..897a605
--- /dev/null
@@ -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 (file)
index 0000000..972fdeb
--- /dev/null
@@ -0,0 +1,15 @@
+# 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
\ 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 (file)
index 0000000..1492ac0
--- /dev/null
@@ -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