shlinkio / shlink

The definitive self-hosted URL shortener
https://shlink.io
MIT License
3.13k stars 253 forks source link

Multiple error logs on docker #2027

Closed PolGZ closed 6 months ago

PolGZ commented 6 months ago

Shlink version

Latest docker

PHP version

Latest on the docker container

How do you serve Shlink

Docker image

Database engine

MariaDB

Database version

docker : latest

Current behavior

After a test install as showed on the documentation that seemed to end on a running docker without errors on the log, after trying the shlink api-key:generate command and getting the readonly error: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database, I proceeded to add a database to the stack:

Here is my docker compose:

version: '3'

services:
  shlink:
    image: shlinkio/shlink:stable
    restart: unless-stopped
    environment:
      - TZ="Europe/Berlin"
      - SHELL_VERBOSITY=3
      - DEFAULT_DOMAIN=mydomain.com
      - IS_HTTPS_ENABLED=false
      - DB_DRIVER=maria
      - DB_USER=shlink
      - DB_NAME=shlink
      - DB_PASSWORD=dbpassword
      - DB_HOST=sh_database
    depends_on:
      - sh_database
    ports:
      - 8081:8081

  sh_database:
    image: mariadb:latest
    restart: unless-stopped
    environment:
      - MARIADB_ROOT_PASSWORD=mbpassword
      - MARIADB_DATABASE=shlink
      - MARIADB_USER=shlink
      - MARIADB_PASSWORD=mbpassword
    volumes:
      - /home/user/dockers/shlink/db_data:/var/lib/mysql

I got errors on the log indicating to enable shell verbosity at level 3 to get details. But I lack the knowledge to understand them.

Here are the logs:

  ERR   Doctrine\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata() at /etc/shlink/vendor/doctrine/persistence/src/Persistence/Mapping/AbstractClassMetadataFactory.php:207
  ERR   Doctrine\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor() at /etc/shlink/vendor/doctrine/persistence/src/Persistence/Mapping/AbstractClassMetadataFactory.php:96
  ERR   Doctrine\Persistence\Mapping\AbstractClassMetadataFactory->getAllMetadata() at /etc/shlink/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Console/Command/GenerateProxiesCommand.php:50
  ERR   Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand->doExecute() at /etc/shlink/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Console/CommandCompatibility.php:32
  ERR   Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand->execute() at /etc/shlink/vendor/symfony/console/Command/Command.php:326
  ERR   Symfony\Component\Console\Command\Command->run() at /etc/shlink/vendor/symfony/console/Application.php:1078
  ERR   Symfony\Component\Console\Application->doRunCommand() at /etc/shlink/vendor/symfony/console/Application.php:324
  ERR   Symfony\Component\Console\Application->doRun() at /etc/shlink/vendor/symfony/console/Application.php:175
  ERR   Symfony\Component\Console\Application->run() at /etc/shlink/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php:51
  ERR   Doctrine\ORM\Tools\Console\ConsoleRunner::run() at /etc/shlink/bin/doctrine:12
  ERR  
  ERR  orm:generate-proxies [--em EM] [--filter FILTER] [--] [<dest-path>]
  ERR  
  ERR  
  RES  255 Command did not run successfully
Clearing entities cache... [Running "/usr/local/bin/php bin/doctrine orm:clear-cache:metadata"]   RUN  '/usr/local/bin/php' 'bin/doctrine' 'orm:clear-cache:metadata'
  ERR  
  ERR   // Clearing all Metadata cache entries                                         
  ERR  
  ERR   [OK] Successfully deleted cache entries.                                       
  ERR  
  ERR  
  RES  Command ran successfully
������
!
Initializing database if needed... [Running "/usr/local/bin/php bin/cli db:create"]   RUN  '/usr/local/bin/php' 'bin/cli' 'db:create'
  OUT  Creating database tables...
  OUT  
  ERR    RUN  '/usr/local/bin/php' 'bin/doctrine' 'orm:schema-tool:create' '--no-interaction'
  ERR    ERR  
  ERR    ERR   ! [CAUTION] This operation should not be executed in a production environment! 
  ERR    ERR  
  ERR    ERR   Creating database schema...
  ERR    ERR  
  ERR    ERR   [OK] Database schema created successfully!                                     
  ERR    ERR  
  ERR    ERR  
  ERR    RES  Command ran successfully
  ERR  
  OUT  
  OUT   [OK] Database properly created!                                                
  OUT  
  OUT  
  RES  Command ran successfully
������
!
Updating database... [Running "/usr/local/bin/php bin/cli db:migrate"]   RUN  '/usr/local/bin/php' 'bin/cli' 'db:migrate'
  OUT  Migrating database...
  OUT  
  ERR    RUN  '/usr/local/bin/php' 'vendor/doctrine/migrations/bin/doctrine-migrations.php' 'migrations:migrate' '--no-interaction'
  ERR    OUT  
  ERR    OUT   [OK] Successfully migrated to version: ShlinkMigrations\Version20230303164233  
  ERR    OUT  
  ERR    OUT  
  ERR    OUT  
  ERR    RES  Command ran successfully
  ERR  
  OUT  
  OUT   [OK] Database properly migrated!                                               
  OUT  
  OUT  
  RES  Command ran successfully
������
!
Generating proxies... [Running "/usr/local/bin/php bin/doctrine orm:generate-proxies"]   RUN  '/usr/local/bin/php' 'bin/doctrine' 'orm:generate-proxies'
  ERR   Processing entity "Shlinkio\Shlink\Core\ShortUrl\Entity\ShortUrl"
  ERR   Processing entity "Shlinkio\Shlink\Core\Tag\Entity\Tag"
  ERR   Processing entity "Shlinkio\Shlink\Core\Visit\Entity\Visit"
  ERR   Processing entity "Shlinkio\Shlink\Core\ShortUrl\Entity\DeviceLongUrl"
  ERR   Processing entity "Shlinkio\Shlink\Core\Visit\Entity\VisitLocation"
  ERR   Processing entity "Shlinkio\Shlink\Core\Domain\Entity\Domain"
  ERR   Processing entity "Shlinkio\Shlink\Rest\Entity\ApiKeyRole"
  ERR   Processing entity "Shlinkio\Shlink\Rest\Entity\ApiKey"
  ERR  
  ERR   Proxy classes generated to "/etc/shlink/data/proxies"
  ERR  
  RES  Command ran successfully
������
!
Clearing entities cache... [Running "/usr/local/bin/php bin/doctrine orm:clear-cache:metadata"]   RUN  '/usr/local/bin/php' 'bin/doctrine' 'orm:clear-cache:metadata'
  ERR  
  ERR   // Clearing all Metadata cache entries                                         
  ERR  
  ERR   [OK] Successfully deleted cache entries.                                       
  ERR  
  ERR  
  RES  Command ran successfully
������
!
DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728646989000 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728646989000 logger=rpc DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728646989000 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728646989000 logger=rpc msg=plugin was started DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728646989000 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728646989000 logger=rpc DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728646989000 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728646989000 logger=rpc msg=plugin was started address=tcp://127.0.0.1:6001 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728646989000 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728646989000 logger=rpc DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728646989000 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728646989000 logger=rpc msg=plugin was started DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728646989000 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728646989000 logger=rpc DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728646989000 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728646989000 logger=rpc msg=plugin was started address=tcp://127.0.0.1:6001 list of the plugins with RPC methods:=["lock","informer","app","resetter","jobs"]
2024-02-26T19:12:08+0000    DEBUG   jobs            initializing driver {"pipeline": "shlink", "driver": "memory"}
2024-02-26T19:12:08+0000    DEBUG   jobs            driver ready    {"pipeline": "shlink", "driver": "memory", "start": "2024-02-26T19:12:08+0000", "elapsed": "132.552µs"}
DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory msg=pipeline was started DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory msg=pipeline was started driver=memory DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory msg=pipeline was started DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory msg=pipeline was started driver=memory pipeline=shlink DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory msg=pipeline was started DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory msg=pipeline was started driver=memory DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory msg=pipeline was started DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory msg=pipeline was started driver=memory pipeline=shlink start=2024-02-26 19:12:08.647277633 +0000 UTC DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory msg=pipeline was started DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory msg=pipeline was started driver=memory DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory msg=pipeline was started DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory msg=pipeline was started driver=memory pipeline=shlink DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory msg=pipeline was started DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory msg=pipeline was started driver=memory DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory msg=pipeline was started DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 DBG DBG DBG DBG DBG DBG DBG DBG ts=1708974728647279600 logger=memory msg=pipeline was started driver=memory pipeline=shlink start=2024-02-26 19:12:08.647277633 +0000 UTC elapsed=5.415µs
2024-02-26T19:12:08+0000    DEBUG   jobs            exited from jobs pipeline processor
2024-02-26T19:12:08+0000    DEBUG   jobs            exited from jobs pipeline processor
2024-02-26T19:12:08+0000    DEBUG   jobs            exited from jobs pipeline processor
2024-02-26T19:12:08+0000    DEBUG   jobs            exited from jobs pipeline processor
2024-02-26T19:12:08+0000    DEBUG   jobs            exited from jobs pipeline processor
2024-02-26T19:12:08+0000    DEBUG   jobs            exited from jobs pipeline processor
2024-02-26T19:12:08+0000    DEBUG   jobs            exited from jobs pipeline processor
2024-02-26T19:12:08+0000    DEBUG   jobs            exited from jobs pipeline processor
2024-02-26T19:12:08+0000    DEBUG   jobs            exited from jobs pipeline processor
2024-02-26T19:12:08+0000    DEBUG   jobs            exited from jobs pipeline processor
[INFO] RoadRunner server started; version: 2023.3.8, buildtime: 2023-12-14T16:05:30+0000
[INFO] sdnotify: not notified

Expected behavior

At least get the 404 on localhost:8081.

Also, not seeing errors relative to ¿proxies? (ERR orm:generate-proxies) when https is set to false and I didn't even start to try and configure a reverse proxie.

How to reproduce

Fresh docker install with that compose file

acelaya commented 6 months ago

What I see there is a working instance. Have you tried using it, or just assumed it was wrong?

I do see one potential problem. You are mapping with the container's port 8081, when it should be 8080.

PolGZ commented 6 months ago

When I tried the basic compose with the minimal elements shown in the documentation I could at least get the 404 error (which I confirmed was expected behaviour, and I should proceed with the api-key:generate command).

But after adding the database and tried to expand my compose file it wasn't showing anymore.

It was the port mapping you pointed. Now with 8081:8080 404 page is shown. Thank you.

I'll try know to configure the reverse proxy with NPM. You could close this issue, and thanks for the (so quick) support.