BeuthBot
BeuthBot is a master project of the Beuth University of Applied Sciences Berlin. This implementation is the work of media informatic students from semesters SS2017 and WS2017/18.
- Requirements
- Technologies
- Firtst steps
- Project documention
- Application properties
- Docker configuration
- Local tunnel
- Debugging
- Known issues
- Used online sources
Requirements
- Java 8 to build the application
- Docker daemon to start application server
Technologies
- Oracle Java 8
- Gradle Build - build system
- Postgres SQL - relational database
- Adminer - database administration
- WildFly 10
- Docker
Firtst steps
The following five steps clarify what is necessary to set up the BeuthBot for the first time. Most of the steps are also useful during development to ultimately test the changes in the application.
All commands are listed in the following five steps and can be executed from the project path. If this is different than this is indicated accordingly. The commands may differ depending on which operating system is used.
1. Set up integrated development environment
The project should be cloned from the repository. For development it is possible to use IDE Intelij. The cloned project can then be imported into the IDE as Gradle project.
2. Execute project build
With the following command it is possible to build the whole project. The construction of the project is possible during operation and before starting the server. In the first case the running server is automatically updated during operation.
./gradlew war
3. Run application
The application can be started with the following command:
# Unix
./gradlew chatbotRun
# Windows
gradlew.bat chatbotRun
# MacOS
cd docker
docker-compose up --build
4. Test application
After the application has started the following two endpoints of the server are easily accessible via the browser:
- WildFly Server Manager: http://localhost:9990/
- Rasa: http://localhost:5000/parse?q=Hello
It is possible to use a Postman Collection to test the configured endpoints for Telegram and Facebook. The docu/postman/
directory includes a Postman collection containing corresponding endpoints. The JSON file beuth-bot.json
can be imported into Postman. If changes are made to the Postman collection, the service of the JSON file should be increased accordingly.
In addition it is also possible to set up your own bot for example, in Telegram and test it with the local server. For this however a local tunnel must be set up to make the application visible to the outside. For details see the section Local tunnel.
5. Stop application
The following command can be used to stop the running application:
# Unix
./gradlew chatbotStop
# Windows
gradlew.bat chatbotStop
# MacOS
cd docker
docker-compose down
Project documention
In addition to this general documentation, the directory docu/
also contains the project_documentation. This section also discuss the individual modules of the application.
Application properties
Settings for this application can be found in the beuthbot.proterties
file. This is located in the directory docker/wildfly/volumes/conf/
. The file is automatically entered in the Tomcat server during deployment and is used for configuration.
Docker configuration
The Docker configurations can be found in the docker-compose.yml
file. This is stored in the directory docker/
. Furthermore you can find the Dockerfile
file in the folder docker/wildfly/
. The following port mappings are set in the Docker files:
Backend
- Internal port of the container:
8080
- External port from the container:
8080
WildFly server manager
- Internal port of the container:
9990
- External port from the container:
9990
Database
- Internal port of the container:
5432
- External port from the container:
5432
Database administration
- Internal port of the container:
8080
- External port from the container:
8081
Localtunnel
Localtunnel is a great way to test the system using your preferred messenger. Both Facebook and Telegram require secure connections via HTTPS in order to transmit messages to a registered bot server. This is done by setting up a random domain name on the localtunnel server and linking it to your internet-ip address. For this process to work, you need administrative access to your wifi-router, where you need to activate port forwarding, and have port 8080 be forwarded to your local ip-address. Once this is setup, you can install and use localtunnel. Localtunnel requires NodeJS in order to work.
MacOS:
1.Installing NodeJS MacOS requires XCode and Homebrew in order to install NodeJS. XCode can be downloaded and installed for free via the App Store.
To install Homebrew, open a terminal window and type`
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
After Homebrew has completed installation, install NodeJS by typing:
brew install node
Finally install localtunnel by typing:
npm install -g localtunnel
If everything has worked correctly, you are now ready to use localtunnel. Using localtunnel is fairly easy, simply type:
lt --port 8080
Where the number entered after --port corresponds to the port you want localtunnel to route its HTTPS-Domain to. The localtunnel server can be slow and a little unreliable at times, but if everything goes well you should see something like:
your url is: https://uawfhausjdj.localtunnel.me
which is the url you can put in the first line of the beuthbot.properties
file in the /docker/wildfly/volumes/conf` directory.
IMPORTANT: The terminal window in which you launched localtunnel needs to be kept open in order for it to work! Closing the terminal-window will kill your localtunnel-connection.
NOTE: Localtunnel tends to crash every now and then, displaying an error message that the connection was refused. In this case, run the localtunnel command again to get a new address.
Debugging
At the moment, the Spring Boot server is always started in debug mode. To attach the process using IntelliJ, a remote debug configuration has to be created. To do so, perform the following steps:
- Go to
Run
->Edit Configurations...
- Add a new configuration using the button in the top left corner of the dialog
- Choose
Remote
- Assign a name, ignore the arguments section and enter port
8787
(localhost
) in the settings section - click
OK
and select the new configuration at the top right of the toolbar if it has not been selected automatically - run the configuration using the
Debug
button
Known issues
The following issues are currently known in the application:
Gradlew
- The
./gradlew chatbotRun
command does not work on Mac OS X - The general build command
./gradlew build
causes errors
Wildfly
- During the boot process of the Wildfly server, the error
Mount point not found
occurs