|
| 1 | +--- |
| 2 | +description: >- |
| 3 | + These instructions will run you through setting up Speedtest Tracker on a |
| 4 | + Docker server using Docker Compose. |
| 5 | +--- |
| 6 | + |
| 7 | +# Using Docker Compose |
| 8 | + |
| 9 | +Setting up your environment with Docker Compose is the recommended way as it'll setup the application and a database for you. These steps will run you through setting up the application using Docker and Docker Compose. |
| 10 | + |
| 11 | +{% hint style="info" %} |
| 12 | +Docker run commands can be found on the [Using Docker](using-docker.md) page and assume you already have a database installed and configured. |
| 13 | +{% endhint %} |
| 14 | + |
| 15 | +### Install with Docker Compose |
| 16 | + |
| 17 | +{% stepper %} |
| 18 | +{% step %} |
| 19 | +#### Generate an Application Key |
| 20 | + |
| 21 | +You can get a generated key on [https://speedtest-tracker.dev/](https://speedtest-tracker.dev/) or run the command below. The key is required for [encryption](../../security/encryption.md). |
| 22 | + |
| 23 | +Copy this key including the `base64:` prefix and paste it as your `APP_KEY` value. |
| 24 | + |
| 25 | +```bash |
| 26 | +echo -n 'base64:'; openssl rand -base64 32; |
| 27 | +``` |
| 28 | +{% endstep %} |
| 29 | + |
| 30 | +{% step %} |
| 31 | +#### **Setting Up Docker** |
| 32 | + |
| 33 | +SQLite is fine for most installs but you can also use more traditional relational databases like MariaDB, MySQL and Postgres. |
| 34 | + |
| 35 | +{% tabs %} |
| 36 | +{% tab title="SQLite" %} |
| 37 | +```yaml |
| 38 | +services: |
| 39 | + speedtest-tracker: |
| 40 | + image: lscr.io/linuxserver/speedtest-tracker:latest |
| 41 | + restart: unless-stopped |
| 42 | + container_name: speedtest-tracker |
| 43 | + ports: |
| 44 | + - 8080:80 |
| 45 | + - 8443:443 |
| 46 | + environment: |
| 47 | + - PUID=1000 |
| 48 | + - PGID=1000 |
| 49 | + - APP_KEY= |
| 50 | + - DB_CONNECTION=sqlite |
| 51 | + volumes: |
| 52 | + - /path/to/data:/config |
| 53 | + - /path/to-custom-ssl-keys:/config/keys |
| 54 | +``` |
| 55 | +{% endtab %} |
| 56 | +
|
| 57 | +{% tab title="MariaDB" %} |
| 58 | +<pre class="language-yaml"><code class="lang-yaml">services: |
| 59 | +<strong> speedtest-tracker: |
| 60 | +</strong> image: lscr.io/linuxserver/speedtest-tracker:latest |
| 61 | + restart: unless-stopped |
| 62 | + container_name: speedtest-tracker |
| 63 | + ports: |
| 64 | + - 8080:80 |
| 65 | + - 8443:443 |
| 66 | + environment: |
| 67 | + - PUID=1000 |
| 68 | + - PGID=1000 |
| 69 | + - APP_KEY= |
| 70 | + - DB_CONNECTION=mariadb |
| 71 | + - DB_HOST=db |
| 72 | + - DB_PORT=3306 |
| 73 | + - DB_DATABASE=speedtest_tracker |
| 74 | + - DB_USERNAME=speedtest_tracker |
| 75 | + - DB_PASSWORD=password |
| 76 | + volumes: |
| 77 | + - /path/to/data:/config |
| 78 | + - /path/to-custom-ssl-keys:/config/keys |
| 79 | + depends_on: |
| 80 | + - db |
| 81 | + db: |
| 82 | + image: mariadb:11 |
| 83 | + restart: always |
| 84 | + environment: |
| 85 | + - MYSQL_DATABASE=speedtest_tracker |
| 86 | + - MYSQL_USER=speedtest_tracker |
| 87 | + - MYSQL_PASSWORD=password |
| 88 | + - MYSQL_RANDOM_ROOT_PASSWORD=true |
| 89 | + volumes: |
| 90 | + - speedtest-db:/var/lib/mysql |
| 91 | + healthcheck: |
| 92 | + test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] |
| 93 | + interval: 5s |
| 94 | + retries: 3 |
| 95 | + timeout: 5s |
| 96 | +volumes: |
| 97 | + speedtest-db: |
| 98 | +</code></pre> |
| 99 | +{% endtab %} |
| 100 | +
|
| 101 | +{% tab title="MySQL" %} |
| 102 | +```yaml |
| 103 | +services: |
| 104 | + speedtest-tracker: |
| 105 | + image: lscr.io/linuxserver/speedtest-tracker:latest |
| 106 | + restart: unless-stopped |
| 107 | + container_name: speedtest-tracker |
| 108 | + ports: |
| 109 | + - 8080:80 |
| 110 | + - 8443:443 |
| 111 | + environment: |
| 112 | + - PUID=1000 |
| 113 | + - PGID=1000 |
| 114 | + - APP_KEY= |
| 115 | + - DB_CONNECTION=mysql |
| 116 | + - DB_HOST=db |
| 117 | + - DB_PORT=3306 |
| 118 | + - DB_DATABASE=speedtest_tracker |
| 119 | + - DB_USERNAME=speedtest_tracker |
| 120 | + - DB_PASSWORD=password |
| 121 | + volumes: |
| 122 | + - /path/to/data:/config |
| 123 | + - /path/to-custom-ssl-keys:/config/keys |
| 124 | + depends_on: |
| 125 | + - db |
| 126 | + db: |
| 127 | + image: mysql:8 |
| 128 | + restart: always |
| 129 | + environment: |
| 130 | + - MYSQL_DATABASE=speedtest_tracker |
| 131 | + - MYSQL_USER=speedtest_tracker |
| 132 | + - MYSQL_PASSWORD=password |
| 133 | + - MYSQL_RANDOM_ROOT_PASSWORD=true |
| 134 | + volumes: |
| 135 | + - speedtest-db:/var/lib/mysql |
| 136 | + healthcheck: |
| 137 | + test: ["CMD", "mysqladmin", "ping", "-p${MYSQL_PASSWORD}"] |
| 138 | + interval: 5s |
| 139 | + retries: 5 |
| 140 | + timeout: 5s |
| 141 | +volumes: |
| 142 | + speedtest-db: |
| 143 | +``` |
| 144 | +{% endtab %} |
| 145 | +
|
| 146 | +{% tab title="Postgres" %} |
| 147 | +```yaml |
| 148 | +services: |
| 149 | + speedtest-tracker: |
| 150 | + image: lscr.io/linuxserver/speedtest-tracker:latest |
| 151 | + restart: unless-stopped |
| 152 | + container_name: speedtest-tracker |
| 153 | + ports: |
| 154 | + - 8080:80 |
| 155 | + - 8443:443 |
| 156 | + environment: |
| 157 | + - PUID=1000 |
| 158 | + - PGID=1000 |
| 159 | + - APP_KEY= |
| 160 | + - DB_CONNECTION=pgsql |
| 161 | + - DB_HOST=db |
| 162 | + - DB_PORT=5432 |
| 163 | + - DB_DATABASE=speedtest_tracker |
| 164 | + - DB_USERNAME=speedtest_tracker |
| 165 | + - DB_PASSWORD=password |
| 166 | + volumes: |
| 167 | + - /path/to/data:/config |
| 168 | + - /path/to-custom-ssl-keys:/config/keys |
| 169 | + depends_on: |
| 170 | + - db |
| 171 | + db: |
| 172 | + image: postgres:17 |
| 173 | + restart: always |
| 174 | + environment: |
| 175 | + - POSTGRES_DB=speedtest_tracker |
| 176 | + - POSTGRES_USER=speedtest_tracker |
| 177 | + - POSTGRES_PASSWORD=password |
| 178 | + volumes: |
| 179 | + - speedtest-db:/var/lib/postgresql/data |
| 180 | + healthcheck: |
| 181 | + test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] |
| 182 | + interval: 5s |
| 183 | + retries: 5 |
| 184 | + timeout: 5s |
| 185 | +volumes: |
| 186 | + speedtest-db: |
| 187 | +``` |
| 188 | +{% endtab %} |
| 189 | +{% endtabs %} |
| 190 | +
|
| 191 | +{% hint style="info" %} |
| 192 | +If you would like to provide your own SSL keys, they must be named `cert.crt` (full chain) and `cert.key` (private key), and mounted in the container folder `/config/keys`. |
| 193 | +{% endhint %} |
| 194 | +{% endstep %} |
| 195 | + |
| 196 | +{% step %} |
| 197 | +#### **Environment Variables** |
| 198 | + |
| 199 | +In order for the application to run smoothly, some environment variables need to be set. Check out the [Environment Variables](../environment-variables.md) section. Make sure all r**equired** variables are configured. |
| 200 | +{% endstep %} |
| 201 | + |
| 202 | +{% step %} |
| 203 | +#### **Configuration Variables (Optional)** |
| 204 | + |
| 205 | +You can set configuration variables to have automatic speedtest on an schedule. Check out the [Environment Variables](../environment-variables.md#speedtest) section on how to set the variables. Also see the [FAQ](../../help/faqs.md#speedtest) for tips effectively scheduling tests. |
| 206 | + |
| 207 | +{% hint style="info" %} |
| 208 | +Complete overview of the Environment Variables for custom configuration can be found [here](../environment-variables.md). |
| 209 | +{% endhint %} |
| 210 | +{% endstep %} |
| 211 | + |
| 212 | +{% step %} |
| 213 | +#### **Start the Container** |
| 214 | + |
| 215 | +You can now start the container accordingly the platform you are on. |
| 216 | +{% endstep %} |
| 217 | + |
| 218 | +{% step %} |
| 219 | +#### **First Login** |
| 220 | + |
| 221 | +During the start the container there is a default username and password created. Use the [default login](../../security/authentication.md#default-user-account) credentials to login to the application. You can [change the default user](../../security/authentication.md#change-account-details) after logging in. |
| 222 | +{% endstep %} |
| 223 | +{% endstepper %} |
0 commit comments