Kazino43 Posted January 11, 2023 Share Posted January 11, 2023 (edited) 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 January 11, 2023 by Kazino43 Quote Link to comment
Kazino43 Posted January 11, 2023 Author Share Posted January 11, 2023 Nevermind. Perhaps trying a bit more in terms of Variables would help! Solved it. Is is correct that the .env file for docker compose must be "copied" 1:1 (Paths, Variables, etc) in the unRaid Template? Quote Link to comment
ich777 Posted January 12, 2023 Share Posted January 12, 2023 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. Quote Link to comment
Kazino43 Posted January 21, 2023 Author Share Posted January 21, 2023 (edited) 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 January 21, 2023 by Kazino43 Quote Link to comment
ich777 Posted January 21, 2023 Share Posted January 21, 2023 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. 1 Quote Link to comment
Kazino43 Posted January 21, 2023 Author Share Posted January 21, 2023 Thanks! Yeah, it's not a perfect solution. Perhaps I am going to try implementing an external database, but I am nowhere near having all the necessary skills for that. Quote Link to comment
Kazino43 Posted April 10, 2023 Author Share Posted April 10, 2023 (edited) On 1/12/2023 at 8:30 AM, ich777 said: 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. Sorry, I have to ask once again. I did change my docker from .img to the folder structure, forgot about this container image being loaded manually and not via CA. Therefore in CA, I cannot restore it since the image is missing. Even building this image once again didn't help. Sitting here for almost 3 hours and not being able to solve this. What am I doing wrong? This repo shall be 'dockerized': https://github.com/0a1b/ebay-kleinanzeigen_enhanced My steps: Remove all self-tried container/images via GUI (include removing images) and/or 'docker image rm XXXX' Via the docker compose manager: New Stack Include the following adapted compose file (added local build path with deleted .env and compose.yaml, changed volumes to appdata, added bridge mode for network) services: version: '3' services: tg-bot: build: 'LOCAL/PATH/DOWNLOADED_GIT_REPO_WITHOUT_ENV_AND_COMPOSE_FILE' volumes: - /mnt/user/appdata/kleinanzeigen-crawler/sqlite:/app/jobs.sqlite ports: - "8444:8443" network_mode: bridge adapted from the original compose, which is the following: version: '3' services: tg-bot: build: . env_file: - .env volumes: - ./jobs.sqlite:/app/jobs.sqlite ports: - "8444:8443" and in the docker compose under the current stack copied the original .env with my credentials: # Token for the bot received from @BotFather TG_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXX # Domain name where the bot is hosted, needed for Telegram callbacks. No leading protocol, it should be accessible via # HTTPS # Example: domain.com HOST_URL= # Add non-empty value to enable debug # So far it affects only the mode of running bot, in Debug it's run in "polling" mode while in Production # it uses "webhook" mode. Thus, HOST_URL is not required for Debug. DEBUG=aa Update Stack, which it does exit fine and 'compose up' After that the following error occurs in the docker log: File "/app/main.py", line 16, in <module> 'default': SQLAlchemyJobStore(url='sqlite:///jobs.sqlite') File "/usr/local/lib/python3.8/site-packages/apscheduler/jobstores/sqlalchemy.py", line 60, in __init__ Column('id', Unicode(191, _warn_on_bytestring=False), primary_key=True), File "/usr/local/lib/python3.8/site-packages/sqlalchemy/sql/sqltypes.py", line 325, in __init__ super().__init__(length=length, **kwargs) TypeError: __init__() got an unexpected keyword argument '_warn_on_bytestring' Really don't know how I did it the last time around, anyone has a clue or can try it out by itself? I am somehow not able to install this docker in any way. It seems like it doesn't install as a docker, but installs the dependencies in the Unraid OS, which is realy bad, isn't it? Edited April 10, 2023 by Kazino43 Quote Link to comment
ich777 Posted April 11, 2023 Share Posted April 11, 2023 12 hours ago, Kazino43 said: Therefore in CA, I cannot restore it since the image is missing. You can restore it usually from the Docker page by clicking Add Container at the bottom and select it from the drop down. 12 hours ago, Kazino43 said: Even building this image once again didn't help. You have to rebuild it with the Docker file since it isn't hosted anywhere, after that you should be able to start it. 12 hours ago, Kazino43 said: It seems like it doesn't install as a docker, but installs the dependencies in the Unraid OS, which is realy bad, isn't it? No, it definitely doesn't do that, of course I would need some full log output but I think you are building the container with docker build . on Unraid and this will ultimately look like it will install it on Unraid itself but it doesn't. 12 hours ago, Kazino43 said: After that the following error occurs in the docker log: This seems like a configuration error to me, but also keep in mind that this repository was last updated 6 months ago and I really don't know if everything is working, maybe something is deprecated now and therefore you'll see this error but I could be wrong about that. Quote Link to comment
Recommended Posts
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.