Skip to content
Projets

À propos

Bitwarden installation optimized for Google Cloud's 'always free' e2-micro compute instance

Systèmes et infrastructure

Comment ces chiffres sont mesurés

Progression mesurée des étoiles

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
Historique en cours

Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.

README.md

Original

Bitwarden self-hosted on Google Cloud for Free

Vaultwarden on a Google Cloud e2-micro, within the Always Free tier. Works with every official Bitwarden client.

  • HTTPS with no manual certificate renewal
  • Scheduled backups, optionally encrypted, to disk, e-mail or cloud storage
  • Weekly check for stopped backups and unsupported OS milestones
  • Vault data on its own persistent disk, so OS upgrades are a disk reattach

Free on the Caddy path while egress stays under 1 GB per month and away from China and Australia, the two destinations Google's free tier excludes (countryblock blocks those and Hong Kong by default). The Cloudflare Tunnel path costs a little every month: see Connectivity.

New install

Installation.

Existing deployment

Your vault, your .env and your data are untouched by a pull.

watchtower, which applies image updates, moves to the maintained nickfedor/watchtower image and runs by default. The old containrrr/watchtower is abandoned and does not work with current Docker releases, so an older deployment may have had no image updates for some time. One pull and docker-compose up -d brings them back. To have watchtower report updates without applying them, set WATCHTOWER_MONITOR_ONLY=true in .env.

On the data disk, the stack closes the deployment and .env to other local users before every start. See Keeping the deployment private.

Everything else below is opt-in.

Goal Page
(Required for the next steps) Move vault data off the boot disk. Migrating to a Data Disk
(Recommended) Replace an unsupported OS milestone Upgrading Container-Optimized OS
Close ports 80 and 443 and retire four containers, in exchange for a small monthly egress charge Switching to a Cloudflare Tunnel

Connectivity

Caddy is the default and the recommended path. The tunnel is a supported alternative that is not free.

Caddy (default) Cloudflare Tunnel
Monthly cost on the free tier none: egress within the allowance, countryblock keeps the non-free destinations off the bill small but non-zero: every byte the vault sends is carrier-peering egress, about $0.10 to $0.20 a month observed for one user
Ports open to the internet 80 and 443 none
TLS terminates at the instance Cloudflare's edge
DNS A record maintained by ddns CNAME created by the tunnel
Instance address changes unreachable until DNS updates no effect
Maximum attachment size unlimited 100 MB
Containers 6 3

On the tunnel path Cloudflare decrypts traffic at its edge. Vault contents are encrypted client-side before transmission; metadata and authentication traffic are not.

What the free tier includes for network traffic

From Google's free tier page and network pricing, checked September 2026. Google changes both, so check them before you rely on a number here.

  • 1 GB per month of outbound data transfer from North American regions to all destinations except China and Australia. Those two are billed from the first byte, which is what countryblock exists to prevent on the Caddy path.
  • The allowance is per billing account, not per project or per instance.
  • Data transfer to networks Google reaches by Direct or Carrier Peering is a separate SKU, "Network Data Transfer Out via Carrier Peering Network", with no free allowance. Cloudflare's edge is such a network, so on the tunnel path every byte the vault sends (client syncs, web vault assets, cloudflared keepalives) is billed. On the Caddy path responses go to your clients' ISPs as ordinary internet egress, inside the allowance.
  • The same charge applies on the Caddy path if the DNS record is proxied through Cloudflare (the orange cloud). Keep it DNS-only: see DDNS.
  • Inbound data transfer is free, and so is data transfer to Google services.

Observed on one deployment with one user, September 2026: 1.37 GiB on the SKU "Network Data Transfer Out via Carrier Peering Network - Americas Based", $0.11, which is about $0.08 per GiB, while every other line on the bill netted to zero. To check your own: Billing, Reports, group by SKU, and look for "Carrier Peering".

How your vault is reached.

Documentation

