I wrote the simplest bot on JAVA for Telegram and I want to upload it to Heroku. Follow the instructions on the official website

$ heroku login $ git clone https://github.com/vladPiyrwaf/my_first_telegram $ cd my_first_telegram $ heroku create $ git push heroku master 

At the end displays the following message: Verifying deploy ... done. And it seems that it doesn’t give out any errors and the program is fixed, but it doesn’t work. And I don't know what the problem is

Here is a link to the project that I am trying to embed: https://github.com/vladPiyrwaf/my_first_telegram

Here is what I write in the Procfile:

 worker: java -jar target/recollect-bot-1.0-SNAPSHOT.jar com.recollect.Bot 

Here is what I have in pom.xml:

  <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>my_first_telegram</groupId> <artifactId>my_first_telegram</artifactId> <version>1.0-SNAPSHOT</version> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>appassembler-maven-plugin</artifactId> <version>1.1.1</version> <configuration> <assembleDirectory>target</assembleDirectory> <programs> <program> <mainClass>vlad.telegram.bot.ver1.Bot</mainClass> <name>workerBot</name> </program> </programs> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>assemble</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>com.heroku.sdk</groupId> <artifactId>heroku-maven-plugin</artifactId> <version>2.0.6</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>7</source> <target>7</target> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>org.jsoup</groupId> <artifactId>jsoup</artifactId> <version>1.7.2</version> </dependency> <dependency> <groupId>org.telegram</groupId> <artifactId>telegrambots</artifactId> <version>3.6</version> </dependency> </dependencies> </project> 

UPD: Thanks to the people from the comments, I was able to shut the bot. The command $ heroku ps:scale web=1 indicates that the application instance is working, but the bot itself in the telegram does not respond to any commands.

The $ heroku logs --tail only shows:

 2019-02-08T21:46:10.352680+00:00 heroku[web.1]: Process exited with status 1 
  • one
    It's time to check that in the logs. - Sergey Gornostaev
  • This web command works for me: java -Dserver.port = $ PORT -jar target / blablabla.jar. the port argument must be specified, plus not the worker, but the web must be specified. Also, I have locally installed a heroku and there is nothing in the skullcap, respectively. You should also check the logs using the heroku logs -t command. - Andrii Torzhkov February
  • @AndriiTorzhkov turned out to botch the bot, shows that one copy of the program is working, but the bot itself is not responding. But I left the port, as you wrote $ PORT - Vlad Gorbunov
  • That is, the deployment problem was solved, and now the problem is in the program? - Andrii Torzhkov February
  • @AndriiTorzhkov Honestly, I don’t really understand what the problem is. Moreover, in heroku it says that the program is compiled and there are no errors. - Vlad Gorbunov

1 answer 1

  1. Build the project "mvn package";
  2. Scripts should appear in the folder \ target \ bin
  3. You have specified workerBot in pom.xml, so write in Procfile: "worker: sh target / bin / workerBot";
  4. The type of the process "worker" in Procfile is indicated if the bot uses Long Polling, if Webhook, then the entry is different.
  5. Further according to the instructions on the website heroku.
  • Thanks, all worked well! - Vlad Gorbunov