feat: Add Invoice Ninja service configuration to Service model

This commit is contained in:
Andras Bacsai
2024-10-05 14:16:53 +02:00
parent 128d732438
commit 9448d0f0d2
3 changed files with 76 additions and 9 deletions

View File

@@ -285,6 +285,27 @@ class Service extends BaseModel
foreach ($applications as $application) {
$image = str($application->image)->before(':')->value();
switch ($image) {
case str($image)?->contains('invoiceninja'):
$data = collect([]);
$email = $this->environment_variables()->where('key', 'IN_USER_EMAIL')->first();
$data = $data->merge([
'Email' => [
'key' => 'IN_USER_EMAIL',
'value' => data_get($email, 'value'),
'rules' => 'required|email',
],
]);
$password = $this->environment_variables()->where('key', 'SERVICE_PASSWORD_INVOICENINJAUSER')->first();
$data = $data->merge([
'Password' => [
'key' => 'IN_PASSWORD',
'value' => data_get($password, 'value'),
'rules' => 'required',
'isPassword' => true,
],
]);
$fields->put('Invoice Ninja', $data->toArray());
break;
case str($image)?->contains('argilla'):
$data = collect([]);
$api_key = $this->environment_variables()->where('key', 'SERVICE_PASSWORD_APIKEY')->first();

View File

@@ -1,4 +1,3 @@
# ignore: true
# documentation: https://invoiceninja.github.io/selfhost.html
# slogan: The leading open-source invoicing platform
# tags: invoicing, billing, accounting, finance, self-hosted
@@ -11,18 +10,20 @@ services:
- SERVICE_FQDN_INVOICENINJA
- APP_ENV=${APP_ENV:-production}
- APP_URL=${SERVICE_FQDN_INVOICENINJA}
- APP_KEY=${SERVICE_REALBASE64_INVOICENINJA}
- APP_KEY=base64:${SERVICE_REALBASE64_INVOICENINJA}
- APP_DEBUG=${APP_DEBUG:-false}
- REQUIRE_HTTPS=${REQUIRE_HTTPS:-false}
- PHANTOMJS_PDF_GENERATION=${PHANTOMJS_PDF_GENERATION:-false}
- PDF_GENERATOR=${PDF_GENERATOR:-snappdf}
- TRUSTED_PROXIES=${TRUSTED_PROXIES:-*}
- QUEUE_CONNECTION=${QUEUE_CONNECTION:-database}
- IN_USER_EMAIL=${IN_USER_EMAIL:-admin@example.com}
- IN_PASSWORD=${SERVICE_PASSWORD_INVOICENINJAUSER}
- DB_HOST=${DB_HOST:-mariadb}
- DB_PORT=${DB_PORT:-3306}
- DB_DATABASE=${DB_DATABASE:-invoiceninja}
- DB_USERNAME=$SERVICE_USER_INVOICENINJA
- DB_PASSWORD=$SERVICE_PASSWORD_INVOICENINJA
- DB_USERNAME=$SERVICE_USER_MARIADB
- DB_PASSWORD=$SERVICE_PASSWORD_MARIADB
healthcheck:
test: ['CMD', 'echo', 'ok']
interval: 5s
@@ -31,6 +32,52 @@ services:
volumes:
- invoice-ninja-public:/var/www/app/public
- invoice-ninja-storage:/var/www/app/storage
- type: bind
source: ./supervisord.conf
target: /etc/supervisord.conf
content: |
[supervisord]
nodaemon=true
pidfile=/tmp/supervisord.pid
logfile=/dev/null ; nodaemon will cause logs to go to stdout
logfile_maxbytes=0
loglevel=info
[program:php-fpm]
redirect_stderr=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=php artisan serve --host 0.0.0.0 --port 9000
[program:scheduler]
autorestart=true
redirect_stderr=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=php artisan schedule:work
[program:queue-worker]
process_name=%(program_name)s_%(process_num)02d
autorestart=true
redirect_stderr=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
numprocs=2
command=php artisan queue:work --sleep=3 --tries=1 --memory=256 --timeout=3600
[eventlistener:shutdown]
command=shutdown.sh
events=PROCESS_STATE_STOPPED, PROCESS_STATE_EXITED, PROCESS_STATE_FATAL
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
- type: bind
source: ./php.ini
target: /usr/local/etc/php/php.ini
@@ -52,7 +99,6 @@ services:
; opcache.jit=1205
; opcache.memory_consumption=1024M
post_max_size = 60M
upload_max_filesize = 50M
memory_limit=512M
@@ -86,10 +132,10 @@ services:
volumes:
- mariadb-data:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=$SERVICE_PASSWORD_ROOT
- MYSQL_ROOT_PASSWORD=$SERVICE_PASSWORD_MARIADBROOT
- MYSQL_DATABASE=${DB_DATABASE:-invoiceninja}
- MYSQL_USER=$SERVICE_USER_INVOICENINJA
- MYSQL_PASSWORD=$SERVICE_PASSWORD_INVOICENINJA
- MYSQL_USER=$SERVICE_USER_MARIADB
- MYSQL_PASSWORD=$SERVICE_PASSWORD_MARIADB
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 5s

File diff suppressed because one or more lines are too long