Selfhosted
A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.
Rules:
-
Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.
-
No spam posting.
-
Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.
-
Don't duplicate the full text of your blog or github here. Just post the link for folks to click.
-
Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).
-
No trolling.
Resources:
- selfh.st Newsletter and index of selfhosted software and apps
- awesome-selfhosted software
- awesome-sysadmin resources
- Self-Hosted Podcast from Jupiter Broadcasting
Any issues on the community? Report it using the report flag.
Questions? DM the mods!
view the rest of the comments
Just specaluting.. is it possible to mount NFS through systemd and make docker service dependent from that mount?
This is the answer. You can straight up make things dependent on .mount units that represent stuff in fstab. To add, you can create any number of systemd services that just check if something is "as you want it" and only then "start". You simply make the Exec line "/bin/bash -c 'your script here'". Then you make whatever else you want dependent on it. For example I have such a unit that monitors for Internet connection by checking some public DNS servers. Then I have services that depend on Internet connection dependent on that. Here's for example my Plex service which demonstrates how to depend on a mount, docker and shows how to manage a docker container with systemd:
BTW you can also do timers in systemd which allows doing what you can do with cron but much more flexibly and utilize dependencies too.
You can use
RequiresMountsFor=
(egRequiresMountsFor=/media/storage-volume1
) instead of manually adding.mount
toAfter
/Requires
- you can then use.mount
files or fstab as you're stipulating the path rather than a potentially changeable systemd unit name.The systemd.mount manpage also strongly recommends using fstab for human added mount points over
.mount
files.Oh this is nice. I'll probably start using it.
That's interesting! I've converted all my docker run commands to docker compose, as I found that easier to manage. But, I guess you can't do the dependencies like you have. Also, yours has the advantage it always pulls the latest.
Doesn't seem mutually exclusive. Replace the docker rm with compose down and the docker run with compose up.
Exactly. In fact I have a few multi-container services with docker-compose that I have to write systemd unit files for.
Perhaps you could also add the mounts as dependencies to the Docker daemon.
I think this is the way!
Sorry, I'm absolutely not a Linux expert :) I use /etc/fstab for the mounts, and to manually re-mount I run "mount -a".
This is a great opportunity to learn a bit of systemd then. Look at my other comment. I've had a nearly identical problem which prompted me to learn in order to solve it years ago.
Especially if you find a corner case autofs doesn't cover. ☺️
Awesome, yes, definitely will do. After years of using Linux, the whole systemd thing is still a bit of a black box to me. I know how to create /start/stop services etc but that's about it. Thanks for the prompt replies!