nanos / FediFetcher

FediFetcher is a tool for Mastodon that automatically fetches missing replies and posts from other fediverse instances, and adds them to your own Mastodon instance.
https://blog.thms.uk/fedifetcher?utm_source=github
MIT License
313 stars 233 forks source link

Further improvement suggestion (and implementation) for systemd unit and timer files #171

Open ethereal-engineer opened 1 month ago

ethereal-engineer commented 1 month ago

I don't know how to submit a PR, so here are my files for your use for now.

# /etc/systemd/system/fedifetcher.service
[Unit]
Description=FediFetcher Service
After=network.target mastodon-web.service mastodon-sidekiq.service mastodon-streaming@<REPLACE_WITH_YOUR_PORT_NUMBER>.service

[Service]
Type=simple
User=mastodon
# WorkingDirectory is your checked-out FediFetcher repo directory
# I don't like having only case-seperate same paths, so this is mine
WorkingDirectory=/opt/fedifetcher/venv/FediFetcher 
# ExecStart must use the python binary created in the venv
ExecStart=/opt/fedifetcher/venv/bin/python3 find_posts.py -c=artifacts/config.json
# /etc/systemd/system/fedifetcher.timer
[Unit]
Description=FediFetcher Timer

[Timer]
# don't start until system has settled (adjust as you need)
OnBootSec=15min
# after the unit has run once, wait a minute, then run again (removes dependency on lockfile, I think)
OnUnitActiveSec=1min

[Install]
WantedBy=timers.target
nanos commented 1 month ago

Thanks for this!

A couple of comments please:

  1. I believe your WorkingDirectory and ExecStart directives don't match the rest of the guide. Can you please either adjust these, or (and maybe that is better, given the confusion of upper/lowercase directories) tell me about changes that would be needed for the rest of the guide to bring these inline?
  2. Your system files seem to indicate you are using the python venv. The current guide suggests in step 8 to disable the venv. Should that step be removed?

PRs to the Wiki can be filed here: https://github.com/nanos/FediFetcher-docs Apologies, I need to update the README file

Sir-Photch commented 1 month ago

I wrote a .service and .timer in the AUR package: https://aur.archlinux.org/packages/fedi-fetcher, down at "Sources".

Maybe this is useful to you