linuxserver / docker-snipe-it

Alpine/Nginx container for the Asset Management software Snipe-IT
GNU General Public License v3.0
123 stars 26 forks source link

Server Error 500 after fresh install #47

Closed Surgical71 closed 1 year ago

Surgical71 commented 1 year ago

linuxserver.io

Server error 500 after fresh docker-compose install


Current Behavior

-- Server error 500. Both App container and SQL container runs as expected and provides a IP

Steps to Reproduce

  1. Launched stack via Portainer and docker compose
  2. Connected to container via NGINX proxy manager

Environment

OS: -- Ubuntu Server CPU architecture: -- arm64 How docker service was installed: -- Via Portainer

Command used to create docker container (run/create/compose/screenshot)

version: "3" services: mysql: image: lscr.io/linuxserver/mariadb:latest container_name: snipe_mysql restart: unless-stopped volumes:

Docker logs


      _         ()
     | |  ___   _    __
     | | / __| | |  /  \
     | | \__ \ | | | () |
     |_| |___/ |_|  \__/

Brought to you by linuxserver.io

To support the app dev(s) visit: Snipe-IT: https://snipeitapp.com/donate To support LSIO projects visit: https://www.linuxserver.io/donate/

GID/UID

User uid: 1000 User gid: 1000

cont-init: info: /etc/cont-init.d/10-adduser exited 0 cont-init: info: running /etc/cont-init.d/20-config cont-init: info: /etc/cont-init.d/20-config exited 0 cont-init: info: running /etc/cont-init.d/30-keygen using keys found in /config/keys cont-init: info: /etc/cont-init.d/30-keygen exited 0 cont-init: info: running /etc/cont-init.d/40-config cont-init: info: /etc/cont-init.d/40-config exited 0 cont-init: info: running /etc/cont-init.d/99-custom-files [custom-init] No custom files found, skipping... cont-init: info: /etc/cont-init.d/99-custom-files exited 0 s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service init-mods: starting s6-rc: info: service init-mods successfully started s6-rc: info: service init-mods-package-install: starting s6-rc: info: service init-mods-package-install successfully started s6-rc: info: service init-mods-end: starting s6-rc: info: service init-mods-end successfully started s6-rc: info: service init-services: starting s6-rc: info: service init-services successfully started s6-rc: info: service legacy-services: starting services-up: info: copying legacy longrun cron (no readiness notification) services-up: info: copying legacy longrun nginx (no readiness notification) services-up: info: copying legacy longrun php-fpm (no readiness notification) s6-rc: info: service legacy-services successfully started s6-rc: info: service 99-ci-service-check: starting [ls.io-init] done. s6-rc: info: service 99-ci-service-check successfully started

github-actions[bot] commented 1 year ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

GooRoo commented 1 year ago

I've just come here to create exactly same issue. Was trying to do something with it the whole day yesterday with no luck. My docker-compose.yaml is nearly the same too:

---
version: "2.1"
services:
  db:
    image: lscr.io/linuxserver/mariadb:latest
    environment:
      - PUID=1026
      - PGID=100
      - TZ=Europe/Berlin
      - MYSQL_ROOT_PASSWORD=<root-pass>
      - MYSQL_DATABASE=snipeit
      - MYSQL_USER=snipeit
      - MYSQL_PASSWORD=<pass>
    volumes:
      - <data-folder>/db:/config
    restart: unless-stopped

  web:
    image: lscr.io/linuxserver/snipe-it:latest
    depends_on:
      - db
    healthcheck:
      test: ["CMD", "curl", "-fs", "-S", "--max-time", "2", "http://localhost:80"]
      interval: 30s
      timeout: 10s
      retries: 5
    environment:
      - PUID=1026
      - PGID=100
      - TZ=Europe/Berlin
      - APP_URL=http://192.168.2.10:8080
      - MYSQL_PORT_3306_TCP_ADDR=db
      - MYSQL_PORT_3306_TCP_PORT=3306
      - MYSQL_DATABASE=snipeit
      - MYSQL_USER=snipeit
      - MYSQL_PASSWORD=<pass>
    volumes:
      - <data-folder>/config:/config
    ports:
      - 8080:80
    restart: unless-stopped
nemchik commented 1 year ago

Can you test lspipepr/snipe-it:v6.0.11-pkg-2eb37743-pr-28 and leave a comment on https://github.com/linuxserver/docker-snipe-it/pull/28 to let us know if it works or if you have any issues?

I don't know if #28 addresses the issue here, but there are significant changes incoming and it might. If not, we'll need a bit more information, specifically the nginx error logs from /config/log/nginx/error.log and possibly other logs as well.

Surgical71 commented 1 year ago

Can you test lspipepr/snipe-it:v6.0.11-pkg-2eb37743-pr-28 and leave a comment on #28 to let us know if it works or if you have any issues?

