Skip to content

Commit 9909476

Browse files
svenvg93gitbook-bot
authored andcommitted
GITBOOK-10: Add MariaDB separately
1 parent 1f26f22 commit 9909476

File tree

2 files changed

+68
-21
lines changed

2 files changed

+68
-21
lines changed

getting-started/database-drivers.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,33 @@ SQLite ships as the default driver but you can also use MySQL/MariaDB and Postgr
1616

1717
#### SQLite (Default)
1818

19-
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.
20-
21-
To use SQLite follow the steps below to create your database file: 
22-
23-
1. Create a volume called `speedtest-tracker` or mount a directory to the container.
24-
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.
25-
3. Update your environment variables to only include the following environment variable in the table below.
26-
4. On start-up the container will checked for the database on the file system, if it can find it errors will be thrown to the log.
19+
SQLite is a good option for simple installs. The database will be create automatically inside the docker volume. 
2720

2821
| Environment Variable | Value |
2922
| -------------------- | -------- |
3023
| `DB_CONNECTION` | `sqlite` |
3124

32-
#### MySQL/MariaDB
25+
#### MariaDB
3326

34-
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.
27+
| Environment Variable | Value |
28+
| -------------------- | -------------------------------------------------------- |
29+
| `DB_CONNECTION` | `mariadb` |
30+
| `DB_HOST` | The FQDN or address to the database instance. |
31+
| `DB_PORT` | `3306` is the default port but can depend on your setup. |
32+
| `DB_DATABASE` | Name of the database you'll connect to. |
33+
| `DB_USERNAME` | User that'll be used to connect to the database. |
34+
| `DB_PASSWORD` | Password for the user above. |
3535

36-
| Environment Variable | Value |
37-
| -------------------- | -------------------------------------------------------------------------------------------------------------- |
38-
| `DB_CONNECTION` | <p><code>mysql</code> </p><p></p><p>The <code>mysql</code> driver can be used for both MySQL and MariaDB.</p> |
39-
| `DB_HOST` | The FQDN or address to the database instance. |
40-
| `DB_PORT` | `3306` is the default port but can depend on your setup. |
41-
| `DB_DATABASE` | Name of the database you'll connect to. |
42-
| `DB_USERNAME` | User that'll be used to connect to the database. |
43-
| `DB_PASSWORD` | Password for the user above. |
36+
#### MySQL
37+
38+
| Environment Variable | Value |
39+
| -------------------- | -------------------------------------------------------- |
40+
| `DB_CONNECTION` | `mysql` |
41+
| `DB_HOST` | The FQDN or address to the database instance. |
42+
| `DB_PORT` | `3306` is the default port but can depend on your setup. |
43+
| `DB_DATABASE` | Name of the database you'll connect to. |
44+
| `DB_USERNAME` | User that'll be used to connect to the database. |
45+
| `DB_PASSWORD` | Password for the user above. |
4446

4547
#### Postgres
4648

getting-started/installation.md

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,50 @@ services:
4747
```
4848
{% endtab %}
4949

50-
{% tab title="MariaDB/MySQL" %}
50+
{% tab title="MariaDB" %}
51+
<pre class="language-yaml"><code class="lang-yaml">services:
52+
<strong> speedtest-tracker:
53+
</strong> image: lscr.io/linuxserver/speedtest-tracker:latest
54+
restart: unless-stopped
55+
container_name: speedtest-tracker
56+
ports:
57+
- 8080:80
58+
- 8443:443
59+
environment:
60+
- PUID=1000
61+
- PGID=1000
62+
- DB_CONNECTION=mariadb
63+
- DB_HOST=db
64+
- DB_PORT=3306
65+
- DB_DATABASE=speedtest_tracker
66+
- DB_USERNAME=speedy
67+
- DB_PASSWORD=password
68+
- APP_KEY=
69+
- DATETIME_FORMAT=
70+
- APP_TIMEZONE=
71+
- SPEEDTEST_SCHEDULE= # Optional
72+
- SPEEDTEST_SERVERS= # Optional
73+
volumes:
74+
- /path/to/data:/config
75+
- /path/to-custom-ssl-keys:/config/keys
76+
depends_on:
77+
- db
78+
db:
79+
image: mariadb:10
80+
restart: always
81+
environment:
82+
- MARIADB_DATABASE=speedtest_tracker
83+
- MARIADB_USER=speedy
84+
- MARIADB_PASSWORD=password
85+
- MARIADB_RANDOM_ROOT_PASSWORD=true
86+
volumes:
87+
- speedtest-db:/var/lib/mysql
88+
volumes:
89+
speedtest-db:
90+
</code></pre>
91+
{% endtab %}
92+
93+
{% tab title="MySQL" %}
5194
```yaml
5295
services:
5396
speedtest-tracker:
@@ -60,7 +103,7 @@ services:
60103
environment:
61104
- PUID=1000
62105
- PGID=1000
63-
- DB_CONNECTION=mysql
106+
- DB_CONNECTION=mariadb
64107
- DB_HOST=db
65108
- DB_PORT=3306
66109
- DB_DATABASE=speedtest_tracker
@@ -77,7 +120,7 @@ services:
77120
depends_on:
78121
- db
79122
db:
80-
image: mariadb:10
123+
image: mysql:9
81124
restart: always
82125
environment:
83126
- MARIADB_DATABASE=speedtest_tracker
@@ -89,6 +132,8 @@ services:
89132
volumes:
90133
speedtest-db:
91134
```
135+
136+
92137
{% endtab %}
93138
94139
{% tab title="Postgres" %}

0 commit comments

Comments
 (0)