Skip to content

Instantly share code, notes, and snippets.

@accdias
Last active May 30, 2024 15:12
Show Gist options
  • Save accdias/835fcc07f343d967df789f7a7f731a2f to your computer and use it in GitHub Desktop.
Save accdias/835fcc07f343d967df789f7a7f731a2f to your computer and use it in GitHub Desktop.
Create a VaultWarden container on OL9

Installation

  1. Install podman
sudo dnf install -y podman
  1. Create the service directory to store data and configurations
sudo mkdir -p /srv/vw01/data
  1. Create the VaultWarden configuration
sudo tee /srv/vw01/vw01.conf < 'EOF'
# /srv/vw01/vw01.conf
ROCKET_TLS={certs="/data/ssl/your.domain.pem",key="/data/ssl/your.domain.key"}
ADMIN_TOKEN=youradmintoken
EOF
  1. Create the container service
sudo tee /etc/containers/systemd/vw01.container < 'EOF'
# /etc/containers/systemd/vw01.container
[Unit]
Description=VaultWarden vw01 container
After=local-fs.target network-online.target

[Container]
Image=docker.io/vaultwarden/server:latest
AutoUpdate=registry
Exec=/start.sh --preset owasp
EnvironmentFile=/srv/vw01/vw01.conf
Volume=/srv/vw01/data/:/data/:Z
PublishPort=443:80

[Install]
WantedBy=multi-user.target default.target
EOF
  1. Reload the services
sudo systemctl daemon-reload
  1. Enable and start the container
sudo systemctl enable --now vw01
  1. Enable auto-updates for the container
sudo systemctl edit podman-auto-update.timer
sudo systemctl enable --now podman-auto-update.timer

Maintenance

# List containers
sudo podman container list

# Update containers marked to auto-update
sudo podman auto-update

References

  • man podman
  • man quadlet
  • man systemd.timer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment