alexjustesen / speedtest-tracker

Speedtest Tracker is a self-hosted internet performance tracking application that runs speedtest checks against Ookla's Speedtest service.
https://speedtest-tracker.dev/
MIT License
2.88k stars 106 forks source link

Docker compose Install failed with "init: error mounting "/etc/localtime" to rootfs at "/etc/localtime" #859

Closed brianread108 closed 11 months ago

brianread108 commented 1 year ago

Describe the bug Created docker-compose.yml as per documentation. "docker compose up" Get this error message after "Initializing database files": Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/etc/localtime" to rootfs at "/etc/localtime": mount /etc/localtime:/etc/localtime (via /proc/self/fd/6), flags: 0x5001: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type Installing on Alpine-linux lxc container under ProxMox.

To Reproduce Install as above.

Expected behavior

Install worked

Environment (please complete the following information):

Screenshots Logs Additional context

alexjustesen commented 1 year ago

That's a new one but I have a suspicion it has to do with the host being on Alpine LCX and timezone data missing. Just a guess but try this: https://www.cduser.com/pique-22-how-to-change-timezone-in-a-linux-alpine-container/

If it works let me know and I'll get this added to the docs.

brianread108 commented 1 year ago

I am afraid that did not work. Same error message.

alexdelprete commented 1 year ago

I am afraid that did not work. Same error message.

don't mount localtime in docker-compose. it's not always necessary.

brianread108 commented 1 year ago

don't mount localtime in docker-compose. it's not always necessary.

deleted that line from the compose.yml, and it got a lot further.

Finally, after a reboot:

speedtest-tracker | ❌ There seems to be a failure in checking the web server + PHP-FPM. Here's the response: speedtest-tracker |

alexdelprete commented 1 year ago

That line is not important, it's just a failed internal test, but app should be running.

Does it work?

brianread108 commented 1 year ago

no it doesn't - it hangs at that point before completing the setup, and speedtest-tracker is not running (although the db task is).

I've found this in docker.log

time="2023-10-15T09:45:48.337339240Z" level=error msg="failed to enable controllers ([cpuset cpu io memory hugetlb pids rdma misc])" error="failed to write subtree controllers [cpuset cpu io memory hugetlb pids rdma misc] to \"/sys/fs/cgroup/docker/cgroup.subtree_control\": write /sys/fs/cgroup/docker/cgroup.subtree_control: no such file or directory"

alexdelprete commented 1 year ago

please show your docker-compose file and also describe the hw/environment where you're running docker.

brianread108 commented 1 year ago

Alpine LXC running as a container under ProxMox v8.0.4 Alpine installed using: https://tteck.github.io/Proxmox/

