Skip to content
This repository has been archived by the owner on Mar 30, 2020. It is now read-only.

Naïve Docker support #16

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

59 changes: 50 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,55 +8,55 @@ 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.

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.

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.

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)
Expand All @@ -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 `<helpdesk_bot_user_name>.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://<your pod host>/pod
SYMPHONY_AGENT=https://<your pod host>/agent
SESSION_AUTH=https://<your api host>/sessionauth
KEY_AUTH=https://<your keyauth host>/keyauth
BOT_USER=<your helpdesk user name. Should match the .p12 cert name>
BOT_DOMAIN=<your domain>
ADMIN_USER=<admin user email>
TRUSTSTORE_PASSWORD=<password for server.truststore>
KEYSTORE_PASSWORD=<password for helpdesk_bot_user_name.p12 cert>
```

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.
Expand Down
113 changes: 113 additions & 0 deletions docker_config/bot.properties
Original file line number Diff line number Diff line change
@@ -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/*
46 changes: 46 additions & 0 deletions docker_config/log4j.properties
Original file line number Diff line number Diff line change
@@ -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
32 changes: 32 additions & 0 deletions docker_exec/run_bot.sh
Original file line number Diff line number Diff line change
@@ -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


2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@
<!-- set alternative assemble directory -->
<assembleDirectory>${project.build.directory}/${project.artifactId}-${project.version}</assembleDirectory>
<!-- Extra JVM arguments that will be included in the bin scripts -->
<extraJvmArguments>-Xms128m -Xmx2048m -Dbot.config.dir=../conf
<extraJvmArguments>-Xms128m -Xmx2048m
</extraJvmArguments>

<!-- Generate bin scripts for windows and unix pr default -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down