diff options
author | Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com> | 2017-09-01 11:12:40 +0530 |
---|---|---|
committer | Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com> | 2017-09-01 11:13:18 +0530 |
commit | 9618946f4a8a3a71703669db772356b301317d10 (patch) | |
tree | 705c82fba8b2171f49d6d5d99416206a7c6271f0 | |
parent | e35db04d37e98688c20c6f42fff0c5ce892aa728 (diff) |
Add occ
Enables ONAP command console at port 9090
CLI-13
Change-Id: If9f3a41853be200cc9e8e2b6d5c3470e6f013c53
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
-rw-r--r-- | deployment/docker/src/main/docker/Dockerfile | 45 | ||||
-rw-r--r-- | deployment/docker/src/main/docker/docker-compose.yaml | 21 | ||||
-rw-r--r-- | deployment/http/lighttpd/10-proxy.conf | 8 | ||||
-rw-r--r-- | deployment/http/lighttpd/lighttpd.conf | 1 | ||||
-rw-r--r-- | main/src/main/java/org/onap/cli/main/OnapCli.java | 10 | ||||
-rw-r--r-- | main/src/main/java/org/onap/cli/main/conf/OnapCliConstants.java | 1 |
6 files changed, 68 insertions, 18 deletions
diff --git a/deployment/docker/src/main/docker/Dockerfile b/deployment/docker/src/main/docker/Dockerfile index 4a519341..8717fb3d 100644 --- a/deployment/docker/src/main/docker/Dockerfile +++ b/deployment/docker/src/main/docker/Dockerfile @@ -1,35 +1,46 @@ FROM ubuntu:14.04 +#installation RUN apt-get update RUN apt-get update && apt-get install -y software-properties-common -RUN sudo -E add-apt-repository ppa:openjdk-r/ppa && apt-get update && apt-get install -y openjdk-8-jdk && apt-get install -y lighttpd -ENV JAVA_HOME usr/lib/jvm/java-8-openjdk-amd64 +RUN sudo -E add-apt-repository ppa:openjdk-r/ppa && apt-get update && apt-get install -y openjdk-8-jdk && apt-get install -y lighttpd && apt-get install -y git curl +RUN cd /tmp && curl -O https://storage.googleapis.com/golang/go1.9.linux-amd64.tar.gz && tar -xvf go1.9.linux-amd64.tar.gz +RUN mkdir -p /tmp/gotty && \ + GOPATH=/tmp/gotty /tmp/go/bin/go get github.com/yudai/gotty && \ + mv /tmp/gotty/bin/gotty /usr/sbin/ && rm /tmp/go1.9.linux-amd64.tar.gz && rm -rf /tmp/go /tmp/gotty && cd - +ENV JAVA_HOME usr/lib/jvm/java-8-openjdk-amd64 ENV ONAP_CLI_HOME /opt/onap/cli -ADD ./STAGE $ONAP_CLI_HOME -COPY ./STAGE/http/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf -COPY ./STAGE/http/web /var/www-data/servers/onap-cli/ -COPY ./STAGE/installer/*.zip /var/www-data/servers/onap-cli/ +ENV ONAP_CLI_DEBUG false +ENV ONAP_CLI_DEBUG_PORT 5005 +ENV CLI_MODE console +ENV CLI_PRODUCT_VERSION cli-1.0 +ENV ONAP_HOST_URL http://localhost:8080 +ENV ONAP_USERNAME guest +ENV ONAP_PASSWORD guest + +ADD ./STAGE $ONAP_CLI_HOME WORKDIR $ONAP_CLI_HOME + RUN chmod +x ./bin/onap.sh +RUN ln ./bin/onap.sh /usr/sbin/onap RUN if [ ! -d ./data ]; then mkdir ./data; fi RUN if [ ! -d ./onap-cli-schema ]; then mkdir ./onap-cli-schema; fi + +COPY ./STAGE/http/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf +COPY ./STAGE/http/web /var/www-data/servers/onap-cli/ +COPY ./STAGE/installer/*.zip /var/www-data/servers/onap-cli/ RUN if [ ! -f /var/log/lighttpd/access.log ]; then touch /var/log/lighttpd/access.log; fi -RUN ln ./bin/onap.sh /usr/sbin/onap +COPY ./STAGE/http/lighttpd/10-proxy.conf /etc/lighttpd/conf-enabled/ +RUN cp /etc/lighttpd/conf-available/10-accesslog.conf /etc/lighttpd/conf-enabled/ +#Lighttpd EXPOSE 80 -ENV ONAP_HOST_URL http://localhost:8080 -ENV ONAP_USERNAME guest -ENV ONAP_PASSWORD guest -ENV ONAP_CLI_DEBUG false -ENV ONAP_CLI_DEBUG_PORT 5005 -ENV CLI_MODE console -ENV CLI_PRODUCT_VERSION cli-1.0 +#gotty +EXPOSE 8080 -ENTRYPOINT cp /etc/lighttpd/conf-available/10-accesslog.conf /etc/lighttpd/conf-enabled/ && \ - service lighttpd start && \ - if [ "$CLI_MODE" = "daemon" ]; then tailf /var/log/lighttpd/access.log;else /bin/bash; fi +ENTRYPOINT if [ "$CLI_MODE" = "daemon" ]; then service lighttpd start; gotty --permit-write --reconnect onap; else onap -v && /bin/bash; fi RUN echo ONAP CLI docker successfully created !!
\ No newline at end of file diff --git a/deployment/docker/src/main/docker/docker-compose.yaml b/deployment/docker/src/main/docker/docker-compose.yaml new file mode 100644 index 00000000..c486fe9c --- /dev/null +++ b/deployment/docker/src/main/docker/docker-compose.yaml @@ -0,0 +1,21 @@ +version: '2.0' + +services: + + occ: + image: onap/cli + environment: + CLI_MODE: 'daemon' + expose: + - 80 + - 8080 + ports: + - 8080:80 + - 9090:8080 + + cli: + stdin_open: true + tty: true + image: onap/cli + environment: + CLI_MODE: 'console' diff --git a/deployment/http/lighttpd/10-proxy.conf b/deployment/http/lighttpd/10-proxy.conf new file mode 100644 index 00000000..71a008ed --- /dev/null +++ b/deployment/http/lighttpd/10-proxy.conf @@ -0,0 +1,8 @@ +proxy.server = ( "/onap" => + ( + ( "host" => "127.0.0.1", + "port" => 8080 + ) + ) + ) + diff --git a/deployment/http/lighttpd/lighttpd.conf b/deployment/http/lighttpd/lighttpd.conf index c915d9d1..8f88a912 100644 --- a/deployment/http/lighttpd/lighttpd.conf +++ b/deployment/http/lighttpd/lighttpd.conf @@ -16,6 +16,7 @@ dir-listing.activate = "disable" server.modules = ( "mod_access", + "mod_proxy", "mod_alias", "mod_compress", "mod_redirect", diff --git a/main/src/main/java/org/onap/cli/main/OnapCli.java b/main/src/main/java/org/onap/cli/main/OnapCli.java index ac63fdfa..b52d89d7 100644 --- a/main/src/main/java/org/onap/cli/main/OnapCli.java +++ b/main/src/main/java/org/onap/cli/main/OnapCli.java @@ -151,7 +151,14 @@ public class OnapCli { } catch (OnapCommandException e) { this.print(e); } + } else if (!args.isEmpty() && this.args.get(0).equals(OnapCliConstants.PARAM_INTERACTIVE_VERSION)) { + this.args = Arrays.asList(new String [] {this.getLongOption(OnapCliConstants.PARAM_VERSION_LONG)}); + handleVersion(); } else { + if (args.size() == 1 && args.get(0).trim().isEmpty()) { + //Ignore blanks // NOSONAR + continue; + } handleCommand(); } } @@ -187,7 +194,8 @@ public class OnapCli { strCompleter.add(OnapCliConstants.PARAM_INTERACTIVE_EXIT, OnapCliConstants.PARAM_INTERACTIVE_CLEAR, OnapCliConstants.PARAM_INTERACTIVE_USE, - OnapCliConstants.PARAM_INTERACTIVE_HELP); + OnapCliConstants.PARAM_INTERACTIVE_HELP, + OnapCliConstants.PARAM_INTERACTIVE_VERSION); console.addCompleter(strCompleter); console.setPrompt(OnapCliConstants.PARAM_INTERACTIVE_PROMPT); } catch (OnapCommandException e) { // NOSONAR diff --git a/main/src/main/java/org/onap/cli/main/conf/OnapCliConstants.java b/main/src/main/java/org/onap/cli/main/conf/OnapCliConstants.java index d01aa1e5..dfb20c96 100644 --- a/main/src/main/java/org/onap/cli/main/conf/OnapCliConstants.java +++ b/main/src/main/java/org/onap/cli/main/conf/OnapCliConstants.java @@ -33,6 +33,7 @@ public final class OnapCliConstants { public static final String PARAM_INTERACTIVE_CLEAR = "clear"; public static final String PARAM_INTERACTIVE_USE = "use"; public static final String PARAM_INTERACTIVE_HELP = "help"; + public static final String PARAM_INTERACTIVE_VERSION = "version"; public static final String PARAM_INTERACTIVE_ARG_SPLIT_PATTERN = "\\s+"; private OnapCliConstants(){} |