docker-compose.yml: `speedtest:~/speedtest# cat docker-compose.yml version: '3.3' services: speedtest-tracker: container_name: speedtest-tracker ports:

alexdelprete commented 1 year ago

I can't read anything formatted that way. Reformat the text so it can be read.

But I see PUID/PGID being used, is user/group 1000 existing? does it have proper permissions?

I also see '/path/to/directory:/config', did you change this to a real directory?

Basic question: do you know how docker and docker compose work?

brianread108 commented 1 year ago

Sorry about the format - copy and paste from a terminal window does that.

Yes- i'll look at the /path/to/dir ones - I expected it to be more copy and run I guess.

I do understand how docker etc works in general, but not in detail.

alexdelprete commented 1 year ago

I highly suggest you get the basics of docker and docker compose before using it. Otherwise you can't expect to have these apps/services running as they should.

The instructions/docs rely on the fact that docker basics are known.

brianread108 commented 1 year ago

I'm running at couple of other apps in a Alpine LXC docker containers where I just copied the compose.yml file in and the app started, so I guess I assumed that yours would be the same. I maqy choose to continue to fiddle with it or may not bother! Thanks for the help so far anyway. 8-))

brianread108 commented 1 year ago

There is a problem with the current version of zfs under proxmox and docker, I think I might well be suffering from that that, details here:

https://github.com/nextcloud/all-in-one/discussions/1490

ProxMox needs to be on zfs 2.2.0, apparently released a few days ago.

I'll wait to get that resolved before trying again to install speedtest (and I'll eyeball the docker-compose.yml properly as well!!)

alexdelprete commented 1 year ago

that's why I asked for a description of the environment...you didn't tell me you used ZFS. :)

ZFZ 2.2 came out, but it has to be pulled in Proxmox, and I don't know how long will it take.

Anyway, I use Proxmox with docker in an LXC (privileged) with ZFS, and Speedtest-Tracker works perfectly.

bmcgonag commented 1 year ago

Sometimes, certain apps will not run in LXC on docker. It's containerizing inside a container already. You can try to make the LXC container a privileged container (if it's not already) and see if that resolves it. I would say 80% of docker apps will run fine on LXC, but some, just won't as it stands today. For that I use a full ubuntu VM running docker, which hasn't failed me yet.

If you are updating from the previous version (before the MariaDB was added) you might need to remove the existing 'config' folder, and then try again fresh.

alexdelprete commented 1 year ago

Docker in LXC is still not officially supported by Proxmox. They support docker in a VM, not in an LXC.

I have two dockers: one LXC privileged + ZFS and the other is a Debian VM. I first test the docker apps on the first, and if I have problems, I migrate them to the VM.

I hope one day it will be officially supported, but I can't complain too much, 85% of apps work fine in LXC privileged, and it consumes lot less resources.

techie2000 commented 1 year ago

That's a new one but I have a suspicion it has to do with the host being on Alpine LCX and timezone data missing. Just a guess but try this: https://www.cduser.com/pique-22-how-to-change-timezone-in-a-linux-alpine-container/

If it works let me know and I'll get this added to the docs.

I am afraid that did not work. Same error message.

I think the issue is in the way Alpine stores/configures TZ:

alpine-docker:/etc/localtime# ls -lth
-rw-r--r--    1 root     root        3.6K Oct 22 19:56 London

whilst say Debian has

root@pve:/etc# cd localtime
-bash: cd: localtime: Not a directory
root@pve:/etc# 
root@pve:/etc# ls -lth localtime
747 lrwxrwxrwx 1 root root 33 2023-05-16 20:40 localtime -> /usr/share/zoneinfo/Europe/London

root@pve:/etc# ls -lth /usr/share/zoneinfo/Europe/London
222686 -rw-r--r-- 1 root root 3.6K 2023-04-18 21:03 /usr/share/zoneinfo/Europe/London

ie /etc/localtime is a directory in Alpine whilst it is file in Debian and similar.

so if you do something like (substituting your timezone) in the docker-compose, it will probably then work without error

     volumes:
            - '/etc/localtime/London:/etc/localtime:ro'

FYI I have it up and running via an alpine (v3.19) lxc running docker/portainer on a proxmox v7 (so Debian 11) instance. (Whilst it's running I can't see anything in the notes that id's what the initial default/admin user name/pwd is (and no offer is made to create one when first accessing the web gui so I can't do any more to see there are no further issues)

techie2000 commented 1 year ago

FYI I have it up and running via an alpine (v3.19) lxc running docker/portainer on a proxmox v7 (so Debian 11) instance. (Whilst it's running I can't see anything in the notes that id's what the initial default/admin user name/pwd is (and no offer is made to create one when first accessing the web gui so I can't do any more to see there are no further issues)

Having eventually discovered the default username/pwd for the initial login (Am I really that blind when it comes to reading docs - I eventually found it reading the code!), I can confirm it starts up/works ok as described above.

brianread108 commented 11 months ago

There is a problem with the current version of zfs under proxmox and docker, I think I might well be suffering from that that, details here:

nextcloud/all-in-one#1490

ProxMox needs to be on zfs 2.2.0, apparently released a few days ago.

I'll wait to get that resolved before trying again to install speedtest (and I'll eyeball the docker-compose.yml properly as well!!)

Confirming that ProxMox v8.1 with openZFS2.2, the docker install in an LXC works fine!

ajtatum commented 10 months ago

Hi, I'm running into the same issue. I wasn't sure if it would be best to create a new ticket or reply here, so sorry if replying was the wrong decision.

The host machine is a Synology DS1821+ running DSM 7.2. The weird thing is that the app was working perfectly fine initially, and then I updated the container and it stopped working. It's always been running with a Postgres DB.

Here's my Docker compose (with secrets removed)

version: "3.3"
networks:
  postgresql_default:
    external: true
    name: postgresql_default
services:
  speedtest-tracker:
    container_name: speedtest-tracker
    ports:
      - 8089:80
      - 8943:443
    environment:
      - PUID=1026
      - PGID=100
      - DB_CONNECTION=pgsql
      - DB_HOST=postgres
      - DB_PORT=5432
      - DB_DATABASE=speedtest_tracker
      - DB_USERNAME=iamagooduser
      - DB_PASSWORD=iamagoodpassword
      - MAIL_MAILER=smtp
      - MAIL_HOST=smtp.mailgun.org
      - MAIL_PORT=465
      - MAIL_USERNAME=speedtesttracker@mg.realdomain.com
      - MAIL_PASSWORD=imarealpassword
      - MAIL_ENCRYPTION=tls
      - MAIL_FROM_ADDRESS="speedtesttracker@mg.realdomain.com"
      - MAIL_FROM_NAME="Speedtest Tracker"
      - APP_KEY=xCO2hiMDVsVaTvoOcZWFKa1DP5Dtd5qGyDYQ76OgYDg=
      - APP_DEBUG=true
    volumes:
      - /volume2/docker/speedtest-tracker/config:/config
      - /volume2/docker/speedtest-tracker/web:/etc/ssl/web
    image: ghcr.io/alexjustesen/speedtest-tracker:latest
    restart: unless-stopped
    networks:
      - postgresql_default

I'm truly befuddled and if you have any ideas as to what may be the issue, I'd sincerely appreciate your help.

Thanks, AJ

Stack Trace

RuntimeException:
Unsupported cipher or incorrect key length. Supported ciphers are: aes-128-cbc, aes-256-cbc, aes-128-gcm, aes-256-gcm.

  at /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php:55
  at Illuminate\Encryption\Encrypter->__construct()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php:32)
  at Illuminate\Encryption\EncryptionServiceProvider->Illuminate\Encryption\{closure}()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php:908)
  at Illuminate\Container\Container->build()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php:795)
  at Illuminate\Container\Container->resolve()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:957)
  at Illuminate\Foundation\Application->resolve()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php:731)
  at Illuminate\Container\Container->make()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:942)
  at Illuminate\Foundation\Application->make()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php:1066)
  at Illuminate\Container\Container->resolveClass()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php:982)
  at Illuminate\Container\Container->resolveDependencies()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php:943)
  at Illuminate\Container\Container->build()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php:795)
  at Illuminate\Container\Container->resolve()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:957)
  at Illuminate\Foundation\Application->resolve()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php:731)
  at Illuminate\Container\Container->make()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:942)
  at Illuminate\Foundation\Application->make()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:172)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:119)
  at Illuminate\Pipeline\Pipeline->then()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php:805)
  at Illuminate\Routing\Router->runRouteWithinStack()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php:784)
  at Illuminate\Routing\Router->runRoute()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php:748)
  at Illuminate\Routing\Router->dispatchToRoute()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php:737)
  at Illuminate\Routing\Router->dispatch()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:200)
  at Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:144)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
     (/var/www/html/vendor/livewire/livewire/src/Features/SupportDisablingBackButtonCache/DisableBackButtonCacheMiddleware.php:19)
  at Livewire\Features\SupportDisablingBackButtonCache\DisableBackButtonCacheMiddleware->handle()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21)
  at Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php:31)
  at Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21)
  at Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php:40)
  at Illuminate\Foundation\Http\Middleware\TrimStrings->handle()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php:27)
  at Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php:99)
  at Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php:49)
  at Illuminate\Http\Middleware\HandleCors->handle()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php:39)
  at Illuminate\Http\Middleware\TrustProxies->handle()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:119)
  at Illuminate\Pipeline\Pipeline->then()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:175)
  at Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()
     (/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:144)
  at Illuminate\Foundation\Http\Kernel->handle()
     (/var/www/html/public/index.php:51)  
ajtatum commented 10 months ago

I've also just tried installing it on unRAID, and I received the same error.

ajtatum commented 10 months ago

I figured it out... I'm not sure why it worked previously, but after Googling the error I found this page which has a screenshot of an APP_KEY with the "base64:" part in front of the key, which I didn't include in my compose file. So, sorry about that! Thanks for the awesome app!

alexjustesen commented 10 months ago

Glad you figured it out!