Storage bridge: copy your bucket files into Google Drive

storage-bridge watches a folder of an object storage bucket (S3, CWCloud object storage, minio, Scaleway...) and copies every new file into a Google Drive folder. A typical use case is an application generating invoices or reports in a bucket, that your accountant or your team only reads in Google Drive.
It's written in Go (since the 2.0.0 version, it was previously a Python/Flask app: the environment variables, the healthcheck and manifest endpoints and the Redis cache didn't change, so upgrading is transparent) and comes with:
- a Swagger UI and an OpenAPI documentation
- Prometheus metrics
- logs, traces and metrics through OpenTelemetry
- Discord (or Slack) notifications
- a correlation id (
X-Cid) in every response, log line and notification
Git repositoriesβ
- Main repo: https://gitlab.comwork.io/oss/storage-bridge
- Github mirror: https://github.com/comworkio/storage-bridge.git
Image on the dockerhubβ
The image is available and versioned here: https://hub.docker.com/r/comworkio/storage-bridge (x86/amd64 only, tags latest, <version> such as 2.0.0, latest-x86, <version>-x86).
How it worksβ
Every WAIT_TIME seconds, storage-bridge lists the files of the BUCKET_FOLDER folder (recursively) and uploads each file which wasn't uploaded yet into the Google Drive folder.
The uploaded files are kept in Redis (key: the file name, value: the Google Drive file id) during REDIS_TTL seconds, so they're not uploaded twice. A file which failed to upload isn't cached, so it's retried on the next scan.
BUCKET_FOLDER can be dynamic: with YYYY-MM, the current month folder is scanned (i.e. 2026-12/).
Prepare the Google Drive accessβ
- Enable the Google Drive API in your Google Cloud project
- Go to credentials, then click Create Credentials > Service Account

- Create a key for this service account, choose the JSON format, and encode the downloaded file in base64:
base64 -w0 key.json # on macOS: base64 -i key.json

- Copy-paste the base64 content in the
GOOGLE_SA_B64environment variable - Create a folder on Google Drive and share it with the service account email as editor:

- Copy-paste the folder id (the last part of the folder URL,
https://drive.google.com/drive/folders/<folder id>) into theGOOGLE_DRIVE_FOLDER_IDenvironment variable
Run it with docker composeβ
Create a storage_bridge.env file:
LOG_LEVEL=INFO
WAIT_TIME=3600
DISCORD_TRIGGER=on
DISCORD_TOKEN=changeit
DISCORD_USERNAME=storage-bridge
BUCKET_URL=s3.fr-par.scw.cloud
BUCKET_REGION=fr-par
BUCKET_ACCESS_KEY=changeit
BUCKET_SECRET_KEY=changeit
BUCKET_NAME=invoices
BUCKET_FOLDER=YYYY-MM
GOOGLE_SA_B64=changeit
GOOGLE_DRIVE_FOLDER_ID=changeit
REDIS_HOST=storage-bridge-redis
REDIS_PORT=6379
REDIS_TTL=2678400
And a docker-compose.yml file:
services:
storage-bridge:
image: comworkio/storage-bridge:latest
restart: always
container_name: storage-bridge
env_file:
- storage_bridge.env
networks:
- storage-bridge
ports:
- 8080:8080
storage-bridge-redis:
image: redis:6.2.6
restart: always
container_name: storage-bridge-redis
networks:
- storage-bridge
volumes:
- storage-bridge-redis:/data
volumes:
storage-bridge-redis:
networks:
storage-bridge:
driver: bridge
Then:
docker compose up -d
Environment variablesβ
| Variable | Description |
|---|---|
LOG_LEVEL | log level (DEBUG, INFO, WARN, ERROR), also the minimum level of the notifications |
LOG_FORMAT | json (default) or text |
WAIT_TIME | wait time between two scans in seconds (i.e: 3600 for one hour) |
BUCKET_URL | object storage endpoint (host[:port], HTTPS by default, prefix it with http:// to disable TLS) |
BUCKET_REGION | object storage region code |
BUCKET_ACCESS_KEY | object storage access key |
BUCKET_SECRET_KEY | object storage secret key |
BUCKET_NAME | bucket name |
BUCKET_FOLDER | folder to scan; YYYY-MM for the current month folder; empty for the whole bucket |
BUCKET_TMP_DIR | download directory (default: /tmp/bucket_files) |
GOOGLE_SA_B64 | google service account JSON key encoded in base64 |
GOOGLE_DRIVE_FOLDER_ID | id of the Google Drive target folder |
REDIS_HOST / REDIS_PORT | redis server |
REDIS_TTL | retention of the uploaded files in the cache, in seconds (i.e: 2678400 for 31 days) |
DISCORD_TRIGGER | enable/disable the notifications (on or off) |
DISCORD_TOKEN | Discord webhook token (the part after https://discord.com/api/webhooks/) |
DISCORD_TOKEN_PUBLIC | optional second Discord webhook for the public notifications |
DISCORD_USERNAME | Discord username |
SLACK_TRIGGER, SLACK_TOKEN, SLACK_TOKEN_PUBLIC, SLACK_CHANNEL, SLACK_USERNAME, SLACK_EMOJI | same for Slack |
STORAGE_BRIDGE_VERSION | the deployed version, displayed in the deployment notification |
LISTEN_ADDR / LISTEN_PORT | HTTP listening address and port (default: 0.0.0.0:8080) |
Notificationsβ
When DISCORD_TRIGGER is on, storage-bridge sends a Discord message for each log at least at the LOG_LEVEL level: the deployment, the bucket listings, every uploaded file, the warnings (bucket or Google Drive misconfigured) and the errors. Each message ends with the correlation id (cid) of the scan, which you can search in the logs.
APIβ
The Swagger UI is served on the root endpoint (http://localhost:8080/) and the OpenAPI document on /openapi.json.
$ curl localhost:8080/v1/health
{"status":"ok","alive":true}
$ curl localhost:8080/v1/manifest
{"arch":"x86","sha":"1c7cb1f","version":"2.0.0"}
The /health and /manifest routes are also available without the /v1 prefix and with a trailing slash.
Every response carries an X-Cid header: the one you sent, or a generated one. On a server error, the API only answers a generic reason with this cid; the real cause is in the logs and in the Discord notification with the same cid.
Observabilityβ
Prometheusβ
The metrics are exposed on /v1/metrics (and /metrics):
storage_bridge_scans_total{status}: bucket scans (okorerror)storage_bridge_files_uploaded_total: files uploaded to Google Drivestorage_bridge_files_skipped_total: files skipped because already uploadedstorage_bridge_upload_errors_total{step}: failures per step (download,upload,cache)storage_bridge_last_scan_timestamp_seconds: unix time of the last finished scanhttp_server_requests_totalandhttp_server_request_duration_secondsperroute,methodandstatus- the Go runtime and process metrics
A simple alert to know the bridge is stuck:
time() - storage_bridge_last_scan_timestamp_seconds > 2 * 3600
OpenTelemetryβ
Logs, traces and metrics can be pushed to an OpenTelemetry collector (for example the Quickwit as a service one):
| Variable | Description |
|---|---|
OTEL_COLLECTOR_ENDPOINT | collector endpoint (host:port or URL, i.e: otel-collector:4317); disabled when empty |
OTEL_COLLECTOR_PROTO | otlp/grpc (default) or otlp/http |
OTEL_COLLECTOR_TLS_CHECK | true to use TLS (default: false) |
OTEL_COLLECTOR_USERNAME / OTEL_COLLECTOR_PASSWORD | optional basic authentication |
OTEL_COLLECTOR_AUTH_HEADER | optional raw Authorization header (i.e: Bearer xxx) |
Each scan is a trace (storage-bridge-scan) with a span per file (storage-bridge-file) and the S3 / Google Drive HTTP calls as children, and every log line carries the cid, trace_id and span_id.