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.77k stars 106 forks source link

Docker with PostgreSQL/SQLite will not start #430

Closed somera closed 1 year ago

somera commented 1 year ago

Describe the bug I try strat the speedtest-tracker with external PostgreSQL. During the start process the tables were created. But the container is exiting

docker run -d --name speedtest-tracker \
    -p 8765:80 \
    -p 8443:443 \
    -e PUID=1000 \
    -e PGID=1000 \
    -e "DB_CONNECTION=pgsql" \
    -e "DB_HOST=192.168.178.30" \
    -e "DB_PORT=5432" \
    -e "DB_DATABASE=speedtest_tracker" \
    -e "DB_USERNAME=speedtest_tracker" \
    -e "DB_PASSWORD=speedtest_tracker" \
    -v /data-files/data/docker/speedtest-tracker:/config \
    ghcr.io/alexjustesen/speedtest-tracker:latest \
    restart: unless-stopped

This is the output

--------------------------------------------------------------------
 ____                             ____  _     _        _   _
/ ___|  ___ _ ____   _____ _ __  / ___|(_) __| | ___  | | | |_ __
\___ \ / _ \  __\ \ / / _ \  __| \___ \| |/ _` |/ _ \ | | | |  _ \
 ___) |  __/ |   \ V /  __/ |     ___) | | (_| |  __/ | |_| | |_) |
|____/ \___|_|    \_/ \___|_|    |____/|_|\__,_|\___|  \___/| .__/
                                                            |_|

Brought to you by serversideup.net
--------------------------------------------------------------------

To support Server Side Up projects visit:
https://serversideup.net/sponsor
-------------------------------------
GID/UID
-------------------------------------

User uid:    1000
User gid:    1000
-------------------------------------

๐Ÿ”’ SSL_MODE has been set to MIXED, setting the web server to work in HTTP + HTTPS...
๐Ÿƒโ€โ™‚๏ธ Checking for Laravel automations...
๐Ÿ” Linking the storage...
๐Ÿƒโ€โ™‚๏ธ An SSL key was not detected, so I'll generate a self-signed SSL certificate pair for you...
..+..+.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*...............+.....+......+....+..+.......+..+...+.......+.....+.+.....+.......+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.........+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
....+....+..+..........+..+.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.......+.....+.+......+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*..+.........+...+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-----

   INFO  The [public/storage] link has been connected to [storage/app/public].

๐Ÿ‡  Configuring Speedtest Tracker...
โœ…  Environment file exists
๐Ÿ”—  Creating symlinks to config and log files
โœ…  App key exists
๐Ÿ”’  Fixing app path file permissions
๐Ÿ’ฐ  Building the cache...
[25-Feb-2023 16:58:20] NOTICE: fpm is running, pid 103
[25-Feb-2023 16:58:20] NOTICE: ready to handle connections
[25-Feb-2023 16:58:20] NOTICE: systemd monitor interval set to 10000ms
๐Ÿš›  Migrating the database...
โœ…  All set, starting Speedtest Tracker container...
โฐ  Starting the cron service...
๐Ÿ’ช  Starting the queue worker...
/run/s6/basedir/scripts/rc.init: 67: restart:: not found
[25-Feb-2023 16:58:21] NOTICE: Terminating ...
[25-Feb-2023 16:58:21] NOTICE: exiting, bye-bye!

I followed this https://docs.speedtest-tracker.dev/getting-started/installation

Environment (please complete the following information):

alexjustesen commented 1 year ago

v0.11.3 was just released, make sure to pull the latest version and let me know if this is still an issue

somera commented 1 year ago

Same problem

$ docker run --rm -it --name speedtest-tracker -p 8765:80 -p 8443:443 -e PUID=1000  -e PGID=1000 -e "DB_CONNECTION=pgsql"     -e "DB_HOST=192.168.178.30"     -e "DB_PORT=5432"     -e "DB_DATABASE=speedtest_tracker"     -e "DB_USERNAME=speedtest_tracker"     -e "DB_PASSWORD=speedtest_tracker"     -v /data-files/data/docker/speedtest-tracker:/config     ghcr.io/alexjustesen/speedtest-tracker:v0.11.3     restart: unless-stopped
Unable to find image 'ghcr.io/alexjustesen/speedtest-tracker:v0.11.3' locally
v0.11.3: Pulling from alexjustesen/speedtest-tracker
677076032cca: Already exists
9a37c607e3b8: Already exists
a179890207f9: Already exists
7d515518f939: Already exists
5b350381c31e: Already exists
413245ff19ed: Already exists
faa467fa5129: Already exists
d94bfc4fae37: Already exists
9c5b35537e0c: Already exists
804ed01b4370: Already exists
438d52203bf5: Already exists
363fb5666fe7: Already exists
27bf73e7ee11: Already exists
1c669e52a61f: Already exists
69a3797ec347: Already exists
a4734d47a07c: Already exists
274ea4828861: Pull complete
fc840294d94c: Pull complete
bfdb4b5fb1f5: Pull complete
015468300ffd: Pull complete
4f4fb700ef54: Pull complete
c57db18e945a: Pull complete
a8371d948d11: Pull complete
Digest: sha256:0e981b48c0991503f980613cca971920bf9df072fecb8a05f6b716b11981e32b
Status: Downloaded newer image for ghcr.io/alexjustesen/speedtest-tracker:v0.11.3

--------------------------------------------------------------------
 ____                             ____  _     _        _   _
/ ___|  ___ _ ____   _____ _ __  / ___|(_) __| | ___  | | | |_ __
\___ \ / _ \  __\ \ / / _ \  __| \___ \| |/ _` |/ _ \ | | | |  _ \
 ___) |  __/ |   \ V /  __/ |     ___) | | (_| |  __/ | |_| | |_) |
