Skip to content

Commit 6135f1f

Browse files
Add invoiceninja (ct) (#9905)
Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com>
1 parent cf14c1b commit 6135f1f

File tree

3 files changed

+295
-0
lines changed

3 files changed

+295
-0
lines changed

ct/invoiceninja.sh

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/usr/bin/env bash
2+
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: MickLesk (CanbiZ)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://invoiceninja.com/
7+
8+
APP="InvoiceNinja"
9+
var_tags="${var_tags:-invoicing;business}"
10+
var_cpu="${var_cpu:-2}"
11+
var_ram="${var_ram:-2048}"
12+
var_disk="${var_disk:-8}"
13+
var_os="${var_os:-debian}"
14+
var_version="${var_version:-13}"
15+
var_unprivileged="${var_unprivileged:-1}"
16+
17+
header_info "$APP"
18+
variables
19+
color
20+
catch_errors
21+
22+
function update_script() {
23+
header_info
24+
check_container_storage
25+
check_container_resources
26+
27+
if [[ ! -d /opt/invoiceninja ]]; then
28+
msg_error "No ${APP} Installation Found!"
29+
exit
30+
fi
31+
32+
if check_for_gh_release "invoiceninja" "invoiceninja/invoiceninja"; then
33+
msg_info "Stopping Services"
34+
systemctl stop supervisor nginx php8.4-fpm
35+
msg_ok "Stopped Services"
36+
37+
msg_info "Creating Backup"
38+
mkdir -p /tmp/invoiceninja_backup
39+
cp /opt/invoiceninja/.env /tmp/invoiceninja_backup/
40+
cp -r /opt/invoiceninja/storage /tmp/invoiceninja_backup/ 2>/dev/null || true
41+
cp -r /opt/invoiceninja/public/storage /tmp/invoiceninja_backup/public_storage 2>/dev/null || true
42+
msg_ok "Created Backup"
43+
44+
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "invoiceninja" "invoiceninja/invoiceninja" "prebuild" "latest" "/opt/invoiceninja" "invoiceninja.tar.gz"
45+
46+
msg_info "Restoring Data"
47+
cp /tmp/invoiceninja_backup/.env /opt/invoiceninja/
48+
cp -r /tmp/invoiceninja_backup/storage/* /opt/invoiceninja/storage/ 2>/dev/null || true
49+
cp -r /tmp/invoiceninja_backup/public_storage/* /opt/invoiceninja/public/storage/ 2>/dev/null || true
50+
rm -rf /tmp/invoiceninja_backup
51+
msg_ok "Restored Data"
52+
53+
msg_info "Running Migrations"
54+
cd /opt/invoiceninja
55+
$STD php artisan migrate --force
56+
$STD php artisan config:clear
57+
$STD php artisan cache:clear
58+
$STD php artisan optimize
59+
chown -R www-data:www-data /opt/invoiceninja
60+
chmod -R 755 /opt/invoiceninja/storage
61+
msg_ok "Ran Migrations"
62+
63+
msg_info "Starting Services"
64+
systemctl start php8.4-fpm nginx supervisor
65+
msg_ok "Started Services"
66+
67+
msg_ok "Updated Successfully"
68+
fi
69+
exit
70+
}
71+
72+
start
73+
build_container
74+
description
75+
76+
msg_ok "Completed Successfully!\n"
77+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
78+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
79+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8080/setup${CL}"
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "InvoiceNinja",
3+
"slug": "invoiceninja",
4+
"categories": [
5+
3
6+
],
7+
"date_created": "2025-12-09",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 8080,
12+
"documentation": "https://invoiceninja.github.io/selfhost.html",
13+
"config_path": "/opt/invoiceninja/.env",
14+
"website": "https://invoiceninja.com/",
15+
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/invoice-ninja.webp",
16+
"description": "Invoice Ninja is a free, open-source invoicing, quotes, expenses and time-tracking application for freelancers and businesses. Features include recurring invoices, online payments, client portal, and multi-company support.",
17+
"install_methods": [
18+
{
19+
"type": "default",
20+
"script": "ct/invoiceninja.sh",
21+
"resources": {
22+
"cpu": 2,
23+
"ram": 2048,
24+
"hdd": 8,
25+
"os": "Debian",
26+
"version": "13"
27+
}
28+
}
29+
],
30+
"default_credentials": {
31+
"username": null,
32+
"password": null
33+
},
34+
"notes": [
35+
{
36+
"text": "First visit http://IP:8080/setup to complete the initial configuration",
37+
"type": "info"
38+
},
39+
{
40+
"text": "Database credentials are stored in ~/invoiceninja.creds",
41+
"type": "info"
42+
},
43+
{
44+
"text": "Configure SMTP settings in /opt/invoiceninja/.env for email functionality",
45+
"type": "warning"
46+
}
47+
]
48+
}

install/invoiceninja-install.sh

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: MickLesk (CanbiZ)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://invoiceninja.com/
7+
8+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apt install -y \
18+
nginx \
19+
supervisor
20+
msg_ok "Installed Dependencies"
21+
22+
setup_mariadb
23+
MARIADB_DB_NAME="invoiceninja" MARIADB_DB_USER="invoiceninja" setup_mariadb_db
24+
PHP_VERSION="8.4" PHP_FPM="YES" PHP_MODULE="bcmath,curl,gd,gmp,imagick,intl,mbstring,mysql,soap,xml,zip" setup_php
25+
import_local_ip
26+
fetch_and_deploy_gh_release "invoiceninja" "invoiceninja/invoiceninja" "prebuild" "latest" "/opt/invoiceninja" "invoiceninja.tar.gz"
27+
28+
msg_info "Configuring InvoiceNinja"
29+
cd /opt/invoiceninja
30+
APP_KEY=$(php artisan key:generate --show)
31+
cat <<EOF >/opt/invoiceninja/.env
32+
APP_NAME="Invoice Ninja"
33+
APP_ENV=production
34+
APP_KEY=${APP_KEY}
35+
APP_DEBUG=false
36+
APP_URL=http://${LOCAL_IP}:8080
37+
38+
DB_CONNECTION=mysql
39+
DB_HOST=127.0.0.1
40+
DB_PORT=3306
41+
DB_DATABASE=${MARIADB_DB_NAME}
42+
DB_USERNAME=${MARIADB_DB_USER}
43+
DB_PASSWORD=${MARIADB_DB_PASS}
44+
45+
MULTI_DB_ENABLED=false
46+
DEMO_MODE=false
47+
48+
BROADCAST_DRIVER=log
49+
LOG_CHANNEL=stack
50+
CACHE_DRIVER=file
51+
QUEUE_CONNECTION=database
52+
SESSION_DRIVER=file
53+
SESSION_LIFETIME=120
54+
55+
MAIL_MAILER=log
56+
MAIL_HOST=null
57+
MAIL_PORT=null
58+
MAIL_USERNAME=null
59+
MAIL_PASSWORD=null
60+
MAIL_ENCRYPTION=null
61+
MAIL_FROM_ADDRESS="noreply@localhost"
62+
MAIL_FROM_NAME="Invoice Ninja"
63+
64+
REQUIRE_HTTPS=false
65+
NINJA_ENVIRONMENT=selfhost
66+
PDF_GENERATOR=snappdf
67+
68+
TRUSTED_PROXIES=*
69+
INTERNAL_QUEUE_ENABLED=false
70+
EOF
71+
72+
mkdir -p /opt/invoiceninja/bootstrap/cache
73+
mkdir -p /opt/invoiceninja/storage/{app/public,framework/{cache/data,sessions,views},logs}
74+
chown -R www-data:www-data /opt/invoiceninja
75+
chmod -R 775 /opt/invoiceninja/storage /opt/invoiceninja/bootstrap/cache
76+
msg_ok "Configured InvoiceNinja"
77+
78+
msg_info "Setting up Database"
79+
cd /opt/invoiceninja
80+
$STD php artisan config:clear
81+
$STD php artisan cache:clear
82+
$STD php artisan route:clear
83+
$STD php artisan view:clear
84+
$STD php artisan migrate --force
85+
$STD php artisan db:seed --force
86+
$STD php artisan optimize
87+
msg_ok "Set up Database"
88+
89+
msg_info "Configuring Nginx"
90+
cat <<'EOF' >/etc/nginx/sites-available/invoiceninja
91+
server {
92+
listen 8080;
93+
server_name _;
94+
root /opt/invoiceninja/public;
95+
index index.php;
96+
97+
client_max_body_size 50M;
98+
charset utf-8;
99+
100+
gzip on;
101+
gzip_types application/javascript application/x-javascript text/javascript text/plain application/xml application/json;
102+
gzip_proxied no-cache no-store private expired auth;
103+
gzip_min_length 1000;
104+
105+
location / {
106+
try_files $uri $uri/ /index.php?$query_string;
107+
}
108+
109+
location = /index.php {
110+
fastcgi_pass unix:/run/php/php8.4-fpm.sock;
111+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
112+
include fastcgi_params;
113+
fastcgi_read_timeout 300;
114+
}
115+
116+
location ~ \.php$ {
117+
return 403;
118+
}
119+
120+
location ~ /\.ht {
121+
deny all;
122+
}
123+
124+
error_log /var/log/nginx/invoiceninja_error.log;
125+
access_log /var/log/nginx/invoiceninja_access.log;
126+
}
127+
EOF
128+
129+
ln -sf /etc/nginx/sites-available/invoiceninja /etc/nginx/sites-enabled/
130+
rm -f /etc/nginx/sites-enabled/default
131+
$STD systemctl reload nginx
132+
msg_ok "Configured Nginx"
133+
134+
msg_info "Setting up Queue Worker"
135+
cat <<'EOF' >/etc/supervisor/conf.d/invoiceninja-worker.conf
136+
[program:invoiceninja-worker]
137+
process_name=%(program_name)s_%(process_num)02d
138+
command=php /opt/invoiceninja/artisan queue:work --sleep=3 --tries=3 --max-time=3600
139+
autostart=true
140+
autorestart=true
141+
stopasgroup=true
142+
killasgroup=true
143+
user=www-data
144+
numprocs=2
145+
redirect_stderr=true
146+
stdout_logfile=/var/log/invoiceninja-worker.log
147+
stopwaitsecs=3600
148+
EOF
149+
150+
touch /var/log/invoiceninja-worker.log
151+
chown www-data:www-data /var/log/invoiceninja-worker.log
152+
$STD supervisorctl reread
153+
$STD supervisorctl update
154+
msg_ok "Set up Queue Worker"
155+
156+
msg_info "Setting up Cron"
157+
cat <<'EOF' >/etc/cron.d/invoiceninja
158+
* * * * * www-data cd /opt/invoiceninja && php artisan schedule:run >> /dev/null 2>&1
159+
EOF
160+
msg_ok "Set up Cron"
161+
162+
msg_info "Enabling Services"
163+
systemctl enable -q --now php8.4-fpm nginx supervisor
164+
msg_ok "Enabled Services"
165+
166+
motd_ssh
167+
customize
168+
cleanup_lxc

0 commit comments

Comments
 (0)