Telegram/Kleinanzeigen notifier: DIY Docker from Dockerfile / Github


Recommended Posts

Hi,

 

dislcaimer: noobie here! ;)

 

I wanted to install a new container (notifying me of new
rental apartments) which does not exist in CA/Dockerhub. There is only a Github Repo with a Dockerfile: https://github.com/0a1b/ebay-kleinanzeigen_enhanced

 

From what I found out, there is a way to create a container via a dockerfile like in this casein unRaid. 

 

1. clone/download the full repo

2. (in this case) add the Telegram-Bot-Token as well as any kind of character to "DEBUG=" in the .env file.

3. in the unRaid-GUI open the console:

3.1 cmd: "docker build -tag TAG:NAME /mnt/way/to/folder

4. So far it did create the image successfully: " Successfully built 9be18592bca2 // Successfully tagged kleinanzeigen:bot"

5. Add a Container via GUI and select the TAG:NAME as the repo

 

The only problem I have right now is if I did everything right, because it seems like there is something missing. In container-log-window it mentions some errors regarding the telegram-token handeling it seems: 

 


Traceback (most recent call last):
File "/app/main.py", line 187, in <module>
main()
File "/app/main.py", line 156, in main
updater = Updater(bot=utils.get_bot(), use_context=True)
File "/app/utils.py", line 18, in get_bot
return Bot(token=os.getenv("TG_TOKEN"), request=request)
File "/usr/local/lib/python3.8/site-packages/telegram/bot.py", line 194, in __init__
self.token = self._validate_token(token)
File "/usr/local/lib/python3.8/site-packages/telegram/bot.py", line 353, in _validate_token
if any(x.isspace() for x in token):
TypeError: 'NoneType' object is not iterable
Traceback (most recent call last):
File "/app/main.py", line 187, in <module>
main()
File "/app/main.py", line 156, in main
updater = Updater(bot=utils.get_bot(), use_context=True)
File "/app/utils.py", line 18, in get_bot
return Bot(token=os.getenv("TG_TOKEN"), request=request)
File "/usr/local/lib/python3.8/site-packages/telegram/bot.py", line 194, in __init__
self.token = self._validate_token(token)
File "/usr/local/lib/python3.8/site-packages/telegram/bot.py", line 353, in _validate_token
if any(x.isspace() for x in token):
TypeError: 'NoneType' object is not iterable

 

I added everything (token as well as a not-empty-value behind "DEBUG=") in the ".env"-file from the repo. But it seems like it either doesn't recognize the .env file (do I need to add some paths in the Template while adding the container?) or it is limitied in connecting to the telegram servers (the container is set to "Network type: Bridge".

 


I would appreciate any help. Sitting here for the last 5 hours trying everything and kind of giving up at this moment. :(  

Edited by Kazino43
Link to comment
9 hours ago, Kazino43 said:

Is is correct that the .env file for docker compose must be "copied" 1:1 (Paths, Variables, etc) in the unRaid Template?

I don't understand...

Do you want to run this through the Docker Compose plugin for Unraid or do you want to use a Unraid Docker template, from what I saw, both is possible.

Link to comment
  • 2 weeks later...
On 1/12/2023 at 8:30 AM, ich777 said:

Do you want to run this through the Docker Compose plugin for Unraid or do you want to use a Unraid Docker template

 

Thanks for your answer!

I would want to use the Unraid Docker template.

As far as I got, all variables/path in the .env file of the docker compose need to be copied to a Unraid docker template, in this case:

  • TG_TOKEN=
  • HOST_URL=
  • DEBUG=

I did that and it works nicely. But there is one problem I am facing:

 

Since the docker container doesn't seem to store it's data in persistency, see main.py:

# TODO: re-enable SQLite storage for persistency

the docker shouldn't get turned off/paused in Unraid. Otherwise it looses the "last chat_id" and stops working.

 

As I had to find out, "CA Appdata Backup" stops all Containers, therefore also this one, which destroys it's functionality. Is there any way to exclude certain docker containers from being paused by "CA Appdata Backup"? Otherwise this will not work, at least in the current state of the github repo.

Edited by Kazino43
Link to comment
8 minutes ago, Kazino43 said:

"CA Appdata Backup" stops all Containers

You can disable that for individual container at the bottom in the settings page, I think you have to click Advanced or something like that and set the toggle switch to Don't Stop.

 

Anyways, that's a real bummer, can't you just use a external database? Is that an issue that will be fixed soon or will this take "forever"? Keep in mind the Docker will be also stopped on a Container Update or Reboot from Unraid.

  • Like 1
Link to comment
  • 2 months later...
On 1/21/2023 at 11:54 AM, ich777 said:

You can disable that for individual container at the bottom in the settings page, I think you have to click Advanced or something like that and set the toggle switch to Don't Stop.

 

Anyways, that's a real bummer, can't you just use a external database? Is that an issue that will be fixed soon or will this take "forever"? Keep in mind the Docker will be also stopped on a Container Update or Reboot from Unraid.

Wanted to exclude a certain container besides that one but on 6.12 rc the "APPLY" button is grey so that I can not apply any changes made in the Appdata Backup/Restore v2 menu. I know that v2.5 should be used with 6.12, but it seems like it is not shown in CA because of its beta status. 

 

Anyone know why the menu doesn't allow me to apply changes?

 

 

not_able.PNG

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.