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
Syncthing is entirely the wrong thing to use.
Anyway what you are describing is possible but it will take some work. I think it is likely not worth the effort. However, I'll leave that up to you.
To do what you are describing you need to first have a way to send data back and forth between devices and then a way to shutdown and start containers.
To do this I would use Ansible. To start you are going to need to setup an Ansible service user on the server. Makes sure that it is configured so that it can run sudo without a password and is in the docker group. Once you have the service user you need to add it to the hosts file on your desktop.
Next, create two different playbooks. The first playbook will be the one that pulls the container over. First have it connect to the server and stop the container. Then have it run rsync to pull the data down to your local machine. Once the data is pulled have it start the container on your machine.
For the second playbook have it first stop the container on your desktop and then rsync the data over. Once the data is synced have it bring up the container on the server.
For safety you probably should add some check to make sure that you don't mistakenly run the wrong playbook. You should add a check to make sure that the container is really running where it is expected. It is pretty easy to have Ansible run a check.
You technically could do this will pure scripting but I wouldn't recommend it.
Ansible plugins:
https://docs.ansible.com/ansible/latest/collections/community/docker/docker_compose_module.html
https://docs.ansible.com/ansible/latest/collections/ansible/posix/synchronize_module.html
I've been wanting to start ansible, maybe this will push me over the edge