This Bot can send beautiful photos of the day from NASA.
Bot is deployed to Heroku and available in telegram --> NasaPhoto Telegram Bot
Deployment process as easy as possible: Required software:
- terminal for running bash scripts
- docker
- docker-compose
- directories for environments:
-
<root project>/jrtb-bot.env
🗝️File contents:
- BOT_USERNAME=<username value> - BOT_TOKEN=<token value> - BOT_DB_USERNAME=<db username> - BOT_DB_PASSWORD=<db password>
-
<root project>/jrtb-db-prod.env
🗝️File contents:
- MYSQL_DATABASE=<db name> - JDBC_DATABASE_USERNAME=<db username> - JDBC_DATABASE_PASSWORD=<db user password> - MYSQL_ROOT_PASSWORD=<root password>
to deploy application, switch to needed branch and run bash script:
$ bash start.sh
That's all.
For local development and testing, use docker-compose-test.yml
.
Run command:
docker-compose -f docker-compose-test.yml up
Next step, is to run SpringBoot app with configured Edit Configuration in which five env vars are provided:
bot.token=${token}; bot.name=${username}; nasa.api_key=${api_key}; spring.datasource.username=${db_username}; spring.datasource.password=${db_password}
File for environments <root project>/jrtb-db-dev.env
🗝️File contents:
- MYSQL_DATABASE=<db name>
- JDBC_DATABASE_USERNAME=<db username>
- JDBC_DATABASE_PASSWORD=<db user password>
- MYSQL_ROOT_PASSWORD=<root password>
And add VM Options:
-Dspring.profiles.active=test
With these configurations - run SpringBoot main method.
- SpringBoot as a skeleton framework
- Spring Scheduler as a task manager
- MySQL database as a database for saving user and subscription info
- Flyway database migration tool
- Telegram-bot SpringBoot starter
- Spring Data starter