Rest-server with docker - restart automatically on boot

Hello! Thanks for restic. It is great!

Question about running a rest-server with Docker.

Currently, I have rest-server working on a stand alone box, using Caddy and docker rest-server but I need to make sure the docker starts up every time (and openvpn3 too but that’s another story!). The server will be located off site so it must be rock solid on every boot/power outage.

  1. Is it still maintained? Or should I try to compile it? Pros/cons? I’m a bit wary of compiling it because the instructions seem light on how to do this on github rest-server page but would be willing to give it a shot if you guys think it’s better in the long-run for me :smiley:

  2. How to make sure the docker rest-server is run on every reboot? Seems this problem would automatically go away if I compile it. hmmm…

Any advice on these two questions? or running rest-server on docker in general.

Thank you for any tips you guys can give me!

I’m not sure if you’re referring to rest-server or the Dockerfile for it, but yes, both are maintained. I’m not sure what you mean by “the instructions seem light on how to do this” - both how to build rest-server and how to build the Docker image is specifically detailed on that page…

This is actually outside the scope of restic or the Docker image. See this documentation on how to keep your container running across reboots: Start containers automatically | Docker Docs

If you use Docker Compose you can specify the restart policy in the docker-compose.yaml file as well (using the restart key/directive).

1 Like

Just to share my experience that might help others…

I had some problems with Wireguard & Rest-server on docker not cooperating on my Debian 10 server. I have now compiled rest-server with Go, and use /etc/rc.local to start it on boot. Works lovely! Don’t have so many Docker network interfaces to complicate things now.

Instructions for Dummies like Me on how to compile rest-server

  1. Read Download and install - The Go Programming Language then install Go compiler
  2. In terminal, git clone https://github.com/restic/rest-server.git
  3. In terminal, CGO_ENABLED=0 go build -o rest-server .rest-server/cmd/rest-server
  4. Move the rest-server binary you created to /usr/local/bin
  5. Go to your home directory and try rest-server to check it’s working.
  6. Read GitHub - restic/rest-server: Rest Server is a high performance HTTP server that implements restic's REST backend API. to see how to initialize rest-server
  7. Enable rc.local - systemctl status rc-local.service, if it doesn’t work How to Enable /etc/rc.local with Systemd - LinuxBabe

@arkadi There’s also an example systemd unit file for rest-server. It runs the rest-server as the www-data user (or any other user you configure; using rc.local probably ends up running the rest-server as root) and enables several other security related configuration options.

1 Like