metube icon indicating copy to clipboard operation
metube copied to clipboard

Systemd & config file

Open evert-mouw opened this issue 3 years ago • 2 comments

Thanks, very handy! I've installed this in a vitual machine that handles my downloads.

Providing a systemd unit file (service) is easy, although you need root for the low port number. Changing the port number using env might be an idea? However I just changed it to my liking in the source. This unit file worked for me: metube.service

[Unit]
Description=MeTube downloader
After=network.target

[Service]
Type=simple
User=root
Group=root
EnvironmentFile=/etc/metube.conf
WorkingDirectory=/opt/metube
ExecStart=pipenv run python3 app/main.py

[Install]
WantedBy=multi-user.target

Note that I didn't care about security, hence the root user, but outside a VM this could be dangerous. Using the EnvironmentFile option enables a quick way to have a configuration file:

UID=2000
GID=2000
DOWNLOAD_DIR="/mnt/storage/MeTube"
STATE_DIR="/mnt/storage/MeTube/_state"

evert-mouw avatar Jul 08 '22 13:07 evert-mouw

Hey! Glad you like the software! :) Why not run in docker? Worth it even just for the automatic upgrades, which are pretty important for MeTube (otherwise your yt-dlp might cease to work..)

I'll leave the issue here for future reference to other people. Although I do recommend running it in Docker and setting up automatic upgrades. And if you choose to use systemd I'd recommend not running as root anyway. It's not that much effort, and you never know...

alexta69 avatar Jul 08 '22 17:07 alexta69

I'm too lazy and uninterested to try Docker. Having KVM already for isolation. As normal user it won't start due to port binding or something - tried net capabilities but failed. Well. I couldn't care less, the VM contains only public videos. And it's running in a local network without public interfacing. Having systemd service control is nice. For updating I'll use a git pull when needed. Good point though on yt-dlp... I've put a pip3 install --upgrade yt-dlp in my daily cron. I removed the add_metadata option, it doesn't work (I'm still used to the old youtube-dl). MeTube works great, especially with the FF addon. Nice!

evert-mouw avatar Jul 08 '22 20:07 evert-mouw