Hi all, just installed this instance of V5 after migrating from an old vm.
I couldnt get snappdf working at all. If I ran sudo -u www-data ./vendor/bin/snappdf download
it would seem to install and that all went well but anytime I would generate a pdf the logs would say The process has been signaled with signal "5"
.
From there I then tried to install chrome seperately and set fastcgi_param SNAPPDF_EXECUTABLE_PATH '/usr/bin/google-chrome';
in my Nginx config with PDF_GENERATOR=snappdf and SNAPPDF_CHROMIUM_PATH=/usr/bin/google-chrome
set in my .env file. That allowed me to generate pdfs and that all worked well until I went to setup my email config when I try to send invoices the laravel.log says
production.ERROR: Unable to generate the raw PDF {"exception":"[object] (App\\Exceptions\\FilePermissionsFailure(code: 0): Unable to generate the raw PDF at /var/www/invoiceninja/app/Jobs/Entity/CreateRawPdf.php:212)
Does anyone have any clue how I can fix this? Below I have put my config files
/var/www/invoiceninja/.env
APP_NAME="Ninja"
APP_ENV=production
APP_KEY=[REDACTED]
APP_DEBUG="false"
APP_URL="https://invoice.mydomain.com"
DB_CONNECTION="mysql"
MULTI_DB_ENABLED=false
DB_HOST="localhost"
DB_DATABASE="db-ninja-01"
DB_USERNAME="ninja"
DB_PASSWORD="[REDACTED]"
DB_PORT="3306"
DEMO_MODE=false
BROADCAST_DRIVER=log
LOG_CHANNEL=stack
CACHE_DRIVER=file
QUEUE_CONNECTION=database
INTERNAL_QUEUE_ENABLED=false
SESSION_DRIVER=file
SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER="smtp"
MAIL_HOST="smtp.gmail.com"
MAIL_PORT="587"
MAIL_USERNAME="myemail@gmail.com"
MAIL_PASSWORD="[MY_APP_KEY]"
MAIL_ENCRYPTION="tls"
MAIL_FROM_ADDRESS="myemail@gmail.com"
MAIL_FROM_NAME="First Last"
POSTMARK_API_TOKEN=
REQUIRE_HTTPS="true"
GOOGLE_MAPS_API_KEY=
ERROR_EMAIL=
TRUSTED_PROXIES=*
NINJA_ENVIRONMENT="selfhost"
#options - snappdf / phantom / hosted_ninja
PDF_GENERATOR=snappdf
SNAPPDF_CHROMIUM_PATH=/usr/bin/google-chrome
PHANTOMJS_KEY='a-demo-key-with-low-quota-per-ip-address'
PHANTOMJS_SECRET=secret
UPDATE_SECRET=[REDACTED]
DELETE_PDF_DAYS=60
DELETE_BACKUP_DAYS=60
COMPOSER_AUTH='{"github-oauth": {"github.com": "${{ secrets.GITHUB_TOKEN }}"}}'
GOOGLE_PLAY_PACKAGE_NAME=
APPSTORE_PASSWORD=
MICROSOFT_CLIENT_ID=
MICROSOFT_CLIENT_SECRET=
MICROSOFT_REDIRECT_URI=
APPLE_CLIENT_ID=
APPLE_CLIENT_SECRET=
APPLE_REDIRECT_URI=
LOCAL_DOWNLOAD=true
/etc/nginx/conf.d/invoiceninja.conf
server {
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
server_name invoice.mydomain.com;
client_max_body_size 100M;
if ($host != $server_name) {
return 301 https://$server_name$request_uri;
}
root /var/www/invoiceninja/public;
index index.php index.html index.htm;
ssl_certificate "/etc/letsencrypt/live/invoice.mydomain.com/fullchain.pem";
ssl_certificate_key "/etc/letsencrypt/live/invoice.mydomain.com/privkey.pem";
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~* \.pdf$ {
add_header Cache-Control no-store;
}
if (!-e $request_filename) {
rewrite ^(.+)$ /index.php?q= last;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SNAPPDF_EXECUTABLE_PATH '/usr/bin/google-chrome';
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}
location ~ /\.ht {
deny all;
}
location = /favicon.ico {
access_log off; log_not_found off;
}
location = /robots.txt {
access_log off; log_not_found off;
}
access_log /var/log/nginx/ininja.access.log;
error_log /var/log/nginx/ininja.error.log;
}
server {
listen 80;
server_name invoice.mydomain.com;
add_header Strict-Transport-Security max-age=2592000;
rewrite ^ https://$server_name$request_uri? permanent;
}
/etc/supervisor/conf.d/laravel-worker.conf
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/invoiceninja/artisan queue:work --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=1
redirect_stderr=true
stdout_logfile=/var/www/invoiceninja/storage/logs/worker.log
stopwaitsecs=3600