2023-03-26 21:39:02 +02:00
|
|
|
# Mezzotre
|
|
|
|
|
2023-03-26 22:44:17 +02:00
|
|
|
[![Build Status](https://ci.poldebra.me/api/badges/polpetta/mezzotre/status.svg?ref=refs/heads/devel)](https://ci.poldebra.me/polpetta/mezzotre)
|
|
|
|
|
2023-03-26 21:39:02 +02:00
|
|
|
Mezzotre is a DnD content management system. Currently, it is still in the first development stages and everything is
|
|
|
|
still evolving, goals included.
|
|
|
|
|
2023-03-27 17:16:29 +02:00
|
|
|
The whole system is based on Java17+ for the language, incoming Webhooks from Telegram, Jooby backend to handle the
|
2023-03-26 21:39:02 +02:00
|
|
|
requests, PostgresSQL to store data and long-term chat context information.
|
|
|
|
|
|
|
|
## Shipping and running
|
|
|
|
|
|
|
|
Keep in mind that Mezzotre is meant to be run behind a reverse proxy handling all the TLS stuff.
|
|
|
|
In the root of the project you can find a `docker-compose.yml` file that can be a useful starting point to generate your
|
|
|
|
configuration. Finally, you can use the same docker-compose definition as a developer to have a live version running.
|
|
|
|
Simply run:
|
2023-03-27 17:16:29 +02:00
|
|
|
|
2023-03-26 21:39:02 +02:00
|
|
|
```shell
|
|
|
|
DEBUG_OPTS=debug- docker-compose up -d --build && docker-compose logs -f
|
|
|
|
```
|
2023-03-27 17:16:29 +02:00
|
|
|
|
|
|
|
to run a debug instance. Omit the `DEBUG_OPTS` env variable for a "production" style environment. Note that this
|
2023-03-26 21:39:02 +02:00
|
|
|
configuration requires an `.env` file (that is not committed for obvious reasons) containing the database password and a
|
|
|
|
valid Telegram Bot token.
|
|
|
|
|
|
|
|
To configure Webhook configuration for your bot, open up a terminal and type:
|
2023-03-27 17:16:29 +02:00
|
|
|
|
2023-03-26 21:39:02 +02:00
|
|
|
```shell
|
2023-04-03 10:57:14 +02:00
|
|
|
curl -F "url=https://example.com/api/tg" \
|
|
|
|
-F "allowed_updates=[\"message\", \"edited_message\", \"channel_post\", \"edited_channel_post\", \"inline_query\", \"choosen_inline_result\", \"callback_query\", \"poll\", \"poll_answer\", \"my_chat_member\", \"chat_member\", \"chat_join_request\"]" \
|
|
|
|
https://api.telegram.org/bot<YOUR BOT TOKEN>/setWebhook
|
2023-03-26 21:39:02 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
## Building
|
|
|
|
|
|
|
|
Build is achieved through Maven. To build a `jar` run:
|
2023-03-27 17:16:29 +02:00
|
|
|
|
2023-03-26 21:39:02 +02:00
|
|
|
```shell
|
2023-04-20 11:30:06 +02:00
|
|
|
./mvnw package -DskipTests=true -Dmaven.test.skip=true -Dmaven.site.skip=true -Dmaven.javadoc.skip=true
|
2023-03-26 21:39:02 +02:00
|
|
|
```
|
|
|
|
|
2023-04-20 11:30:06 +02:00
|
|
|
In the `target/` folder you will find an uber-jar and optionally the possibility to run it via a script and to setup
|
2023-03-26 21:39:02 +02:00
|
|
|
auto-startup via systemd or openrc units.
|
|
|
|
|
|
|
|
## Developing
|
|
|
|
|
|
|
|
### Automatic testing
|
|
|
|
|
2023-04-20 11:30:06 +02:00
|
|
|
You can simply run tests with `./mvnw test`. This will run `UT` and `IT` tests together.
|
2023-03-26 21:39:02 +02:00
|
|
|
|
|
|
|
### Manual testing
|
|
|
|
|
2023-03-27 17:16:29 +02:00
|
|
|
For a manual approach, just open a terminal and type `mvn jooby:run`. Assuming you have a database locally available
|
2023-04-20 11:30:06 +02:00
|
|
|
(check out [application.conf](conf/application.conf)) and a valid Telegram token set (maybe as environment variable) you
|
2023-03-27 17:16:29 +02:00
|
|
|
can develop and see live changes of your Mezzotre on the fly. Finally, by using Postman, you can simulate incoming
|
2023-03-26 21:39:02 +02:00
|
|
|
Telegram events.
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
2023-03-27 17:16:29 +02:00
|
|
|
This software is under AGPL3+. You can find all details in the [LICENSE](LICENSE) file.
|