Hey there,
i am trying invoice ninja selfhosted and it looks amazing. To assess its feasability I installed it following the official guideline. I have a traefik setup allowing me to run it on my internal home network with proper DNS resolution. This works for everything, the tool works really good, until resources such as images or already generated PDFs are loaded. They get loaded from http://localhost/storage
or similar url with localhost instead of http://domainname/storage
- which makes little sense. It is strange because I can otherwise browse well through the application and everything seems to work with the correct domainname.
All I did was the usual adding labels to the docker container I want to make available (nginx in that example).
version: '3.7'
services:
server:
image: nginx
restart: always
container_name: invoiceninja_nginx
volumes:
- /media/docker-mounts/invoiceninja/config/nginx/in-vhost.conf:/etc/nginx/conf.d/in-vhost.conf:ro
- /media/docker-mounts/invoiceninja/app/public:/var/www/app/public:ro
depends_on:
- invoiceninja-app
networks:
- external-net
env_file:
- invoice.env
- .env
labels:
- traefik.http.routers.invoices.rule=Host(`invoices.mylocaldomain.com`)
- traefik.http.services.invoices.loadbalancer.server.port=80
extra_hosts:
- "in5.localhost:${GEARBOX_HOST_IP} " #host and ip
invoiceninja-app:
image: invoiceninja/invoiceninja:5
container_name: invoiceninja_app
restart: always
env_file:
- invoice.env
- .env
volumes:
- /media/docker-mounts/invoiceninja/config/hosts:/etc/hosts:ro
- /media/docker-mounts/invoiceninja/app/public:/var/www/app/public:rw,delegated
- /media/docker-mounts/invoiceninja/app/storage:/var/www/app/storage:rw,delegated
depends_on:
- invoiceninja_db
networks:
- external-net
extra_hosts:
- "in5.localhost:${GEARBOX_HOST_IP} " #host and ip
invoiceninja_db:
container_name: invoiceninja_database
image: mariadb:10.4
env_file:
- invoice.env
- .env
# ports:
# - "3305:3306"
restart: always
volumes:
- /media/docker-mounts/invoiceninja/database:/var/lib/mysql:rw,delegated
networks:
- external-net
extra_hosts:
- "in5.localhost:${GEARBOX_HOST_IP} " #host and ip
networks:
external-net:
external: true
invoice.env:
# --- Invoice Ninja
IN_APP_URL=http://invoices.mylocaldomain.com
APP_KEY=base64:bM0123...
APP_DEBUG=false
REQUIRE_HTTPS=false
PHANTOMJS_PDF_GENERATION=false
PDF_GENERATOR=snappdf
QUEUE_CONNECTION=database
# DB connection
DB_HOST=invoiceninja_db
DB_PORT=3306
DB_DATABASE=ninja
DB_USERNAME=ninja
DB_PASSWORD=****
# Create initial user
# Default to these values if empty
# IN_USER_EMAIL=admin@example.com
# IN_PASSWORD=changeme!
IN_USER_EMAIL=
IN_PASSWORD=
# Mail options
MAIL_MAILER=log
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS='user@example.com'
MAIL_FROM_NAME='Self Hosted User'
# MySQL
MYSQL_ROOT_PASSWORD=****
MYSQL_USER=ninja
MYSQL_PASSWORD=****
MYSQL_DATABASE=ninja
Ideas? It seems quite straight forward, but still strange.
Edit: Maybe to say if I take the request URL to a resource http://localhost/client/invoice/n68SvXVwCc6RWhfeO7dCNdq2iYBGWNLW/download?t=1634735414637&per_page=999999
and change the URL manually to http://invoices.mylocaldomain.com/client/invoice/n68SvXVwCc6RWhfeO7dCNdq2iYBGWNLW/download?t=1634735414637&per_page=999999
that works.