Backing up Rhinvoice to Google Drive
Rhinvoice backs up to Google Drive through rclone, which is part of the backup container, with a Google OAuth client ID of your own. rclone’s shared client ID “is being retired and will stop working during 2026” (rclone.org/drive). Creating your own is free and takes about ten minutes. The backups are encrypted before they leave the machine.
Creating the client ID at Google
Section titled “Creating the client ID at Google”The menus of the Google Cloud console change now and then. If a name below is not where you look, follow the links and compare with rclone’s own steps.
- Create a project: console.cloud.google.com/projectcreate, any name, e.g. “Rhinvoice Backup”. In all following steps this project must be the one selected at the top of the page.
- Enable the Google Drive API: console.cloud.google.com/apis/library/drive.googleapis.com, Enable.
- Consent screen: console.cloud.google.com/auth/overview, Get started: an app name (e.g. “rclone”), your address as support e-mail, audience External, your address as contact, Create.
- Scope: console.cloud.google.com/auth/scopes, add
https://www.googleapis.com/auth/drive.file, Update, Save. With this scope the client only sees the files it creates itself, not the rest of your Drive. - Client: console.cloud.google.com/auth/clients, Create client, type Desktop app. Keep the client ID and the client secret at once, in a password manager. The secret is shown only now.
- Publish the app: console.cloud.google.com/auth/audience, Publish app. The status must read In production.
While the status is “Testing”, Google ends the access after seven days. The backups would stop a week later without anything having changed. An app for your own use needs no verification by Google. When logging in you accept the warning that the app is not verified.
Connecting the backup container
Section titled “Connecting the backup container”-
Allow access, on a computer with a web browser and rclone 1.75 or newer.
readkeeps ID and secret off the screen and out of the shell history:Terminal window read -rs CID # paste the client ID, press Enterread -rs CSECRET # paste the client secret, press Enterrclone authorize "drive" "$CID" "$CSECRET" --drive-scope drive.fileThe scope must be chosen when authorizing. Log in and allow access. The terminal prints a token: one line starting with
{"access_token":. -
Hand it to the backup container, on the server, in the Rhinvoice folder. If that is another machine, set
CIDandCSECRETthere the same way first:Terminal window read -rs TOKENdocker compose run --rm --no-deps backup rclone config create gdrive drive \client_id "$CID" client_secret "$CSECRET" scope drive.file \config_refresh_token false token "$TOKEN"unset TOKEN CID CSECRET -
Choose the folder in
.envand restart (docker compose up -d):RESTIC_REPOSITORY=rclone:gdrive:Rhinvoice-Backup -
Try it: wait until
docker compose logs backupshowswaiting for requests, then rundocker compose exec backup rhinvoice-backup backup. Settings → Backup shows the backup.
Let rclone create the folder. A folder you made yourself in the browser is invisible with drive.file: if RESTIC_REPOSITORY names such a folder, a second folder of the same name appears next to it.
Moving an existing backup to your own client ID
Section titled “Moving an existing backup to your own client ID”A backup container that logs NOTICE: … rclone's shared Google Drive client_id still uses the shared client ID. The new client does not see what the old one wrote. The backup container therefore creates a new, empty repository in a second folder of the same name. Since version 0.6.1 it backs up into a new repository at once.
Up to version 0.6.0 the container does not back up by itself after creating the repository. Until you start a backup by hand, there is no backup the installation can reach, while the dashboard still shows the last successful one.
Create the client ID and authorize as above, then on the server:
docker compose stop backupread -rs CID; read -rs CSECRET; read -rs TOKENdocker compose run --rm --no-deps backup rclone config delete gdrivedocker compose run --rm --no-deps backup rclone config create gdrive drive \ client_id "$CID" client_secret "$CSECRET" scope drive.file \ config_refresh_token false token "$TOKEN"unset TOKEN CID CSECRETdocker compose up -d backupdocker compose logs -f backup # wait for "waiting for requests"docker compose exec backup rhinvoice-backup backup # needed up to 0.6.0: the new repository is emptydocker compose exec backup rhinvoice-backup snapshotsdocker compose exec backup rhinvoice-backup checkThe NOTICE is gone from the log. The old folder with the earlier backups stays in your Drive. Delete it in the browser once the new backup is checked, or keep it until you have tried a restore.
Questions
Section titled “Questions”Why does Google Drive need a client ID of my own?
rclone's shared Google Drive client ID is being retired and stops working during 2026. A remote that still uses it logs a NOTICE on every backup. With your own client ID the backups keep working.
Why did my Google Drive backup stop after a week?
The Google app is still in the status "Testing". Google then ends the access after seven days. Publish the app so that its status reads "In production", and authorize again.
Can Google read my backups?
No. restic encrypts the backups before they leave the machine. Google Drive only stores unreadable blocks, and nobody can restore them without RESTIC_PASSWORD.
Why are there two folders of the same name in my Drive?
With the scope drive.file rclone only sees files it created itself with the same client ID. A folder you made in the browser, or one written with another client ID, is invisible to it, so it creates a second one.