From fb83a20237695edc61603e1c97793d0a68b508e8 Mon Sep 17 00:00:00 2001 From: Arkadiy Kraportov Date: Thu, 22 Jun 2017 08:39:11 +0800 Subject: [PATCH 1/4] Add basic Docker support --- Dockerfile | 8 +++ ProxyDeskBot.sh | 4 ++ docker_config/bot.properties | 113 +++++++++++++++++++++++++++++++++ docker_config/log4j.properties | 46 ++++++++++++++ pom.xml | 2 +- 5 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100755 ProxyDeskBot.sh create mode 100755 docker_config/bot.properties create mode 100755 docker_config/log4j.properties diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e64093d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM maven:3.5-jdk-8-onbuild-alpine + +VOLUME ["/usr/src/app/certs", "/usr/src/app/data"] + +ENV JAVA_OPTS="-Dbot.config.dir=/usr/src/app/docker_config -Dlog4j.configurationFile=/usr/src/app/docker_config/log4j.properties" + +CMD ["/usr/src/app/ProxyDeskBot.sh"] + diff --git a/ProxyDeskBot.sh b/ProxyDeskBot.sh new file mode 100755 index 0000000..6c3830e --- /dev/null +++ b/ProxyDeskBot.sh @@ -0,0 +1,4 @@ +#!/bin/sh +mkdir -p /usr/src/app/data/proxydesk-json/ +/usr/src/app/proxy-desk/target/proxy-desk-0.9.0-SNAPSHOT/bin/ProxyDeskBot + diff --git a/docker_config/bot.properties b/docker_config/bot.properties new file mode 100755 index 0000000..44ca039 --- /dev/null +++ b/docker_config/bot.properties @@ -0,0 +1,113 @@ +# +# +# +# Copyright 2016 The Symphony Software Foundation +# +# Licensed to The Symphony Software Foundation (SSF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# +# + +#______________SHARED_CONFIG______________# + +#ENV VARIABLES && SYSTEM PROPERTIES + #BOT + bot.user=helpdesk + bot.domain=domain.com + + #PASWORDS + keystore.password=password + truststore.password=password + + #URLS + sessionauth.url=https://podhost/sessionauth + keyauth.url=https://podhost/keyauth + symphony.agent.pod.url=https://podhost/pod + symphony.agent.agent.url=https://agenthost/agent + + #FILE + certs.dir=/usr/src/app/certs/ + truststore.file=/usr/src/app/certs/server.truststore + files.transcript=/usr/src/app/data/transcripts/ + + #ADMIN + admin.user=nicholas.tarsillo@markit.com + +#CONFIG PROPERTIES + #COMMANDS + ai.command.acceptnext=Accept Next SymUser + ai.command.accept=Accept + ai.command.togglealias=Toggle Use Alias + ai.command.onlinemembers=Online Members + ai.command.clientqueue=Client Queue + ai.command.addmember=Add Member + ai.command.mysettings=My Settings + ai.command.exit=Exit + ai.command.helpsummary=Help Summary + ai.command.roominfo=Room Info + ai.command.callcache=Call Cache + ai.command.setalias=Set Alias + + + +#______________PROXYBOT_CONFIG______________# + +#ENV VARIABLES && SYSTEM PROPERTIES + #BOT + proxybot.files.json=/usr/src/app/data/proxydesk-json/ + +#CONFIG PROPERTIES + #COMMANDS + proxybot.ai.command.toggleonline=Toggle Online + proxybot.ai.command.joinchat=Join Chat + proxybot.ai.command.settags=Set Tags + proxybot.ai.command.addtags=Add Tags + proxybot.ai.command.removetags=Remove Tags + + #SETTINGS + proxybot.setting.bestpercentage=0.2 + + + +#______________ROOM_BOT_CONFIG______________# + +#ENV VARIABLES && SYSTEM PROPERTIES + #BOT + roombot.files.json=/dev/helpdesk/roomdesk-json/ + + #SETTINGS + roombot.member.chat.stream=2ahd4BrJX27BXOh4WovZ8H___qpDioJtdA + + + +#______________WEB_BOT_CONFIG______________# + +#ENV VARIABLES && SYSTEM PROPERTIES + #BOT + webbot.files.json=/dev/helpdesk/roomdesk-json/ + webbot.files.webdesk=web-desk/src/main/resources/web + + #SETTINGS + webbot.member.chat.stream=2ahd4BrJX27BXOh4WovZ8H___qpDioJtdA + webbot.web.desk.port=8080 + webbot.trust.all.ssl=false + +#CONFIG PROPERTIES + #HEADER + webbot.header.index=/web/index.html?token= + webbot.header.help=/web/help.html + webbot.web.directory=/web/* diff --git a/docker_config/log4j.properties b/docker_config/log4j.properties new file mode 100755 index 0000000..b8bc0c1 --- /dev/null +++ b/docker_config/log4j.properties @@ -0,0 +1,46 @@ +# +# +# +# Copyright 2016 The Symphony Software Foundation +# +# Licensed to The Symphony Software Foundation (SSF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# +# + + +log4j.rootLogger = DEBUG,console + + +# Direct log messages to a log file +log4j.appender.file=org.apache.log4j.RollingFileAppender +log4j.appender.file.File=../logs/helpdesk.log +log4j.appender.file.MaxFileSize=10MB +log4j.appender.file.MaxBackupIndex=10 +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n + +# Direct log messages to stdout +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n + +# Direct log messages to stdout +log4j.appender.console=org.apache.log4j.ConsoleAppender +log4j.appender.console.layout=org.apache.log4j.PatternLayout +log4j.appender.console.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n diff --git a/pom.xml b/pom.xml index 856fecd..9f5ab4a 100755 --- a/pom.xml +++ b/pom.xml @@ -286,7 +286,7 @@ ${project.build.directory}/${project.artifactId}-${project.version} - -Xms128m -Xmx2048m -Dbot.config.dir=../conf + -Xms128m -Xmx2048m From bac6684b0dba636a11a14687014483bb596842d2 Mon Sep 17 00:00:00 2001 From: Arkadiy Kraportov Date: Fri, 23 Jun 2017 14:35:33 +0800 Subject: [PATCH 2/4] Finalize docker support --- Dockerfile | 3 ++- ProxyDeskBot.sh | 4 ---- README.md | 41 +++++++++++++++++++++++++++++++++++++++++ docker_exec/run_bot.sh | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 5 deletions(-) delete mode 100755 ProxyDeskBot.sh create mode 100755 docker_exec/run_bot.sh diff --git a/Dockerfile b/Dockerfile index e64093d..28c8b69 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,5 +4,6 @@ VOLUME ["/usr/src/app/certs", "/usr/src/app/data"] ENV JAVA_OPTS="-Dbot.config.dir=/usr/src/app/docker_config -Dlog4j.configurationFile=/usr/src/app/docker_config/log4j.properties" -CMD ["/usr/src/app/ProxyDeskBot.sh"] +ENTRYPOINT ["/usr/src/app/docker_exec/run_bot.sh"] +CMD ["ProxyDeskBot"] diff --git a/ProxyDeskBot.sh b/ProxyDeskBot.sh deleted file mode 100755 index 6c3830e..0000000 --- a/ProxyDeskBot.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -mkdir -p /usr/src/app/data/proxydesk-json/ -/usr/src/app/proxy-desk/target/proxy-desk-0.9.0-SNAPSHOT/bin/ProxyDeskBot - diff --git a/README.md b/README.md index 0defc82..dc434ce 100755 --- a/README.md +++ b/README.md @@ -71,6 +71,47 @@ Please contact your Symphony local administrator to obtain the necessary certifi -Dbot.domain=(domain of user) -Djson.files=/dev/json +## Docker + +### Build docker image +From the project directory run: + +```bash +docker build . --tag helpdesk-bot +``` + +It will download and install all deplendencies. You don't need to have Java or Maven installed to build the docker image. + +### Run docker image + +1. In any empty directory create a `certs` subdirectory. +2. Plase `.p12` cert and `server.truststore` keystore into the `certs` subdirectory +3. Create a `proxy_bot.env` environment file with your bot configurations. It should contain the following variables: + +```bash +SYMPHONY_POD=https:///pod +SYMPHONY_AGENT=https:///agent +SESSION_AUTH=https:///sessionauth +KEY_AUTH=https:///keyauth +BOT_USER= +BOT_DOMAIN= +ADMIN_USER= +TRUSTSTORE_PASSWORD= +KEYSTORE_PASSWORD= +``` + +4. Run the image with command: + +```bash +docker run -it --rm \ + -v "$PWD"/certs:/usr/src/app/certs \ + -v "$PWD"/data:/usr/src/app/data \ + --env-file proxy_bot.env \ + helpdesk-bot +``` + +The running image will store runtime data into the `data` subdirectory. + ## Contribute This project was initiated at [IHS Markit](https://www.ihsmarkit.com) and has been developed as open-source from the very beginning. diff --git a/docker_exec/run_bot.sh b/docker_exec/run_bot.sh new file mode 100755 index 0000000..f805ebb --- /dev/null +++ b/docker_exec/run_bot.sh @@ -0,0 +1,32 @@ +#!/bin/bash +set -e +shopt -s nocasematch + +if [ $# -eq 0 ]; then + echo "Please provide a Bot name or linux command like 'bash'" + echo "Possible bot names:" + echo " ProxyBot" + echo " RoomBot" + echo " WebBot" + exit 1 +fi + + +case "$1" in + "ProxyDeskBot"|"ProxyDesk"|"ProxyBot"|"proxy_bot"|"proxy") + mkdir -p /usr/src/app/data/proxydesk-json/ + exec /usr/src/app/proxy-desk/target/proxy-desk-0.9.0-SNAPSHOT/bin/ProxyDeskBot + ;; + "RoomDeskBot"|"RoomDesk"|"RoomBot"|"room_bot"|"room") + mkdir -p /usr/src/app/data/roomdesk-json/ + exec /usr/src/app/room-desk/target/room-desk-0.9.0-SNAPSHOT/bin/RoomDeskBot + ;; + "WebDeskBot"|"WebDesk"|"web_bot"|"web") + mkdir -p /usr/src/app/data/webdesk-json/ + exec /usr/src/app/web-desk/target/web-desk-0.9.0-SNAPSHOT/bin/WebDeskBot + ;; + *) + exec "$@" +esac + + From 80335aa388d4a88944284d39e0708995b15f873e Mon Sep 17 00:00:00 2001 From: arkadiy kraportov Date: Fri, 23 Jun 2017 15:52:00 +0900 Subject: [PATCH 3/4] RADME.md: Fix formatting and typos --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index dc434ce..69df0ad 100755 --- a/README.md +++ b/README.md @@ -8,23 +8,23 @@ Symphony Helpdesk Bot Help Desk BOT(s) are Java based applications that implement a call routing workflow based framework leveraging the Symphony API. To implement a common design pattern which supports a call routing workflow from a named end-point (network user) to an application (BOT) end-point named alias (operator/call router), which routes to a rota of other named user end-points who service the call. -##General Concepts +## General Concepts * All communications from initiating user end-points to application end-point are private. * All communications from the application end-point to the rota of servicing user end-points are shared. Rules can be applied to prevent communications between servicing users. * The application end-point will maintain session state with all end-points. * The application end-point will have additional programmatic workflow hooks to support other implementations. These include event listeners and interfaces through the life-cycle of call handling. e.g. Connect, Validation, Session, SymMessage, Rules, Context, Commands, Termination -##Change log and notes +## Change log and notes ### V1.0.0 (SNAPSHOT) * Upgrade to Symphony-Java-Client 1.0.0 * General features described below. -##Help Desk BOT Types +## Help Desk BOT Types -###Proxy Desk +### Proxy Desk See video [DEMO](https://www.youtube.com/watch?v=aXv35MU3szQ) All communications flows through (ingress/egress) the BOT application, which handles all call routing. Command line interface is provided to members to manage all calls. @@ -32,7 +32,7 @@ All communications flows through (ingress/egress) the BOT application, which han U(SymUser) < - - > O(Operator)< - - > R(Rota of Users/members) (~~~~~~~~~~~~~~~~~~~~)< - - >Ru(Rota SymUser callback, proxy through O) -###Room Desk +### Room Desk See video [DEMO](https://www.youtube.com/watch?v=Uq_eS-L6Ud8) All inbound user communications flows through the BOT into a chat room of members. Command line interface is provided to all members, but calls are established through an external multi-party conversation outside the chat room. @@ -40,7 +40,7 @@ All inbound user communications flows through the BOT into a chat room of member U(SymUser) < - - > O(Operator)< - > R(Rota of Users/members) (~~~~~) <- - - - - - - - - - - - - - - -Ru(Rota SymUser callback, direct) -###Web Desk +### Web Desk See video [DEMO](https://www.youtube.com/watch?v=CAhl18L7kXo) All inbound users leverage an external web client, which communicates with a backend BOT service that implements the Room Desk construct. @@ -48,15 +48,15 @@ All inbound users leverage an external web client, which communicates with a bac U(SymUser) < - -> Web Module < - - > O (Operator) <- > R(Rota of users/members) (~~~~~) <-------------------------------------------Ru(Rota SymUser callback) -##Requirements +## Requirements -###Certificates: +### Certificates: Please contact your Symphony local administrator to obtain the necessary certificates for the user/service account being used to access the POD. Server Truststore = Contains server certs SymUser Keystore = Symphony user client certificate -###Required System Properties: +### Required System Properties: -Dkeystore.password=(Pass) -Dtruststore.password=(Pass) @@ -85,7 +85,7 @@ It will download and install all deplendencies. You don't need to have Java or M ### Run docker image 1. In any empty directory create a `certs` subdirectory. -2. Plase `.p12` cert and `server.truststore` keystore into the `certs` subdirectory +2. Place `.p12` cert and `server.truststore` keystore into the `certs` subdirectory 3. Create a `proxy_bot.env` environment file with your bot configurations. It should contain the following variables: ```bash From c4820781d53b08421fb1787785fafffa04a01ac5 Mon Sep 17 00:00:00 2001 From: arkadiy kraportov Date: Wed, 28 Jun 2017 17:26:37 +0900 Subject: [PATCH 4/4] Fix typo in config prop name --- .../java/org/symphonyoss/proxydesk/config/ProxyBotConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxy-desk/src/main/java/org/symphonyoss/proxydesk/config/ProxyBotConfig.java b/proxy-desk/src/main/java/org/symphonyoss/proxydesk/config/ProxyBotConfig.java index 9f6cb48..c37d863 100755 --- a/proxy-desk/src/main/java/org/symphonyoss/proxydesk/config/ProxyBotConfig.java +++ b/proxy-desk/src/main/java/org/symphonyoss/proxydesk/config/ProxyBotConfig.java @@ -50,7 +50,7 @@ public final class ProxyBotConfig { public static final String CALL_QUEUE = "ai.command.callcache"; public final static String JOIN_CHAT = "proxybot.ai.command.joinchat"; public final static String TOGGLE_ONLINE = "proxybot.ai.command.toggleonline"; - public final static String EXIT = "proxybot.command.exit"; + public final static String EXIT = "ai.command.exit"; public final static String SET_TAGS = "proxybot.ai.command.settags"; public final static String ADD_TAGS = "proxybot.ai.command.addtags"; public final static String REMOVE_TAGS = "proxybot.ai.command.removetags";