diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..28c8b69 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +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" + +ENTRYPOINT ["/usr/src/app/docker_exec/run_bot.sh"] +CMD ["ProxyDeskBot"] + diff --git a/README.md b/README.md index 0defc82..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) @@ -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. 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 +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_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/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 + + 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 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";