diff --git a/Using-the-MySQL-Backend.md b/Using-the-MySQL-Backend.md index de41dce..8b1b946 100644 --- a/Using-the-MySQL-Backend.md +++ b/Using-the-MySQL-Backend.md @@ -1,4 +1,4 @@ -To use the MySQL backend, you can either use the [official Docker image](https://hub.docker.com/r/bitwardenrs/server) or build your own binary [with MySQL enabled](https://github.com/dani-garcia/bitwarden_rs/wiki/Building-binary#mysql-backend). +To use the MySQL backend, you can either use the [official Docker image](https://hub.docker.com/r/bitwardenrs/server-mysql) or build your own binary [with MySQL enabled](https://github.com/dani-garcia/bitwarden_rs/wiki/Building-binary#mysql-backend). To run the binary or container, ensure the ```DATABASE_URL``` environment variable is set (i.e. ```DATABASE_URL='mysql://:@mysql/bitwarden'```). @@ -39,6 +39,50 @@ Server IP/Port 192.168.1.10:3306 UN: dbuser / PW: yourpassword / DB: bitwarden mysql://dbuser:yourpassword@192.168.1.10:3306/bitwarden ``` +**Example using docker-compose + +``` +version: "3.7" +services: + mariadb: + image: "mariadb" + container_name: "mariadb" + hostname: "mariadb" + restart: always + env_file: + - ".env" + volumes: + - "mariadb_vol:/var/lib/mysql" + - "/etc/localtime:/etc/localtime:ro" + environment: + - "MYSQL_ROOT_PASSWORD=" + - "MYSQL_PASSWORD=" + - "MYSQL_DATABASE=bitwarden_db" + - "MYSQL_USER=" + + bitwarden: + image: "bitwardenrs/server-mysql:latest" + container_name: "bitwarden" + hostname: "bitwarden" + restart: always + env_file: + - ".env" + volumes: + - "bitwarden_vol:/data/" + environment: +## Had issues when using single parentheses around the mysql URL as in the plain docker example + - "DATABASE_URL=mysql://:@mariadb/bitwarden_db" + - "ADMIN_TOKEN=" + - "ENABLE_DB_WAL='false'" + - "RUST_BACKTRACE=1" + ports: + - "80:80" + +volumes: + bitwarden_vol: + mariadb_vol: +``` + **Migrating from SQLite to MySQL** An easy way of migrating from SQLite to MySQL has been described in this [issue comment](https://github.com/dani-garcia/bitwarden_rs/issues/497#issuecomment-511827057). The steps are repeated below. Please, note that you are using this at your own risk and you are strongly advised to backup your installation and data!