Vaultwarden on Podman
Vaultwarden on Podman
Running Vaultwarden in a Podmand container, creating a systemd config and running it using systemctl
Why Vaultwarden?
Vaultwarden is an alternative implementation of Bitwarden server, written in Rust
It works with the official Bitwarden clients and works great self hosted
It’s super lightweight compared to the Bitwarden version
Why Podman?
Podman is an open-source, daemon-less, Linux-native tool to run containers
It works perfectly with systemd
Because of its daemon-less nature, it allows running containers under an arbitrary user
sudo yum update
Setup Vaultwarden
echo -n “PassW0rdFor” | argon2 “$(openssl rand -base64 48)” -e -id -k 19456 -t 2 -p 1
#得到字符串 $argon2id$v=19$m=19456,t=2,p=1$ZXVPcUdUTEFielFLRVREMmFVR3c2VEx6QU45M0pZZzhSNGlyK29ueFAwZTdrLzhxN0NFYlVYQUdmRVdoQUU0Ng$07Mv57/P3lAIUZAsQzKBuw7sCK0ZNXXRP6SmTWfpW24
# Create data directory
sudo mkdir /data/vaultwarden
# Create the image
sudo podman pull docker.io/vaultwarden/server:latest
sudo podmanpull docker.xuanyuan.run/vaultwarden/server:latest
sudo podman pull docker.io/vaultwarden/server:latest
sudo podman pull docker.1ms.run/vaultwarden/server:latest
# Run the pod
sudo podman run --detach --name vaultwarden.pod -e WEBSOCKET_ENABLED=true --env DOMAIN=“https://p.facesoho.com” -v /data/vaultwarden/:/data/ --restart unless-stopped --publish 8000:80 docker.1ms.run/vaultwarden/server:latestCreate a Systemd service
Keep things tidy by adding
pod suffix
# Create service file
sudo touch /etc/systemd/system/vaultwarden.pod.service
Populate it with the following:
[Unit]
Description=Vaultwarden/Bitwarden Server (Rust Edition)
Documentation=https://github.com/dani-garcia/vaultwarden
Wants=syslog.service
[Service]
Environment=“SIGNUPS_ALLOWED=true” # false if migrating
Restart=on-failure
ExecStart=/usr/bin/podman start -a vaultwarden.pod
ExecStop=/usr/bin/podman stop vaultwarden.pod
[Install]
WantedBy=multi-user.target
Reload the daemon: console sudo systemctl daemon-reload
Now check the status:
sudo systemctl status vaultwarden.pod
sudo systemctl enable vaultwarden.pod
# start and stop like so
sudo systemctl stop vaultwarden.pod
sudo systemctl start vaultwarden.pod
上一篇: CentOS 环境变量
下一篇: CentOS 安装 Rust
