snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
11.2k stars 3.2k forks source link

Error 500 on docker install #14234

Open donotos opened 9 months ago

donotos commented 9 months ago

Debug mode

Describe the bug

After upgrading from 6.2.3 to 6.3.0 i get 500 error

Reproduction steps

  1. sudo docker-compose down
  2. sudo docker-compose pull
  3. sudo docker-compose up -d

Expected behavior

upgraded to 6.3.0 and working

Screenshots

Capture d'écran 2024-02-08 202252

Snipe-IT Version

6.3.0

Operating System

Debian 12

Web Server

Apache

PHP Version

8.1

Operating System

No response

Browser

No response

Version

No response

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

Docker logs:

Module ssl disabled.
To activate the new configuration, you need to run:
  service apache2 restart
   Illuminate\Database\QueryException 
  SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = snipeit and table_name = migrations and table_type = 'BASE TABLE')
  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:712
    708▕         // If an exception occurs when attempting to run a query, we'll format the error
    709▕         // message to include the bindings with SQL, which will make this exception a
    710▕         // lot more helpful to the developer instead of just the database's errors.
    711▕         catch (Exception $e) {
  ➜ 712▕             throw new QueryException(
    713▕                 $query, $this->prepareBindings($bindings), $e
    714▕             );
    715▕         }
    716▕     }
      +36 vendor frames 
  37  artisan:35
      Illuminate\Foundation\Console\Kernel::handle()
Configuration cache cleared!
Configuration cache cleared!
Configuration cached successfully!
2024-02-08 18:57:04,556 CRIT Supervisor is running as root.  Privileges were not dropped because no user is specified in the config file.  If you intend to run as root, you can set user=root in the config file to avoid this message.
2024-02-08 18:57:04,557 INFO supervisord started with pid 1
2024-02-08 18:57:05,561 INFO spawned: 'exit_on_any_fatal' with pid 41
2024-02-08 18:57:05,568 INFO spawned: 'apache' with pid 42
2024-02-08 18:57:05,574 INFO spawned: 'run_schedule' with pid 43
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.23.0.3. Set the 'ServerName' directive globally to suppress this message
No scheduled commands are ready to run.
2024-02-08 18:57:06,962 INFO success: exit_on_any_fatal entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-02-08 18:57:06,962 INFO success: apache entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-02-08 18:57:06,963 INFO success: run_schedule entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

Additional context

it's a docker-compose install. it works again after downgrading back to 6.2.3 I tried "php artisan migrate" while the command work it does not get better.

version: "3" services: mysql: image: mariadb:latest container_name: snipe-it_db restart: always environment:

Debug mode error log: log.txt

welcome[bot] commented 9 months ago

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

snipe commented 9 months ago

@uberbrady This looks like a docker permission error for the log file - can you take a look?

apmurdoch commented 9 months ago

I'm a new Snipe-IT user, first time install.

Had this issue also.

Can confirm it is premissions related, as using brute force (e.g. docker exec snipeit chmod -R 777 /var/html/storage and restarting resolved it (not knowing what the permissions should be since it's a first install, obviously I'd find this out and correct it).

But the odd thing: I'm running it as http://fqdn on port 80 since I'm just at the testing stage. In my env I had (by mistake): APP_URL=FQDN I corrected it to APP_URL=http://FQDN Removed and ran it again - no permissions error. If I remove it, change the env file to APP_URL=FQDN without http and run it - permissions error again. So maybe permissions aren't being set correctly based on the format of the APP_URL, one way or another. Hope this might help.

snipe commented 9 months ago

@apmurdoch i think that’s a red herring. APP_URL needs to include the host name and protocol (http:// or https://). The 500 you’re getting is likely because it was trying to write the debug warning about the url to the error log and couldn’t because of permissions

apmurdoch commented 9 months ago

Hah! Yeah makes sense. At least I can move on to my next dumb mistake.

snipe commented 9 months ago

Hah! Yeah makes sense. At least I can move on to my next dumb mistake.

Welcome to our world ;)