Is the bitwarden rs service stateless if its using postgres backend?

I’m deploying on Kubernetes. I was hoping to deploy the Bitwarden server in a deployment with 3 replicas and then have a single stateful state postgres instance with an open ebs volume. Do bitwarden rs instance have any state to worry about if the postgres db is not colocated?

One reason I ask is because the docs point at this setup as an example: https://github.com/icicimov/kubernetes-bitwarden_rs/blob/7b6c0d49f9c5f5c6b7fce31a2a97bca9df8d0d25/statefulset.yml#L2-L3

p.s … Just setting the postgress connection string will ensure that the container I build from the bitwarden rs service doesn’t install any persistence store on the container right?

Bitwarden_rs doesn’t install anything it self.
Using multi instance with one mysql or Postgresql will work with some restrictions.

  1. Websockets will not work correctly between containers.
  2. If multi running containers have different rsa keys login/sessions between the containers will fail.
  3. No shared icon storage. (Unless a shared filesystem is used)
  4. Attachments could be scattered (Unless a shared filesystems is used)
1 Like

Also, no attachments.

AFAIK, bitwarden_rs is generally intended for personal use and wasn’t really designed with scalability as an objective, but given that the clients maintain a cached copy of the database anyway, super high availability is not as important.

2 Likes

I’m not so much trying to scale as get HA. The last thing I want is my password vault to be offline when I’m not home and I need some credentials. I’d rather have it running across at least 2 nodes than one.

1 Like

Well, solely HA should not be an issue i think. Although the clients keep the passwords cached (for a while).
But keep in mind at least the attachments.

I know someone did asked for storage of these attachments in the database, but I’m not quite in favor of that. I know kubernetes has some features to support that, like glusterfs to be used.
If only for passwords and notes, no issue.

I plan on using open ebs for the bitwarden containers. Hopefully that will work out.

I am using bitwarden_RS in a serverless environment (Cloud RUN - uses Knative) with postgres backend (managed).
It’s working fine, you just need to disable the attachment functionality.
Here my env settings to auto-configure my containers:

USER_ATTACHMENT_LIMIT 0
ORG_ATTACHMENT_LIMIT 0
DATABASE_URL postgresql://user:password@IP:port/dbName
SMTP_HOST xxxxxxxxx
SMTP_PORT xxxxxxxxx
SMTP_SSL true
SMTP_USERNAME xxxxxxxxx
SMTP_PASSWORD xxxxxxxxx
SMTP_FROM xxxxxxxxx
DOMAIN https://xxxxxxxxx.xx
ADMIN_TOKEN admintoken
SMTP_FROM_NAME xxxxxxxxx
SIGNUPS_ALLOWED false

1 Like

I have created an easy to deploy kubernetes project, if you want to try it :

2 Likes