I don't know if #28 addresses the issue here, but there are significant changes incoming and it might. If not, we'll need a bit more information, specifically the nginx error logs from /config/log/nginx/error.log and possibly other logs as well.

Same Issue

Karunamon commented 1 year ago

I was getting this problem, a look at /config/log/nginx/error.log showed a number of complaints about my chosen time zone.

After setting TZ=US/Eastern in the application environment variables and redeploying, there have been no further problems. Unlike some other applications, snipe-it is naturally pretty quiet and the lack of meaningful output in the container log other than the usual LSIO stuff is normal.

GooRoo commented 1 year ago

In my case the /config/log/nginx/error.log is full of the following:

2022/10/23 19:11:25 [error] 28640#28640: *21166 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught InvalidArgumentException: Please provide a valid cache path. in /var/www/html/vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php:36
Stack trace:
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/View/ViewServiceProvider.php(88): Illuminate\View\Compilers\Compiler->__construct()
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(873): Illuminate\View\ViewServiceProvider->Illuminate\View\{closure}()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(758): Illuminate\Container\Container->build()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(851): Illuminate\Container\Container->resolve()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(694): Illuminate\Foundation\Application->resolve()
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(836): Illuminate\Container\Container->make...
GooRoo commented 1 year ago

Ah, okay, the problem in my case is with the volume that I mount. It doesn't like something in the permissions I suppose because if I don't map it to the folder but just use a named docker volume, it works.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

devvick commented 1 year ago

Still doesn't work on :latest image:

2022/12/11 19:29:30 [error] 201#201: *4 FastCGI sent in stderr: "PHP message: PHP Notice:  date_default_timezone_set(): Timezone ID 'Europe/Warsaw
' is invalid in /app/www/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php on line 49" while reading response header from upstream, client: 172.18.0.7, server: <redacted>, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "<redacted>"

None of TZ settings changes work:

2022/12/11 13:45:29 [error] 201#201: *1 FastCGI sent in stderr: "PHP message: PHP Notice:  date_default_timezone_set(): Timezone ID 'US/Eastern
' is invalid in /app/www/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php on line 49" while reading response header from upstream, client: 172.18.0.7, server: <redacted>, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "<redacted>"
2022/12/11 18:35:45 [error] 203#203: *1 FastCGI sent in stderr: "PHP message: PHP Notice:  date_default_timezone_set(): Timezone ID 'UTC
' is invalid in /app/www/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php on line 49" while reading response header from upstream, client: 172.18.0.7, server: <redacted>, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "<redacted>"
thespad commented 1 year ago

It looks like a line break is getting added to the end of the TZ somehow

madtempest commented 1 year ago

This is the Laravel error I'm getting on :latest but there are no errors in nginx access.log or php access.log.

This occurs whether via reverse proxy or straight to the container.

`[2022-12-26 11:44:13] production.ERROR: Header may not contain more than a single header, new line detected {"exception":"[object] (ErrorException(code: 0): Header may not contain more than a single header, new line detected at /app/www/vendor/symfony/http-foundation/Response.php:359) [stacktrace]

0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()

1 /app/www/vendor/symfony/http-foundation/Response.php(359): header()

2 /app/www/vendor/symfony/http-foundation/Response.php(393): Symfony\Component\HttpFoundation\Response->sendHeaders()

3 /app/www/vendor/laravel/framework/src/Illuminate/Support/HigherOrderTapProxy.php(34): Symfony\Component\HttpFoundation\Response->send()

4 /app/www/public/index.php(53): Illuminate\Support\HigherOrderTapProxy->__call()

5 {main}

"}`

thespad commented 1 year ago

I think it's because this is using echo and not printf https://github.com/linuxserver/docker-snipe-it/blob/master/root/etc/cont-init.d/40-config#L75-L78

I'll see if I can PR a fix for people to test.

thespad commented 1 year ago

OK, @devvick @madtempest can you test with lspipepr/snipe-it:v6.0.14-pkg-2013becd-pr-48, it should fix all the issues introduced by version 6 having a dislike for spurious newlines.

If you've got an existing .env file in /config it'll need to be deleted (or fix the newlines by hand, or use a completely clean /config mount).

madtempest commented 1 year ago

OK, @devvick @madtempest can you test with lspipepr/snipe-it:v6.0.14-pkg-2013becd-pr-48, it should fix all the issues introduced by version 6 having a dislike for spurious newlines.

If you've got an existing .env file in /config it'll need to be deleted (or fix the newlines by hand, or use a completely clean /config mount).

I can confirm that this seems to fix the issue for me. No more server 500 errors and I can authenticate and browse assets correctly.

Thank you.

thespad commented 1 year ago

PR is merged and should build and push to live in the next ~30 minutes.