Closed neondrift closed 3 years ago
I know very little about docker but ill add it to the list, if you/anyone would like to submit a PR that would be great as well.
If you can make it so that recordurbate stays in the foreground (and logs to stdout), I'll whip up a dockerfile in a few minutes.
Having logs printed to stdout when in foreground is practical for the way docker works. But if it's a pain, I can redirect it some other way.
I can make it run as it is right now, and watch the pid. But that would be an ugly solution.
@Suika I started working on one. It is messy. It currently builds but you have to start and stop the underlying process manually.
Uploaded it here: https://hub.docker.com/r/n30ndr1ft/recordurbate
Here's how far I got:
FROM python:alpine
VOLUME /opt/recordurbate/configs
VOLUME /opt/recordurbate/videos
ADD https://codeload.github.com/oliverjrose99/Recordurbate/zip/master /tmp/master.zip
RUN \
echo "**** install runtime packages ****" && \
apk update && \
apk add --nocache --upgrade \
ffmpeg \
tzdata && \
pip3 install --no-cache --upgrade \
pip \
requests \
youtube-dl && \
echo "**** install recordurbate ****" && \
cd /tmp && \
unzip master.zip && \
cd Recordurbate-master/recordurbate && \
# mkdir /opt/recordurbate/ && \
cp --force *.py /opt/recordurbate/ && \
chmod +x /opt/recordurbate/Recordurbate.py && \
cd configs && \
# mkdir /opt/recordurbate/configs && \
cp *.* /opt/recordurbate/configs && \
echo "**** configure logging ****" && \
ln -sf /dev/stdout /opt/recordurbate/configs/rb.log &&\
echo "**** cleanup ****" && \
rm -rf \
/tmp/* \
/var/tmp/*
CMD ["python", "/opt/recordurbate/Recordurbate.py", "start"]
I've debated writing an OpenRC init script to handle the start / stop?
https://github.com/LootScooper/docker-recordurbate works pretty much. Only thing is that it doesnt catch the SIGTERM signal so the the Bot.stop() method is not called when the container is stopped. Which is strange because according to this test it should work https://github.com/marians/python-docker-exit
I managed to fix the SIGTERM issue. The container is now fully working, the stop() function is being called when the container stops.
can you provide an image via docker hub?
You can build it yourself!
git clone https://github.com/LootScooper/docker-recordurbate.git
cd docker-recordurbate/recordurbate
docker build . -t recordurbate
Then you run it using:
docker start -d --restart unless-stopped -v your-config-folder:/data -v my-video-folder:/videos recordurbate
Make sure you copy config.json and youtube-dl.config to your config folder.
Make sure to change the uid in the dockerfile to match your system I had to change it to 0 so it could run as root otherwise it won't be able to make the folders
Uid 1000 is the uid of my user. I recommend changing it to the uid of your user and not root. Because running containers as root is not recomended although probably harmless in this case.
Yeah that was more of a frankenstein fix cause I was running into a lot of issues getting this to run
you managed to get it to work now?
Not really
what problems are you running into?
I fix that by putting into the same folder as requirment.txt and changing the location in the dockerfile I have the git hub clone to /home/main/Recorders/docker-recordurbate/
whereis ffmpeg ffmpeg: /usr/bin/ffmpeg /usr/local/bin/ffmpeg /usr/share/ffmpeg /usr/share/man/man1/ffmpeg.1.gz
ow im sorry i just noticed my ide didnt upload the ffmpeg binary when pushing to git. Should be fixed now.
I got it to work somewhat like before the logs says it is recording models. But I can't find any videos in my videos folder not even the .part files logs are working
are you using docker-compose?
No I used your commands from this post
I switch to docker-compose Attaching to recordurbate recordurbate | 2020-02-18 19:45:13,089 - smdl - INFO - Started to record angelika_rouge
No video yet
pip install youtube-dl says 2018 verison is already installed currently trying to update it for python3 to 2020 or 2019
ah oke the videos get saved in /videos in the container. So just mount /videos using
-v your/video/path:/videos
The way i intended to run this container tho is using docker-compose.
pip install docker-compose
git clone https://github.com/LootScooper/docker-recordurbate.git
cd docker-recordurbate
then you edit the docker-compose.yml with an editor of your choice. And change " - /srv/sto1/recordubate:/videos" on line 9. You need to change "/srv/sto1/recordubate" to your video path. Then you run:
docker-compose up
Or if you want to run your container detached (In the background)
docker-compose up -d
The hole pip thing was probably a move of desperation I realize that it didn't matter
My config was wrong as it needed to point to /videos/ I kept using my old youtube-dl config.
The last issue was that I was letting the docker container make the folder. That usually okay with the linuxserver dockers I run. However after player around with docker exec dockername youtube-dl it's clear that the folder has to exist before you run the docker otherwise it doesn't have the right permissions or something
Ah yes, The Linux Server images are a bit more user friendly. The reason why you need that mountpoint to work is because /video doesnt exists in the image. It gets created when you create that mountpoint. Since i intended this to be used with docker-compose it is already implied in the docker-compose.yml
A docker container would be really cool. Specifically with env variables for the config folder and the download folder, auto updating (ffmpeg, youtube-dl, recordurbate), etc.