|
| 1 | +--- |
| 2 | +meta: |
| 3 | + title: Deploying Vaultwarden on a Serverless infrastructure |
| 4 | + description: This tutorial shows how to configure and deploy a Vaultwarden server using Scaleway Serverless products. |
| 5 | +content: |
| 6 | + h1: Deploying Vaultwarden on a Serverless infrastructure |
| 7 | + paragraph: This tutorial shows how to configure and deploy a Vaultwarden server using Scaleway Serverless products. |
| 8 | +tags: vaultwarden password-safe serverless containers sql-database |
| 9 | +categories: |
| 10 | + - containers |
| 11 | + - sql-databases |
| 12 | +dates: |
| 13 | + validation: 2025-04-03 |
| 14 | + posted: 2025-04-03 |
| 15 | +--- |
| 16 | + |
| 17 | +Vaultwarden is an open-source password manager that helps you securely store and manage your passwords. It is a community-maintained fork of the popular Bitwarden project, offering the same features with flexibility and privacy in mind. |
| 18 | + |
| 19 | +Scaleway Serverless Containers and Serverless SQL Databases allow you to quickly deploy a Vaultwarden server that: |
| 20 | +- benefits from autoscaling according to your workloads |
| 21 | +- can scale down to zero to save costs |
| 22 | +- requires little-to-no maintenance |
| 23 | +- has built-in resiliency |
| 24 | + |
| 25 | +<Macro id="requirements" /> |
| 26 | + |
| 27 | +- A Scaleway account logged into the [console](https://console.scaleway.com) |
| 28 | +- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization |
| 29 | + |
| 30 | +## Creating a new Project |
| 31 | + |
| 32 | +For the sake of this tutorial, we recommend you create all the required resources in a dedicated new Project. Using dedicated Projects serves several purposes: |
| 33 | + |
| 34 | +- It allows you to separate different applications, environments, or teams, keeping their resources isolated and organized. |
| 35 | + |
| 36 | +- You can set up specific permissions and access controls for each Project, ensuring that only authorized users can access and manage the resources within that Project. |
| 37 | + |
| 38 | +- It simplifies the process of monitoring and tracking usage, as you can view the resources and usage associated with each Project separately. |
| 39 | + |
| 40 | +- You can also use Projects to create a logical separation between different parts of your infrastructure, making it easier to scale, maintain, and optimize your resources. |
| 41 | + |
| 42 | +## Creating a serverless SQL Database |
| 43 | + |
| 44 | +Vaultwarden relies on a database to store all password data securely. The database stores encrypted passwords, associated metadata, and user data. Serverless SQL Databases adapt to your workloads automatically thanks to autoscaling, and can scale down to zero to reduce costs. |
| 45 | + |
| 46 | +1. Follow [this procedure](/serverless-sql-databases/how-to/create-a-database/) to create a Serverless SQL Database. |
| 47 | + |
| 48 | +2. On the **Overview** page of the database you created, click **Connect application**. |
| 49 | + |
| 50 | +3. To connect to the database you can either: |
| 51 | + - use an existing API secret key, by copying the **Connection string** and replacing the placeholder with your secret key. |
| 52 | + - create a new API key, by clicking **Generate new secret key**, and by copying the newly created **Connection string**. |
| 53 | + |
| 54 | + Your connection string should look like the following: |
| 55 | + ``` |
| 56 | + postgresql://example-f3e2-4e5d-8e51-0fd3299d5d70:example-9ee1-43da-9231-0a351bf06139@example-8324-4d44-b03d-b6115096d2c7.pg.sdb.fr-par.scw.cloud:5432/serverless-sqldb-example-database?sslmode=require |
| 57 | + ``` |
| 58 | + <Message type="note"> |
| 59 | + Store your connection string securely, as it will be needed in the next steps. |
| 60 | + </Message> |
| 61 | + |
| 62 | +## Creating a Serverless Container |
| 63 | + |
| 64 | +1. [Create a Serverless Containers namespace](/serverless-containers/how-to/create-manage-delete-containers-namespace/#creating-a-serverless-containers-namespace), then click **Create namespace and add container** to directly open the Serverless Containers creation menu. |
| 65 | + |
| 66 | +2. Set the following parameters for the **image** of your container: |
| 67 | + |
| 68 | + | Parameter | Value | |
| 69 | + |--------------|-----------------------------------------------------------------------------------------------------| |
| 70 | + | Image origin | External registry | |
| 71 | + | Image URL | `vaultwarden/server:latest` | |
| 72 | + | CPU | 1 000 mVCPU | |
| 73 | + | RAM | 2 048 MB | |
| 74 | + | Min scale | `0` ((set a value of 1 or more to avoid [cold starts](/serverless-containers/concepts/#cold-start)) | |
| 75 | + | Max scale | `1` or more, according to your workload | |
| 76 | + |
| 77 | +3. Set the following **environment variables**: |
| 78 | + |
| 79 | + | Key | Value | |
| 80 | + |-------------------------|--------| |
| 81 | + | `DATA_FOLDER` | `/tmp` | |
| 82 | + | `ORG_ATTACHMENT_LIMIT` | `0` | |
| 83 | + | `SIGNUPS_ALLOWED` | `true` | |
| 84 | + | `USER_ATTACHMENT_LIMIT` | `0` | |
| 85 | + |
| 86 | +4. Set the following ¨¨**secrets**: |
| 87 | + | Key | Value | |
| 88 | + |----------------|-----------------------------------------------------------------------------------------------------------------------------------| |
| 89 | + | `DATABASE_URL` | connection string retrieved during the [previous step](#creating-a-serverless-sql-database) | |
| 90 | + | `ADMIN_TOKEN` | authentication token retrieved by following [This procedure](https://github.com/dani-garcia/vaultwarden/wiki/Enabling-admin-page) | |
| 91 | +5. Click **Deploy container**. The container **Overview** tab displays. |
| 92 | + |
| 93 | +## Finalizing the container configuration |
| 94 | + |
| 95 | +Once your container is deployed, you need to make a few adjustments before being able to fully use your Vaultwarden server. |
| 96 | + |
| 97 | +1. Access the **Settings** tab of your container. |
| 98 | + |
| 99 | +2. In the **Data** tab of the **Advanced options** section, add or update the following environment variables: |
| 100 | + - `SIGNUPS_ALLOWED` = `false` (optional, to prevent unwanted signups) |
| 101 | + - `DOMAIN` = endpoint or custom domain of your container |
| 102 | + |
| 103 | +3. Click **Save settings and deploy container** to apply your changes. |
| 104 | + |
| 105 | +Once your container's **status** switches to `ready`, your Vaultwarden server is ready to be used. |
| 106 | + |
| 107 | +<Message type="important"> |
| 108 | +Vaultwarden is designed to store passwords, and other sensitive data. This tutorial only covers the basic set up of the server, and does not guarantee its security. |
| 109 | + |
| 110 | +Refer to the official [Vaultwarden Wiki](https://github.com/dani-garcia/vaultwarden/wiki) for detailed instructions on how to secure your deployment. |
| 111 | +</Message> |
| 112 | + |
| 113 | +## Going Further |
| 114 | + |
| 115 | +- Refer to the official [Vaultwarden Wiki](https://github.com/dani-garcia/vaultwarden/wiki) for detailed instructions on how to secure your deployment. |
| 116 | + |
| 117 | +- Refer to the [dedicated documentation](/domains-and-dns/how-to/register-internal-domain/) to get your own custom domain. |
| 118 | + |
| 119 | +- Configure e-mails by adding the appropriate variables. Refer to the official [Vaultwarden repository](https://github.com/dani-garcia/vaultwarden/blob/main/.env.template) for a comprehensive list of variables. |
| 120 | + ``` |
| 121 | + # SMTP_HOST=smtp.domain.tld |
| 122 | +
|
| 123 | + |
| 124 | +
|
| 125 | + # SMTP_FROM_NAME=Vaultwarden |
| 126 | +
|
| 127 | + # SMTP_USERNAME=username |
| 128 | +
|
| 129 | + # SMTP_PASSWORD=password |
| 130 | +
|
| 131 | + # SMTP_TIMEOUT=15 |
| 132 | + ``` |
| 133 | + |
0 commit comments