Cannot setup v5.8.51 - Laravel variables not populated?

Hi there,

I have been trying to setup Invoice Ninja v.5.8.51 on Ubuntu 22.04 LTS and NGINX at least a dozen of times.

No matter what I try, I keep on getting the same error message over and over again:

The command "mysql  --user="${:LARAVEL_LOAD_USER}" --password="${:LARAVEL_LOAD_PASSWORD}" --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}" --database="${:LARAVEL_LOAD_DATABASE}" < "${:LARAVEL_LOAD_PATH}"" failed.

Exit Code: 1(General error)

Working directory: /usr/share/nginx/invoiceninja/public

Output:
================


Error Output:
================
ERROR 2002 (HY000): Received error packet before completion of TLS handshake. The authenticity of the following error cannot be verified:
1130 - Received error packet before completion of TLS handshake. The authenticity of the following error cannot be verified … ```

I closely followed the instructions as set out here [https://forum.invoiceninja.com/t/install-invoice-ninja-v5-5-on-ubuntu-22-04/13272](https://forum.invoiceninja.com/t/install-invoice-ninja-v5-5-on-ubuntu-22-04/13272). What am I missing?

Nextcloud and Matomo run flawlessly on the same webserver, all applications are being served as vhosts with php8.1-fpm as upstream server:

server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name invoiceninja.undisclosed-domain.com;
client_max_body_size 64M;

# This if statement will forcefully redirect any connection attempts to explicitly use the domain name.
# If not, and your DNS doesn’t provide IP address protection, accessing the server with direct IP can
# cause glitches with the services provided by the app, that could be security, or usability issues.

 if ($host != $server_name) {
		return 301 https://$server_name$request_uri\;
 \}

# Here, enter the path to your invoiceninja directory, in the public dir. VERY IMPORTANT
# DO NOT point the root directly at your invoiceninja directory, it MUST point at the public folder
# This is for security reasons.

root         /usr/share/nginx/invoiceninja/public\;

gzip on\;
gzip_types application/javascript application/x-javascript text/javascript text/plain application/xml application/json\;
gzip_proxied    no-cache no-store private expired auth\;
gzip_min_length 1000\;

index index.php index.html index.htm\;

ssl_certificate /etc/letsencrypt/live/invoiceninja.undisclosed-domain.com/fullchain.pem\; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/invoiceninja.undisclosed-domain.com/privkey.pem\; # managed by Certbot

# include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

ssl_session_cache shared:SSL:10m\;
ssl_session_timeout  30m\;
ssl_ciphers 'AES128+EECDH:AES128+EDH:!aNULL'\;
ssl_prefer_server_ciphers on\;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2\;

charset utf-8\;

# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;

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

if (!-e $request_filename) {
		rewrite ^(.+)$ /index.php?q= last\;
\}

 location ~ \.php$ {
			fastcgi_split_path_info ^(.+\.php)(/.+)$;
		\# Here we pass php requests to the php8.1-fpm listen socket.  
		\# PHP errors are often because this value is not correct.  
		\# Verify your php8.1-fpm.sock socket file exists at the below directory
		\# and that the php8.1-fpm service is running.
			fastcgi_pass unix:/var/run/php/php8.1-fpm.sock\;
			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\;
 \}

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\;

 sendfile off\;

}

server {
listen 80;
server_name invoiceninja.undisclosed-domain.com;
add_header Strict-Transport-Security max-age=2592000;
rewrite ^ https://$server_name$request_uri? permanent;
}


What is probably misconfigured? Please advise …


Jens

Hi,

Are you able to use mysql from the command line to access the database?

Hi @hillel,

Yes, I am. I tried accessing it via “mysql -u ninja …” on ssh as root.

Likewise, /setup gave my a green light … so that I was provided with fields to setup a user. Afterwards, the error message comes up.

And .env gets populated.

The ownership of root /usr/share/invoiceninja/public is www-data:www-data

Could it have to do with n nginx upstream declaration in another conf?

Sorry, I’m not sure.

You may want to try with the Docker install or use one of the automated installers.

Thanks, Hillel …

Hmm … I’d really like to stick to an ordinary installation as I am not really familiar with Docker and already have SSL certificates in place.

I somehow assume that Laravel cannot write to the db.

Hi Hillel,

I solved my problem on my non-containered install. it took me ages to find the culprit …

I had to fiddle with skip-name-resolve in one of my mysql conf files so that laravel would talk to my db on setup.

Cheers,
Jens

1 Like

Glad to hear it, thanks for sharing the solution!