Be Your Own Cloud code · PART 3 — THE STACK

Chapter 11 Vaultwarden: Your Own Password Vault

3 blocks · pp. 52–53 in the paperback

Going further than the chapter: Vaultwarden: Going Deeper

Deploying It

# p. 52

File /opt/stacks/vaultwarden/docker-compose.yml
services:
  vaultwarden:
    image: vaultwarden/server:1.37.3
    container_name: vaultwarden
    restart: unless-stopped
    volumes:
      - ./data:/data
    environment:
      # set in .env: true now, false once your account exists
      - SIGNUPS_ALLOWED=${SIGNUPS_ALLOWED}
      - ADMIN_TOKEN=${ADMIN_TOKEN}
    networks:
      # Chapter 8's shared network -- no host port published at all
      - proxy

networks:
  proxy:
    external: true

# p. 52

Run Terminal, on the server
openssl rand -base64 48   # your ADMIN_TOKEN value, per Chapter 9
File /opt/stacks/vaultwarden/.env
# .env
ADMIN_TOKEN=the_value_from_the_line_above
SIGNUPS_ALLOWED=true

Locking the Vault Down

# p. 53

Add to /opt/stacks/vaultwarden/.env

Change this one line, then docker compose up -d.

# In .env, then docker compose up -d again:
SIGNUPS_ALLOWED=false

Reproduced exactly from Be Your Own Cloud, Chapter 11. The book explains what each line does and what to do when it doesn't work. About the book

Something here not working as the book describes? Tell the author.