|____/ \___|_|    \_/ \___|_|    |____/|_|\__,_|\___|  \___/| .__/
                                                            |_|

Brought to you by serversideup.net
--------------------------------------------------------------------

To support Server Side Up projects visit:
https://serversideup.net/sponsor
-------------------------------------
GID/UID
-------------------------------------

User uid:    1000
User gid:    1000
-------------------------------------

๐Ÿ”’ SSL_MODE has been set to MIXED, setting the web server to work in HTTP + HTTPS...
๐Ÿƒโ€โ™‚๏ธ Checking for Laravel automations...
๐Ÿ” Linking the storage...
๐Ÿƒโ€โ™‚๏ธ An SSL key was not detected, so I'll generate a self-signed SSL certificate pair for you...
......+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.....+.....+...+.+......+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*....+...+......+....+..+.............+...+.....+...+....+.....+...+.......+.....+.+..+....+.........+..+...+.......+...+........................+...+.........+.....+..................+.+......+...+..+....+..+....+...+...+..+.+...........+.+...............+.........+........+...+...+.+...+......+..+...........................+.............+..+.......+.....+.+...+...........+........................+....+..+....+.........+..+...+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
....+..+....+.....+......+....+...+...+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*..+........+.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*........+.....+.+.....+...+.............+..+.......+...+..+.+.....+...+.+.........+..+...+....+......+......+.....+......+....+..................+..+................+.....+...+.+.....+...+.............+........+.........+..........+......+......+..............+.+...+...+...+...........+......+...+....+........+....+...+...+...+.....................+...+.....+.......+........+...+.......+...+..+.+..
   INFO  The [public/storage] link has been connected to [storage/app/public].

....+........+......+.++++++++++++++++++++๐Ÿ‡  Configuring Speedtest Tracker...
โœ…  Environment file exists
๐Ÿ”—  Creating symlinks to config and log files
++++++++โœ…  App key exists
๐Ÿ”’  Fixing app path file permissions
+++๐Ÿ’ฐ  Building the cache...
++++++++++++++++++++++++++++++++++
-----
[06-Mar-2023 12:32:13] NOTICE: fpm is running, pid 102
[06-Mar-2023 12:32:13] NOTICE: ready to handle connections
[06-Mar-2023 12:32:13] NOTICE: systemd monitor interval set to 10000ms
๐Ÿš›  Migrating the database...
โœ…  All set, starting Speedtest Tracker container...
โฐ  Starting the cron service...
๐Ÿ’ช  Starting the queue worker...
/run/s6/basedir/scripts/rc.init: 67: restart:: not found
[06-Mar-2023 12:32:15] NOTICE: Terminating ...
[06-Mar-2023 12:32:15] NOTICE: exiting, bye-bye!
somera commented 1 year ago

