How to build VaultWarden/MariaDB on Portainer with Nginx

VaultWarden is a password manager, this app is the best I have, and my company uses this password manager. It is very helpful for our team to be able to log in for our business and help employees access it, instead of waiting for the leader or owner to respond. You should build this for your small business or over 500 employees. It will help save you from headaches. And times.

Before we begin, please verify you are running the Portainer and Nginx Proxy Manager.

We will need to go to PhpMyAdmin and create a Database and User for the VaultWarden. If you do not have one, please follow these steps. This instruction to set up PhpMyAdmin.

Sign in to PhpMyAdmin and make a database.

Login to your admin account

Then click ‘New’ for the database to be created.

Create any name you prefer, only you need to make sure it matches on your docker-compose below.

Now we need to create a user, so we have to go to “privileges” in the menu.

Click Privileges on the top bar

Then click add user account

Make sure you create a username and password(I used generate password) since it is not exposed public, so my database is safe.

Now, we will create the vault warden on Portainer.

Open Portainer site → login admin → stacks → Add Stacks:

version: '3.3'
services:
  vaultwarden:
    networks:
      - nginx
      - mariadb
    container_name: vaultwarden
    image: vaultwarden/server:latest
    restart: unless-stopped
    environment:
      - ROCKET_PORT=80
      - DATABASE_URL=mysql://user:password@databasecontainer_name:3306/databasename
      - ADMIN_TOKEN=
      - TZ=America/los_Angeles
      - SMTP_HOST=mail.email.com
      - SMTP_FROM=username@email.com
      - SMTP_PORT=465
      - SMTP_SECURITY=force_tls
      - SMTP_USERNAME=username@email.com
      - SMTP_PASSWORD=P@ssW0rd
      - WEBSOCKET_ENABLED=true
    expose:
      - 80
      - 3012
    volumes:
      - /mnt/applegatebackup/vaultwarden/data/:/data/
networks:
  nginx:
   external: true
  mariadb:
   external: true

Please ensure that you have modified the admin token, SMTP environment, and database.