Invoiceplane: Difference between revisions
imported>Onny mNo edit summary |
Add dev env example |
||
(7 intermediate revisions by 3 users not shown) | |||
Line 10: | Line 10: | ||
After that Invoiceplane will be available at http://localhost . Complete the setup by choosing your default language and setting up your user profile. | After that Invoiceplane will be available at http://localhost . Complete the setup by choosing your default language and setting up your user profile. | ||
It is recommended to disable the setup wizard after installation is complete. Add following arguments to the settings option: | |||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | |||
services.invoiceplane.sites."localhost".settings = { | |||
DISABLE_SETUP=true; | |||
SETUP_COMPLETED=true; | |||
}; | |||
</nowiki>}} | |||
== Configuration == | == Configuration == | ||
Line 25: | Line 34: | ||
src = pkgs.fetchgit { | src = pkgs.fetchgit { | ||
url = "https://git.project-insanity.org/onny/invoiceplane-vtdirektmarketing.git"; | url = "https://git.project-insanity.org/onny/invoiceplane-vtdirektmarketing.git"; | ||
rev = " | rev = "0a891d836e199cf0f6bd2c4276991665d5d3405e"; | ||
hash = "sha256- | hash = "sha256-GhKd+dviufeGi3ZnyukzvwzVE5BO7jAx1SdsG/ioSeU="; | ||
}; | }; | ||
makeFlags = [ "DESTDIR=$(out)" ]; | makeFlags = [ "DESTDIR=$(out)" ]; | ||
Line 33: | Line 42: | ||
in { | in { | ||
services.invoiceplane.sites."localhost" = { | |||
enable = true; | |||
invoiceTemplates = [ template-vtdirektmarketing ]; | |||
}; | |||
} | } | ||
Line 59: | Line 68: | ||
Replace the cron key value with the one given in the Invoiceplane administration web interface. | Replace the cron key value with the one given in the Invoiceplane administration web interface. | ||
=== Electronic invoice === | |||
To enable electronic invoicing using the [http://zugferd.org standard ZUGFeRD], we can hardcode the activation into the InvoicePlane source code. Otherwise it has to be manually enabled in the settings menu of the web app. | |||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | |||
nixpkgs = { | |||
overlays = [ | |||
(self: super: { | |||
invoiceplane = super.invoiceplane.overrideAttrs (oldAttrs: rec { | |||
postFixup = '' | |||
sed -i 's/\$include_zugferd = .*/$include_zugferd = true;/g' $out/application/helpers/pdf_helper.php | |||
''; | |||
}); | |||
}) | |||
]; | |||
}; | |||
</nowiki>}} | |||
Enabling this via <code>settings</code> option is [https://github.com/InvoicePlane/InvoicePlane/issues/999 not yet possible]. | |||
== Maintenance == | == Maintenance == | ||
Line 64: | Line 93: | ||
=== Upgrading to new versions === | === Upgrading to new versions === | ||
After upgrading to a new version of Invoiceplane, change following two lines of your Invoiceplane config | After upgrading to a new version of Invoiceplane, change following two lines of your Invoiceplane config to re-enable the setup wizard, required for database upgrades. | ||
{{file|/ | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
DISABLE_SETUP=false | services.invoiceplane.sites."localhost".settings = { | ||
SETUP_COMPLETED=false | DISABLE_SETUP=false; | ||
SETUP_COMPLETED=false; | |||
}; | |||
</nowiki>}} | </nowiki>}} | ||
Access your Invoiceplane instance again in your browser and rerun the setup | Access your Invoiceplane instance again in your browser and rerun the setup. After upgrading the tables you can login as usual. It is now recommended to change both variables in the config file above back to <code>true</code>. | ||
== Tips and tricks == | |||
=== Invoice template development === | |||
Following <code>flake.nix</code> file helps you spawning a virtual machine running a development environment of Invoiceplane. The local directory <code>/home/user/my_invoiceplane_template</code> containing a modified invoice or quote template will be mounted into the Invoiceplane web app, allowing to change the template and directly render the invoice PDF in the local web server at http://localhost:8080<syntaxhighlight lang="nix"> | |||
{ | |||
description = "Invoiceplane invoice template development shell"; | |||
inputs.nixpkgs.url = "nixpkgs/nixos-24.11"; | |||
outputs = { self, nixpkgs, ... }@inputs: | |||
let | |||
pkgs = nixpkgs.legacyPackages.x86_64-linux; | |||
start = | |||
pkgs.writeShellScriptBin "start" '' | |||
set -e | |||
export QEMU_NET_OPTS="hostfwd=tcp::8080-:80" | |||
${pkgs.nixos-shell}/bin/nixos-shell --flake . | |||
''; | |||
in { | |||
nixosConfigurations.vm = nixpkgs.lib.nixosSystem { | |||
system = "x86_64-linux"; | |||
specialArgs.inputs = inputs; | |||
pkgs = import nixpkgs { | |||
overlays = [ | |||
(self: super: { | |||
invoiceplane = super.invoiceplane.overrideAttrs (oldAttrs: rec { | |||
installPhase = oldAttrs.installPhase + '' | |||
rm -r $out/application/views/invoice_templates/pdf | |||
ln -sf /var/lib/invoiceplane/localhost/pdf $out/application/views/invoice_templates/pdf | |||
''; | |||
}); | |||
}) | |||
]; | |||
}; | |||
modules = [ | |||
({ lib, config, pkgs, ... }: { | |||
services.invoiceplane.sites."localhost" = { | |||
enable = true; | |||
settings.IP_URL = "http://localhost:8080"; | |||
}; | |||
nixos-shell.mounts.extraMounts = { | |||
"/var/lib/invoiceplane/localhost/pdf" = { | |||
target = /home/user/my_invoiceplane_template; | |||
cache = "none"; | |||
}; | |||
}; | |||
system.stateVersion = "24.11"; | |||
services.getty.autologinUser = "root"; | |||
}) | |||
]; | |||
}; | |||
packages = { inherit start; }; | |||
defaultPackage.x86_64-linux = start; | |||
}; | |||
} | |||
</syntaxhighlight>To run the web server simply execute following command in the same directory as the <code>flake.nix</code> file<syntaxhighlight lang="shell"> | |||
nix run | |||
</syntaxhighlight> | |||
== See also == | == See also == | ||
* [[Crater]], alternative self-hosted invoicing application | * [[Crater]], alternative self-hosted invoicing application | ||
[[Category:Server]] | |||
[[Category:Web Applications]] | [[Category:Web Applications]] |