Still same problem with v0.11.4.

Why it starts so slow?

Start at 17:37:18:

[Mo Mรคr 06][17:37:18][rafcio]@[nuc-mini-pentium]:[~]$ docker run --rm -it --name speedtest-tracker     -p 8765:80     -p 8443:443     -e PUID=1000     -e PGID=1000     -e "DB_CONNECTION=pgsql"     -e "DB_HOST=192.168.178.30"     -e "DB_PORT=5432"     -e "DB_DATABASE=speedtest_tracker"     -e "DB_USERNAME=speedtest_tracker"     -e "DB_PASSWORD=speedtest_tracker"     -v /data-files/data/docker/speedtest-tracker:/config     ghcr.io/alexjustesen/speedtest-tracker:v0.11.4     restart: unless-stopped

Need 60 Secends to see this:

[06-Mar-2023 16:38:38] NOTICE: fpm is running, pid 103
[06-Mar-2023 16:38:38] NOTICE: ready to handle connections
[06-Mar-2023 16:38:38] NOTICE: systemd monitor interval set to 10000ms
๐Ÿš›  Migrating the database...
โœ…  All set, starting Speedtest Tracker container...
โฐ  Starting the cron service...
๐Ÿ’ช  Starting the queue worker...
/run/s6/basedir/scripts/rc.init: 67: restart:: not found
[06-Mar-2023 16:38:39] NOTICE: Terminating ...
[06-Mar-2023 16:38:39] NOTICE: exiting, bye-bye!
bboysoulcn commented 1 year ago

same

alexjustesen commented 1 year ago

Do you have PostgreSQL running as a separate container? Also double check your connection settings, this step will fail if it (Speedtest Tracker) can't make a successful connection to the DB in order to run the migration scripts.

somera commented 1 year ago

I'm running PostgreSQL outside of the docker. And the connection is working. I see the created tables.

image

somera commented 1 year ago

I tested the SQLite docker version too. Same problem like with PostgreSQL. Looks like the database is not the problem.

alexjustesen commented 1 year ago

Thanks for the extra info, this might be related to #400. Can you also enable DEBUG_OUTPUT=true and S6_VERBOSITY='all' and then share the output to a GIST?

somera commented 1 year ago

Here with -e DEBUG_OUTPUT=true and -e S6_VERBOSITY='all' ...

And after

s6-rc: info: service legacy-cont-init successfully started speedtest-tracker_v0.11.4_debug.log

it need about 1 minute.

alexjustesen commented 1 year ago

I got #452 in the pipeline which will hopefully provide some stability to the startup process. Maybe we'll get luck on this issue too.

somera commented 1 year ago

Sounds good. Should I wait for the v.0.11.6?

alexjustesen commented 1 year ago

Sounds good. Should I wait for the v.0.11.6?

It's published if you want to give it a try

somera commented 1 year ago

Isn't working. speedtest-tracker_v0.11.6_debug.log

somera commented 1 year ago

Same for sqlite speedtest-tracker_v0.11.6sqlite_debug.log

alexjustesen commented 1 year ago

Set S6_VERBOSITY=5 not "all", had a typo before

somera commented 1 year ago

Isn't working too. speedtest-tracker_v0.11.6_debug.log

alexjustesen commented 1 year ago

What's the specs of the server you're trying to run this on and is Docker up to date?