Installation Build from nothing
Cloud Shell Setup Environment assumed by every other page
Backup Configuration and restore
Operations Secrets, image updates, log growth, SSH, resource limits
Migrating to a Data Disk Move the vault off the boot disk
Upgrading Container-Optimized OS Replace the OS, keep the data
Switching to a Cloudflare Tunnel Move to a tunnel, or back to Caddy
Instance Metadata Contents of the cloud-config

Feature Container Projects

Containers maintained in other projects. Report issues there.

  • Backup - automatic backup services
  • Caddy - reverse proxy and TLS certificate renewal
  • Countryblock - IP Tables block lists by country

cloudflared, ddclient and fail2ban come from cloudflare/cloudflared, linuxserver/ddclient and crazymax/fail2ban, and are not maintained here.

Changelog

Unreleased

  • 4 November 2026: watchtower runs by default again, so image security updates apply without anyone logging in. It was briefly opt-in behind a compose profile; a deployment that set COMPOSE_PROFILES=watchtower keeps working, and WATCHTOWER_MONITOR_ONLY=true turns updating off

  • 29 September 2026: Caddy is the recommended path again, and the tunnel is a documented alternative. Google bills egress to Cloudflare's edge on the carrier-peering SKU ("Network Data Transfer Out via Carrier Peering Network"), which has no free allowance, so a tunnel deployment is not free: about $0.10 a month for one user, scaling with traffic. Nothing in the compose files changes; COMPOSE_FILE still selects the tunnel, and a deployment on either path keeps working as it did. See Connectivity

  • Cloudflare Tunnel was made the default for new installs (reversed above). COMPOSE_FILE in .env selects it; proxy, ddns, countryblock and fail2ban do not run on that path. Existing Caddy deployments are unaffected until they set it

  • Vault data moves to its own persistent disk (utilities/migrate-to-data-disk.sh), and OS milestone upgrades become a disk reattach (utilities/upgrade-cos.sh)

  • Startup moves to cloud-init: bwgc.service starts the stack once the data disk is mounted, and bwgc-supervise.timer restarts what stops

  • On the data disk the stack closes the deployment and .env to other users before every start, and the migration and upgrade scripts do the same

  • Security headers in caddy/Caddyfile now apply to every path. The header / matcher was an exact match, so /admin and /api/* were served without X-Frame-Options and X-Content-Type-Options

  • watchtower was made opt-in behind a compose profile, with renovate.json as the reviewed replacement (reversed above)

  • Removed the Docker socket mount from backup; restore now needs the operator to stop bitwarden first

  • Removed privileged: true from countryblock; NET_ADMIN and NET_RAW are sufficient

  • Narrowed the fail2ban mounts: dropped the host-wide /var/log mount

  • Added mem_limit and pids_limit to every service

  • Added a systemd timer that applies staged COS updates; deprecated utilities/reboot-on-update.sh in favour of it

2.0.3 - 21 May 2025

  • Added backup restore feature to backup image, documented

2.0.2 - 7 November 2023

  • Improve fail2ban SMTP env variable documentation in .env.template (#79)
  • Update IP Header env var (#77)
  • Push fail2ban logs to STDOUT / docker logging
  • Update docker-compose to latest version (#76). Requires manual updating of ~/.bash_alias with the following command:
$ docker-compose version
$ sed -i "s|docker/compose|docker compose|g" ~/.bash_alias
$ source ~/.bash_alias
$ docker-compose version

2.0.1 - 25 October 2023

  • Update backup option to include .env for full restoration. Off by default. Please encrypt your backup if including .env
  • Starting new versioning/tagging system to keep track of changes. Arbitrarily starting after 2.0, which was the fully modular approach.

3 April 2023 Alert: Recent changes to Vaultwarden may cause Vaultwarden to fail to start due to default environmental variables. .env.template has been updated in this repo, however, if you are affected, you must also update .env and comment out all YUBICO_* variables, so that they appear as:

#YUBICO_CLIENT_ID=
#YUBICO_SECRET_KEY=
#YUBICO_SERVER=

Restart with docker-compose, and Vaultwarden should come up as normal. Credit to @AySz88 for reporting this.

Explorer des projets similaires

Chargement…