If you are a Red Hatter that would like to report Acrobot not working, please ping Eduardo who took over the Acrobot maintenance at Red Hat, or Richard as a backup.
This repository is now archived.
Acrobot is a Google Hangouts chat bot, with the aim of keeping track of acronyms used within the company.
Acrobot is capable of multiple actions:
- Saving an acronym:
!acronym = explanation
- Getting an acronym explanation:
acronym
- Modifying an acronym explanation:
!acronym = explanation => new explanation
- Removing an acronym explanation:
!acronym = explanation =>
White spaces do not matter. If you are interacting with acrobot in a room,
do not forget to tag the bot, e.g. @Acrobot !acronym = explanation
.
You can change and remove only those explanations that you entered into the database.
Acrobot is a simple application, using:
- Java (tested against OpenJDK 11)
- Hibernate
- MySQL
- Kubernetes/OpenShift for deployment #todo OCP template
This particular implementation uses Google's Cloud Pub/Sub messaging middleware.
custom_mark10 @startuml; actor "Google Hangouts" as User; participant "Pub/Sub middleware" as A; participant Acrobot; User -> A: Send a message; Acrobot --> A: Poll for a message; Acrobot --> User: Send a response; @enduml; custom_mark10
As such, before deploying the Google bot, you have to complete Google's Pub/Sub prerequisites:
- Create a project in the Cloud Platform Console, which:
- Has the Pub/Sub API enabled.
- Has granted the Pub/Sub permissions to the chat-api-push@system.gserviceaccount.com service role.
- Create a service account with the Pub/Sub API roles.
- Create a message queue in the Cloud Platform Console.
- Associate the queue with a subscription in the Cloud Platform Console.
For more details on setting up the bot, see the Google Developer's documentation.
Acrobot has a few dependencies:
- export GOOGLE_APPLICATION_CREDENTIALS: an environment variable that contains the path to the service account json you created. If you are deploying Acrobot on Kubernetes/OpenShift, you will have to inject the file either using a secret, or a config map, into your pod.
- export JDBC_URL, JDBC_USER, and JDBC_PASSWORD for the DB connection details.
- export PROJECT_ID and SUBSCRIPTION_ID which match your Google project and subscription created earlier.
Acrobot contains unit tests with an in-memory H2 database. You should execute all tests before pushing new code.
You can execute tests by issuing: mvn clean test
. To execute a particular test, you can specify the test
parameter in the format of ClassName#TestName
, for example:
mvn clean test -Dtest=MessageHelperTest#exceptionPropagationTest
All new features should have tests.
Author: Marek Czernek. The idea of Acrobot came from a number of very smart folks at Red Hat. The IRC implementation was done by https://github.com/mfojtik. If you wish to run AcroBot on IRC, see the AcroBot Implementation.