somera commented 1 year ago
[Di Mรคr 07][21:07:30][rafcio]@[nuc-mini-celeron]:[~]$ neofetch
            .-/+oossssoo+/-.               rafcio@nuc-mini-celeron
        `:+ssssssssssssssssss+:`           -----------------------
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 22.04.2 LTS x86_64
    .ossssssssssssssssssdMMMNysssso.       Host: NUC11ATKC4 M53052-301
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Kernel: 5.15.0-67-generic
  +ssssssssshmydMMMMMMMNddddyssssssss+     Uptime: 1 hour, 9 mins
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Packages: 1003 (dpkg), 6 (snap)
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Shell: bash 5.1.16
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Terminal: /dev/pts/0
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   CPU: Intel Celeron N5105 (4) @ 2.900GHz
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   GPU: Intel JasperLake [UHD Graphics]
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Memory: 678MiB / 31881MiB
.ssssssssdMMMNhsssssssssshNMMMdssssssss.
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/
  +sssssssssdmydMMMMMMMMddddyssssssss+
   /ssssssssssshdmNNNNmyNMMMMhssssss/
    .ossssssssssssssssssdMMMNysssso.
      -+sssssssssssssssssyyyssss+-
        `:+ssssssssssssssssss+:`
            .-/+oossssoo+/-.
somera commented 1 year ago

And my PostgreSQL 13 runs on

[Di Mรคr 07][22:18:11][rafcio]@[nuc-mini-pentium]:[~]$ neofetch
            .-/+oossssoo+/-.               rafcio@nuc-mini-pentium
        `:+ssssssssssssssssss+:`           -----------------------
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 20.04.5 LTS x86_64
    .ossssssssssssssssssdMMMNysssso.       Host: NUC7PJYH J67992-406
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Kernel: 5.15.0-67-generic
  +ssssssssshmydMMMMMMMNddddyssssssss+     Uptime: 4 days, 8 hours, 33 mins
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Packages: 1943 (dpkg), 7 (snap)
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Shell: bash 5.0.17
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Terminal: /dev/pts/0
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   CPU: Intel Pentium Silver J5005 (4) @ 2.800GHz
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   GPU: Intel UHD Graphics 605
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Memory: 3077MiB / 15585MiB
.ssssssssdMMMNhsssssssssshNMMMdssssssss.
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/
  +sssssssssdmydMMMMMMMMddddyssssssss+
   /ssssssssssshdmNNNNmyNMMMMhssssss/
    .ossssssssssssssssssdMMMNysssso.
      -+sssssssssssssssssyyyssss+-
        `:+ssssssssssssssssss+:`
            .-/+oossssoo+/-.
somera commented 1 year ago

What is the problem here?

alexjustesen commented 1 year ago

I've only tested the app with v14 and v15 of pgsql, try that and let me know if it works.

somera commented 1 year ago

I can check this on weekend. Cause I have only PostgreSQL 11 and 13 on start.

But why it's not working with SQLite too. speedtest-tracker_v0.11.6sqlite_debug.log

alexjustesen commented 1 year ago

I'm not seeing this problem on my end. Pgsql worked fine on windows, wsl, an Ubuntu 22.04 server and an rpi so can't really suggest much more.

somera commented 1 year ago

I started PG 14 on other computer and can connect. But the Docker isn't working. Samle problem.

I can see the created tables

image

As I wrote, this is not a DB problem.

somera commented 1 year ago

But why is this stopping? I try to understand it.

s6-rc: info: service nginx successfully started
s6-rc: info: service legacy-services: starting
s6-ipcclient: connected to /run/s6-rc/servicedirs/s6rc-oneshot-runner/s
s6-rc: info: service legacy-services successfully started
/run/s6/basedir/scripts/rc.init: 67: restart:: not found
s6-rc: info: bringing selected services down
s6-rc: info: service legacy-services: stopping
s6-ipcclient: connected to /run/s6-rc/servicedirs/s6rc-oneshot-runner/s
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service msmtp: stopping
s6-ipcclient: connected to /run/s6-rc/servicedirs/s6rc-oneshot-runner/s
s6-rc: info: service queue-worker: stopping
s6-ipcclient: connected to /run/s6-rc/servicedirs/s6rc-oneshot-runner/s
s6-rc: info: service nginx: stopping
s6-rc: info: service cron: stopping
s6-rc: info: service msmtp successfully stopped
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-ipcclient: connected to /run/s6-rc/servicedirs/s6rc-oneshot-runner/s
s6-rc: info: service cron successfully stopped
s6-rc: info: service queue-worker successfully stopped
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service nginx successfully stopped
s6-rc: info: service debug-nginx: stopping
s6-rc: info: service php-fpm: stopping
s6-ipcclient: connected to /run/s6-rc/servicedirs/s6rc-oneshot-runner/s

