invoiceninja / dockerfiles

Docker files for Invoice Ninja
https://hub.docker.com/r/invoiceninja/invoiceninja
GNU General Public License v2.0
411 stars 267 forks source link

SWAG + v5 - "Read error (Connection reset by peer) in headers" #620

Open andrew-cullen opened 1 week ago

andrew-cullen commented 1 week ago

Setup information

docker-compose.yml

services: swag: image: lscr.io/linuxserver/swag container_name: swag cap_add:

  • NET_ADMIN environment:
  • URL=
  • SUBDOMAINS=wildcard volumes:
  • ../swag:/config ports:
  • 8443:443
  • 8880:80 restart: unless-stopped networks: selfhosted: ipv4_address: 172.20.0.2

.....

Invoice_Ninja: container_name: invoiceninja-v5
image: invoiceninja/invoiceninja:5 env_file: ../invoiceninja/env restart: always volumes:

  • ../invoiceninja/config/hosts:/etc/hosts:ro
  • ../invoiceninja/docker/app/public:/var/www/app/public:rw,delegated
  • ../invoiceninja/docker/app/storage:/var/www/app/storage:rw,delegated
  • ../invoiceninja/config/php/php.ini:/usr/local/etc/php/php.ini
  • ../invoiceninja/config/php/php-cli.ini:/usr/local/etc/php/php-cli.ini

    depends_on:

  • Invoice_Ninja_db networks: selfhosted: ipv4_address: 172.20.0.3

    Invoice_Ninja_db: container_name: ininja_db image: mysql:8 restart: always env_file: ../invoiceninja/env volumes:

  • ../invoiceninja/docker/mysql/data:/var/lib/mysql:rw,delegated

    networks: selfhosted: ipv4_address: 172.20.0.4

Env

IN application vars

APP_URL=https:// APP_KEY=base64:.... APP_DEBUG=true REQUIRE_HTTPS=false
PHANTOMJS_PDF_GENERATION=false PDF_GENERATOR=snappdf TRUSTED_PROXIES='*'

QUEUE_CONNECTION=database

DB connection

DB_HOST=ininja_db DB_PORT=3306 DB_DATABASE=A DB_USERNAME=B DB_PASSWORD=C DB_DATABASE1=A DB_USERNAME1=B DB_PASSWORD1=C

MySQL

MYSQL_ROOT_PASSWORD=D MYSQL_USER=E MYSQL_PASSWORD=F MYSQL_DATABASE=G

GoCardless/Nordigen API key for banking integration

NORDIGEN_SECRET_ID= NORDIGEN_SECRET_KEY=

Swag Config

server { listen 443 ssl; listen [::]:443 ssl; http2 on;

server_name ininja.*;

include /config/nginx/ssl.conf;

client_max_body_size 0;

location / {
    include /config/nginx/proxy.conf;
    include /config/nginx/resolver.conf;
    set $upstream_app invoiceninja-v5;
    set $upstream_port 80;
    set $upstream_proto http;
    proxy_pass $upstream_proto://$upstream_app:$upstream_port;

    proxy_set_header Range $http_range;
    proxy_set_header If-Range $http_if_range;
}

}

Steps taken upon setup

chmod 755 docker/app/public sudo chown -R 1500:1500 docker/app Modify ./config/hosts

Describe the bug

To reproduce See above

Expected behavior Ability to access webserver.

Screenshots/logs Only noteable lines in logs appear to be 2024-10-13 05:15:25,025 WARN For [program:php-fpm], redirect_stderr=true but stderr_logfile has also been set to a filename, the filename has been ignored 2024-10-13 05:15:25,025 WARN For [program:scheduler], redirect_stderr=true but stderr_logfile has also been set to a filename, the filename has been ignored 2024-10-13 05:15:25,025 WARN For [program:queue-worker], redirect_stderr=true but stderr_logfile has also been set to a filename, the filename has been ignored 2024-10-13 05:15:25,025 WARN For [program:queue-worker], redirect_stderr=true but stderr_logfile has also been set to a filename, the filename has been ignored

Docker/Kubernetes/Helm: Running docker 27.1.1

Any feedback as to where I might be able to look next to chase this down would be appreciated. I assume the error is upstream of Swag, as I'm unable to access :9000 from within the InvoiceNinja container, but I may well be missing something obvious here.

Thanks in advance, and apologies for the formatting.

tomtjes commented 2 days ago

Here's what works for me (have only run it for 2 days, so...) :

Swag

version: "3.9"
services:  
  swag:
    image: lscr.io/linuxserver/swag
    container_name: swag
    cap_add:
      - NET_ADMIN
    environment:
      - ...
    volumes:
      - /opt/swag:/config
      - /opt/invoiceninja/docker/app/public:/var/www/app/public:ro
    ports:
      - 443:443
      - 80:80
    restart: unless-stopped

networks:
  default:
    name: proxy-net

Invoice Ninja

version: "3.9"
services:
  invoiceninja:
    image: invoiceninja/invoiceninja:5
    container_name: invoiceninja
    env_file: ./.env
    restart: always
    volumes:
      - ./config/hosts:/etc/hosts:ro
      - ./docker/app/public:/var/www/app/public:rw,delegated
      - ./docker/app/storage:/var/www/app/storage:rw,delegated
      - ./config/php/php.ini:/usr/local/etc/php/php.ini
      - ./config/php/php-cli.ini:/usr/local/etc/php/php-cli.ini
    depends_on:
      - invoiceninja_db
    networks:
      - default
      - proxy-net

  invoiceninja_db:
    image: mariadb:10.4
    container_name: invoiceninja_db
    restart: always
    env_file: ./.env
    volumes:
      - ./docker/mysql/data:/var/lib/mysql:rw,delegated
    networks:
      - default

networks:
  proxy-net:
    external: true

Nginx invoiceninja.subdomain.conf

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name invoices.*;

    include /config/nginx/ssl.conf;

    server_tokens off;

    client_max_body_size 100M;

    root /var/www/app/public/;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;

        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    location ~* /storage/.*\.php$ {
        return 503;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass invoiceninja:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
    }
}