Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile #3

Closed
aacater opened this issue Dec 13, 2022 · 20 comments
Closed

Dockerfile #3

aacater opened this issue Dec 13, 2022 · 20 comments
Assignees
Labels
enhancement New feature or request

Comments

@aacater
Copy link

aacater commented Dec 13, 2022

I wiped up a quick Dockerfile if someone wants to use it: https://gist.github.com/aacater/6086b51732dfdd9a6ef0db6fa7d316d4

It is currently working. Although I have not tested it intensively.

Notes

Some minor bugs:

  • When copying commands from the UI, the hostname and port are not filled in, they are just left blank. For example I get ssh://bdd5588d@:/./repo1, when based on my environment variables it should be ssh://bdd5588d@localhost:2222/./repo1. I am unsure if this is related to the Dockerfile or the app.

  • I initially limited the borgwarehouse user's access to commands like in the docs. But then the scripts where getting stuck with sudo requiring a password. Too lazy to debug this at the moment.

Not currently implemented:

When the container is recreated all users are reset which means each repo's user is removed. createRepo.sh seems like it could easily be modified to create a user with a specific user and uid, instead of both being random.

Then entrypoint.sh could look at repo.json and recreate each user as needed. It would have to get the UID right so the user actually owned the relevant files. So maybe store UID in repo.json also? Or forget about having the correct UID and create a user with a random UID then chown to fix the repo's permissions. That seems like its more work though.

Feature Request:

I would like it if it was possible to set the config (./config/) and home (/var/borgwarehouse) directories using environment variables. This would allow entrypoint.sh to be simplified because /app/config/ would no longer be used in the container. Instead of creating the json files from hardcoded values, the script could copy files from /app/config/ to /config/ for example.

@Ravinou
Copy link
Owner

Ravinou commented Dec 13, 2022

Thank you for your work @aacater

I'm testing your dockerfile in the next few days.

@Ravinou Ravinou added the enhancement New feature or request label Dec 13, 2022
@Ravinou Ravinou self-assigned this Dec 13, 2022
@alex3305
Copy link

alex3305 commented May 9, 2023

Just out of curiosity. Is there any progress on this issue?

@Ravinou
Copy link
Owner

Ravinou commented May 9, 2023

Currently BorgWarehouse works with: a system user = SSH access in a jail, without shell and only with strict access to BorgBackup commands.

I haven't found a way to achieve user persistence in docker. Docker is not designed for that and so it's on pause right now on this topic because I don't know how to go further.

The problem is not to run BorgWarehouse as a webui in docker, the problem is the implementation of the system aspects in docker and especially the persistence of the created system users. I have the impression that there is no implementation of BorgBackup on Docker either which does not help.

@Pimmetje
Copy link

I have a docker image based on alpine linux i use for borgbackup. It's basically a alpine box with ansible & SSH. I have made it so that it will download a config from a configurable repo and build it's users/authorize_keys based on that and start the SSH server with borg. I have been using it for some time and this works for me.
I just found your project. Ill look into this if i can adopt this to make a POC for this project.

As a reaction to your "I haven't found a way to achieve user persistence in docker. ". Me neither i just recreate the users every time docker starts based on data i have. This way you don't need to persist them. You only need a database or config file and a init script :)

@alex3305
Copy link

I haven't found a way to achieve user persistence in docker. Docker is not designed for that and so it's on pause right now on this topic because I don't know how to go further.

What I see other, popular projects do is simply set user permissions on container startup. You let your users configure UID/GID when creating the container. In my experience (and on my system) that has worked great so far. And when it doesn't, it probably means that data is not for my backup container to read or backup, so I should look for alternatives. For instance a database data dump instead of reading shards.

Currently I'm running Vorta as a container and that works reasonably well. I run it on a potato so VNC feels sluggish. And things like restores are just really slow and tedious.

@Pimmetje Sounds wonderful. I also wanted to look into this. Even if it was only something to play with 😉.

@Ravinou
Copy link
Owner

Ravinou commented May 13, 2023

If any of you want to contribute to this task, I'm interested ☺. Personally, I don't have much time right now. But maybe the next few months.

@Pimmetje
Copy link

I was looking into it. If i have time ill make u a quick demo based on the current code but ill make it work not safe. That's for a later time :D

@Pimmetje
Copy link

I have created something based on alpine linux that build to a container. Ill see if i can testrun it in the next few days so i can post it here.

@Pimmetje
Copy link

I sent everyone in this issue a link to some quick & dirty POC i made. It's to dirty for my taste to make public :). I have not fully debugged/tested it. But it seem to create the users when u restart the container. That was the most important thing i wanted to show for now.

@sammcj
Copy link

sammcj commented May 21, 2023

Looking forward to seeing this, would be great to try this project out - but I didn't want to install nodejs etc on my servers OS when I have everything else running as a container. I suspect others will be in a similar boat so you might see an uptake in adoption once this is in!

@Pimmetje
Copy link

Pimmetje commented Jun 5, 2023

@Ravinou Did u have time to look at the POC?

@Ravinou
Copy link
Owner

Ravinou commented Jun 5, 2023

Hi @Pimmetje it's in my todolist. Sorry I haven't had time to test it but I will!

@shad-lp
Copy link

shad-lp commented Jun 11, 2023

Looking forward to seeing this, would be great to try this project out - but I didn't want to install nodejs etc on my servers OS when I have everything else running as a container. I suspect others will be in a similar boat so you might see an uptake in adoption once this is in!

A big uptake, because of that is typically something you'd like to run on a NAS.
And many as myself don't want to spin up a VM and allocate resources for something as lightweigh as BWH.

@Ravinou
Copy link
Owner

Ravinou commented Jun 11, 2023

Hi, @Pimmetje share to me a POC and I started testing it and giving him feedback.

@alex3305
Copy link

alex3305 commented Aug 5, 2023

I looked this over multiple times, but I couldn't find an easy way to make this work. Also when I tried to restore my latest Borg backup, which was created with Vorta, the backup was empty. That's why I have looked elsewhere and since than have migrated to kopia/kopia which seems to work a bit better for me.

Thanks again for all the effort and I hope you'll get things going! 🚀

@erpadmin
Copy link

have you considered a volume mount providing user info data file which has parseable format (ie csv: user,uid,gid,shell,etc whatever u need) and have the entrypoint script read and create the accounts?

@Pimmetje
Copy link

@erpadmin that is basically what i did (i used ansible). But than the backend need to change to just create a yaml and run updatescript everytime something changes. I think that is also better for the installed version. Makes it cross platform as a bonus.

@Ravinou
Copy link
Owner

Ravinou commented Aug 22, 2023

Hi, I'm currently working (after work or at weekends) on bringing BorgWarehouse and BorgBackup closer together, in more scrupulous compliance with their documentation on use as a central repository. (See #47 )

As a result, I'm working on v2, which will be a breaking change, but will enable us to move to single unix user management. This approach will make the BorgWarehouse back-end fully compatible with Docker.

Work in progress! Stay tuned!

@Ravinou
Copy link
Owner

Ravinou commented Oct 15, 2023

Hi, a major rewrite for Docker porting is coming to an end. I'm pretty proud of the many evenings and Saturdays I've spent working on BorgWarehouse, and I hope you enjoy this version.

You will find :

To give me strength, I can only invite you to consider github sponsor (one-time/monthly), and talk about BorgWarehouse. It keeps me going!

Have fun with docker 🚀

@Ravinou Ravinou closed this as completed Oct 15, 2023
@sammcj
Copy link

sammcj commented Oct 15, 2023

Wow this is exciting! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants