|
| 1 | +# Database Drivers |
| 2 | + |
| 3 | +Since Speedtest Tracker is built on the Laravel Framework any of the framework's supported database [drivers](https://laravel.com/docs/10.x/database#configuration) are also supported. |
| 4 | + |
| 5 | +MySQL/MariaDB ships as the default driver but you can also use SQLite and Postgres. While SQL Server is supported by Laravel it hasn't been tested with Speedtest Tracker so no support will be provided for that driver. |
| 6 | + |
| 7 | +*** |
| 8 | + |
| 9 | +### Driver Options |
| 10 | + |
| 11 | +#### MySQL/MariaDB (Default, recommended) |
| 12 | + |
| 13 | +MariaDB ships as the default database that's included in the `docker-compose.yml` configuration, it's functionally the same as MySQL just an open-source earlier fork. |
| 14 | + |
| 15 | +| Environment Variable | Value | |
| 16 | +| -------------------- | -------------------------------------------------------------------------------------------------------------- | |
| 17 | +| `DB_DRIVER` | <p><code>mysql</code> </p><p></p><p>The <code>mysql</code> driver can be used for both MySQL and MariaDB.</p> | |
| 18 | +| `DB_HOST` | The FQDN or address to the database instance. | |
| 19 | +| `DB_PORT` | `3306` is the default port but can depend on your setup. | |
| 20 | +| `DB_DATABASE` | Name of the database you'll connect to. | |
| 21 | +| `DB_USERNAME` | User that'll be used to connect to the database. | |
| 22 | +| `DB_PASSWORD` | Password for the user above. | |
| 23 | + |
| 24 | +#### SQLite |
| 25 | + |
| 26 | +SQLite is a good option for simple installs and only not recommended because I think separating your application and the database into separate services is a better idea. |
| 27 | + |
| 28 | +To use SQLite follow the steps below to create your database file:  |
| 29 | + |
| 30 | +1. Create a volume called `speedtest-tracker` or mount a directory to the container. |
| 31 | +2. Create a file called `database.sqlite`, you can do this by running `touch database.sqlite` in the mounted volume or create it in the mounted directory. |
| 32 | +3. Update your environment variables to only include the following environment variables in the table below. |
| 33 | + |
| 34 | +| Environment Variable | Value | |
| 35 | +| -------------------- | --------------------------------------------------------------------------------- | |
| 36 | +| `DB_DRIVER` | `sqlite` | |
| 37 | +| `DB_DATABASE` | This should be the path to your SQLite database (i.e. `/config/database.sqlite`). | |
| 38 | + |
| 39 | +#### Postgres |
| 40 | + |
| 41 | +| Environment Variable | Value | |
| 42 | +| -------------------- | -------------------------------------------------------- | |
| 43 | +| `DB_DRIVER` | `pgsql` | |
| 44 | +| `DB_HOST` | The FQDN or address to the database instance. | |
| 45 | +| `DB_PORT` | `5432` is the default port but can depend on your setup. | |
| 46 | +| `DB_DATABASE` | Name of the database you'll connect to. | |
| 47 | +| `DB_USERNAME` | User that'll be used to connect to the database. | |
| 48 | +| `DB_PASSWORD` | Password for the user above. | |
| 49 | + |
| 50 | +#### SQL Server |
| 51 | + |
| 52 | +While supported by the framework it's drivers are not installed in the base image, if you want to use SQL Server you should extend the base image. |
| 53 | + |
| 54 | +Laravel docs: [https://laravel.com/docs/10.x/database#mssql-configuration](https://laravel.com/docs/10.x/database#mssql-configuration) |
0 commit comments