In desperate need for self hosting help in proxmox

Hello first time poster here.

Im hoping someone could help me with a tutorial or even a install script.

I just built my first proxmox server about a week ago and am trying to move a lot of stuff to self hosted.

I know its frowned upon but so far I have used quite a few proxmox install scripts and set up a few very basic vms. I have setup docker , portainer and docker compose in its own lxc as well.

However I have been banging my head against the wall for the last week trying to get invoice ninja running. I have tried running the docker compose install guides and googling and can get to the point where it appears the service is up and running and but cant access the web gui, or i get errors.

I’m looking for help getting this running as am a freelancer and looking to use it for freelancing purposes. Ideally I would like to have it running on a local ip address and be able move it to my domain later or make it access able via Cloudflare.

Would someone be able to help me with a simple install script / guide to get this installed and access able locally in a proxmox lxc?

I would be ever so grateful and please forgive my ignorance for not understanding all the info in the forums and guides as I have simply become overwhelmed.

Thanks!

So i seem to have found a few helper scripts to get it installed and running. Im just not entirely sure what to change the env files to get it to run on a local ip address and connect to the DB…

Hi,

@david do you have any suggestions?

Scratch that so far every guide I have followed has tossed me errors and left me with a unusable mess… I have a domain ready to go and proxmox but cant seem to get anything running using any tutorial

If you can provide the errors you are seeing we can try to help.

I’m not familiar with Proxmox, however with docker compose we have this video which shows - live - the configuration of a Invoice Ninja installation

Hello mjkent090!

I run Invoice Ninja on Proxmox 8 using a Debian 12 container behind a reverse proxy, a Cloudflare Tunnel would be a great option as well.

Below is the “cheat sheet” I’ve created over a couple years of testing, and amazing support from the devs. I hope this helps!

1. Look for support here:
   1st: https://invoiceninja.github.io/en/self-host-installation/
   2nd: https://forum.invoiceninja.com/latest
   3rd: https://invoiceninja.slack.com/

3. Import not working? Database errors in log? Run the following and retry import:
   sudo -u www-data php artisan migrate

4. Logo not showing on imported PDFs:
   You may need to copy the contents of storage/app/public/ from your old install to your new one.
   
5. If something is acting "wonky," the following may help:

   https://YOURDOMAIN.XYZ?clear_cache=true

   https://YOURDOMAIN.XYZ?update?secret=secret

   systemctl restart nginx mysql

   cd /var/www/html/invoiceninja && sudo -u www-data php artisan optimize

   chown -R www-data:www-data /var/www/html/invoiceninja

   find ./ -type d -exec chmod 755 {} \;

	# Update system
	
apt update && apt full-upgrade -y

	# Install dependencies and packages
	
apt install apt-transport-https ca-certificates composer curl fonts-liberation git libappindicator3-1 libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgbm-dev libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxshmfence-dev libxss1 libxtst6 lsb-release mariadb-client mariadb-server nginx supervisor wget php8.2-{bcmath,cgi,common,curl,fpm,gd,gmp,imagick,imap,intl,ldap,bz2,mailparse,mbstring,mysql,pgsql,opcache,soap,xml,zip} software-properties-common sudo xdg-utils -y

	# Configure PHP

nano /etc/php/8.2/fpm/php.ini

memory_limit = 1024M

	# Setup MySQL
	
systemctl enable --now mysql
	
mysql_secure_installation

	# Yes to all, set root password

mysql -u root -p

CREATE SCHEMA `ninjadb` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

CREATE USER 'ninja'@'localhost' IDENTIFIED BY 'PASSWORD';

GRANT ALL PRIVILEGES ON ninjadb.* TO 'ninja'@'localhost';

FLUSH PRIVILEGES;

exit

	# Set Invoice Ninja as default site config

rm /etc/nginx/sites-enabled/default
rm /etc/nginx/sites-available/default
nano /etc/nginx/sites-available/invoiceninja

	# Add the following, change YOUR_URL to your actual URL, uncomment the Cloudflare PDF option at the bottom if needed, save & close

server {

	listen 80 default_server;
	listen [::]:80 default_server;

	root /var/www/html/invoiceninja/public;

	index index.html index.htm index.php;

	charset utf-8;
	client_max_body_size 100M;

	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;

	server_name YOUR_URL;

	location / {
	    try_files $uri $uri/ =404;
	}

	location ~ \.php$ {

	   include snippets/fastcgi-php.conf;
	   fastcgi_pass unix:/run/php/php8.2-fpm.sock;
	}

	location ~ /\.ht {
	   deny all;
	}

	location ~* \.pdf$ {
	    add_header Cache-Control no-store;
	}

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

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

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

	#Only enable this for PDF creation via Cloudflare Tunnel
	#location ~* \.pdf$ {
	#    add_header Cache-Control no-store;
	#}
}
ln -s /etc/nginx/sites-available/invoiceninja /etc/nginx/sites-enabled/
nginx -t

	# You should see:
	# nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
	# nginx: configuration file /etc/nginx/nginx.conf test is successful

systemctl restart nginx

	# Clone Invoice Ninja, create project with composer

chown -R www-data:www-data /var/www/html

cd /var/www/html && sudo -u www-data git clone -b v5-stable --single-branch https://github.com/invoiceninja/invoiceninja.git

cd invoiceninja

sudo -u www-data composer create-project --no-dev

	# Yes to the question at the end regarding .env

	# Configure .env

sudo -u www-data nano .env
	
	# Change the following

QUEUE_CONNECTION=database
PDF_GENERATOR=snappdf
TRUSTED_PROXIES=*

	# Add the following, save & close
	
INTERNAL_QUEUE_ENABLED=false
LOCAL_DOWNLOAD=true

    # Download SnapPDF, set proper permissions, test SnapPDF

sudo -u www-data vendor/bin/snappdf download

find ./ -type d -exec chmod 755 {} \;

sudo -u www-data ./vendor/bin/snappdf convert --html "<h1>Hello world</h1>" test.pdf
	# You should see: "Success! PDF saved at test.pdf"
	
	# Set crontab to run Laravel Scheduler every minute, handle queued work, & send invoice reminders at 8 AM every Saturday

sudo -u www-data crontab -e

* * * * * cd /var/www/html/invoiceninja/ && php artisan schedule:run >> /dev/null 2>&1
* * * * * cd /var/www/html/invoiceninja/ && php artisan queue:work --stop-when-empty
0 8 * * Sat cd /var/www/html/invoiceninja/ && php artisan ninja:send-invoices

	# Configure Laravel Supervisor & clear cache

nano /etc/supervisor/conf.d/laravel-worker.conf

	# Add the following, save and close

[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/html/invoiceninja/artisan queue:work --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=8
redirect_stderr=true
stdout_logfile=/var/log/supervisor.log
stopwaitsecs=3600

	# Enable and start supervisor

supervisorctl reread && supervisorctl update && supervisorctl start laravel-worker:*

sudo -u www-data php artisan optimize

	# Browse to your IP/Domain and complete setup. You may get a 500 error, if so do the following, then remove /setup from the URL.

sudo -u www-data php artisan queue:restart
2 Likes