Is this /run/s6/basedir/scripts/rc.init: 67: restart:: not found the problem?

somera commented 1 year ago

Tested

nomoreimportant commented 1 year ago

Please let me know if you need the log from me, I am on arm64 (Raspian x64 OS) with SQLite install and getting the same error as @somera but I see he is on amd64.

My Docker is up to date and all the OS patches are up to date.

_speedtest-tracker_logs.txt

somera commented 1 year ago

Tested SQLite with v0.11.6 on Kali Linux. Same problem.

somera commented 1 year ago

@alexjustesen did you change something?

With v0.11.8 it works on my system with SQLite and PostgreSQL 13. I can login. Will test it next days.

alexjustesen commented 1 year ago

Not a thing for v0.11.8 related to startup but we'll take it!

somera commented 1 year ago

But ...

This

docker run --rm -it --name speedtest-tracker \
    -p 8765:80 \
    -p 8443:443 \
    -e PUID=1000 \
    -e PGID=1000 \
    -e "DB_CONNECTION=pgsql" \
    -e "DB_HOST=192.168.178.30" \
    -e "DB_PORT=5432" \
    -e "DB_DATABASE=speedtest_tracker" \
    -e "DB_USERNAME=speedtest_tracker" \
    -e "DB_PASSWORD=speedtest_tracker" \
    -e DEBUG_OUTPUT=true \
    -e S6_VERBOSITY=5 \
    -v /data-files/data/docker/speedtest-tracker:/config \
    alexjustesen/speedtest-tracker:v0.11.8

works,

But when I try to start is as DEAMON it's exiting.

docker run -d --name speedtest-tracker \
    -p 8765:80 \
    -p 8443:443 \
    -e PUID=1000 \
    -e PGID=1000 \
    -e "DB_CONNECTION=pgsql" \
    -e "DB_HOST=192.168.178.30" \
    -e "DB_PORT=5432" \
    -e "DB_DATABASE=speedtest_tracker" \
    -e "DB_USERNAME=speedtest_tracker" \
    -e "DB_PASSWORD=speedtest_tracker" \
    -e DEBUG_OUTPUT=true \
    -e S6_VERBOSITY=5 \
    -v /data-files/data/docker/speedtest-tracker:/config \
    alexjustesen/speedtest-tracker:v0.11.8 \
    restart: unless-stopped

Any idea why?

Are the both parameters needed?

    -e DEBUG_OUTPUT=true \
    -e S6_VERBOSITY=5
somera commented 1 year ago

Not a thing for v0.11.8 related to startup but we'll take it!

You close it to early. ;) See my last comment.

somera commented 1 year ago

Ok, this

docker run -d --name speedtest-tracker \
    --restart=unless-stopped \
    -p 8765:80 \
    -p 8443:443 \
    -e PUID=1000 \
    -e PGID=1000 \
    -e "DB_CONNECTION=pgsql" \
    -e "DB_HOST=192.168.178.30" \
    -e "DB_PORT=5432" \
    -e "DB_DATABASE=speedtest_tracker" \
    -e "DB_USERNAME=speedtest_tracker" \
    -e "DB_PASSWORD=speedtest_tracker" \
    -v /data-files/data/docker/speedtest-tracker:/config \
    alexjustesen/speedtest-tracker:v0.11.8

works.

Your docker example (https://docs.speedtest-tracker.dev/getting-started/installation) is wrong.

This is restart: unless-stopped wrong. See above.

alexjustesen commented 1 year ago

PRs welcome on the docs ๐Ÿ‘ https://docs.speedtest-tracker.dev/getting-started/installation