Skip to content

History / Cloud Shell Setup

Revisions

  • Bring the wiki in line with v3.0.0 and the major image tags Read every page against v3.0.0 and master (bitwarden_gcloud #114-#117). - Installation and the disk-loss recovery check out the newest release after cloning, and Cloud Shell Setup downloads that release's scripts, so new installs follow releases the way Updating Your Deployment does. - Updating Your Deployment looks the newest release up instead of hard-coding v3.0.0, and prunes images a tag change left behind. - Container counts include watchtower: seven on Caddy, four on a tunnel. - Instance Metadata lists the twelve files the cloud-config writes now, including make-private.sh and the home-directory links. - Migrating to a Data Disk sends a deployment still on pre-v3 code to the update, since the migration alone leaves its broken watchtower. - Operations says which tag each image follows and fixes a relative link that does not resolve on the wiki. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ArPBUq2nqe2bkxtqPzAqiF

    @claude claude committed Nov 6, 2026
  • Move reasoning into numbered notes on the maintenance pages

    @dadatuputi dadatuputi committed Oct 23, 2026
  • Describe how the deployment symlink is created Instances with the current cloud-config create it in every home present at boot and on first interactive login elsewhere, so the page no longer says not to rely on it. It states the one case that is still uncovered: a login that has never opened a shell, in a home created since the last boot.

    @dadatuputi dadatuputi committed Aug 29, 2026
  • Make the deployment path unambiguous Three forms were in use across seven pages: an absolute path, a bare ~/bitwarden_gcloud, and an ls of both locations piped to head. Which one worked depended on who was connecting, because gcloud takes the ssh login name from the local machine rather than the Google account, so the same instance presents different home directories to a laptop and to Cloud Shell. Maintenance pages now use /mnt/disks/bwgc/bitwarden_gcloud throughout. Cloud Shell Setup states that once, with the cause and a command that shows which login you are using. Pre-migration deployments have no canonical path, since they live in whichever home ran the install. The migration page now confirms that gcloud lands in the right one before its first command instead of assuming it. Installation still creates the ~/bitwarden_gcloud symlink and now says it is a convenience local to one login rather than something other pages depend on.

    @dadatuputi dadatuputi committed Aug 29, 2026
  • Install the compose helper before the page first uses it Step 4 sourced ~/.bwgc-compose.sh, and the command that creates that file was 85 lines further down, at the end of the page. A reader following the steps in order got "No such file or directory" and then "docker-compose: command not found". The helper only exists after Installation Step 8 or a migration run, neither of which a legacy deployment arriving here for maintenance has done. The remaining commands hardcoded ~/bitwarden_gcloud, which is a symlink that does not exist on every deployment and is lost whenever the home directory is rebuilt, as this page notes. They now use the same lookup as the rest of the wiki.

    @dadatuputi dadatuputi committed Aug 29, 2026
  • Fix defects found by the third audit round The deployment-shape test was wrong again, in a new way. systemd's list verbs exit 0 whether or not the pattern matches, so "list-unit-files X >/dev/null && echo migrated" always reported migrated. It now tests for the unit file, which fails closed, and the labels say what is actually being tested: a Caddy install from the current Installation page carries the supervisor without ever having been migrated. The Step 7 bypass added last round told a reader with an existing filesystem to skip to Step 10. Step 8 is what creates the docker-compose shim and the home symlink, so Step 10's first command would have been command not found. The bypass now restores both. Nothing on the Installation page ever set BWGC_RESTART_POLICY, though the page builds exactly the shape that needs it: a data disk plus the bwgc cloud-config. Only migrate-to-data-disk.sh set it, and Installation only ever calls that with --print-cloud-config. Without it Docker starts the stack about twenty seconds before cloud-init mounts the disk, which is the race the design exists to avoid, and it surfaces on the first reboot rather than during the install. Also: .env is now created in Step 8, because the supervisor can fire between the clone and Step 9 and Docker would create the missing bind source as a directory; releasing a reserved address needs the address detached first; and going back to Caddy restored port 80 without ever restoring DNS.

    @dadatuputi dadatuputi committed Aug 29, 2026
  • Fix defects introduced by the previous round of fixes The mkfs warning added last round told a reader with an existing filesystem to skip the format and run the rest of the step. Following that led into Step 8's git clone and Step 9's cp .env.template .env, which overwrite the deployment and the .env the warning had just protected. That branch now sends them to Step 10 instead, and runs nothing. Adding the DNS record step to the Caddy path moved the reader to Cloud Shell and never moved them back, so chmod 600 .env and docker-compose up -d landed on the wrong machine. The tunnel branch had been given that handling and the Caddy branch had not. Reconciling the country lists produced a claim that countryblock protects a reader from egress charges. It does not run on the tunnel path, which is the default, and that claim was the third line of the page. Also: nothing created ~/bitwarden_gcloud, which four commands on Cloud Shell Setup depend on; the tag-removal remediation had no command; the Caddy path had no way to tell whether the certificate was issued; and Step 0 listed the prerequisites for one path only.

    @dadatuputi dadatuputi committed Aug 29, 2026
  • Fix ten blockers found by a cold-reader audit The migration page said aborting was harmless. Past the Proceed? prompt it is not: the reboot question arrives after the stack is down, the restart policy is set to no and the metadata is replaced, and answering no there leaves the vault stopped with the script refusing to re-run. It now says so and gives the reboot that recovers it. Registration was never mentioned anywhere in the wiki, while SIGNUPS_ALLOWED ships true. Step 11 now closes it. The restore command omitted RESTORE_FORCE, which the backup container requires because it has no Docker socket, so the documented recovery could not run. It now carries the flag, a way to find a real filename, and a success criterion. The tunnel switch pointed DNS at a tunnel two steps before that tunnel started, and omitted --overwrite-dns, which is required to replace the A record every reader of that page has. The steps are reordered and the page states that the vault is down while you work. Its systemctl commands are now marked as applying only to migrated deployments, which is the shape the same page says may not apply. Also: the Caddy path never created its DNS record; mkfs.ext4 -F carried no warning on a page a reader may re-run with a populated disk; Automatic Restarts named a file the script does not write; fail2ban, countryblock and ddns did not say they are inactive on the default path; and a four-command paste block set a backup encryption key published in this wiki. Register: 81 em dashes and 14 bold lead-in paragraph openings removed, verdict headings replaced with plain nouns.

    @dadatuputi dadatuputi committed Aug 29, 2026
  • Correct the last details a full clean run turned up The final verification run completed every phase and both recoveries with no blocker. These are the remainder. Step 4's settings table had its separator below the first data row, so GitHub promoted BACKUP_ENCRYPTION_KEY and its whole description into the header and the two settings read as different kinds of thing. It has a header row now. Step 5's sample plan omitted the line the script prints directly above it, naming the data disk it read from the instance. On the recovery path, reusing the same disk name makes the regenerated configuration identical to what is already set, so gcloud answers "No change requested; skipping update" immediately after a keystroke the page has just called mandatory. The page now says that is the correct outcome. Step 2's listing also contains instance-<name>.json, a configuration dump the upgrade saves, which is often the newest entry and is not a backup.

    @dadatuputi dadatuputi committed Aug 28, 2026
  • Stop the recovery procedure from deleting the vault it just recovered A tester ran the disaster-recovery path end to end, twice. It destroyed the recovery both times, and could not reach that point without an undocumented workaround first. Step 6 was written as tidying -- "the restore leaves a compose project of its own behind" -- and told the reader to run "docker-compose -p bwgc-restore down -v" and "rm -rf ~/bwgc-restore". But bwgc-restore IS the recovered deployment; the step before adopts it and says to log in and check your entries. Following the page left no containers, a dangling symlink, and the uploaded archives deleted, while the old project's network and cert volume survived untouched. Adoption is now its own step, it says in bold not to delete the directory, and only the old project's leftovers are removed. Step 4's first command could not run at all. Stopping bwgc.service does not free the container names: its ExecStop stops containers without removing them, so all six keep their names and the restore project collides on "/proxy". The stop step now removes them, and explains why that destroys nothing. Step 4 also started vaultwarden as a compose dependency and then asserted RESTORE_FORCE=true, which claims the vault is stopped. It was not. The Backup page warns in bold that restoring while vaultwarden holds the database open risks losing writes. It now uses --no-deps so the assertion is true. The restore does copy .env out, to bitwarden/.env.restored, which is simpler than the manual extraction the page described and was documented as impossible. Both are now covered, and the procedure ends by getting the deployment back onto a data disk rather than leaving it on the boot disk. Cloud Shell Setup Step 4 said the scripts refuse to run without an encryption key twelve lines above saying neither setting stops them. The refusal claim is gone and both configurations are described.

    @dadatuputi dadatuputi committed Aug 28, 2026
  • Rewrite Rollback around what the restore actually does A tester ran the documented restore chain end to end. It could not complete, and its central promise was false. The restore does not put .env back. The archive contains it when BACKUP_ENV was true, but backup restore only writes into the data directory, and .env sits at the archive root. The page said the opposite in two places, and following it left a stack whose proxy restart-loops on an empty EMAIL -- exactly the failure .env.template warns about. The procedure now extracts .env from the archive directly, with commands for both the encrypted and unencrypted cases. The prescribed minimal .env also could not start the backup container: with only the key it logs "Backup is not configured, exiting", and with BACKUP but no schedule it refuses to start and restart-loops. The restore then refuses again because it cannot reach the Docker daemon to confirm vaultwarden is stopped, which needs RESTORE_FORCE=true -- documented on the Backup page and neither repeated nor linked here. Two hazards the page never mentioned: bwgc-supervise.timer recreates the stack from the data disk every five minutes using the same container names, so it has to be stopped first; and the restore leaves a compose project and root-owned files behind, which Step 15's billing check does not cover. Also: --overlap was listed without the constraint that rules it out on the 15 GB data disk this wiki creates; the rollback command compounded the instance name; and three contradictions from earlier rounds are resolved -- "all three" versus "both", "four files" versus "all three", and a lead-in promising a block that was not there.

    @dadatuputi dadatuputi committed Aug 28, 2026
  • Support every backup configuration instead of insisting on one The pages had grown an opinion: that a backup must be encrypted and must carry .env, with the scripts refusing to run otherwise. That is the wrong trade. A backup existing matters more than how it is protected, and both settings are the operator's call. Only BACKUP is genuinely required, because without it there is no backup container and no backup at all. BACKUP_ENCRYPTION_KEY and BACKUP_ENV are now presented as choices, each with what it buys and what it costs, and the scripts report which case you are in before taking the backup rather than stopping. Cloud Shell Setup no longer asserts the archive is encrypted or that .env is inside it; it describes both outcomes and says the scripts will tell you which one you have. Rollback covers restoring from an archive that carries .env and from one that does not.

    @dadatuputi dadatuputi committed Aug 27, 2026
  • Correct what a sixth end-to-end run exposed The run completed all three phases again. Every remaining defect is off the happy path, in rollback, recovery and cleanup. Two pages stated as fact that .env comes back from inside the backup archive. backup.sh only includes it when BACKUP_ENV=true, which ships false, so for anyone following these pages the archive held the database and nothing else. A restore would have come up with an empty EMAIL, which stops Caddy parsing its config, with an error naming the Caddyfile rather than the missing setting. The template now ships true, the maintenance scripts require it, and Cloud Shell Setup states the condition. The Rollback block cloned into ~/bitwarden_gcloud, which is a symlink to the data disk on every instance this wiki builds, so the clone failed. The block was newline-separated, so the next line landed in the live deployment and the line after truncated its .env. It now restores into a separate directory, chains with &&, and repoints the symlink only once the restore has succeeded. Cloud Shell Setup's routing table sends Automatic Restarts readers to Step 5, which downloaded three scripts and not the one that page opens with. Step 5's plan sample omitted the four lines saying the instance and its boot disk are deleted and that there is no way back, which is the screen the reader is being told to approve. The two Sizing sections disagreed on where the ceiling comes from; this page still said the boot size comes from the image, which the script does not do and the other page had already corrected. Also: "a replaced instance starts without it" was untrue of the documented upgrade, which reinstates the shim; the shim reinstall used ./ on a path under noexec /home; the prompt paragraph contradicted itself; Step 2 never said what a blank deprecation field means; and the gcloud listings pinned column sets that drift between releases.

    @dadatuputi dadatuputi committed Aug 27, 2026
  • Correct what a fourth end-to-end run exposed The run completed all three phases from these pages alone, so these are accuracy fixes rather than blockers. Step 4's bolded claim that every prompt defaults to no was false, and it was false about the one prompt that runs rm -rf. That is fixed in the scripts rather than the page: both yes-defaulting prompts now default to no, so the rule the page states is true. Steps 2 and 3 described the opposite of the order the script uses. The plan and Proceed? come first; the sizing decision arrives later, after a backup has already been taken. They are swapped, and the sizing step now says so. That step also claimed the script never stops on its own, contradicting both the Sizing table three sections below and the same table on the upgrade page. Two outcomes were being conflated: a vault too large for any free-tier disk stops, while a boot disk that already fills the allowance warns and asks. Step 15's cleanup command used $REGION, which nothing on the wiki ever exports, and an unfilled NAME with no example; it now derives both from the variables Cloud Shell Setup does export. Also: the upgrade options block's closing fence was a line too late, so its copy button appended a sentence to the option list; Step 5's sample was ls output under an ls -l command, on a listing the page asks you to check; and Step 6 named a backup directory that the documented setup never produces.

    @dadatuputi dadatuputi committed Aug 27, 2026
  • Correct what a second end-to-end run exposed A tester following these pages completed the migration but not the upgrade, and could not have known the upgrade succeeded. "Wait through the steps" invited walking away from a script that asks four questions, two of which default to yes and one of which is printed after the entire cloud-config, twice. All four are now a table, with the script's own Step N/7 numbering explained against this page's steps. Step 7 gated removing the old copy on the Step 6 login, but the script offers that deletion at the end of its own run, before any login is possible. The page now says so and covers both answers. The prerequisite check was printed as literal INSTANCE and ZONE in both places it appears, unlike every other command on the page; pasted as written it fails on an invalid zone, and the routing table has no row for that error. The backup verification asked for an rclone backup unconditionally, printing a red ERROR on a correctly configured local-only deployment, immediately before the script deletes the instance. The billing check looked at unattached disks only. The upgrade reserves the external address in Step 7, and a reservation that stops being attached bills on its own, so addresses are checked too. "Set both keys" did not say that BACKUP names a method rather than taking a boolean, and both pages told the reader to run docker-compose on the instance in a form that only works from an interactive shell.

    @dadatuputi dadatuputi committed Aug 27, 2026
  • Say how to run compose commands over ssh docker-compose is a shell function, and gcloud compute ssh --command runs a non-interactive shell that reads no startup files, so a bare docker-compose there gives command not found. Nothing can fix that on COS: every PATH entry is on the read-only root, and /home and /var are both noexec. Sourcing the shim in the command is the form that works, and the page now gives it, along with how to reinstall the shim after an instance is replaced.

    @dadatuputi dadatuputi committed Aug 27, 2026
  • Correct what an end-to-end run of these pages exposed A tester following these pages on a fresh install could not complete the migration. The page now says what it actually requires and what it actually does. Migrating to a Data Disk did not mention that the script backs up through the backup container, which ships disabled: BACKUP and BACKUP_ENCRYPTION_KEY are both commented out in .env.template, and Backup is filed under optional configuration. Both are now listed before you start, with the check to run. Step 7's rm -rf could not remove the root-owned files the containers write, and left a half-deleted tree. It now uses sudo and creates the symlink the script would have made. Installation said the file was self-documenting and named a domain, DDNS and an email relay. It never mentioned EMAIL, which the Caddyfile interpolates into "tls {$EMAIL}"; empty, Caddy cannot parse the line and the proxy never starts, with an error that names the Caddyfile rather than the setting. The four required settings are now a table. Cloud Shell Setup's key check matched the commented-out template line, so a user with no key set was shown a comment and told to copy the value. It is anchored now and says what to do when nothing prints. The listing's byte counts were wrong by roughly half and would drift again, so they are gone; what matters is that all three files arrived, since curl -f writes nothing on a miss. The upgrade page's shortcut callout survived a renumbering: both anchors resolved to nothing and it sent readers to a Part 4 that does not exist.

    @dadatuputi dadatuputi committed Aug 27, 2026
  • Put the Cloud Shell setup in one place and route between the pages Opening Cloud Shell, setting the project, exporting INSTANCE and ZONE, recording the encryption key and downloading the scripts appeared on both maintenance pages and partly on Installation. Anyone doing the migration and then the upgrade did all of it twice. It now lives on one page, Cloud Shell Setup, which says which of its steps each task needs and links back to whichever page sent the reader there. Installation uses Steps 1-2 and 5; it cannot use 3 and 4, which point at an instance that does not exist yet. The upgrade page opens by routing rather than assuming. Upgrading is a disk swap, so it only works if the vault is already on its own disk, and one command distinguishes the two cases: a filesystem listed means carry on, "No such file or directory" means do the migration first. The migration page ends by handing the reader back. Instances built from the older Installation instructions keep everything on the boot disk, so that routing is the common case rather than an edge case, and the page says so.

    @claude claude committed Aug 27, 2026