autorestic
                                
                                 autorestic copied to clipboard
                                
                                    autorestic copied to clipboard
                            
                            
                            
                        Update the version of restic in the docker image
Hi, I've spent more time than I would like to admit trying to get working the negative include of restic on the docker image until I figured out that the latest tag contains the version 0.12.1 of restic that does not have this feature yet.
I tried some things, and actually just rebuilding the 1.7.1 image would update the version of restic to 0.13.1 because the base image in the dockerfile is untagged alpine, so rebuilding now means using the latest version.
Now I'm not sure it would be considered very good practice to rebuild an existing tag to update the binary in it, it might cause some problems to some users.
If you need help to lock some versions in the dockerfile, I would be happy to contribute.
This is an issue.
Probably the best way would be to build the docker image daily in github actions using the latest stable restic. Optimally only if there is a new restic version. RN restic is installed as an alpine package, so one could check there.
What are your thoughs?
Probably the best way would be to build the docker image daily in github actions using the latest stable restic.
This could be risky. The day restic releases a breaking change (it would probably not happen due to the size of project but as it has not reached 1.0.0 yet, a minor patch could theoretically have breaking changes), the daily build could create a broken image which could mean no backups for users. This is even more a problem for the fully tagged image (with the format X.X.X) as the users using this format usually expect the image to be always the same (not even updated dependencies).
To stabilize the restic version, it should be fixed in the dockerfile, but that raise other problems. An update of restic would update the dockerfile, which would normally create a new image with a new tag. Now I see three ways to create a new tag:
- Bump the version of autorestic, but that would create some noise in the releases and for the users that don't use docker and for basically nothing. Not ideal.
- Bump the patch version of only the docker tag, that would decorrelate the patch version of autorestic and its image. Not ideal.
- Add the restic version as a suffix of the tag when there is an update. The new tags would look something like this 1.7.1-restic0.13.0. Of course the tag1.7.1should still be created during a release but not updated if a new version of restic is released. I think this solution could be a good compromise.
Here are some ideas to control the version of restic:
- Fix the installed version with something like this : apk add restic=0.13.1
- Use the officially distributed restic image as a base of the autorestic image (dockerfile)
I think the second option could be easier to integrate to an update manager, like Dependabot or Renovate.
What do you think ?
Actually there is a problem with the suffix solution, the autorestic version part of the tag would be inaccurate, as the image would be built on master and not on the tag linked to the version. It doesn't seem the best idea.
Maybe the first solution is better after all as restic doesn't release that often, if you don't mind a patch release every restic release of course. And it requires only a little change to the Dockerfile.
Just did a quick POC if you want to have a look : https://github.com/TGuimbert/autorestic.
I updated the Dockerfile with the restic/restic image as a base and enable Dependabot for docker, The restic/restic version I added is late of a patch, so you can already see the pull request to update it.
I'm running into an issue that may be from the same underlying issue. I installed autorestic via homebrew and it picked up the most recently released restic 0.14 (which includes compression!). I am able to initialize a restic repo. But when I go to back it up I am backing up a docker volume, and this is running the autorestic docker image which is on a different version of restic. The result is that my backup fails with this error, presumably because my local install has a different and incompatible version of restic.
1.7.1: Pulling from cupcakearmy/autorestic
Digest: sha256:xxxx
Status: Image is up to date for cupcakearmy/autorestic:1.7.1
Fatal: Fatal: config cannot be loaded: unsupported repository version
1.7.1: Pulling from cupcakearmy/autorestic Digest: sha256:xxxx Status: Image is up to date for cupcakearmy/autorestic:1.7.1 Fatal: Fatal: config cannot be loaded: unsupported repository version
Can confirm that a clean install today of autorestic via homebrew results in a setup where a location type volume doesn't work because the os installed restic 0.14 is now incompatible with the version in this project's Dockerfile.
A couple of ideas on how to address this:
- 
Provide a way to override which docker image is used so that it isn't hard-coded: https://github.com/cupcakearmy/autorestic/blob/6990bf6adc200e7e5a38e76e8f07c4060d3650f1/internal/backend.go#L197 
- 
Provide multiple images, tagged with their restic versions for some set of supported restic versions. Then have autorestic pull a version that matches what is currently installed on the host OS. 
Option 1 is the easier way out but would require users to build and maintain their own images. Option 2 could be hard to manage from a build/release engineering perspective. For now I'm probably going to hack up Option 1 for my use case.
Also +1 for the approach @TGuimbert took with using the restic image as the base image for this one.
In case anyone is looking for specific instructions to work around this issue. I was able to work around the unsupported repository version error by adding a RUN command to use Restic's self update feature (restic self-update) inside the Dockerfile and publishing the image to Dockerhub.
Rebuilt the autorestic binary, using @cheradenine 's patch, specifying my Dockerhub image and the backup works fine.
./autorestic_1.7.2_linux_amd64 --docker-image jaidenx/autorestic:latest backup -a
Not ideal for a long term solution, but hope this helps someone who just needs to use the latest version of restic. Thanks to @cheradenine for the patch.
I worked around this within a cron script. I'm already running autorestic with a 15min crond, so I added autorestic upgrade before that. That way I can keep using the cupcakearmy image and still get the latest everything.
thanks @TGuimbert I've integrated the changes and dependabot, should work better in the future. I'll close as soon as there is a new release